Skip to content

num::lu_factor

Defined in header <linear/factorization/lu.hpp>

template <std::floating_point T, class Index>
bool lu_factor(T *LU, Index *piv, idx n) noexcept;

LU factorization \(PA = LU\) with partial pivoting, packed in place.

On return LU holds the unit-lower factor below the diagonal and the upper factor on and above it; piv[i] is the row swapped with row i. Returns false when an exactly zero pivot column is found, i.e. when A is singular.

Parameters

  • LU: In/out packed factors, n*n row-major; pass a copy of A.
  • piv: Output pivot sequence, length n.
  • n: mat dimension.