In docs of SparseArrays.jl
If you have data in CSC format from a different application or library, and wish to import it in Julia, make sure that you use 1-based indexing. The row indices in every column need to be sorted, and if they are not, the matrix will display incorrectly. If your SparseMatrixCSC object contains unsorted row indices, one quick way to sort them is by doing a double transpose. Since the transpose operation is lazy, make a copy to materialize each transpose.
And i get some .mat data from https://github.com/qpsolvers/maros_meszaros_qpbenchmark/blob/main/data/QFORPLAN.mat which contains sparse matrix with unsorted row indices. Then the getindex method would crash because Julia remove inbounds check.
We could check the Ir and Jc to make sure row indices is sorted, If it's unsorted, use double transpose to collect the correct result?
It's a feature request and I would make an PR if we agree it should be done in MAT.jl instead of SparseArrays.jl
In docs of SparseArrays.jl
And i get some .mat data from https://github.com/qpsolvers/maros_meszaros_qpbenchmark/blob/main/data/QFORPLAN.mat which contains sparse matrix with unsorted row indices. Then the
getindexmethod would crash because Julia remove inbounds check.We could check the
IrandJcto make sure row indices is sorted, If it's unsorted, use double transpose to collect the correct result?It's a feature request and I would make an PR if we agree it should be done in
MAT.jlinstead ofSparseArrays.jl