public class LUDecomposition extends Object
For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n unit lower triangular matrix L, an n-by-n upper triangular matrix U, and a permutation vector piv of length m so that A(piv,:) = L*U. In other words, assuming P the permutation Matrix, P*A = L*U. If m < n, then L is m-by-m and U is m-by-n.
The LU decomposition with pivoting always exists, even if the matrix is singular, so the constructor will never fail. The primary use of the LU decomposition is in the solution of square systems of simultaneous linear equations. This will fail if isNonsingular() returns false.
Constructor and Description |
---|
LUDecomposition(double[][] A)
LU Decomposition
|
Modifier and Type | Method and Description |
---|---|
double |
det()
Determinant
|
double[][] |
getL()
Return lower triangular factor
|
double[][] |
getP()
Return pivot permutation vector
|
double[][] |
getU()
Return upper triangular factor
|
boolean |
isNonsingular()
Is the matrix nonsingular?
|
double[][] |
solve(double[][] B)
Solve A*X = B
|
public LUDecomposition(double[][] A)
A
- Rectangular matrixpublic boolean isNonsingular()
public double[][] getL()
public double[][] getU()
public double[][] getP()
public double det()
IllegalArgumentException
- Matrix must be squarepublic double[][] solve(double[][] B)
B
- A Matrix with as many rows as A and any number of columns.IllegalArgumentException
- Matrix row dimensions must agree.RuntimeException
- Matrix is singular.Jas4pp 1.5 © Java Analysis Studio for Particle Physics