The LUP-decomposition of a matrix A consists of three matrices L, U and P that satisfy: PA = LU, L is lower triangular, and U is upper triangular and P is a permutation matrix. All matrices are m×m.
Since field elements do not provide an ordering
operator, the permutation matrix is computed here only in order to avoid
a zero pivot element, no attempt is done to get the largest pivot
element.
This class is based on the class with similar name from the JAMA library.
getP method has been added,det method has been renamed as getDeterminant,getDoublePivot method has been removed (but the int based
getPivot method has been kept),solve and isNonSingular methods have been replaced
by a getSolver method and the equivalent methods
provided by the returned DecompositionSolver.| Modifier and Type | Class and Description |
|---|---|
| private static class | FieldLUDecomposition.
the type of the field elements T extends FieldElementSpecialized solver. |
| Modifier and Type | Field and Description |
|---|---|
| private FieldMatrix | cachedL
Cached value of L. |
| private FieldMatrix | cachedP
Cached value of P. |
| private FieldMatrix | cachedU
Cached value of U. |
| private boolean | even
Parity of the permutation associated with the LU decomposition. |
| private final Field | field
Field to which the elements belong. |
| private T[][] | lu
Entries of LU decomposition. |
| private int[] | pivot
Pivot permutation associated with LU decomposition. |
| private boolean | singular
Singularity indicator. |
| Access | Constructor and Description |
|---|---|
| public | FieldLUDecomposition(FieldMatrix<T>
The matrix to decompose. matrix)Calculates the LU-decomposition of the given matrix. |
| Modifier and Type | Method and Description |
|---|---|
| public T | |
| public FieldMatrix | Returns: the L matrix (or null if decomposed matrix is singular)Returns the matrix L of the decomposition. |
| public FieldMatrix | Returns: the P rows permutation matrix (or null if decomposed matrix is singular)Returns the P rows permutation matrix. |
| public int[] | |
| public FieldDecompositionSolver | |
| public FieldMatrix | Returns: the U matrix (or null if decomposed matrix is singular)Returns the matrix U of the decomposition. |
| cachedL | back to summary |
|---|---|
| private FieldMatrix<T> cachedL Cached value of L. | |
| cachedP | back to summary |
|---|---|
| private FieldMatrix<T> cachedP Cached value of P. | |
| cachedU | back to summary |
|---|---|
| private FieldMatrix<T> cachedU Cached value of U. | |
| even | back to summary |
|---|---|
| private boolean even Parity of the permutation associated with the LU decomposition. | |
| field | back to summary |
|---|---|
| private final Field<T> field Field to which the elements belong. | |
| lu | back to summary |
|---|---|
| private T[][] lu Entries of LU decomposition. | |
| pivot | back to summary |
|---|---|
| private int[] pivot Pivot permutation associated with LU decomposition. | |
| singular | back to summary |
|---|---|
| private boolean singular Singularity indicator. | |
| FieldLUDecomposition | back to summary |
|---|---|
| public FieldLUDecomposition(FieldMatrix<T> matrix) Calculates the LU-decomposition of the given matrix.
| |
| getDeterminant | back to summary |
|---|---|
| public T getDeterminant() Return the determinant of the matrix.
| |
| getL | back to summary |
|---|---|
| public FieldMatrix Returns the matrix L of the decomposition. L is a lower-triangular matrix
| |
| getP | back to summary |
|---|---|
| public FieldMatrix Returns the P rows permutation matrix. P is a sparse matrix with exactly one element set to 1.0 in each row and each column, all other elements being set to 0.0. The positions of the 1 elements are given by the
| |
| getPivot | back to summary |
|---|---|
| public int[] getPivot() Returns the pivot permutation vector.
| |
| getSolver | back to summary |
|---|---|
| public FieldDecompositionSolver Get a solver for finding the A × X = B solution in exact linear sense.
| |
| getU | back to summary |
|---|---|
| public FieldMatrix Returns the matrix U of the decomposition. U is an upper-triangular matrix
| |
| Modifier and Type | Field and Description |
|---|---|
| private final Field | field
Field to which the elements belong. |
| private final T[][] | lu
Entries of LU decomposition. |
| private final int[] | pivot
Pivot permutation associated with LU decomposition. |
| private final boolean | singular
Singularity indicator. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public FieldMatrix | getInverse()
Implements org. Get the inverse (or pseudo-inverse) of the decomposed matrix. |
| public boolean | isNonSingular()
Implements org. Check if the decomposed matrix is non-singular. |
| public FieldVector | solve(FieldVector<T>
right-hand side of the equation A × X = B b)Implements org. Solve the linear equation A × X = B for matrices A. |
| public ArrayFieldVector | Returns: a vector X such that A × X = Bright-hand side of the equation A × X = B b)Solve the linear equation A × X = B. |
| public FieldMatrix | solve(FieldMatrix<T>
right-hand side of the equation A × X = B b)Implements org. Solve the linear equation A × X = B for matrices A. |
| field | back to summary |
|---|---|
| private final Field<T> field Field to which the elements belong. | |
| lu | back to summary |
|---|---|
| private final T[][] lu Entries of LU decomposition. | |
| pivot | back to summary |
|---|---|
| private final int[] pivot Pivot permutation associated with LU decomposition. | |
| singular | back to summary |
|---|---|
| private final boolean singular Singularity indicator. | |
| Solver | back to summary |
|---|---|
| private Solver(final Field<T> field, final T[][] lu, final int[] pivot, final boolean singular) Build a solver from decomposed matrix.
| |
| getInverse | back to summary |
|---|---|
| public FieldMatrix Implements org. Doc from org. Get the inverse (or pseudo-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 FieldVector 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 ArrayFieldVector Solve the linear equation A × X = B. The A matrix is implicit here. It is
| |
| solve | back to summary |
|---|---|
| public FieldMatrix 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.
| |