Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issymmetric for matrices with empty columns #606

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jishnub
Copy link
Collaborator

@jishnub jishnub commented Mar 6, 2025

The issymmetric check tracks an offset that it uses to go from (row, col) to (col, row). However, currently this doesn't account for the fact that if a column is empty, entries in colptr will be identical. E.g., in #605, we have

julia> S = sparse([2, 3, 1], [1, 1, 3], [1, 1, 1], 3, 3)
3×3 SparseMatrixCSC{Int64, Int64} with 3 stored entries:
     1
 1    
 1    

julia> SparseArrays.getcolptr(S)
4-element Vector{Int64}:
 1
 3
 3
 4

The offset 3 corresponds to rows in the third column, as the second column is empty. This PR checks for empty columns, in which case we may exit the call immediately.

Fixes #605

@jishnub jishnub added backport 1.10 backport 1.11 backport 1.12 Change should be backported to release-1.12 labels Mar 6, 2025
Copy link

codecov bot commented Mar 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.07%. Comparing base (9548149) to head (4303560).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #606      +/-   ##
==========================================
- Coverage   84.10%   84.07%   -0.04%     
==========================================
  Files          12       12              
  Lines        9192     9193       +1     
==========================================
- Hits         7731     7729       -2     
- Misses       1461     1464       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jishnub jishnub requested a review from rayegun March 10, 2025 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.10 backport 1.11 backport 1.12 Change should be backported to release-1.12
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Likely bug in issymmetric(A::AbstractSparseMatrixCSC)
1 participant