-
Notifications
You must be signed in to change notification settings - Fork 1
Description
A sparsity is allocated inside of las and used to create a matrix of some type.
The matrix will then either own the sparsity and manage it's lifespan or the sparsity is still owned by the user and must be dealt with.
At present this detail is handled differently by different backends. When creating a PETSc matrix, the Sparsity NNZ is used to preallocate the matrix, but not owned by the PETSc Mat.
The sparse sparse(csr) backend captures the underlying CSR object, but doesn't own it since the object is not deleted when the matrix is. But if the user deletes the CSR object in user space the matrix would be invalidated.
We either need to copy the CSR (less desirable but not practically terrible), or invalidate the user-space pointer to the Sparsity so the user can't accidentally delete it and invalidate the Matrix, which would mean passing in a Sparsity ** to the matrix creation function instead of a Sparsity*.