NLA-lib Explorer

QR factorization

Factor a matrix into an orthogonal basis and a triangular factor.

Definition

Definition (QR factorization). For \mathbf{A}\in\mathbb{C}^{m\times n} with m\ge n, a thin QR factorization is \mathbf{A}=\mathbf{Q}\mathbf{R}, where \mathbf{Q}^{\mathsf{H}}\mathbf{Q}=\mathbf{I} and \mathbf{R} is upper triangular. Full QR extends \mathbf{Q} to a unitary basis. Rank deficiency permits zero diagonal entries of \mathbf{R}. Householder transformations, Givens rotations, and Gram–Schmidt are different ways to compute factors; QR eigenvalue iteration is a separate algorithm.

Copy link

Results

Theorem (Givens QR gives the thin QR factorization).

of a tall upper Hessenberg matrix. [GolubVanLoan2013, Algorithm 5.2.4].

Lean statement and details
NLAlib.isQR_givensHessenberg.{u_1} {π•œ : Type u_1} [RCLike π•œ] {m p : β„•}
  {H : Matrix (Fin m) (Fin p) π•œ} (hH : IsUpperHessenberg H) (h : p ≀ m) :
  IsQR H ((givensHessenbergQ H).submatrix id (Fin.castLE h))
    ((givensHessenbergR H).submatrix (Fin.castLE h) id)

Full source on GitHub

Copy link

Theorem (Least squares through QR).

When the diagonal of \mathbf{R} has no zero (full column rank), \mathbf{x} minimises \|\mathbf{A}\mathbf{x} - \mathbf{b}\| exactly when \mathbf{R}\mathbf{x} = \mathbf{Q}^{\mathsf{H}}\mathbf{b}. [GolubVanLoan2013, Β§5.3.3]; [TrefethenBau1997, Lecture 11].

Lean statement and details
NLAlib.IsQR.isLeastSquaresSolution_iff.{u_1, u_3, u_4} {π•œ : Type u_1} [RCLike π•œ] {m : Type u_3}
  {n : Type u_4} [Fintype m] [Fintype n] [LinearOrder n] [DecidableEq n] {A Q : Matrix m n π•œ}
  {R : Matrix n n π•œ} (h : IsQR A Q R) (hR : βˆ€ (i : n), R i i β‰  0) {b : m β†’ π•œ} {x : n β†’ π•œ} :
  IsLeastSquaresSolution A b x ↔ R *α΅₯ x = Qα΄΄ *α΅₯ b

Full source on GitHub

Copy link

Used by other algorithms

Mathematical background

Appears under these tasks

Family