I'm trying to define a type for a matrix (two dimensional array). I have this:
scala> type DMatrix[T] = Array[Array[T]]
defined type alias DMatrix
and then I define de DMatrix:
scala> def DMatrix = Array.ofDim[Double](2,2)
DMatrix: Array[Array[Double]]
So far so good. The problem now is how to work with th DMatrix. I've tried some examples but nothing happens:
scala> DMatrix(0)(0) = 1.0
scala> DMatrix
res40: Array[Array[Double]] = Array(Array(0.0, 0.0), Array(0.0, 0.0))
scala> DMatrix(0)
res41: Array[Double] = Array(0.0, 0.0)
scala> DMatrix(0) = Array(1.0,2.1)
scala> DMatrix(0)
res43: Array[Double] = Array(0.0, 0.0)
so, the question is how to use this DMatrix type?
thanks in advance