Documentation

Linglib.Core.Analysis.LeastSquares

Least-squares solutions #

IsLeastSquares A b x says x minimises the residual norm ‖b − A y‖ over the domain of a linear map A between real inner product spaces. Mathlib characterises the minimisers of a continuous linear map by its adjoint (ContinuousLinearMap.forall_norm_sub_apply_le_iff_adjoint_apply_sub_eq_zero); in finite dimension every linear map is continuous, and this file packages the resulting API: the normal equations in adjoint and inner-product form, existence by orthogonal projection, uniqueness of fitted values, and the solution coset.

[UPSTREAM] candidate; generalises from to RCLike 𝕜.

Main declarations #

def Core.IsLeastSquares {E : Type u_1} {F : Type u_2} [NormedAddCommGroup E] [InnerProductSpace E] [NormedAddCommGroup F] [InnerProductSpace F] (A : E →ₗ[] F) (b : F) (x : E) :

x is a least-squares solution of A y ≈ b if it minimises the residual norm ‖b − A y‖.

Equations
Instances For
    theorem Core.isLeastSquares_of_map_eq {E : Type u_1} {F : Type u_2} [NormedAddCommGroup E] [InnerProductSpace E] [NormedAddCommGroup F] [InnerProductSpace F] {A : E →ₗ[] F} {b : F} {x : E} (h : A x = b) :

    An interpolating point is a least-squares solution.

    theorem Core.isLeastSquares_iff_adjoint_eq_zero {E : Type u_1} {F : Type u_2} [NormedAddCommGroup E] [InnerProductSpace E] [NormedAddCommGroup F] [InnerProductSpace F] {A : E →ₗ[] F} {b : F} {x : E} [FiniteDimensional E] [FiniteDimensional F] :
    IsLeastSquares A b x (LinearMap.adjoint A) (b - A x) = 0

    The normal equations in adjoint form: x solves iff the adjoint kills the residual.

    theorem Core.isLeastSquares_iff_inner_eq_zero {E : Type u_1} {F : Type u_2} [NormedAddCommGroup E] [InnerProductSpace E] [NormedAddCommGroup F] [InnerProductSpace F] {A : E →ₗ[] F} {b : F} {x : E} [FiniteDimensional E] [FiniteDimensional F] :
    IsLeastSquares A b x ∀ (y : E), inner (b - A x) (A y) = 0

    The normal equations in inner-product form: the residual is orthogonal to the range.

    theorem Core.exists_isLeastSquares {E : Type u_1} {F : Type u_2} [NormedAddCommGroup E] [InnerProductSpace E] [NormedAddCommGroup F] [InnerProductSpace F] {A : E →ₗ[] F} {b : F} [FiniteDimensional E] [FiniteDimensional F] :
    ∃ (x : E), IsLeastSquares A b x

    Least-squares solutions exist.

    theorem Core.IsLeastSquares.map_eq {E : Type u_1} {F : Type u_2} [NormedAddCommGroup E] [InnerProductSpace E] [NormedAddCommGroup F] [InnerProductSpace F] {A : E →ₗ[] F} {b : F} {x x' : E} [FiniteDimensional E] [FiniteDimensional F] (hx : IsLeastSquares A b x) (hx' : IsLeastSquares A b x') :
    A x = A x'

    Fitted values are unique: any two least-squares solutions map to the same point.

    theorem Core.IsLeastSquares.iff_map_eq {E : Type u_1} {F : Type u_2} [NormedAddCommGroup E] [InnerProductSpace E] [NormedAddCommGroup F] [InnerProductSpace F] {A : E →ₗ[] F} {b : F} {x x' : E} [FiniteDimensional E] [FiniteDimensional F] (hx : IsLeastSquares A b x) :
    IsLeastSquares A b x' A x' = A x

    The least-squares solutions are exactly the preimages of the fitted value.

    theorem Core.IsLeastSquares.eq_of_injective {E : Type u_1} {F : Type u_2} [NormedAddCommGroup E] [InnerProductSpace E] [NormedAddCommGroup F] [InnerProductSpace F] {A : E →ₗ[] F} {b : F} {x x' : E} [FiniteDimensional E] [FiniteDimensional F] (hA : Function.Injective A) (hx : IsLeastSquares A b x) (hx' : IsLeastSquares A b x') :
    x = x'

    Under an injective design map the least-squares solution is unique.