Class CholeskyDecompositionLDL_FDRM
- All Implemented Interfaces:
CholeskyLDLDecomposition<FMatrixRMaj>
,CholeskyLDLDecomposition_F32<FMatrixRMaj>
,DecompositionInterface<FMatrixRMaj>
This variant on the Cholesky decomposition avoid the need to take the square root
by performing the following decomposition:
L*D*LT=A
where L is a lower triangular matrix with zeros on the diagonal. D is a diagonal matrix.
The diagonal elements of L are equal to one.
Unfortunately the speed advantage of not computing the square root is washed out by the increased number of array accesses. There only appears to be a slight speed boost for very small matrices.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfloat[]
_getVV()
boolean
decompose
(FMatrixRMaj mat) Performs Choleksy decomposition on the provided matrix.getD
(@Nullable FMatrixRMaj D) Returns the diagonal matrixfrom the decomposition.float[]
Diagonal elements of the diagonal D matrix.getL()
Returns L matrix from the decomposition.
L*D*LT=AgetL
(@Nullable FMatrixRMaj L) Returns the lower triangular matrix from the decomposition.boolean
Checks if the input matrix toDecompositionInterface.decompose(org.ejml.data.Matrix)
is modified during the decomposition process.void
setExpectedMaxSize
(int numRows, int numCols)
-
Constructor Details
-
CholeskyDecompositionLDL_FDRM
public CholeskyDecompositionLDL_FDRM()
-
-
Method Details
-
setExpectedMaxSize
public void setExpectedMaxSize(int numRows, int numCols) -
decompose
Performs Choleksy decomposition on the provided matrix.
If the matrix is not positive definite then this function will return false since it can't complete its computations. Not all errors will be found.
- Specified by:
decompose
in interfaceDecompositionInterface<FMatrixRMaj>
- Parameters:
mat
- A symmetric n by n positive definite matrix.- Returns:
- True if it was able to finish the decomposition.
-
inputModified
public boolean inputModified()Description copied from interface:DecompositionInterface
Checks if the input matrix toDecompositionInterface.decompose(org.ejml.data.Matrix)
is modified during the decomposition process.- Specified by:
inputModified
in interfaceDecompositionInterface<FMatrixRMaj>
- Returns:
- true if the input matrix to decompose() is modified.
-
getDiagonal
public float[] getDiagonal()Diagonal elements of the diagonal D matrix.- Specified by:
getDiagonal
in interfaceCholeskyLDLDecomposition_F32<FMatrixRMaj>
- Returns:
- diagonal elements of D
-
getL
Returns L matrix from the decomposition.
L*D*LT=A- Returns:
- A lower triangular matrix.
-
_getVV
public float[] _getVV() -
getL
Description copied from interface:CholeskyLDLDecomposition
Returns the lower triangular matrix from the decomposition.
If an input is provided that matrix is used to write the results to. Otherwise a new matrix is created and the results written to it.
- Specified by:
getL
in interfaceCholeskyLDLDecomposition<FMatrixRMaj>
- Parameters:
L
- If not null then the decomposed matrix is written here.- Returns:
- A lower triangular matrix.
-
getD
Description copied from interface:CholeskyLDLDecomposition
Returns the diagonal matrixfrom the decomposition.
If an input is provided that matrix is used to write the results to. Otherwise a new matrix is created and the results written to it.
- Specified by:
getD
in interfaceCholeskyLDLDecomposition<FMatrixRMaj>
- Parameters:
D
- If not null it will be used to store the diagonal matrix- Returns:
- D Square diagonal matrix
-