Class RealCholesky
An abstract base class for Cholesky decomposition of symmetric (or symmetric) positive-definite matrices.
The Cholesky decomposition factorizes a symmetric/symmetric, positive-definite matrix \( A \) as: \[ A = LL^{T} \] where \( L \) is a lower triangular matrix. The decomposition is primarily used for efficient numerical solutions to linear systems, computing matrix inverses, and generating samples from multivariate normal distributions.
Symmetric Verification:
This class provides an option to explicitly check whether the input matrix is symmetric. If enforceSymmetric
is set
to true
, the implementation will verify that \( A \) satisfies
\( A = A^{T} \) before performing decomposition.
If set to false
, the matrix is assumed to be symmetric, no explicit check will be performed, and only the lower-diagonal
entries of \( A \) are accessed.
positive-definiteness Check:
To ensure numerical stability, the algorithm verifies that all diagonal entries of \( L \) are positive.
A tolerance threshold, posDefTolerance
, is used to determine whether a diagonal entry is considered
non-positive, indicating that the matrix is not positive-definite. This threshold can be adjusted using
Cholesky.setPosDefTolerance(double)
.
Usage:
A typical workflow using a concrete implementation of Cholesky decomposition follows these steps:
- Instantiate an instance of
RealCholesky
. - Call
decompose(Matrix)
to compute the decomposition. - Retrieve the factorized matrices using
Cholesky.getL()
orCholesky.getLH()
.
- See Also:
-
Field Summary
Fields inherited from class org.flag4j.linalg.decompositions.chol.Cholesky
enforceHermitian, L, posDefTolerance, SYM_POS_DEF_ERR
Fields inherited from class org.flag4j.linalg.decompositions.Decomposition
hasDecomposed
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a Cholesky decomposer.RealCholesky
(boolean enforceSymmetric) Constructs a Cholesky decomposer. -
Method Summary
Modifier and TypeMethodDescriptionDecompose a matrix into \( A=LL^{T} \) where L is a lower triangular matrix and \( L^{T} \) is the transpose of L.Methods inherited from class org.flag4j.linalg.decompositions.chol.Cholesky
getL, getLH, setPosDefTolerance
Methods inherited from class org.flag4j.linalg.decompositions.Decomposition
ensureHasDecomposed
-
Constructor Details
-
RealCholesky
public RealCholesky()Constructs a Cholesky decomposer. -
RealCholesky
public RealCholesky(boolean enforceSymmetric) Constructs a Cholesky decomposer.- Parameters:
enforceSymmetric
- Flag indicating if an explicit check should be made that the matrix to be decomposed is symmetric.- If
true
, the matrix will be explicitly verified to be symmetric. - If
false
, no check will be made to verify the matrix is symmetric, and it will be assumed to be.
- If
-
-
Method Details
-
decompose
Decompose a matrix into \( A=LL^{T} \) where L is a lower triangular matrix and \( L^{T} \) is the transpose of L.- Specified by:
decompose
in classDecomposition<Matrix>
- Parameters:
src
- The source matrix to decompose. Must be symmetric positive-definite. Note, symmetry will only be checked explicitly ifenforceSymmetric
was set totrue
when this decomposer was instantiated.- Returns:
- A reference to this decomposer.
- Throws:
IllegalArgumentException
- Ifsrc.numRows != src.numCols
orsrc
is not symmetric andenforceSymmetric
was set to true when this decomposer was instantiated.LinearAlgebraException
- If this matrix is not positive-definite.
-