Skip to content

num::cholesky

Defined in header <linear/factorization/cholesky.hpp>, <linear/factorization/factor.hpp>, <linear/factorization/reuse.hpp>

template <std::floating_point T>
bool cholesky(T *L, const T *A, idx n) noexcept;  // (1)

cholesky_result cholesky(const with_law<mat<real>, law::spd> &A);  // (2)

template <class M>
requires matrix_space<M> && (!claims<M, law::spd>)
cholesky_result cholesky(const M & /*untagged*/);  // (3)

similar_factor<cholesky_result> cholesky(const spmat &R, view<const real> h);  // (4)

similar_factor<block_cholesky_factor>
cholesky(const spmat &R, block_structure structure, view<const real> h);  // (5)

corrected_cholesky cholesky(const spmat &R, view<const real> h,
                            const corrected_cholesky *previous,
                            view<const idx> changed);  // (6)

suffix_block_cholesky cholesky(const spmat &R, block_structure structure,
                               view<const real> h,
                               const suffix_block_cholesky *previous,
                               view<const idx> changed);  // (7)

(1) Cholesky factorization \(A = L L^T\) for symmetric positive definite \(A\).

Writes L and zeroes the strict upper triangle; L and A may alias. Returns false at the first non-positive pivot, which proves A is not positive definite.

(2) Factor a matrix whose SPD property has already been established.

(3) Rejects an untagged matrix at compile time.

Cholesky is defined only for symmetric positive definite matrices, so a raw mat<real> does not satisfy its precondition. This overload exists to say so in a diagnostic rather than to run: a warning can be silenced by an unrelated -Wno- flag, whereas this cannot compile.

(4) Factor H R H^-1 by Cholesky and retain H for applications of R^-1.

(5) Block-Cholesky specialization of the diagonally similar factorization.

(6) Dense Cholesky of a symmetric similarity of R, corrected from previous when only a few slots differ.

(7) Block Cholesky of H R H^-1, copying the unchanged prefix of previous.

Parameters

  • L: Output lower triangular factor, n*n.
  • A: Input symmetric matrix, n*n; only the lower triangle is read.
  • n: mat dimension.