Definition (Singular-value decomposition). A singular-value decomposition is \mathbf{A}=\mathbf{U}\mathbf\Sigma\mathbf{V}^{\mathsf{H}}, with unitary factors \mathbf{U},\mathbf{V} and a rectangular diagonal matrix \mathbf\Sigma containing nonnegative singular values in decreasing order. Retaining the leading k singular components defines a rank-at-most-k truncation. The decomposition and its truncation are mathematical objects; concrete SVD algorithms have separate execution and accuracy questions.
Singular-value decomposition
Construct singular values and left and right singular vectors.
Definition
Mathematical guarantees
Theorem (Optimal rank truncation). For every comparison matrix \mathbf{B} with rank at most k,
\|\mathbf{A}-[\mathbf{A}]_k\|_{\mathrm{F}}\le\|\mathbf{A}-\mathbf{B}\|_{\mathrm{F}}.
Thus retaining the leading singular components gives a best rank-at-most-k approximation in Frobenius norm. A separate checked result gives the spectral-norm optimum.
Lean statement and details
NLAlib.frobNorm_sub_truncatedSVD_le_of_rank_le.{u_1, u_2, u_3} {π : Type u_1} [RCLike π]
{m : Type u_2} {n : Type u_3} [Fintype m] [Fintype n] (A : Matrix m n π) {B : Matrix m n π}
{k : β} (hB : B.rank β€ k) : frobNorm (A - truncatedSVD A k) β€ frobNorm (A - B)Further results
Theorem (EckartβYoung in the spectral norm).
, as a least element: \sigma_k(\mathbf{A}) is the smallest spectral distance \|\mathbf{A} - \mathbf{B}\|_2 from \mathbf{A} to a matrix \mathbf{B} of rank at most k.
Lean statement and details
NLAlib.isLeast_specNorm_sub_of_rank_le.{u_1, u_2, u_3} {π : Type u_1} [RCLike π] {m : Type u_2}
{n : Type u_3} [Fintype m] [Fintype n] (A : Matrix m n π) (k : β) :
IsLeast ((fun B β¦ specNorm (A - B)) '' {B | B.rank β€ k}) (singularValues A k)Theorem (Existence of the singular value decomposition).
For every k between the rank of \mathbf{A} and its smaller dimension, \mathbf{A} = \mathbf{U} \operatorname{diag}\bigl(\sigma_0(\mathbf{A}), \dots, \sigma_{k-1}(\mathbf{A})\bigr) \mathbf{V}^{\mathsf{H}} with \mathbf{U}, \mathbf{V} having k orthonormal columns. With k = \operatorname{rank} \mathbf{A} this is the compact SVD and with k = \min(\lvert m \rvert, \lvert n \rvert) the thin SVD. [HornJohnson2013, Theorem 2.6.3]; [GolubVanLoan2013, Theorem 2.4.1].
General form: sizes are index types
Lean statement and details
NLAlib.exists_isSVD.{u_1, u_3, u_4} {π : Type u_1} [RCLike π] {m : Type u_3} {n : Type u_4}
[Fintype m] [Fintype n] (A : Matrix m n π) {k : β} (hk : A.rank β€ k) (hkm : k β€ Fintype.card m)
(hkn : k β€ Fintype.card n) : β U V, IsSVD A U (fun i β¦ singularValues A βi) VTheorem (Uniqueness of the singular values).
In an SVD with columns indexed by Fin k and \boldsymbol{\sigma} non-increasing, \boldsymbol{\sigma} is the sequence of singular values: \sigma_i(\mathbf{A}) = \boldsymbol{\sigma}_i for i < k.
Lean statement and details
NLAlib.IsSVD.singularValues_eq.{u_1, u_3, u_4} {π : Type u_1} [RCLike π] {m : Type u_3}
{n : Type u_4} [Fintype m] [Fintype n] {A : Matrix m n π} {k : β} {U : Matrix m (Fin k) π}
{Ο : Fin k β β} {V : Matrix n (Fin k) π} (h : IsSVD A U Ο V) (hΟ : Antitone Ο) (i : Fin k) :
singularValues A βi = Ο i