<p>If you are looking for direct support for higher-order tensors, bad luck. David Hall already <a href="https://groups.google.com/d/msg/scala-breeze/tn-iXWdOkYM/SUohQOdzEQAJ" rel="nofollow noreferrer">stated</a> that they would <a href="https://github.com/scalanlp/breeze/issues/505" rel="nofollow noreferrer">require</a> a lot of work to implement properly which makes perfect sense. They are very <a href="https://arxiv.org/pdf/1704.08578.pdf" rel="nofollow noreferrer">math intensive</a>. </p>

<p>With that said you can still make a 2 by 1 <code>DenseMatrix</code> of <code>DenseVectors</code> 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</p>

<pre><code>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) )
</code></pre>

<p>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.</p>
Dense matrix for 3D-shaped objects
<p>I am fairly new to Breeze library. I am trying to convert a 3D Array of shape (2,1,40) to a dense matrix but I am not sure if I am doing it the right way.
My requirement is: </p>

<p>A matrix with 2 rows, 1 column and each of the two rows should have 0.0 values (40 times)</p>

<pre><code>import breeze.linalg._

val matrix = new DenseMatrix[Float](shape(0), shape(1), Array.fill(shape(2))(0.0f))
</code></pre>