sparsemat / sprs

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

Fix nnz for partial views + add test to expose #243

Closed kolstae closed 3 years ago

kolstae commented 3 years ago

There's probably a possibility to have separate nnz implementations, but my rust knowledge is not up to the task. This might not be a hot method, so probably not a big problem.

vbarrielle commented 3 years ago

Thanks for the fix, though it makes me realize there are other places in the code that do not take this into account, for instance https://github.com/vbarrielle/sprs/blob/master/src/sparse.rs#L279. It's also possible there are issues in lots of other functions with these partial views.

I'm going to merge this for now, and I'm going to investigate possible other issues.

There's probably a possibility to have separate nnz implementations, but my rust knowledge is not up to the task.

I don't think it's possible, and I don't think we want to have separate implementations. I think your fix is more general and could help for other edge cases.