mtl5.sparse.from_scipy#

mtl5.sparse.from_scipy(sp_matrix)#

Convert a scipy.sparse matrix (any format) to an MTL5 SparseMatrix.

Non-CSR formats are converted to CSR via scipy, including CSC — MTL5 has no column-major container, so that conversion is real work rather than a relabelling. Use coo_matrix() to build COO directly without going through CSR. The result has the same dtype as the input (float32 or float64).