Definition (Gram–Schmidt orthogonalization). Process the input columns in order. Remove from each column its components along the earlier nonzero orthonormal columns, then normalize a nonzero residual. A zero residual represents a dependent column and remains zero in the library's rank-revealing convention. Classical Gram–Schmidt forms projection coefficients from a common input residual; modified Gram–Schmidt updates that residual after each projection. Repeated passes are separate implementation choices.
Lean statement and details
NLAlib.gramSchmidtQ.{u_1, u_2, u_3} {𝕜 : Type u_1} [RCLike 𝕜] {m : Type u_2} {n : Type u_3}
[Fintype m] [Fintype n] [LinearOrder n] [LocallyFiniteOrderBot n] (A : Matrix m n 𝕜) :
Matrix m n 𝕜