Should we check if row indices is sorted in every column when importing sparse matrix?
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 46/100
Research direction
Start by tracing MAT.jl’s sparse-matrix import path and reproduce the failure with QFORPLAN.mat, focusing on the Ir and Jc row-index data and the getindex behavior. Compare the proposed validation or normalization with the SparseArrays documentation; done means the unsorted-row case has an agreed implementation location and no longer crashes during import or access.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Julia
- Stars
- 293
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JuliaIO/MAT.jl
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 65/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 50/100
-
Difficulty 3/5 1-2 days Newbie friendliness 40/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
question
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
brown-ccv/Chamber.jl#272 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
JuliaAstro/SolarPosition.jl#143 ·
-
distributions
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
JuliaBayes/Wren.jl#404 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
JuliaAI/MLJTransforms.jl#113 ·
Maintainers usually reply within 1 day