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

eigen() broken for non-Hermitian matrices #77

Open
sverek opened this issue Jul 23, 2021 · 1 comment
Open

eigen() broken for non-Hermitian matrices #77

sverek opened this issue Jul 23, 2021 · 1 comment

Comments

@sverek
Copy link

sverek commented Jul 23, 2021

Both in 1.6.2 and 1.7b3, see examples below with BigFloat.

julia> versioninfo()
Julia Version 1.6.2
Commit 1b93d53fc4 (2021-07-14 15:36 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)

julia> using LinearAlgebra,GenericLinearAlgebra

julia> eigen(Hermitian(rand(BigFloat,5,5)))
Eigen{BigFloat, BigFloat, Matrix{BigFloat}, Vector{BigFloat}}
values:
5-element Vector{BigFloat}:
 -0.4887698284034353629278662405847996486390203845256632669531308786790234904305252
 -0.23957178126044890148706578948820548968416904833626474092213791610934499449746
  0.2420315098582791585836827261159398231227201754519835421916618918814673416784328
  1.027553335067571884556797097988170714414183181354401756940097138295884750065342
  2.4179948357615710761208524931932816638859780417157267213822396311464899653017
vectors:
5×5 Matrix{BigFloat}:
  0.643244   0.056325  -0.703372   0.15764   0.251957
  0.137664  -0.823489   0.111178  -0.380953  0.381352
  0.335786   0.350451   0.593617   0.159468  0.621788
 -0.395071   0.390543  -0.309542  -0.627235  0.449617
 -0.546308  -0.208215  -0.211448   0.641226  0.449792

julia> eigen(rand(BigFloat,5,5))
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[6]:1
julia> versioninfo()
Julia Version 1.7.0-beta3.0
Commit e76c9dad42 (2021-07-07 08:12 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.0 (ORCJIT, skylake)

julia> using LinearAlgebra,GenericLinearAlgebra

julia> eigen(Hermitian(rand(BigFloat,5,5)))
Eigen{BigFloat, BigFloat, Matrix{BigFloat}, Vector{BigFloat}, Vector{BigFloat}}
values:
5-element Vector{BigFloat}:
 -0.3013651960644129641532610658746961406964259498102245867410423605298043880153657
  0.120203860860071466734019164981546073833764155606255715475030075776944488735232
  0.6240177079049022904005106766910157195384973670823691563637390563798449544924699
  0.7367367930040014998095951360312239998683781592003136115029612450139105705095599
  2.332417706482406886949287685629486433665965295696010610051049348107239712251295
vectors:
5×5 Matrix{BigFloat}:
 -0.0392047  -0.197348     0.861579   0.316458   0.34213
 -0.0925792   0.961961     0.137852  -0.0203742  0.215967
 -0.716137   -0.16382     -0.297161  -0.0398325  0.608621
  0.360393   -0.0939928    0.133732  -0.821625   0.410281
  0.5892     -0.00360311  -0.363992   0.472001   0.545487

julia> eigen(rand(BigFloat,5,5))
ERROR: MethodError: no method matching eigen!(::Matrix{BigFloat}; permute=true, scale=true, sortby=LinearAlgebra.eigsortby, jvl=false, jvr=true, jce=false, jcv=false)
Closest candidates are:
  eigen!(::StridedMatrix{T}; permute, scale, sortby, jvl, jvr, jce, jcv) where T<:Union{Float32, Float64} at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/LinearAlgebra/src/eigen.jl:163
  eigen!(::StridedMatrix{T}; permute, scale, sortby, jvl, jvr, jce, jcv) where T<:Union{ComplexF32, ComplexF64} at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/LinearAlgebra/src/eigen.jl:206
  eigen!(::StridedMatrix{T}, ::StridedMatrix{T}; sortby) where T<:Union{Float32, Float64} at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/LinearAlgebra/src/eigen.jl:478 got unsupported keyword arguments "permute", "scale", "jvl", "jvr", "jce", "jcv"
  ...
Stacktrace:
 [1] eigen(A::Matrix{BigFloat}; permute::Bool, scale::Bool, sortby::typeof(LinearAlgebra.eigsortby), jvl::Bool, jvr::Bool, jce::Bool, jcv::Bool)
   @ LinearAlgebra /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/LinearAlgebra/src/eigen.jl:276
 [2] eigen(A::Matrix{BigFloat})
   @ LinearAlgebra /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.7/LinearAlgebra/src/eigen.jl:274
 [3] top-level scope
   @ REPL[6]:1
@andreasnoack
Copy link
Member

This is actually never worked. Most of the pieces are there but they are not assembled. I.e. you can do

schur(rand(BigFloat,5,5))

but I haven't yet written the diagonalization routine for (quasi) triangular matrices.

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