Class RealCholesky


public class RealCholesky extends Cholesky<Matrix>

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:

  1. Instantiate an instance of RealCholesky.
  2. Call decompose(Matrix) to compute the decomposition.
  3. Retrieve the factorized matrices using Cholesky.getL() or Cholesky.getLH().
See Also:
  • 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.
  • Method Details

    • decompose

      public RealCholesky decompose(Matrix src)
      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 class Decomposition<Matrix>
      Parameters:
      src - The source matrix to decompose. Must be symmetric positive-definite. Note, symmetry will only be checked explicitly if enforceSymmetric was set to true when this decomposer was instantiated.
      Returns:
      A reference to this decomposer.
      Throws:
      IllegalArgumentException - If src.numRows != src.numCols or src is not symmetric and enforceSymmetric was set to true when this decomposer was instantiated.
      LinearAlgebraException - If this matrix is not positive-definite.