Documentation

TauCeti.Analysis.Matrix.CovariancePseudoInverse

The pseudoinverse of a covariance matrix #

Matrix.covariancePseudoInverse inverts the nonzero eigenvalues of a real positive-semidefinite matrix and vanishes on its kernel. Invalid covariance matrices give zero. This is the inverse needed to condition a Gaussian vector on an observed block with singular covariance.

The construction uses Mathlib's finite-spectrum continuous functional calculus. Its Euclidean operator is the existing LinearMap.moorePenroseInverse, so uniqueness follows from the four Penrose equations rather than a choice of eigenbasis.

References #

noncomputable def Matrix.covariancePseudoInverse {ι : Type u_1} [Fintype ι] [DecidableEq ι] (C : Matrix ι ι ℝ) :
Matrix ι ι ℝ

Invert the nonzero eigenvalues of a positive-semidefinite covariance matrix, sending zero eigenvalues to zero. For a matrix that is not positive semidefinite, return zero.

Instances For
    theorem Matrix.covariancePseudoInverse_of_posSemidef {ι : Type u_1} [Fintype ι] [DecidableEq ι] {C : Matrix ι ι ℝ} (hC : C.PosSemidef) :
    C.covariancePseudoInverse = cfc (fun (x : ℝ) => x⁻¹) C

    The positive-semidefinite branch of the covariance pseudoinverse.

    @[simp]

    An invalid covariance has zero pseudoinverse.

    @[simp]

    The pseudoinverse of zero is zero, also in dimension zero.

    Every covariance pseudoinverse is positive semidefinite, including the invalid branch.

    A covariance matrix commutes with its pseudoinverse.

    The first Penrose equation for a positive-semidefinite matrix.

    The second Penrose equation holds for every matrix, including invalid covariances.

    The product of a covariance and its pseudoinverse is symmetric.

    The product of a covariance pseudoinverse and its covariance is symmetric.

    The functional-calculus construction satisfies all four Moore–Penrose equations.

    theorem Matrix.eq_covariancePseudoInverse_of_penrose {ι : Type u_1} [Fintype ι] [DecidableEq ι] {C D : Matrix ι ι ℝ} (hC : C.PosSemidef) (h₁ : C * D * C = C) (h₂ : D * C * D = D) (h₃ : (C * D).IsHermitian) (h₄ : (D * C).IsHermitian) :

    The four matrix Penrose equations characterize the covariance pseudoinverse.

    The covariance construction agrees with the existing Moore–Penrose inverse of the Euclidean operator.

    At positive-definite covariance, the pseudoinverse is the ordinary inverse.

    On one coordinate, the pseudoinverse of a valid covariance agrees with the totalized ordinary inverse, including zero variance.

    @[simp]

    Inverting the covariance pseudoinverse recovers every valid covariance.

    Multiplication by a covariance and its pseudoinverse is the orthogonal projection onto its Euclidean range. Submodule.starProjection is the ambient inclusion composed with Submodule.orthogonalProjectionOnto.

    Multiplication by a covariance pseudoinverse and its covariance is the orthogonal projection onto the covariance's Euclidean range.

    theorem Matrix.tendsto_inv_sq_add_smul_mul {ι : Type u_1} [Fintype ι] [DecidableEq ι] {C : Matrix ι ι ℝ} (hC : C.PosSemidef) :
    Filter.Tendsto (fun (ε : ℝ) => (C ^ 2 + ε • 1)⁻¹ * C) (nhdsWithin 0 (Set.Ioi 0)) (nhds C.covariancePseudoInverse)

    The covariance pseudoinverse is the limit of (C² + ε I)⁻¹ C as positive ε tends to zero. The limit includes zero covariance and empty coordinate types.

    The totalized covariance pseudoinverse is Borel measurable in all matrix entries.