If you are looking for direct support for higher-order tensors, bad luck. David Hall already stated that they would require a lot of work to implement properly which makes perfect sense. They are very math intensive.
With that said you can still make a 2 by 1 DenseMatrix
of DenseVectors
and manipulate the values of those vectors. 2 by 1 matrix is basically a vector so here's example with 2 by 2 and "40 zeroes" vectors
val matrix = DenseMatrix(
(DenseVector.zeros[Double](40), DenseVector.zeros[Double](40)),
(DenseVector.zeros[Double](40), DenseVector.zeros[Double](40))
)
matrix(0,0)(0) = 1.0
println( matrix(0,0) )
I must say that this approach is not recommended due to complex nature of computations on such data structure. If you are working with points in 3D space I would rather go for either a matrix or distributed dataset of vectors.