LDLTMgr class

LDLT factorization.

LDLTMgr is a class that performs the LDLT factorization for a given symmetric matrix. The LDLT factorization decomposes a symmetric matrix A into the product of a lower triangular matrix L, a diagonal matrix D, and the transpose of L. This factorization is useful for solving linear systems and eigenvalue problems. The class provides methods to perform the factorization, check if the matrix is positive definite, calculate a witness vector if it is not positive definite, and calculate the symmetric quadratic form.

  • LDL^T square-root-free version
  • Option allow semidefinite
  • A matrix A in R^{m x m} is positive definite iff v' A v > 0 for all v in R^n.
  • O(pos^2) per iteration, independent of N

Constructors, destructors, conversion operators

LDLTMgr(size_t N) explicit
Construct a new ldlt ext object.
LDLTMgr(const LDLTMgr&) deleted
LDLTMgr(LDLTMgr&&) defaulted

Public functions

auto operator=(const LDLTMgr&) -> LDLTMgr& deleted
template<typename Mat>
auto factorize(const Mat& A) -> bool -> auto
Perform LDLT Factorization.
auto factor(const std::function<double(size_t, size_t)>& get_matrix_elem) -> bool -> auto
Perform LDLT Factorization (Lazy evaluation)
auto factor_with_allow_semidefinite(const std::function<double(size_t, size_t)>& get_matrix_elem) -> bool -> auto
Perform LDLT Factorization (Lazy evaluation)
auto is_spd() const noexcept -> bool -> auto
Is $A$ symmetric positive definite (spd)
auto witness() -> double -> auto
witness that certifies $A$ is not symmetric positive definite (spd)
template<typename Arr036>
auto set_witness_vec(Arr036& v) const -> void -> auto
Set the witness vec object.
template<typename Mat>
auto sym_quad(const Mat& A) const -> double -> auto
Calculate v'*{A}(pos,pos)*v.
template<typename Mat>
auto sqrt(Mat& M) -> void -> auto
Return upper triangular matrix $R$ where $A = R^T R$.

Public variables

Rng pos
the rows where the process starts and stops
Vec witness_vec
witness vector
const size_t _n
dimension

Function documentation

LDLTMgr::LDLTMgr(size_t N) explicit

Construct a new ldlt ext object.

Parameters
in dimension

template<typename Mat>
auto LDLTMgr::factorize(const Mat& A) -> bool

Perform LDLT Factorization.

Parameters
in Symmetric Matrix

The factorize function is a template function that takes a symmetric matrix A as input and performs the LDLT factorization on it. It calls the factor function with a lambda function as an argument. The lambda function takes the indices i and j and returns the element A(i, j) of the matrix A. The factor function performs the actual factorization using the provided lambda function. The factorize function returns a boolean value indicating whether the factorization was successful or not.

auto LDLTMgr::factor(const std::function<double(size_t, size_t)>& get_matrix_elem) -> bool

Perform LDLT Factorization (Lazy evaluation)

Parameters
get_matrix_elem in function to access the elements of A
Returns true

See also: factorize()

auto LDLTMgr::factor_with_allow_semidefinite(const std::function<double(size_t, size_t)>& get_matrix_elem) -> bool

Perform LDLT Factorization (Lazy evaluation)

Parameters
get_matrix_elem in function to access the elements of A
Returns true

See also: factorize()

auto LDLTMgr::is_spd() const noexcept -> bool

Is $A$ symmetric positive definite (spd)

Returns true

auto LDLTMgr::witness() -> double

witness that certifies $A$ is not symmetric positive definite (spd)

Returns double

The witness() function calculates a witness that certifies that the matrix A is not symmetric positive definite (spd). It returns a double value that represents the witness.

template<typename Arr036>
auto LDLTMgr::set_witness_vec(Arr036& v) const -> void

Set the witness vec object.

Template parameters
Arr036
Parameters
in

template<typename Mat>
auto LDLTMgr::sym_quad(const Mat& A) const -> double

Calculate v'*{A}(pos,pos)*v.

Template parameters
Mat
Parameters
in
Returns double

template<typename Mat>
auto LDLTMgr::sqrt(Mat& M) -> void

Return upper triangular matrix $R$ where $A = R^T R$.

Template parameters
Mat
Parameters
in/out

The sqrt function calculates the square root of a symmetric positive definite matrix M. It assumes that M is a zero matrix and calculates the upper triangular matrix R such that M = R^T * R.