Menu

#3 SparseDoubleMatrix2D multiply returns dense matrix

open
nobody
None
5
2011-09-23
2011-09-23
Marc
No

Hey all, I hope all is well. I am a little confused with the behavior of SparseDoubleMatrix2D. I am using .9.4 and am calling Colt from the most recent version of scala.

When I call

val m = new SparseDoubleMatrix2D(100,100,Array.range(0,100),Array.range(0,100),1)
and then

val n = m.zMult(m,null,2,0,false,false)

I would expect that n would be a sparse matrix. Instead, it is dense with storage of all of the zeros. I have
tried the same thing through the factory method creation and again,

Thanks in advance!
m

Discussion

  • Marc

    Marc - 2011-09-23

    Actually, I am seven more confused.

    val m = DoubleFactory2D.sparse
    n = m.make(4,4)
    // Set n to be identity

    Creating a DoubeProperty d then throws an exception when called with d.checksparse( n)

    Printing out n at the REPL gives

    n
    res27: cern.colt.matrix.tdouble.DoubleMatrix2D =
    4 x 4 sparse matrix, nnz = 4
    (0,0) 1.0
    (1,1) 1.0
    (2,2) 1.0
    (3,3) 1.0

    Thanks!

     
  • Marc

    Marc - 2011-09-23

    Interestingly, checkDense(n) also throws an exception saying the matrix is not dense.. ALso, if I take n and cast it to a Sparse Matrix, I still get the exception for checkSparse()

     
  • Marc

    Marc - 2011-09-23

    More debugging, it see if I make the sparse matrix a row compressed matrix then things go through...

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.