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

Can't compute eigenvalues of Hermitian Diagonal matrix for generic types #1070

Closed
araujoms opened this issue May 8, 2024 · 3 comments
Closed

Comments

@araujoms
Copy link
Contributor

araujoms commented May 8, 2024

As the title says, the following code fails:

using LinearAlgebra
using GenericLinearAlgebra
m = Hermitian(Diagonal(randn(BigFloat,2)))
eigvals(m)

This is not related to BigFloat, it also fails for Double64 and Float128. I think the underlying issue is the same as #1056, the lack of a universal fallback.

To make life even stranger, after GenericLinearAlgebra is loaded this code starts failing even for Float64. That is,

using LinearAlgebra
m = Hermitian(Diagonal(randn(Float64,2)))
eigvals(m)

works fine, but

using LinearAlgebra
using GenericLinearAlgebra
m = Hermitian(Diagonal(randn(Float64,2)))
eigvals(m)

fails.

@aravindh-krishnamoorthy
Copy link
Contributor

I'm not sure what to do here. None of the functions in the stack trace or the symtriUpper! function are in the Julia codebase, but in the codebase of the package GenericLinearAlgebra. Furthermore, there is no function called symtriUpper! in LinearAlgebra so a generic version of this cannot be provided?

julia> using LinearAlgebra

julia> using GenericLinearAlgebra

julia> m = Hermitian(Diagonal(randn(Float64,2)))
2×2 Hermitian{Float64, Diagonal{Float64, Vector{Float64}}}:
 -0.395806    
           -1.38742

julia> eigvals(m)
ERROR: MethodError: no method matching symtriUpper!(::Diagonal{Float64, Vector{Float64}})

Closest candidates are:
  symtriUpper!(::StridedMatrix{T}, ::Any, ::Any) where T
   @ GenericLinearAlgebra ~/.julia/packages/GenericLinearAlgebra/ljyYY/src/eigenSelfAdjoint.jl:519
  symtriUpper!(::StridedMatrix{T}, ::Any) where T
   @ GenericLinearAlgebra ~/.julia/packages/GenericLinearAlgebra/ljyYY/src/eigenSelfAdjoint.jl:519
  symtriUpper!(::StridedMatrix{T}) where T
   @ GenericLinearAlgebra ~/.julia/packages/GenericLinearAlgebra/ljyYY/src/eigenSelfAdjoint.jl:519

Stacktrace:
 [1] symtri!(A::Hermitian{Float64, Diagonal{Float64, Vector{Float64}}})
   @ GenericLinearAlgebra ~/.julia/packages/GenericLinearAlgebra/ljyYY/src/eigenSelfAdjoint.jl:447
 [2] _eigvals!(A::Hermitian{Float64, Diagonal{Float64, Vector{…}}}; tol::Float64, sortby::typeof(LinearAlgebra.eigsortby))
   @ GenericLinearAlgebra ~/.julia/packages/GenericLinearAlgebra/ljyYY/src/eigenSelfAdjoint.jl:578
 [3] eigvals!(A::Hermitian{Float64, Diagonal{Float64, Vector{…}}}; tol::Float64, sortby::typeof(LinearAlgebra.eigsortby))
   @ GenericLinearAlgebra ~/.julia/packages/GenericLinearAlgebra/ljyYY/src/eigenSelfAdjoint.jl:587
 [4] eigvals(A::Hermitian{Float64, Diagonal{Float64, Vector{Float64}}})
   @ GenericLinearAlgebra ~/.julia/packages/GenericLinearAlgebra/ljyYY/src/eigenSelfAdjoint.jl:638
 [5] top-level scope
   @ REPL[10]:1
Some type information was truncated. Use `show(err)` to see complete types.

julia> versioninfo()
Julia Version 1.10.5
Commit 6f3fdf7b362 (2024-08-27 14:19 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, tigerlake)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

@araujoms
Copy link
Contributor Author

I was under the impression that GenericLinearAlgebra was a standard library; now I see it is a separate package: https://github.com/JuliaLinearAlgebra/GenericLinearAlgebra.jl

Is it possible to transfer the issue there, or should I close this one and open a new one there?

@aravindh-krishnamoorthy
Copy link
Contributor

Yes, perhaps it's best to close this one and open a new one there. Even after you close this, you can reference this issue over there as JuliaLang/julia#54412.

@araujoms araujoms closed this as not planned Won't fix, can't repro, duplicate, stale Sep 12, 2024
@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