alugowski / fast_matrix_market

Fast and full-featured Matrix Market I/O library for C++, Python, and R
BSD 2-Clause "Simplified" License
75 stars 7 forks source link

Enable GraphBLAS binding to write arrays directly #36

Closed alugowski closed 1 year ago

alugowski commented 1 year ago

Previous implementation would always write a coordinate file due to GraphBLAS iterators sometimes throwing GrB_NOT_IMPLEMENTED. Turns out that only throws when the matrix is GxB_BY_ROW, as Matrix Market requires column-major order and GraphBLAS appears to only support iterating on the native direction.

Note that this change is only efficient if the matrix is GxB_BY_COL as that is the only case where an iterator can be used. If the matrix is GxB_BY_ROW, then a full copy and sort is necessary, a very inefficient operation, but still better than writing a coordinate version of that matrix.