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

Support indexing Tridiagonal/SymTridiagonal block matrices #1218

Merged
merged 4 commits into from
Feb 28, 2025

Conversation

jishnub
Copy link
Collaborator

@jishnub jishnub commented Feb 21, 2025

This uses diagzero instead of zero to obtain the zero elements, which works for matrix-valued elements as well. The following works after this:

julia> m = ones(2,2);

julia> T = Tridiagonal(fill(m,3), fill(2m,4), fill(3m,3))
4×4 Tridiagonal{Matrix{Float64}, Vector{Matrix{Float64}}}:
 [2.0 2.0; 2.0 2.0]  [3.0 3.0; 3.0 3.0]                     
 [1.0 1.0; 1.0 1.0]  [2.0 2.0; 2.0 2.0]                      
                    [1.0 1.0; 1.0 1.0]     [3.0 3.0; 3.0 3.0]
                                          [2.0 2.0; 2.0 2.0]

julia> S = SymTridiagonal(fill(2m,4), fill(m,3))
4×4 SymTridiagonal{Matrix{Float64}, Vector{Matrix{Float64}}}:
 [2.0 2.0; 2.0 2.0]  [1.0 1.0; 1.0 1.0]                     
 [1.0 1.0; 1.0 1.0]  [2.0 2.0; 2.0 2.0]                      
                    [1.0 1.0; 1.0 1.0]     [1.0 1.0; 1.0 1.0]
                                          [2.0 2.0; 2.0 2.0]

This was already supported for Diagonal/Bidiagonal, and this PR extends the feature to tridiagonal matrices as well.

@jishnub jishnub added the arrays [a, r, r, a, y, s] label Feb 21, 2025
Copy link

codecov bot commented Feb 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.96%. Comparing base (62c8100) to head (ec09767).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1218   +/-   ##
=======================================
  Coverage   91.96%   91.96%           
=======================================
  Files          34       34           
  Lines       15473    15473           
=======================================
  Hits        14229    14229           
  Misses       1244     1244           

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

@jishnub jishnub requested a review from ViralBShah February 27, 2025 04:25
@jishnub
Copy link
Collaborator Author

jishnub commented Feb 28, 2025

Good to merge?

@ViralBShah ViralBShah merged commit eb064b8 into master Feb 28, 2025
4 checks passed
@ViralBShah ViralBShah deleted the jishnub/blocktri_indexing branch February 28, 2025 16:03
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]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants