# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.algebra.linear.matrix.doubles.factorization.triangle

## Class Doolittle

• java.lang.Object
• com.numericalmethod.suanshu.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,
such that PA = LU. That is,
 P.multiply(A) == L.multiply(U) 
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.

Wikipedia: LU decomposition
• ### Constructor Summary

Constructors
Constructor and 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
Modifier and Type Method and 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.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### 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 matrix
epsilon - 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 matrix
usePivoting - 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 matrix
usePivoting - true if (partial) pivoting is used
epsilon - 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 interface LUDecomposition
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 interface LUDecomposition
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 interface LUDecomposition
Returns:
P