Skip to content

Conversation

@jishnub
Copy link
Member

@jishnub jishnub commented Apr 27, 2025

Currently, the following works unexpectedly:

julia> A = Symmetric(fill([1 2; 3 4], 3, 3))
3×3 Symmetric{AbstractMatrix, Matrix{Matrix{Int64}}}:
 [1 2; 2 4]  [1 2; 3 4]  [1 2; 3 4]
 [1 3; 2 4]  [1 2; 2 4]  [1 2; 3 4]
 [1 3; 2 4]  [1 3; 2 4]  [1 2; 2 4]

julia> A[1,1] = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> A[1,1]
2×2 Symmetric{Int64, Matrix{Int64}}:
 1  2
 2  4

After this PR, the setindex! throws an error if the exact value cannot be used:

julia> A[1,1] = [1 2; 3 4]
ERROR: ArgumentError: cannot set a diagonal element of a symmetric matrix to an asymmetric value

@codecov
Copy link

codecov bot commented Apr 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.70%. Comparing base (5d3d02a) to head (65b8538).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1317      +/-   ##
==========================================
- Coverage   93.72%   93.70%   -0.02%     
==========================================
  Files          34       34              
  Lines       15733    15734       +1     
==========================================
- Hits        14746    14744       -2     
- Misses        987      990       +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 merged commit 6e8f9a1 into master Apr 27, 2025
3 of 4 checks passed
@jishnub jishnub deleted the jishnub/symhermsetindex branch April 27, 2025 15:19
@odow
Copy link

odow commented May 15, 2025

This broke JuMP because we defined LinearAlgegbra.symmetric_type and LinearAlgebra.symmetric, but not LinearAlgebra.issymmetric. See jump-dev/JuMP.jl#3997

Based on https://juliahub.com/ui/Search?type=code&q=LinearAlgebra.symmetric_type, implementing LinearAlgegbra.symmetric_type is a very rare operation.

image

Exclude the DeltaArrays, which isn't hit by this, and the four packages are all somehow related to JuMP:

cc @blegat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants