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

Popular posts from this blog

c# SetCompatibleTextRenderingDefault must be called before the first -

c++ - Fill runtime data at compile time with templates -

C#.NET Oracle.ManagedDataAccess ConfigSchema.xsd -