NLA-lib Explorer

Every matrix with at least as many rows as columns has a QR factorization

Library · Result group

Theorem (exists_isQR). Every matrix with at least as many rows as columns has a QR factorization, with nonnegative diagonal: if \lvert n \rvert \le \lvert m \rvert, then \mathbf{A} = \mathbf{Q}\mathbf{R} with \mathbf{R}_{i,i} \ge 0. [HornJohnson2013, Theorem 2.1.14]; [GolubVanLoan2013, Theorem 5.2.3].

Headline General form: sizes are index types

Lean statement and details
NLAlib.exists_isQR.{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 : Matrix m n 𝕜)
  (h : Fintype.card n ≤ Fintype.card m) : ∃ Q R, IsQR A Q R ∧ ∀ (i : n), 0 ≤ R i i

Full source on GitHub

Copy link

General form: sizes are index types. A size is carried by a finite index type: |k| is the number of elements of the index type k, and "k nonempty" means k ≥ 1.