NLA-lib Explorer

NLAlib.isTotalLeastSquaresSolution_iff_exists

Library · theorem

This statement changed in the recorded rename: 2026-11-total-least-squares.

General form: sizes are index types

Total least squares solution directions. For an augmented matrix \mathbf{C}, every optimal finite solution is the negative ratio of the leading coordinates to the last coordinate of a unit least Gram eigenvector with nonzero last coordinate: \mathbf{x}_i=-\frac{\mathbf{v}_i}{\mathbf{v}_{\mathrm{last}}}. Every such direction gives an optimal solution. [GolubVanLoan2013, §6.3]. Result: total-least-squares-svd

NLAlib.isTotalLeastSquaresSolution_iff_exists.{u_1, u_2, u_3} {𝕜 : Type u_1} [RCLike 𝕜]
  {m : Type u_2} {n : Type u_3} [Fintype m] [Fintype n] (C : Matrix m (n ⊕ Unit) 𝕜) (x : n → 𝕜) :
  IsTotalLeastSquaresSolution C.toCols₁ (C.col (Sum.inr ())) x ↔
    ∃ v,
      ‖WithLp.toLp 2 v‖ = 1 ∧
        v (Sum.inr ()) ≠ 0 ∧
          (Cᴴ * C) *ᵥ v = eigenvalue (Cᴴ * C) (Fintype.card n) • v ∧
            x = fun i ↦ -v (Sum.inl i) / v (Sum.inr ())

Full source on GitHub

Import NLAlib.Matrix.Pseudoinverse.TotalLeastSquares.

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.