public class CholeskyDecomposition extends Object implements Decomposition
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 | Field and Description |
---|---|
static double |
DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD
Default threshold below which diagonal elements are considered null
and matrix not positive definite.
|
static double |
DEFAULT_RELATIVE_SYMMETRY_THRESHOLD
Default threshold above which off-diagonal elements are considered too different
and matrix not symmetric.
|
Constructor and Description |
---|
CholeskyDecomposition(RealMatrix matrix)
Calling this constructor is equivalent to call
CholeskyDecomposition(RealMatrix, double, double) with
the thresholds set to the default values DEFAULT_RELATIVE_SYMMETRY_THRESHOLD and
DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD |
CholeskyDecomposition(RealMatrix matrix,
double relativeSymmetryThreshold,
double absolutePositivityThreshold)
Constructor used to set the relative & absolute thresholds.
|
Modifier and Type | Method and Description |
---|---|
static Function<RealMatrix,Decomposition> |
decompositionBuilder(double relativeSymmetryThreshold,
double absolutePositivityThreshold)
Builder for decomposition.
|
double |
getDeterminant()
Return the determinant of the matrix
|
RealMatrix |
getL()
Returns the matrix L of the decomposition.
|
RealMatrix |
getLT()
Returns the transpose of the matrix L of the decomposition.
|
DecompositionSolver |
getSolver()
Gets a solver for finding the A × X = B solution in exact linear sense.
|
public static final double DEFAULT_RELATIVE_SYMMETRY_THRESHOLD
public static final double DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD
public CholeskyDecomposition(RealMatrix matrix)
CholeskyDecomposition(RealMatrix, double, double)
with
the thresholds set to the default values DEFAULT_RELATIVE_SYMMETRY_THRESHOLD
and
DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD
The decomposition is directly computed on the input matrix.
matrix
- The matrix to decompose.NonSquareMatrixException
- if the matrix is not square.NonSymmetricMatrixException
- if the matrix is not symmetric.NonPositiveDefiniteMatrixException
- if the matrix is not
strictly positive definite.DEFAULT_RELATIVE_SYMMETRY_THRESHOLD
,
DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD
,
CholeskyDecomposition(RealMatrix, double, double)
public CholeskyDecomposition(RealMatrix matrix, double relativeSymmetryThreshold, double absolutePositivityThreshold)
The decomposition is directly computed on the input matrix.
matrix
- The matrix to decompose.relativeSymmetryThreshold
- threshold above which off-diagonal
elements are considered too different and matrix not symmetricabsolutePositivityThreshold
- threshold below which diagonal
elements are considered null and matrix not positive definiteNonSquareMatrixException
- if the matrix is not square.NonSymmetricMatrixException
- if the matrix is not symmetric.NonPositiveDefiniteMatrixException
- if the matrix is not
strictly positive definite.public RealMatrix getL()
L is an lower-triangular matrix
public RealMatrix getLT()
LT is an upper-triangular matrix
public double getDeterminant()
public DecompositionSolver getSolver()
getSolver
in interface Decomposition
public static Function<RealMatrix,Decomposition> decompositionBuilder(double relativeSymmetryThreshold, double absolutePositivityThreshold)
relativeSymmetryThreshold
- threshold above which off-diagonal elements are considered too different and matrix not symmetricabsolutePositivityThreshold
- threshold below which diagonal elements are considered null and matrix not positive definiteCopyright © 2023 CNES. All rights reserved.