Skip to content

Order of eigenvectors of (symmetric) 2x2 matrices #523

Closed
@dkarrasch

Description

@dkarrasch

I guess the following is a (quite scary) bug:

using LinearAlgebra, StaticArrays, Test
S = SMatrix{2,2}((70., 0., 0., 1/70))
E = eigen(S)
Λs = eigvals(E)
V = eigvecs(E)
@test S * V  ≈ V * Diagonal(eigvals(E))
M = Matrix(S)
F = eigen(M)
Λm = eigvals(F)
@test Λs ≈ Λm
U = eigvecs(F)
@test M * U ≈ U * Diagonal(eigvals(F))

I thought one should be able to rely on that eigvecs(E)[:,1] is the eigenvector corresponding to eigvals(E)[1], like in the normal matrix case? Or how would one do that otherwise?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions