|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.matrix.doubles.factorization.triangle.Doolittle
public class Doolittle
This class implements the Doolittle algorithm with column/partial pivoting for the LU decomposition of a square matrix. It iteratively fills the first row, then first column, then second row, second column, etc. Before each iteration, it swaps the rows so that the biggest entry in the column is on the main diagonal. If this biggest entry is 0, the Doolittle construction fails and throws a runtime exception.
On success, we have
P %*% A == L %*% U
where
A is an n x n matrix, P is an n x n pivoting matrix,
L is an n x n lower triangular matrix, U is an n x n upper triangular matrix.
That is,
P.multiply(A) == L.multiply(U)
Singular matrix can have valid LU decomposition.
Note that not every non-singular matrix can be factored as A = L %*% U. E.g., |1, 0, 0| |0, 0, 2| |0, 1, -1|
On the other hand, the LU decomposition with pivoting always exists, even if the matrix is singular.
| Field Summary | |
|---|---|
int |
dim
the dimension of the square matrix A |
double |
epsilon
a precision parameter: when a number |x| ≤ ε, it is considered 0 |
boolean |
usePivoting
true if partial pivoting is wanted, e.g., for numerical stability |
| Constructor Summary | |
|---|---|
Doolittle(Matrix A)
Construct an LU decomposition using the Doolittle algorithm. |
|
Doolittle(Matrix A,
boolean usePivoting,
double epsilon)
Construct an LU decomposition using the Doolittle algorithm. |
|
| Method Summary | |
|---|---|
LowerTriangularMatrix |
L()
Get a copy of the lower triangular matrix L as in
P %*% A == L %*% U |
PermutationMatrix |
P()
Get a copy of the permutation matrix P as in
P %*% A == L %*% U |
UpperTriangularMatrix |
U()
Get a copy of the upper triangular matrix U as in
P %*% A == L %*% U |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final int dim
A
public final boolean usePivoting
true if partial pivoting is wanted, e.g., for numerical stability
public final double epsilon
| Constructor Detail |
|---|
public Doolittle(Matrix A,
boolean usePivoting,
double epsilon)
A - a square matrixusePivoting - true if partial pivoting is wanted, e.g., for numerical stabilityepsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
java.lang.IllegalArgumentException - if A is not squarepublic Doolittle(Matrix A)
A - a square matrix to which Doolittle is applied
java.lang.IllegalArgumentException - if A is not square| Method Detail |
|---|
public LowerTriangularMatrix L()
LUDecompositionL as in
P %*% A == L %*% U
L in interface LUDecompositionLpublic UpperTriangularMatrix U()
LUDecompositionU as in
P %*% A == L %*% U
U in interface LUDecompositionUpublic PermutationMatrix P()
LUDecompositionP as in
P %*% A == L %*% U
P in interface LUDecompositionP
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||