In eigen.jl
function eigen()
calls eigen!()
which appears to call
LAPACK.geevx!()
for all types of matrices (symmetric and non-symmetric).
For symmetric matrices this results in insufficiently orthogonal eigenvectors
- the orthogonality is worse than
norm(A)*eps()
.
For symmetric matrix the wrapper should callLAPACK.syev!
.
This is illustrated by the following example in Julia 1.0.2:
# Example
using LinearAlgebra
import Random
Random.seed!(123)
n=1600
D=rand(n)
a=rand(n)
A=diagm(0=>D)+a*a'
λ,X=eigen(A)
μ,Y=LAPACK.syev!('V','U',deepcopy(A))
# Relative residuals and orthogonality
opnorm(A*X-X*diagm(0=>λ))/opnorm(A), opnorm(X'*X-I),
opnorm(A*Y-Y*diagm(0=>μ))/opnorm(A), opnorm(Y'*Y-I)