|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.commons.math.linear.LUDecompositionImpl
public class LUDecompositionImpl
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.
As shown by the presence of the P matrix, this decomposition is implemented using partial pivoting.
| Nested Class Summary | |
|---|---|
private static class |
LUDecompositionImpl.Solver
Specialized solver. |
| Field Summary | |
|---|---|
private RealMatrix |
cachedL
Cached value of L. |
private RealMatrix |
cachedP
Cached value of P. |
private RealMatrix |
cachedU
Cached value of U. |
private static double |
DEFAULT_TOO_SMALL
Default bound to determine effective singularity in LU decomposition |
private boolean |
even
Parity of the permutation associated with the LU decomposition |
private double[][] |
lu
Entries of LU decomposition. |
private int[] |
pivot
Pivot permutation associated with LU decomposition |
private boolean |
singular
Singularity indicator. |
| Constructor Summary | |
|---|---|
LUDecompositionImpl(RealMatrix matrix)
Calculates the LU-decomposition of the given matrix. |
|
LUDecompositionImpl(RealMatrix matrix,
double singularityThreshold)
Calculates the LU-decomposition of the given matrix. |
|
| Method Summary | |
|---|---|
double |
getDeterminant()
Return the determinant of the matrix |
RealMatrix |
getL()
Returns the matrix L of the decomposition. |
RealMatrix |
getP()
Returns the P rows permutation matrix. |
int[] |
getPivot()
Returns the pivot permutation vector. |
DecompositionSolver |
getSolver()
Get a solver for finding the A × X = B solution in exact linear sense. |
RealMatrix |
getU()
Returns the matrix U of the decomposition. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final double DEFAULT_TOO_SMALL
private double[][] lu
private int[] pivot
private boolean even
private boolean singular
private RealMatrix cachedL
private RealMatrix cachedU
private RealMatrix cachedP
| Constructor Detail |
|---|
public LUDecompositionImpl(RealMatrix matrix)
throws InvalidMatrixException
matrix - The matrix to decompose.
InvalidMatrixException - if matrix is not square
public LUDecompositionImpl(RealMatrix matrix,
double singularityThreshold)
throws NonSquareMatrixException
matrix - The matrix to decompose.singularityThreshold - threshold (based on partial row norm)
under which a matrix is considered singular
NonSquareMatrixException - if matrix is not square| Method Detail |
|---|
public RealMatrix getL()
L is an lower-triangular matrix
getL in interface LUDecompositionpublic RealMatrix getU()
U is an upper-triangular matrix
getU in interface LUDecompositionpublic RealMatrix 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 LUDecompositionLUDecomposition.getPivot()public int[] getPivot()
getPivot in interface LUDecompositionLUDecomposition.getP()public double getDeterminant()
getDeterminant in interface LUDecompositionpublic DecompositionSolver getSolver()
getSolver in interface LUDecomposition
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||