tesseract++ 0.0.1
N-dimensional tensor library for embedded systems
Loading...
Searching...
No Matches
Namespaces | Functions
cholesky.h File Reference

Cholesky decomposition for symmetric positive-definite matrices. More...

#include "config.h"
#include "utilities/expected.h"
#include "matrix_traits.h"
#include "math/math_utils.h"
#include "simple_type_traits.h"
Include dependency graph for cholesky.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  matrix_algorithms
 

Functions

template<typename MatrixType >
Expected< MatrixType, MatrixStatus > matrix_algorithms::cholesky (const MatrixType &A, typename MatrixType::value_type tol=typename MatrixType::value_type(PRECISION_TOLERANCE))
 Compute the Cholesky decomposition of a symmetric positive-definite matrix.
 
template<typename MatrixType >
MatrixType matrix_algorithms::cholesky_or_die (const MatrixType &A)
 Cholesky decomposition — abort on failure.
 

Detailed Description

Cholesky decomposition for symmetric positive-definite matrices.

Computes the lower-triangular factor L such that A = L · Lᵀ. Returns the result wrapped in Expected so that callers can distinguish success from well-defined failure modes (not symmetric, not positive definite) without exceptions or dynamic allocation.


ALGORITHM

For a symmetric positive-definite matrix A of size N×N, the Cholesky decomposition computes a lower-triangular matrix L such that A = LLᵀ.

For each row i = 0 … N−1:
For each column j = 0 … i:
If i == j (diagonal):
L(i,i) = sqrt( A(i,i) − Σ_{k=0}^{j-1} L(i,k)² )
Else (below diagonal):
L(i,j) = ( A(i,j) − Σ_{k=0}^{j-1} L(i,k)·L(j,k) ) / L(j,j)

Complexity: O(N³/3) multiplications, O(N) square roots.


FAILURE MODES

The tolerance parameter tol controls the diagonal threshold: