Class FieldLUDecomposition<T>
- java.lang.Object
-
- org.apache.commons.math4.legacy.field.linalg.FieldLUDecomposition<T>
-
- Type Parameters:
T
- Type of the field elements.
public final class FieldLUDecomposition<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.
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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getDeterminant()
Return the determinant of the matrix.FieldDenseMatrix<T>
getL()
Builds the "L" matrix of the decomposition.FieldDenseMatrix<T>
getP()
Builds the "P" matrix.int[]
getPivot()
Gets the pivot permutation vector.FieldDecompositionSolver<T>
getSolver()
Creates a solver for finding the solutionX
of the linear system of equationsA X = B
.FieldDenseMatrix<T>
getU()
Builds the "U" matrix of the decomposition.boolean
isSingular()
static <T> FieldLUDecomposition<T>
of(FieldDenseMatrix<T> m)
Factory method.
-
-
-
Method Detail
-
of
public static <T> FieldLUDecomposition<T> of(FieldDenseMatrix<T> m)
Factory method.- Type Parameters:
T
- Type of the field elements.- Parameters:
m
- Matrix to decompose.- Returns:
- a new instance.
-
isSingular
public boolean isSingular()
- Returns:
true
if the matrix is singular.
-
getL
public FieldDenseMatrix<T> getL()
Builds the "L" matrix of the decomposition.- Returns:
- the lower triangular matrix.
- Throws:
SingularMatrixException
- if the matrix is singular.
-
getU
public FieldDenseMatrix<T> getU()
Builds the "U" matrix of the decomposition.- Returns:
- the upper triangular matrix.
- Throws:
SingularMatrixException
- if the matrix is singular.
-
getP
public FieldDenseMatrix<T> getP()
Builds the "P" matrix.P is a matrix with exactly one element set to
one
in each row and each column, all other elements being set tozero
. The positions of the "one" elements are given by thepivot permutation vector
.- Returns:
- the "P" rows permutation matrix.
- Throws:
SingularMatrixException
- if the matrix is singular.- See Also:
getPivot()
-
getPivot
public int[] getPivot()
Gets 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()
Creates a solver for finding the solutionX
of the linear system of equationsA X = B
.- Returns:
- a solver.
- Throws:
SingularMatrixException
- if the matrix is singular.
-
-