Adding to Daniel Sobrado good response, spark 2.4 also comes with Breeze support Breeze Linear Algebra
This library has the benefits that matrices default to column major ordering, like Matlab, but indexing is 0-based, like Numpy.
Breeze supports indexing and slicing, linear algebra functions
(Linear solve, transpose, Determinant, Inverse, Eigenvalues , Eigenvectors, Singular Value Decomposition) and operations (Vector dot product, Elementwise addition, Shaped/Matrix multiplication, Elementwise multiplication, Elementwise max, Elementwise argmax), etc.
Its to be noted that Breeze uses netlib-java for its core linear algebra routines
Below is an example of scala code that uses Breeze
import breeze.linalg.DenseVector
import com.github.fommil.netlib.BLAS
import org.slf4j.LoggerFactory
object Breeze1 {
def main(args:Array[String]): Unit = {
println("Init logging...")
System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "TRACE");
val log = LoggerFactory.getLogger("main")
log.trace("Starting...")
val b = BLAS.getInstance()
log.trace(s"BLAS = $b")
val v = DenseVector(1,2,3,4)
log.trace("Ending.")
}
}