Expand description
The QR factorisation A = Q R: orthonormal columns times an upper triangular matrix.
Gram-Schmidt builds Q one column at a time by subtracting from each column of A its
projections onto the columns already found. The classical form projects the original column;
the modified form projects the partially orthogonalised one, which is algebraically identical
but loses orthogonality much more slowly in floating point (roughly ε κ(A) instead of
ε κ(A)², where κ is the condition number).
Householder QR instead multiplies A by reflections H = I − 2 v vᵀ, each zeroing the
entries below one diagonal position. Products of reflections are exactly orthogonal, so Q is
orthonormal to working precision whatever the conditioning of A. This is what production
libraries use.
All three return the thin factorisation of an m × n matrix with m ≥ n: Q is m × n and
R is n × n.
See the book entry QR factorisation.
Functions§
- classical_
gram_ schmidt - Classical Gram-Schmidt:
r_ij = q_i · a_jwith the original columna_j. - householder
- Householder QR. Reflection
kmaps columnk(from rowkdown) onto a multiple ofe_1;Qis then accumulated by applying the reflections to the firstncolumns of the identity. - modified_
gram_ schmidt - Modified Gram-Schmidt:
r_ij = q_i · vwith the columnvas orthogonalised so far. - orthogonality_
error ‖QᵀQ − I‖_F, the loss of orthogonality.