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 indexing triangular matrices with undef elements in the parent #52530

Merged
merged 6 commits into from
Jan 26, 2024

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented Dec 14, 2023

I'm not totally sure about specializinggetindex for numeric arrays, but this lets us display a triangular matrix where the parent is not initialized.

julia> M = Matrix{BigFloat}(undef, 4, 4)
4×4 Matrix{BigFloat}:
 #undef  #undef  #undef  #undef
 #undef  #undef  #undef  #undef
 #undef  #undef  #undef  #undef
 #undef  #undef  #undef  #undef

julia> UpperTriangular(M)
4×4 UpperTriangular{BigFloat, Matrix{BigFloat}}:
 #undef  #undef  #undef  #undef
        #undef  #undef  #undef
               #undef  #undef
                      #undef

@jishnub jishnub added linear algebra Linear algebra arrays [a, r, r, a, y, s] labels Dec 14, 2023
@mikmoore
Copy link
Contributor

See concern at comment on #52528.

@jishnub jishnub changed the title Fix display for triangular matrix with undef elements Fix indexing triangular matrices with undef elements in the parent Jan 18, 2024
@jishnub
Copy link
Contributor Author

jishnub commented Jan 18, 2024

Similar to #52528 (comment), is it reasonable to add a haszero trait, and use to decide if we should return zero(T) or zero(data[i,j])? The former would only be chosen for concrete number types, which should resolve the issue raised above.

@jishnub
Copy link
Contributor Author

jishnub commented Jan 25, 2024

@mikmoore In line with #52528, I think this PR should also be fine?

@mikmoore
Copy link
Contributor

@mikmoore In line with #52528, I think this PR should also be fine?

I think so, yes.

@jishnub jishnub merged commit 1e45aba into master Jan 26, 2024
5 of 7 checks passed
@jishnub jishnub deleted the jishnub/trishowundef branch January 26, 2024 01:46
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] linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants