The Cholesky decomposition of a real symmetric positive-definite matrix A consists of a lower triangular matrix L with same size such that: A = LLT. In a sense, this is the square root of A.
This class is based on the class with similar name from the JAMA library, with the following changes:
getLT method has been added,isspd method has been removed, since the constructor of
this class throws a NonPositiveDefiniteMatrixException when a
matrix cannot be decomposed,getDeterminant method has been added,solve method has been replaced by a getSolver method and the equivalent method provided by the returned
DecompositionSolver.| Modifier and Type | Class and Description |
|---|---|
| private static class | CholeskyDecomposition.
Specialized solver. |
| Modifier and Type | Field and Description |
|---|---|
| private RealMatrix | cachedL
Cached value of L. |
| private RealMatrix | cachedLT
Cached value of LT. |
| public static final double | DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD
Default threshold below which diagonal elements are considered null and matrix not positive definite. |
| public static final double | DEFAULT_RELATIVE_SYMMETRY_THRESHOLD
Default threshold above which off-diagonal elements are considered too different and matrix not symmetric. |
| private double[][] | lTData
Row-oriented storage for LT matrix data. |
| Access | Constructor and Description |
|---|---|
| public | CholeskyDecomposition(final RealMatrix
the matrix to decompose matrix)Calculates the Cholesky decomposition of the given matrix. |
| public | CholeskyDecomposition(final RealMatrix
the matrix to decompose matrix, final double threshold above which off-diagonal
elements are considered too different and matrix not symmetric relativeSymmetryThreshold, final double threshold below which diagonal
elements are considered null and matrix not positive definite absolutePositivityThreshold)Calculates the Cholesky decomposition of the given matrix. |
| Modifier and Type | Method and Description |
|---|---|
| public double | |
| public RealMatrix | |
| public RealMatrix | Returns: the transpose of the matrix L of the decompositionReturns the transpose of the matrix L of the decomposition. |
| public DecompositionSolver |
| cachedL | back to summary |
|---|---|
| private RealMatrix cachedL Cached value of L. | |
| cachedLT | back to summary |
|---|---|
| private RealMatrix cachedLT Cached value of LT. | |
| DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD | back to summary |
|---|---|
| public static final double DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD Default threshold below which diagonal elements are considered null and matrix not positive definite. | |
| DEFAULT_RELATIVE_SYMMETRY_THRESHOLD | back to summary |
|---|---|
| public static final double DEFAULT_RELATIVE_SYMMETRY_THRESHOLD Default threshold above which off-diagonal elements are considered too different and matrix not symmetric. | |
| lTData | back to summary |
|---|---|
| private double[][] lTData Row-oriented storage for LT matrix data. | |
| CholeskyDecomposition | back to summary |
|---|---|
| public CholeskyDecomposition(final RealMatrix matrix) Calculates the Cholesky decomposition of the given matrix.
Calling this constructor is equivalent to call
| |
| CholeskyDecomposition | back to summary |
|---|---|
| public CholeskyDecomposition(final RealMatrix matrix, final double relativeSymmetryThreshold, final double absolutePositivityThreshold) Calculates the Cholesky decomposition of the given matrix.
| |
| getDeterminant | back to summary |
|---|---|
| public double getDeterminant() Return the determinant of the matrix
| |
| getL | back to summary |
|---|---|
| public RealMatrix getL() Returns the matrix L of the decomposition. L is an lower-triangular matrix
| |
| getLT | back to summary |
|---|---|
| public RealMatrix getLT() Returns the transpose of the matrix L of the decomposition. LT is an upper-triangular matrix
| |
| getSolver | back to summary |
|---|---|
| public DecompositionSolver getSolver() Get a solver for finding the A × X = B solution in least square sense.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final double[][] | lTData
Row-oriented storage for LT matrix data. |
| Access | Constructor and Description |
|---|---|
| private | Solver(final double[][]
row-oriented storage for LT matrix data lTData)Build a solver from decomposed matrix. |
| Modifier and Type | Method and Description |
|---|---|
| public RealMatrix | Returns: the inverse matrix.Implements org. Get the inverse of the decomposed matrix. |
| public boolean | isNonSingular()
Implements org. Check if the decomposed matrix is non-singular. |
| public RealVector | solve(final RealVector
right-hand side of the equation A × X = B b)Implements org. Solve the linear equation A × X = B for matrices A. |
| public RealMatrix | solve(RealMatrix
right-hand side of the equation A × X = B b)Implements org. Solve the linear equation A × X = B for matrices A. |
| lTData | back to summary |
|---|---|
| private final double[][] lTData Row-oriented storage for LT matrix data. | |
| Solver | back to summary |
|---|---|
| private Solver(final double[][] lTData) Build a solver from decomposed matrix.
| |
| getInverse | back to summary |
|---|---|
| public RealMatrix getInverse() Implements org. Get the inverse of the decomposed matrix.
| |
| isNonSingular | back to summary |
|---|---|
| public boolean isNonSingular() Implements org. Doc from org. Check if the decomposed matrix is non-singular.
| |
| solve | back to summary |
|---|---|
| public RealVector solve(final RealVector b) Implements org. Doc from org. Solve the linear equation A × X = B for matrices A. The A matrix is implicit, it is provided by the underlying decomposition algorithm.
| |
| solve | back to summary |
|---|---|
| public RealMatrix solve(RealMatrix b) Implements org. Doc from org. Solve the linear equation A × X = B for matrices A. The A matrix is implicit, it is provided by the underlying decomposition algorithm.
| |