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

Support sortby in eigen #133

Closed
dlfivefifty opened this issue Aug 8, 2024 · 4 comments
Closed

Support sortby in eigen #133

dlfivefifty opened this issue Aug 8, 2024 · 4 comments

Comments

@dlfivefifty
Copy link
Member

I ran into this issue:

julia>  eigen(Tridiagonal(SymTridiagonal{BigFloat}(randn(5), randn(4))))
ERROR: MethodError: no method matching eigen!(::Hermitian{BigFloat, Matrix{BigFloat}}; sortby::typeof(LinearAlgebra.eigsortby))

Closest candidates are:
  eigen!(::Hermitian; tol) got unsupported keyword argument "sortby"
   @ GenericLinearAlgebra ~/Projects/GenericLinearAlgebra.jl/src/eigenSelfAdjoint.jl:605
  eigen!(::AbstractMatrix, ::Cholesky; sortby)
   @ LinearAlgebra ~/Projects/julia-1.10/usr/share/julia/stdlib/v1.10/LinearAlgebra/src/symmetriceigen.jl:180
  eigen!(::Union{Hermitian{var"#s125", var"#s124"}, Hermitian{Complex{var"#s125"}, var"#s124"}, Symmetric{var"#s125", var"#s124"}} where {var"#s125"<:Union{Float32, Float64}, var"#s124"<:(StridedMatrix{T} where T)}; sortby)
   @ LinearAlgebra ~/Projects/julia-1.10/usr/share/julia/stdlib/v1.10/LinearAlgebra/src/symmetriceigen.jl:8
  ...

Stacktrace:
 [1] kwerr(::@NamedTuple{sortby::typeof(LinearAlgebra.eigsortby)}, ::Function, ::Hermitian{BigFloat, Matrix{BigFloat}})
   @ Base ./error.jl:165
 [2] eigen(A::Tridiagonal{BigFloat, Vector{BigFloat}}; permute::Bool, scale::Bool, sortby::typeof(LinearAlgebra.eigsortby))
   @ LinearAlgebra ~/Projects/julia-1.10/usr/share/julia/stdlib/v1.10/LinearAlgebra/src/eigen.jl:239
 [3] eigen(A::Tridiagonal{BigFloat, Vector{BigFloat}})
   @ LinearAlgebra ~/Projects/julia-1.10/usr/share/julia/stdlib/v1.10/LinearAlgebra/src/eigen.jl:237
 [4] top-level scope
   @ REPL[7]:1
@andreasnoack
Copy link
Member

The issue here is actually #77. The sorting would be very simple to add but there is a little more work to finalize eigen!.

@dlfivefifty
Copy link
Member Author

That's not actually my issue nor the issue in the example above: in my case its a custom matrix type that is symmetric. It ends up calling eigen!(::Hermitian{BigFloat}; sortby=sortby) which throws the error.

There is no need for supporting non-symmetric eigen in either case.

@andreasnoack
Copy link
Member

I see. I misread the error and thought the Tridiagonal made it hit the general solver. Then it is probably a pretty easy fix.

@dlfivefifty
Copy link
Member Author

Yes its an easy fix I might put together a PR over the weekend.

dlfivefifty added a commit that referenced this issue Aug 9, 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