Skip to main content
6 events
when toggle format what by license comment
May 23, 2023 at 14:54 vote accept Albercoc
May 23, 2023 at 12:52 comment added Henrik Schumacher Yes. That's understood. The person who wrote the export filter has taken care of this off-by-one issue. And because mtx stores data as strings (and not in binary), this SuiteSparse importer is able to case to every they want. =)
May 23, 2023 at 11:01 comment added Albercoc These are valuable comments. To avoid confusion: in the solution above, the sparse matrix is passed with a standard format (matrix market) that both Mathematica and SuiteSparse read and write.
May 23, 2023 at 10:19 comment added Henrik Schumacher Oh, and a further typical issue with moving sparse arrays between Mathematica and C is of course, that Mathematica uses 1-based indices but C uses 0-based indices. There could be a compile switch in SuiteSparse that changes the behavior to 1-based indexing. But again the simplest work-around is probably to substract 1 during the above copying process. (You have to substract 1 only from the "ColumnIndices", not from the "RowPointers" of the SparseArray.)
May 23, 2023 at 10:16 comment added Henrik Schumacher Hm. It could be that the LibraryLink method failed because SparseSuite uses 32-bit integers by default while Mathematica uses 64-bit integers. I faced similar problems when I instelled SparseSuite via homebrew. There are two possible workarounds: Recompile SuiteSparse manually with 64-bit integers (which is probably cumbersome, and I don't know for sure that it will work) or you first have copy the 64-bit-integer arrays into 32-bit integer arrays in the LibraryLink code... If I had more time, I would investigate it. Anyways, congratulations that you found a solution that works for you! (+1)
May 23, 2023 at 7:54 history answered Albercoc CC BY-SA 4.0