Package org.hipparchus.linear
Class FieldLUDecomposition<T extends FieldElement<T>>
- java.lang.Object
-
- org.hipparchus.linear.FieldLUDecomposition<T>
-
- Type Parameters:
T
- the type of the field elements
public class FieldLUDecomposition<T extends FieldElement<T>> extends Object
Calculates the LUP-decomposition of a square matrix.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.
This class is based on the class with similar name from the JAMA library.
- a
getP
method has been added, - the
det
method has been renamed asgetDeterminant
, - the
getDoublePivot
method has been removed (but the int basedgetPivot
method has been kept), - the
solve
andisNonSingular
methods have been replaced by agetSolver
method and the equivalent methods provided by the returnedDecompositionSolver
.
-
-
Constructor Summary
Constructors Constructor Description FieldLUDecomposition(FieldMatrix<T> matrix)
Calculates the LU-decomposition of the given matrix.FieldLUDecomposition(FieldMatrix<T> matrix, Predicate<T> zeroChecker)
Calculates the LU-decomposition of the given matrix.FieldLUDecomposition(FieldMatrix<T> matrix, Predicate<T> zeroChecker, boolean numericPermutationChoice)
Calculates the LU-decomposition of the given matrix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Constructor Detail
-
FieldLUDecomposition
public FieldLUDecomposition(FieldMatrix<T> matrix)
Calculates the LU-decomposition of the given matrix.By default,
numericPermutationChoice
is set totrue
.- Parameters:
matrix
- The matrix to decompose.- Throws:
MathIllegalArgumentException
- if matrix is not square- See Also:
FieldLUDecomposition(FieldMatrix, Predicate)
,FieldLUDecomposition(FieldMatrix, Predicate, boolean)
-
FieldLUDecomposition
public FieldLUDecomposition(FieldMatrix<T> matrix, Predicate<T> zeroChecker)
Calculates the LU-decomposition of the given matrix.By default,
numericPermutationChoice
is set totrue
.- Parameters:
matrix
- The matrix to decompose.zeroChecker
- checker for zero elements- Throws:
MathIllegalArgumentException
- if matrix is not square- See Also:
FieldLUDecomposition(FieldMatrix, Predicate, boolean)
-
FieldLUDecomposition
public FieldLUDecomposition(FieldMatrix<T> matrix, Predicate<T> zeroChecker, boolean numericPermutationChoice)
Calculates the LU-decomposition of the given matrix.- Parameters:
matrix
- The matrix to decompose.zeroChecker
- checker for zero elementsnumericPermutationChoice
- iftrue
choose permutation index with numeric calculations, otherwise choose withzeroChecker
- Throws:
MathIllegalArgumentException
- if matrix is not square
-
-
Method Detail
-
getL
public FieldMatrix<T> getL()
Returns the matrix L of the decomposition.L is a lower-triangular matrix
- Returns:
- the L matrix (or null if decomposed matrix is singular)
-
getU
public FieldMatrix<T> getU()
Returns the matrix U of the decomposition.U is an upper-triangular matrix
- Returns:
- the U matrix (or null if decomposed matrix is singular)
-
getP
public FieldMatrix<T> getP()
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
pivot permutation vector
.- Returns:
- the P rows permutation matrix (or null if decomposed matrix is singular)
- See Also:
getPivot()
-
getPivot
public int[] getPivot()
Returns the pivot permutation vector.- Returns:
- the pivot permutation vector
- See Also:
getP()
-
getDeterminant
public T getDeterminant()
Return the determinant of the matrix.- Returns:
- determinant of the matrix
-
getSolver
public FieldDecompositionSolver<T> getSolver()
Get a solver for finding the A × X = B solution in exact linear sense.- Returns:
- a solver
-
-