Class RealLU
- All Implemented Interfaces:
Decomposition<Matrix>
This class provides methods for computing the LU decomposition of a real dense matrix.
The following decompositions are provided: A=LU
, PA=LU
, and PAQ=LU
.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.flag4j.linalg.decompositions.lu.LU
LU.Pivoting
-
Field Summary
Fields inherited from class org.flag4j.linalg.decompositions.lu.LU
colSwaps, DEFAULT_ZERO_PIVOT_TOLERANCE, LU, numColSwaps, numRowSwaps, P, pivotFlag, Q, rowSwaps, zeroPivotTol
-
Constructor Summary
ConstructorDescriptionRealLU()
Constructs a LU decomposer to decompose the specified matrix using partial pivoting.RealLU
(int pivoting) Constructs a LU decomposer to decompose the specified matrix.RealLU
(int pivoting, double zeroPivotTol) Constructs a LU decomposer to decompose the specified matrix. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
computeRows
(int j) Helper method which computes rows in the gaussian elimination algorithm.protected void
Computes the LU decomposition using full/rook pivoting (i.e.getL()
Gets the unit lower triangular matrix of the decomposition.getU()
Gets the upper triangular matrix of the decomposition.protected void
Initializes theLU
matrix by copying the source matrix to decompose.private int
maxColIndex
(int j) Computes the max absolute value in a column so that the row is >= j.private int[]
maxIndex
(int startIndex) Computes maximum absolute value in sub portion of LU matrix below and right ofstartIndex, startIndex
.protected void
noPivot()
Computes the LU decomposition using no pivoting (i.e.protected void
Computes the LU decomposition using partial pivoting (i.e.Methods inherited from class org.flag4j.linalg.decompositions.lu.LU
decompose, getLU, getNumColSwaps, getNumRowSwaps, getP, getQ, swapCols, swapRows
-
Constructor Details
-
RealLU
public RealLU()Constructs a LU decomposer to decompose the specified matrix using partial pivoting. -
RealLU
public RealLU(int pivoting) Constructs a LU decomposer to decompose the specified matrix.- Parameters:
pivoting
- Pivoting to use. If pivoting is 2, full pivoting will be used. If pivoting is 1, partial pivoting will be used. If pivoting is any other value, no pivoting will be used.
-
RealLU
public RealLU(int pivoting, double zeroPivotTol) Constructs a LU decomposer to decompose the specified matrix.- Parameters:
pivoting
- Pivoting to use. If pivoting is 2, full pivoting will be used. If pivoting is 1, partial pivoting will be used. If pivoting is any other value, no pivoting will be used.zeroPivotTol
- Value for determining if a zero pivot value is detected when computing the LU decomposition with no pivoting. If a pivot value (value along the principle diagonal of U) is within this tolerance from zero, then an exception will be thrown if solving with no pivoting.
-
-
Method Details
-
initLU
-
noPivot
-
partialPivot
protected void partialPivot()Computes the LU decomposition using partial pivoting (i.e. row swapping).- Specified by:
partialPivot
in classLU<Matrix>
-
fullPivot
-
computeRows
private void computeRows(int j) Helper method which computes rows in the gaussian elimination algorithm.- Parameters:
j
- Column for which to compute values to the right of.
-
maxColIndex
private int maxColIndex(int j) Computes the max absolute value in a column so that the row is >= j.- Parameters:
j
- column index.- Returns:
- The index of the maximum absolute value in the specified column such that the row is >= j.
-
maxIndex
private int[] maxIndex(int startIndex) Computes maximum absolute value in sub portion of LU matrix below and right ofstartIndex, startIndex
.- Parameters:
startIndex
- Top left index of row and column of sub matrix.- Returns:
- Index of maximum absolute value in specified sub matrix.
-
getL
-
getU
-