title: Sparse matrices multiplication with Colt
body: <p>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:</p>
  
  <pre><code>Algebra al = new Algebra();
  SparseDoubleMatrix2D a = generateSparseMatrix(); // whatever is here
  SparseDoubleMatrix2D aCarre = (SparseDoubleMatrix2D) al.mult(a, al.transpose(a));
  </code></pre>
  
  <p>But I obtain a <code>java.lang.ClassCastException</code> (can't cast from Dense to Sparse).</p>
  
  <p>Thanks by advance,</p>
  
  <p>Maveric78f</p>