Scala Breeze DenseMatrix to SparseMatrix conversion -
im struggeling find way convert densematrix sparsematrix.
i tried flattening densematrix array, converting sparse matrix , reshaping not possible since there no reshape function..
val dm = densematrix((1,2,3),(0,0,0),(0,0,0)) val sm =cscmatrix(dm.toarray) sm.reshape(3,3)
error: value reshape not member of breeze.linalg.cscmatrix[int]
how this:
val dm = densematrix((1,2,3),(0,0,0),(0,0,0)) val sm = cscmatrix.tabulate(dm.rows, dm.cols)(dm(_, _))
Comments
Post a Comment