In Mathematica, sparse arrays use a CSR representation. Suppose I already have data in this format. Is there a way to create an
MSparseArray from it directly with LibraryLink, without manually converting to
position -> value pairs first?
This data may come from another C library that also uses CSR or CSC for its sparse matrices.
This is possible in pure Mathematica. I am looking to do the same in C, with the LibraryLink API, if possible.
I know that there is no function to do this directly in the LibraryLink API. What is not clear to me is whether it is reasonable to start with an empty
MSparseArray, created using
MSparseArray_fromExplicitPositions() (with no positions) and manually fill in the CSR data. It is not entirely clear to me if changing the internals of an
MSparseArray like this is allowed.