Class Doolittle
- java.lang.Object
-
- dev.nm.algebra.linear.matrix.doubles.factorization.triangle.Doolittle
-
- All Implemented Interfaces:
LUDecomposition
public class Doolittle extends Object implements LUDecomposition
Doolittle algorithm is a LU decomposition algorithm which decomposes a square matrix A into:- P is an n x n permutation matrix;
- L is an n x n (unit) lower triangular matrix;
- U is an n x n upper triangular matrix,
Not every non-singular matrix can be LU decomposed but some singular matrix can have valid LU decomposition. For example, the following singular matrix has LU decomposition. \[ \begin{bmatrix} 1 & 0 & 0\\ 0 & 0 & 2\\ 0 & 1 & -1 \end{bmatrix} \] On the other hand, the LU decomposition with pivoting always exists, even if the matrix is singular. With (partial) pivoting, rows may be swapped during the decomposition process to avoid division by zero, and hence make the process more numerically stable.P.multiply(A) == L.multiply(U)
- See Also:
- Wikipedia: LU decomposition
-
-
Constructor Summary
Constructors Constructor Description Doolittle(Matrix A)
Runs Doolittle algorithm on a square matrix for LU decomposition.Doolittle(Matrix A, boolean usePivoting)
Runs Doolittle algorithm on a square matrix for LU decomposition.Doolittle(Matrix A, boolean usePivoting, double epsilon)
Runs Doolittle algorithm on a square matrix for LU decomposition.Doolittle(Matrix A, double epsilon)
Runs Doolittle algorithm on a square matrix for LU decomposition.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LowerTriangularMatrix
L()
Get the lower triangular matrix L as in the LU decomposition.PermutationMatrix
P()
Get the permutation matrix P as in P * A = L * U.UpperTriangularMatrix
U()
Get the upper triangular matrix U as in the LU decomposition.
-
-
-
Constructor Detail
-
Doolittle
public Doolittle(Matrix A)
Runs Doolittle algorithm on a square matrix for LU decomposition.- Parameters:
A
- the square matrix
-
Doolittle
public Doolittle(Matrix A, double epsilon)
Runs Doolittle algorithm on a square matrix for LU decomposition.- Parameters:
A
- the square matrixepsilon
- a precision parameter: when a number |x| ≤ ε, it is considered 0
-
Doolittle
public Doolittle(Matrix A, boolean usePivoting)
Runs Doolittle algorithm on a square matrix for LU decomposition.- Parameters:
A
- the square matrixusePivoting
-true
if (partial) pivoting is used
-
Doolittle
public Doolittle(Matrix A, boolean usePivoting, double epsilon)
Runs Doolittle algorithm on a square matrix for LU decomposition.- Parameters:
A
- the square matrixusePivoting
-true
if (partial) pivoting is usedepsilon
- a precision parameter: when a number |x| ≤ ε, it is considered 0
-
-
Method Detail
-
L
public LowerTriangularMatrix L()
Description copied from interface:LUDecomposition
Get the lower triangular matrix L as in the LU decomposition.- Specified by:
L
in interfaceLUDecomposition
- Returns:
- L
-
U
public UpperTriangularMatrix U()
Description copied from interface:LUDecomposition
Get the upper triangular matrix U as in the LU decomposition.- Specified by:
U
in interfaceLUDecomposition
- Returns:
- U
-
P
public PermutationMatrix P()
Description copied from interface:LUDecomposition
Get the permutation matrix P as in P * A = L * U.- Specified by:
P
in interfaceLUDecomposition
- Returns:
- P
-
-