Skip to main content

Module qr_algorithm

Module qr_algorithm 

Source
Expand description

The QR algorithm (Francis and Kublanovskaya, 1961) for the eigenvalues of a symmetric matrix.

Factor A_k = Q_k R_k, then multiply in the other order: A_{k+1} = R_k Q_k = Q_kᵀ A_k Q_k. Every iterate is similar to A, and the product Q_1 Q_2 ⋯ Q_k is exactly what subspace (orthogonal) iteration on Aᵏ would produce, so A_k converges to a diagonal matrix of eigenvalues, ordered by magnitude, with entry (i, j) decaying like |λ_i / λ_j|ᵏ. Equal magnitudes (±λ) never separate.

The shifted algorithm factors A_k − μ I instead and adds μ I back. A shift close to an eigenvalue makes the last row converge in a few steps; that eigenvalue is then deflated and the iteration continues on the leading block. Wilkinson’s shift, the eigenvalue of the trailing 2 × 2 block nearer its corner entry, always converges for symmetric matrices. Production codes add one more ingredient, a preliminary reduction to tridiagonal (or Hessenberg) form, so that each step costs O(n) (or O(n²)) rather than O(n³).

See the book entry Eigenvalue algorithms.

Structs§

QrEigenvalues
Eigenvalues in ascending order and the number of QR steps taken.

Functions§

shifted_qr
QR iteration with Wilkinson shifts and deflation.
unshifted_qr
Unshifted QR iteration until the off-diagonal norm is below tolerance × ‖A‖_F.
wilkinson_shift
The eigenvalue of [[a, b], [b, c]] closer to c.