Sparse matrices multiplication with Colt

794 Views Asked by At

I am using Colt for its Sparse Matrix implementation, but as soon as I apply algebra on these, they become Dense Matrix. Namely, if I multiply two sparse matrices A and B and want to assign the result to a third matrix C, I cannot declare C as a sparse matrix. I have a lot of memory issues because I manipulate large matrices (1GB in RAM if I make it dense). I tried the following:

Algebra al = new Algebra();
SparseDoubleMatrix2D a = generateSparseMatrix(); // whatever is here
SparseDoubleMatrix2D aCarre = (SparseDoubleMatrix2D) al.mult(a, al.transpose(a));

But I obtain a java.lang.ClassCastException (can't cast from Dense to Sparse).

Thanks by advance,

Maveric78f

0

There are 0 best solutions below