public class LUDecomposition
extends java.lang.Object
The LU decomposition with pivoting always exists, even if the matrix is singular. The primary use of the LU decomposition is in the solution of square systems of simultaneous linear equations if it is not singular.
This decomposition can also be used to calculate the determinant.
| Constructor and Description |
|---|
LUDecomposition(DenseMatrix A)
Constructor.
|
LUDecomposition(double[][] A)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double |
det()
Returns the matrix determinant
|
DenseMatrix |
getL()
Returns the lower triangular factor.
|
int[] |
getPivot()
Returns the pivot permutation vector.
|
DenseMatrix |
getU()
Returns the upper triangular factor.
|
DenseMatrix |
inverse()
Returns the matrix inverse.
|
boolean |
isSingular()
Returns true if the matrix is singular or false otherwise.
|
void |
solve(DenseMatrix B,
DenseMatrix X)
Solve A * X = B.
|
void |
solve(double[] b)
Solve A * x = b.
|
void |
solve(double[] b,
double[] x)
Solve A * x = b.
|
public LUDecomposition(double[][] A)
A - input matrixpublic LUDecomposition(DenseMatrix A)
A - input matrixpublic boolean isSingular()
public DenseMatrix getL()
public DenseMatrix getU()
public int[] getPivot()
public double det()
public DenseMatrix inverse()
public void solve(double[] b)
b - right hand side of linear system. On output, it will be
overwritten with the solution vectorjava.lang.RuntimeException - if matrix is singular.public void solve(double[] b,
double[] x)
b - right hand side of linear system.x - the solution vector.java.lang.RuntimeException - if matrix is singular.public void solve(DenseMatrix B, DenseMatrix X)
B - right hand side of linear system.X - the solution matrix.java.lang.RuntimeException - if matrix is singular.