Open IgorBaratta opened 1 year ago
This will require MatrixCSR
to recompute its sparsity and some of its internal data (insert position for finalize for example).
We also should check (in debug mode) that insertion to indices which are not in the sparsity cause appropriate exceptions.
This will require
MatrixCSR
to recompute its sparsity and some of its internal data (insert position for finalize for example).
Yes, I think that's the main idea of the issue. Maybe instead of changing the matrix in place, we could create a new matrix with a new sparsity pattern.
We also should check (in debug mode) that insertion to indices which are not in the sparsity cause appropriate exceptions.
This something that we want to do anyway, right? Even without removing zeros, since we call std::lower_bound
.
Describe new/missing feature
Explicit zero values can be added to the entries of CSR matrix. For some types of elements, the element tensor is not dense, but the sparsity pattern doesn't have this information.
Example using scipy:
Output example:
Maybe a similar function should be implemented for
MatrixCSR.h
.Suggestion user interface