linalg::factor::eig
General real eigenproblem: Householder reduction to upper Hessenberg form (orthes), then the Francis double-shift QR iteration to real Schur form (hqr2), as in EISPACK and JAMA. Eigenvectors come from back substitution on the quasi-triangular factor. Backward stable for the Schur form; eigenvectors of ill-conditioned eigenvalues are only as good as their conditioning allows. About 25n^3 with vectors.
Structs
EigSource
pub struct Eig<T>The eigenvalues and eigenvectors of a real square matrix:
A v_j = w_j v_j. Complex eigenvalues come in conjugate pairs, the
one with positive imaginary part first; each vector has unit 2-norm.
use core::array::Matrix;
let r: Matrix<f64> = [[0, -1], [1, 0]]; // a quarter turn
let e = try linalg::eig(r);
let w = e.values();
assert(w[0].re.abs() < 1e-12 && (w[0].im - 1.0).abs() < 1e-12);
The eigenvalues, in the order the QR iteration finds them.
The eigenvectors: column
jbelongs tovalues()[j].
SchurSource
pub struct Schur<T>The real Schur form A = Z T Z^T: Z orthogonal, T upper
quasi-triangular with a 1 x 1 block per real eigenvalue and a 2 x 2
block per complex pair.
use core::array::Matrix;
let a: Matrix<f64> = [[1, 2], [0, 3]];
let s = try linalg::schur(a);
assert(s.t()[1, 0] == 0.0);
The quasi-triangular factor
T.The orthogonal factor
Z.The eigenvalues, from the diagonal blocks of
T.