Interface LUDecomposition<T extends Matrix>
-
- All Superinterfaces:
DecompositionInterface<T>
- All Known Subinterfaces:
LUDecomposition_F32<T>,LUDecomposition_F64<T>,LUSparseDecomposition<MatrixType>,LUSparseDecomposition_F32<T>,LUSparseDecomposition_F64<T>
public interface LUDecomposition<T extends Matrix> extends DecompositionInterface<T>
LU Decomposition refactors the original matrix such that:
PT*L*U = A where P is a pivot matrix, L is a lower triangular matrix, U is an upper triangular matrix and A is the original matrix.LU Decomposition is useful since once the decomposition has been performed linear equations can be quickly solved and the original matrix A inverted. Different algorithms can be selected to perform the decomposition, all will have the same end result.
To use this class first specify the size of the matrix that will be decomposed by it in the constructor. Only square m by m matrices can be decomposed. Then to decompose a matrix call
DecompositionInterface.decompose(T). If it encounters any problems an exception will be thrown. After that all the other functions will be available for solving and inverting matrices.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TgetLower(T lower)Returns the L matrix from the decomposition.TgetRowPivot(T pivot)For numerical stability there are often row interchanges.int[]getRowPivotV(IGrowArray pivot)Returns the row pivot vectorTgetUpper(T upper)Returns the U matrix from the decomposition.booleanisSingular()Returns true if the decomposition detected a singular matrix.-
Methods inherited from interface org.ejml.interfaces.decomposition.DecompositionInterface
decompose, inputModified
-
-
-
-
Method Detail
-
getLower
T getLower(T lower)
Returns the L matrix from the decomposition. Should only be called after
DecompositionInterface.decompose(org.ejml.data.Matrix)has been called.If parameter 'lower' is not null, then that matrix is used to store the L matrix. Otherwise a new matrix is created.
- Parameters:
lower- Storage for T matrix. If null then a new matrix is returned. Modified.- Returns:
- The L matrix.
-
getUpper
T getUpper(T upper)
Returns the U matrix from the decomposition. Should only be called after
DecompositionInterface.decompose(org.ejml.data.Matrix)has been called.If parameter 'upper' is not null, then that matrix is used to store the U matrix. Otherwise a new matrix is created.
- Parameters:
upper- Storage for U matrix. If null then a new matrix is returned. Modified.- Returns:
- The U matrix.
-
getRowPivot
T getRowPivot(T pivot)
For numerical stability there are often row interchanges. This computes a pivot matrix that will undo those changes.
- Parameters:
pivot- Storage for the pivot matrix. If null then a new matrix is returned. Modified.- Returns:
- The pivot matrix.
-
getRowPivotV
int[] getRowPivotV(IGrowArray pivot)
Returns the row pivot vector- Parameters:
pivot- (Optional) Storage for pivot vector- Returns:
- The pivot vector
-
isSingular
boolean isSingular()
Returns true if the decomposition detected a singular matrix. This check will not work 100% of the time due to machine precision issues.- Returns:
- True if the matrix is singular and false if it is not.
-
-