Multiplication can break when one dimension is 0
avangogo opened this issue · 2 comments
I ran across an edge case where the multiplication panicked with ''assertion failed: nb_threads > 0' coming from the following line.
https://github.com/vbarrielle/sprs/blob/2fd6cc3e6b3f9261e33c0744b258f4464302039e/src/sparse/smmp.rs#L48
The matrices multiplied are the following zero matrices with one empty dimension
CsMatBase { storage: CSR, nrows: 0, ncols: 11, indptr: [0], indices: [], data: [] }
CsMatBase { storage: CSR, nrows: 11, ncols: 11, indptr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], indices: [], data: [] }
The example does not make really sense, but it should still returns a zero (0,11)-matrix. I guess that it is enough to slightly relax the assert.
You're right, this case should be allowed.
The fix has been pushed in v0.9.2