Skip to content

Fix copy for partly initialized unit triangular #1350

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

Merged
merged 2 commits into from
May 13, 2025
Merged

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented May 12, 2025

Currently, we forward copy for unit triangular matrices to the parents. This also copies the diagonal, which may not be initialized in the parent. This PR fixes this.
After this, the following works again

julia> M = Matrix{BigFloat}(undef,2,2);

julia> M[2,1] = 3;

julia> M'
2×2 adjoint(::Matrix{BigFloat}) with eltype BigFloat:
 #undef    3.0
 #undef  #undef

julia> U = UnitUpperTriangular(M')
2×2 UnitUpperTriangular{BigFloat, Adjoint{BigFloat, Matrix{BigFloat}}}:
 1.0  3.0
     1.0

julia> copyto!(similar(M), U)
2×2 Matrix{BigFloat}:
 1.0  3.0
 0.0  1.0

@jishnub jishnub added backport 1.12 Change should be backported to release-1.12 arrays [a, r, r, a, y, s] labels May 12, 2025
Copy link

codecov bot commented May 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.75%. Comparing base (3e4d569) to head (382a1ee).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1350      +/-   ##
==========================================
+ Coverage   93.12%   93.75%   +0.62%     
==========================================
  Files          34       34              
  Lines       16705    15761     -944     
==========================================
- Hits        15557    14776     -781     
+ Misses       1148      985     -163     

☔ 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 mentioned this pull request May 12, 2025
27 tasks
Copy link
Member

@dkarrasch dkarrasch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one minor comment, otherwise LGTM.

@jishnub jishnub force-pushed the jishnub/tricopy branch from bb7b60b to 382a1ee Compare May 13, 2025 12:57
@jishnub jishnub merged commit 8a1ecfb into master May 13, 2025
4 checks passed
@jishnub jishnub deleted the jishnub/tricopy branch May 13, 2025 13:25
jishnub added a commit that referenced this pull request May 14, 2025
Currently, we forward copy for unit triangular matrices to the parents.
This also copies the diagonal, which may not be initialized in the
parent. This PR fixes this.
After this, the following works again
```julia
julia> M = Matrix{BigFloat}(undef,2,2);

julia> M[2,1] = 3;

julia> M'
2×2 adjoint(::Matrix{BigFloat}) with eltype BigFloat:
 #undef    3.0
 #undef  #undef

julia> U = UnitUpperTriangular(M')
2×2 UnitUpperTriangular{BigFloat, Adjoint{BigFloat, Matrix{BigFloat}}}:
 1.0  3.0
  ⋅   1.0

julia> copyto!(similar(M), U)
2×2 Matrix{BigFloat}:
 1.0  3.0
 0.0  1.0
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] backport 1.12 Change should be backported to release-1.12
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants