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

lu(Symmetric(Diagonal(...))) fails #922

Closed
tpapp opened this issue Apr 6, 2022 · 4 comments
Closed

lu(Symmetric(Diagonal(...))) fails #922

tpapp opened this issue Apr 6, 2022 · 4 comments

Comments

@tpapp
Copy link
Contributor

tpapp commented Apr 6, 2022

julia> VERSION
v"1.8.0-beta3"

julia> using LinearAlgebra

julia> M = Symmetric(Diagonal(ones(3)))
3×3 Symmetric{Float64, Diagonal{Float64, Vector{Float64}}}:
 1.0  0.0  0.0
 0.0  1.0  0.0
 0.0  0.0  1.0

julia> lu(M)
ERROR: MethodError: no method matching lu!(::Diagonal{Float64, Vector{Float64}}, ::RowMaximum; check=true)
@tpapp
Copy link
Contributor Author

tpapp commented Apr 6, 2022

Suggestion:

Symmetric(D::Diagonal, uplo=:U) = D

and the same for Hermitian. Possibly checking uplo.

The downside is violating T(...) isa T.

@dkarrasch
Copy link
Member

One would need to respect the array of arrays case:

Symmetric(D::Diagonal, uplo=:U) = Diagonal(symmetric.(D.diag), uplo)

Or pick up some of JuliaLang/julia#41288.

@tpapp
Copy link
Contributor Author

tpapp commented Apr 8, 2022

I don't understand why JuliaLang/julia#41288 was closed in the first place.

The issue is not explicitly why LU is useful for Diagonal in the first place (it isn't), or why Symmetric(Diagonal(...)) makes sense (it doesn't, really). But code that wants to handle a generic AbstractMatrix can end up with constructs like this so there should be code path that just works.

@andreasnoack, I would appreciate your thoughts on this.

@dkarrasch
Copy link
Member

This has been fixed, perhaps in JuliaLang/julia#47107. The question is whether the resulting LU object is useful. Getting properties à la F.L creates dense factors, while F.factors is a memory-efficient Diagonal. Some further optimizations are proposed in JuliaLang/julia#48189.

@KristofferC KristofferC transferred this issue from JuliaLang/julia Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants