james-bowman/sparse

How to we set/remove a value to is suppose to be set to 0.0

sergecpelletier opened this issue · 3 comments

When assigning a value to a CSR (might be others too, but I know that one), how do we set the value back to 0.0?

From https://github.com/james-bowman/sparse/blob/master/blas/matrix.go#L39, we can see that the value of 0.0 will not be set.

Thanks, good point. I have added a fix that sets the non-zero element to zero. It should be noted that this doesn't update the sparsity pattern and actually stores the zero value. We could remove the element if the value is zero but that would mean regenerating the indices which would have a definite performance overhead.

Coincidentally I am looking at something quite similar. I've pushed an approach built around Culling the blas.SparseMatrix object to my fork here.

I've tried to keep this separate from, but composable with, the sparse Cholesky stuff.

Apologies for the delay Jon, that is a nice way to clean up and remove the zero values do you want to create a PR and I will merge?