GenericLinearAlgebra.jl icon indicating copy to clipboard operation
GenericLinearAlgebra.jl copied to clipboard

wrapper for eigen(Matrix A) where A is hermitian by value but not type

Open johnfgibson opened this issue 4 years ago • 2 comments

A small fix to make the generic eigen work for matrices that are hermitian by value but not by type, following @dlfivefifty's suggestion at https://discourse.julialang.org/t/eigen-not-working-for-arbitrary-precision-bigfloat/67686/11

johnfgibson avatar Sep 07 '21 14:09 johnfgibson

For reference, the current error is

julia> eigen(big.(A + A'))
ERROR: MethodError: no method matching eigen!(::Matrix{BigFloat}; permute=true, scale=true, sortby=LinearAlgebra.eigsortby)
Closest candidates are:
  eigen!(::StridedMatrix{T}; permute, scale, sortby) where T<:Union{Float32, Float64} at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/eigen.jl:148
  eigen!(::StridedMatrix{T}; permute, scale, sortby) where T<:Union{ComplexF32, ComplexF64} at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/eigen.jl:171
  eigen!(::StridedMatrix{T}, ::StridedMatrix{T}; sortby) where T<:Union{Float32, Float64} at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/eigen.jl:427 got unsupported keyword arguments "permute", "scale"
  ...
Stacktrace:
 [1] eigen(A::Matrix{BigFloat}; permute::Bool, scale::Bool, sortby::typeof(LinearAlgebra.eigsortby))
   @ LinearAlgebra /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/eigen.jl:237
 [2] eigen(A::Matrix{BigFloat})
   @ LinearAlgebra /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/eigen.jl:235
 [3] top-level scope
   @ REPL[3]:1

It would probably be more appropriate to adjust the eigen! methods in this package such that they have the same keyword arguments as the ones in LinearAlgebra.

andreasnoack avatar Sep 16 '21 09:09 andreasnoack

Codecov Report

Patch coverage has no change and project coverage change: -0.21 :warning:

Comparison is base (2f2f4e6) 82.59% compared to head (6e17f92) 82.38%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #78      +/-   ##
==========================================
- Coverage   82.59%   82.38%   -0.21%     
==========================================
  Files          11       11              
  Lines        1637     1641       +4     
==========================================
  Hits         1352     1352              
- Misses        285      289       +4     
Impacted Files Coverage Δ
src/eigenSelfAdjoint.jl 92.23% <0.00%> (-0.86%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Mar 09 '23 08:03 codecov[bot]