Add a method to export a CRSMatrix and a SparsityPattern into Python.
Closed this issue · 2 comments
For exporting a CRSMatrix
I think we want to use the scipy.sparse.csr_matrix
object. This would involve verifying that the matrix is compressed, then creating three 1D ndarrays and calling the python method to construct the csr_matrix
object.
There doesn't seem to be something equivalent to the SparsityPattern
so we could either export it as an ArrayOfSets
or create a ndarray of true
representing the values and then create a crs_matrix
object.
https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.html#scipy.sparse.csr_matrix
https://stackoverflow.com/questions/3286448/calling-a-python-method-from-c-c-and-extracting-its-return-value
@corbett5 Is the scipy.sparse.csr_matrix
making a shallow copy of the underlying arrays if copy=false
?
Correct.