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

Matrix conversion for structured matrices without a zero #1159

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Dec 25, 2024

This adds a fallback branch in case the eltype doesn't have a unique zero, so that the following works after this PR:

julia> D = Diagonal(fill(ones(2,2), 2, 2))
2×2 Diagonal{Matrix{Float64}, Vector{Matrix{Float64}}}:
 [1.0 1.0; 1.0 1.0]                   
                    [1.0 1.0; 1.0 1.0]

julia> Matrix(D)
2×2 Matrix{Matrix{Float64}}:
 [1.0 1.0; 1.0 1.0]  [0.0 0.0; 0.0 0.0]
 [0.0 0.0; 0.0 0.0]  [1.0 1.0; 1.0 1.0]

Similarly, for Bidiagonal and Tridiagonal/SymTridiagonal.

@jishnub jishnub added the arrays [a, r, r, a, y, s] label Dec 25, 2024
@jishnub jishnub marked this pull request as draft December 25, 2024 10:36
Copy link

codecov bot commented Dec 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.96%. Comparing base (62c8100) to head (4bc7eda).

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

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

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.

LGTM. My only question is (as in the other PRs) about implicit eltype promotion. Would that work as well?

@jishnub
Copy link
Member Author

jishnub commented Feb 28, 2025

The problem with this approach is #1221

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.

2 participants