T
- the type of the field elementspublic class FieldLUDecompositionImpl<T extends FieldElement<T>> extends java.lang.Object implements FieldLUDecomposition<T>
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.
Modifier and Type | Class and Description |
---|---|
private static class |
FieldLUDecompositionImpl.Solver<T extends FieldElement<T>>
Specialized solver.
|
Modifier and Type | Field and Description |
---|---|
private FieldMatrix<T> |
cachedL
Cached value of L.
|
private FieldMatrix<T> |
cachedP
Cached value of P.
|
private FieldMatrix<T> |
cachedU
Cached value of U.
|
private boolean |
even
Parity of the permutation associated with the LU decomposition
|
private Field<T> |
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.
|
Constructor and Description |
---|
FieldLUDecompositionImpl(FieldMatrix<T> matrix)
Calculates the LU-decomposition of the given matrix.
|
Modifier and Type | Method and Description |
---|---|
T |
getDeterminant()
Return the determinant of the matrix
|
FieldMatrix<T> |
getL()
Returns the matrix L of the decomposition.
|
FieldMatrix<T> |
getP()
Returns the P rows permutation matrix.
|
int[] |
getPivot()
Returns the pivot permutation vector.
|
FieldDecompositionSolver<T> |
getSolver()
Get a solver for finding the A × X = B solution in exact linear sense.
|
FieldMatrix<T> |
getU()
Returns the matrix U of the decomposition.
|
private final Field<T extends FieldElement<T>> field
private T extends FieldElement<T>[][] lu
private int[] pivot
private boolean even
private boolean singular
private FieldMatrix<T extends FieldElement<T>> cachedL
private FieldMatrix<T extends FieldElement<T>> cachedU
private FieldMatrix<T extends FieldElement<T>> cachedP
public FieldLUDecompositionImpl(FieldMatrix<T> matrix) throws NonSquareMatrixException
matrix
- The matrix to decompose.NonSquareMatrixException
- if matrix is not squarepublic FieldMatrix<T> getL()
L is an lower-triangular matrix
getL
in interface FieldLUDecomposition<T extends FieldElement<T>>
public FieldMatrix<T> getU()
U is an upper-triangular matrix
getU
in interface FieldLUDecomposition<T extends FieldElement<T>>
public FieldMatrix<T> getP()
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 pivot permutation vector
.
getP
in interface FieldLUDecomposition<T extends FieldElement<T>>
FieldLUDecomposition.getPivot()
public int[] getPivot()
getPivot
in interface FieldLUDecomposition<T extends FieldElement<T>>
FieldLUDecomposition.getP()
public T getDeterminant()
getDeterminant
in interface FieldLUDecomposition<T extends FieldElement<T>>
public FieldDecompositionSolver<T> getSolver()
getSolver
in interface FieldLUDecomposition<T extends FieldElement<T>>
Copyright (c) 2003-2014 Apache Software Foundation