ocramz / sparse-linear-algebra

Numerical computation in native Haskell
GNU General Public License v3.0
88 stars 10 forks source link

sparsifying of Matrix-Matrix product #68

Open adamConnerSax opened 5 years ago

adamConnerSax commented 5 years ago

This may be more question than issue.

I understand why post-sparsifying might be the best route to making the matrix-matrix product sparse. But, in the regular product, why not leave out the elements that are sums of products all of which involve one structural zero? That is, if an element in the result comes from multiplying a row and column such that every product in that sum has at least one structural zero, why not leave that element out of the sparse product?

I got bitten by this because I assumed (my fault, I know!) that the sparse product would behave this way so I was ending up with dense matrices full of zeroes without realizing.

GregorySchwartz commented 5 years ago

Are you assuming that there are dense 0s present in the matrix before the product? If so, it would make more sense to sparsify before the multiplication and then after (to account for negative + positive).