fn
ldl_factor
→Tensorldl_factor(A: Tensor, hermitian: bool = True)LDL factorization of a symmetric (or Hermitian) matrix.
For a real symmetric matrix (possibly indefinite), computes a Bunch-Kaufman block factorization
where is unit-lower-triangular and is
block-diagonal with or
blocks. Unlike cholesky, this factorization exists for
indefinite symmetric matrices (e.g., saddle-point systems).
Parameters
ATensorSymmetric / Hermitian matrix of shape
(*, n, n).hermitianbool= TrueIf
True (default), treat A as Hermitian (conjugate
symmetric in the complex case).Returns
TensorPacked factor of shape (*, n, n). The strict lower
triangle holds ; the diagonal holds 's
entries ( blocks are stored in the
sub-diagonal).
Notes
Backed by LAPACK sytrf. Cost is . Pair
with ldl_solve for solving symmetric indefinite systems.
Examples
>>> import lucid
>>> from lucid.linalg import ldl_factor
>>> A = lucid.tensor([[1.0, 2.0], [2.0, 3.0]])
>>> LD, piv = ldl_factor(A)