Closed
Description
Hello! I noticed an incorrect behavior using eigen()
on 2x2 Hermitian SMatrices:
using LinearAlgebra
using StaticArrays
A = @SMatrix [1.0 1e-10; 1e-10 1.0]
eigen(A)
outputs
Eigen{Float64, Float64, SMatrix{2, 2, Float64, 4}, SVector{2, Float64}}
values:
2-element SVector{2, Float64} with indices SOneTo(2):
1.0
1.0
vectors:
2×2 SMatrix{2, 2, Float64, 4} with indices SOneTo(2)×SOneTo(2):
0.0 0.0
1.0 1.0
The problem seems to be a numerical instability in
Lines 161 to 176 in f59bceb
vals
should be [-1e-10, 1e-10]
instead of [0.0, 0.0]
. This has consequences on the rest of the evaluations, e.g., v11
is evaluated to 0.0
instead of -1e-10
and n1
is evaluated to 1e-10
instead of 2e-10
etc.
More info:
julia> versioninfo()
Julia Version 1.6.2
Commit 1b93d53fc4 (2021-07-14 15:36 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
(@v1.6) pkg> status StaticArrays
Status `~\v1.6\Project.toml`
[90137ffa] StaticArrays v1.2.12
Metadata
Metadata
Assignees
Labels
No labels