lu_factor_ex(A: Tensor, pivot: bool = True, check_errors: bool = False)LU factorization with partial pivoting and an explicit status.
Variant of lu_factor that returns the factors of a singular
matrix too, with an info code following LAPACK getrf:
info == 0— every pivot is non-zero.info == k > 0— is the first exactly-zero pivot (1-based). The factorization is still complete, but is singular andlu_solvedivides by that pivot.
Parameters
Matrix of shape
(*, m, n). Need not be square.pivot(bool, keyword - only)= TrueMust be
True (the default); unpivoted LU is not implemented
and raises NotImplementedError.check_errors(bool, keyword - only)= FalseIf
True, raise LinAlgError for the first singular
matrix instead of reporting it through info.Returns
TensorPacked factorization of shape (*, m, n), as lu_factor.
Examples
>>> import lucid
>>> from lucid.linalg import lu_factor_ex
>>> LU, piv, info = lu_factor_ex(lucid.tensor([[1.0, 2.0], [2.0, 4.0]]))
>>> int(info)
2