Expand description
Linear least squares, min ‖A x − b‖₂ for a tall A, two ways.
The normal equations AᵀA x = Aᵀb come straight from setting the gradient to zero and are
solved cheaply with Cholesky, but forming AᵀA squares the condition number. QR writes
A = Q R, so ‖A x − b‖ = ‖R x − Qᵀb‖ in the column space, and solves the triangular system
R x = Qᵀb directly, with error proportional to κ(A) rather than κ(A)².
See the book entry Linear least squares.
Functions§
- normal_
equations - Solves the normal equations
AᵀA x = Aᵀbwith Cholesky:L y = Aᵀb, thenLᵀ x = y. - qr_
least_ squares - Solves
R x = Qᵀbwith the Householder QR factorisation.