sparsemat / sprs

sparse linear algebra library for rust
Apache License 2.0
386 stars 45 forks source link

Add Kronecker product #211

Closed mulimoen closed 4 years ago

mulimoen commented 4 years ago

This is a slightly modified version of the one in #209, which uses some symmetries for the CSC^2 -> CSR^2 case.

The incompatible storage case is now handled by converting the second matrix to the opposite storage. This might not be the most efficient, but the performance should be predictable in this case.

Closes #209

vbarrielle commented 4 years ago

Thanks, that's a very clean implementation.

This might not be the most efficient, but the performance should be predictable in this case.

Indeed, it might be best to dynamically choose which matrix should be converted, but this would need benchmarks first. I think it's best to first have this implementation, then later we'll see if the performance needs to be improved. And since the performance is predictable, this means the calling code is free to perform its own manipulations to enforce best performance.