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

Preserve eltype in converting Symmetric to Matrix #52738

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented Jan 4, 2024

This allows cases where the eltype differs from that of the parent:

julia> M = [UpperTriangular([1 2; 3 4]) for i in 1:2, j in 1:2]
2×2 Matrix{UpperTriangular{Int64, Matrix{Int64}}}:
 [1 2; 0 4]  [1 2; 0 4]
 [1 2; 0 4]  [1 2; 0 4]

julia> H = Hermitian(M)
2×2 Hermitian{AbstractMatrix, Matrix{UpperTriangular{Int64, Matrix{Int64}}}}:
 [1 2; 2 4]  [1 2; 0 4]
 [1 0; 2 4]  [1 2; 2 4]

julia> Array(H)
2×2 Matrix{AbstractMatrix}:
 [1 2; 2 4]  [1 2; 0 4]
 [1 0; 2 4]  [1 2; 2 4]

This conversion throws an error at present on master.

@jishnub jishnub added domain:linear algebra Linear algebra domain:arrays [a, r, r, a, y, s] labels Jan 4, 2024
@jishnub jishnub changed the title Preserve eltype in converting Symmetic to Matrix Preserve eltype in converting Symmetric to Matrix Jan 5, 2024
@jishnub jishnub merged commit 8dc2c30 into master Jan 8, 2024
10 checks passed
@jishnub jishnub deleted the jishnub/symhermmatrix branch January 8, 2024 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:arrays [a, r, r, a, y, s] domain:linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants