-
-
Notifications
You must be signed in to change notification settings - Fork 37
Description
I encountered the following error in computing the eigenvalues of a pair of complex matrices A and B, arising by a similarity transformation of a pair of Hamiltonian-skew Hamiltonian matrices. The eigenvalues should have a certain symmetry: if λ is a generalized eigenvalue of the pair (A,B), then -conj(λ) is a generalized eigenvalue as well.
julia> eigvals(A,B)
ERROR: LAPACKException(34)
Stacktrace:
[1] chklapackerror(ret::Int64)
@ LinearAlgebra.LAPACK C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\lapack.jl:38
[2] ggev!(jobvl::Char, jobvr::Char, A::Matrix{ComplexF64}, B::Matrix{ComplexF64})
@ LinearAlgebra.LAPACK C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\lapack.jl:2321
[3] eigvals!(A::Matrix{ComplexF64}, B::Matrix{ComplexF64}; sortby::typeof(LinearAlgebra.eigsortby))
@ LinearAlgebra C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\eigen.jl:551
[4] eigvals!
@ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\eigen.jl:550 [inlined]
[5] #eigvals#82
@ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\eigen.jl:580 [inlined]
[6] eigvals(A::Matrix{ComplexF64}, B::Matrix{ComplexF64})
@ LinearAlgebra C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\eigen.jl:579
[7] top-level scope
@ REPL[77]:1
To reproduce this computation, I am attaching the saved matrices in the file test_ggev.jld (packed in the zip-file test_ggev.zip) and the following code produces the error with Julia v1.6.0 running on a machine with Windows 10:
using JLD
A, B = load("test_ggev.jld","A","B");
eigvals(A,B)
For checking purposes, I transfered the matrices to MATLAB and obtained the following eigenvalues, which exhibit the expected symmetry:
eig(A,B)
ans =
-7.8949 - 3.1677i
-7.8950 - 3.1674i
7.8949 - 3.1677i
7.8950 - 3.1674i
7.8949 - 3.1675i
7.8949 - 3.1675i
-7.8949 - 3.1675i
-7.8949 - 3.1675i
-2.6435 - 1.3271i
-2.6434 - 1.3269i
-2.1045 + 0.3119i
-2.1048 + 0.3122i
2.1045 + 0.3119i
2.1048 + 0.3122i
-0.5757 - 2.2930i
-0.5760 - 2.2949i
0.5757 - 2.2930i
0.5760 - 2.2949i
2.1046 + 0.3121i
2.1046 + 0.3121i
2.6435 - 1.3271i
2.6434 - 1.3269i
2.6434 - 1.3270i
2.6434 - 1.3270i
0.5758 - 2.2940i
0.5758 - 2.2940i
0.1491 + 1.3045i
0.1491 + 1.3045i
-0.1491 + 1.3045i
-0.1491 + 1.3045i
0.1491 + 1.3045i
0.1491 + 1.3045i
-2.6434 - 1.3270i
-2.6434 - 1.3270i
-2.1046 + 0.3121i
-2.1046 + 0.3121i
-0.5758 - 2.2940i
-0.5758 - 2.2940i
-0.1491 + 1.3045i
-0.1491 + 1.3045i
The following computation in Julia produces approximately the same result:
julia> eigvals(A/B)
40-element Vector{ComplexF64}:
-7.894987786971432 - 3.1673553694785017im
-7.894924711201389 - 3.167535553514198im
-7.894924711198504 - 3.1675355535182783im
-7.894861512653495 - 3.1677157151387565im
-2.643461272885884 - 1.3271419108713263im
-2.6434480473706086 - 1.3270066949327255im
-2.6434480473705486 - 1.3270066949316872im
-2.643434600429585 - 1.326871448734545im
-2.1047552691676503 + 0.31216749748540107im
-2.1046238787850124 + 0.3120568420550187im
-2.1046238787848073 + 0.3120568420537384im
⋮
2.1046238787850733 + 0.31205684205442474im
2.104623878785536 + 0.31205684205421114im
2.104755269167242 + 0.3121674974850989im
2.6434346004304508 - 1.3268714487339714im
2.6434480473693047 - 1.3270066949322732im
2.6434480473698527 - 1.3270066949328774im
2.6434612728870044 - 1.3271419108711606im
7.894861512656981 - 3.167715715138961im
7.8949247111950225 - 3.1675355535141736im
7.894924711201617 - 3.167535553515905im
7.894987786971231 - 3.167355369480694im