public static class Matrix.LU
extends java.lang.Object
implements java.io.Serializable
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. The decomposition can also be used to calculate the determinant.
Modifier and Type | Field and Description |
---|---|
int |
info
If info = 0, the LU decomposition was successful.
|
int[] |
ipiv
The pivot vector.
|
Matrix |
lu
The LU decomposition.
|
Constructor and Description |
---|
LU(Matrix lu,
int[] ipiv,
int info)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
det()
Returns the matrix determinant.
|
Matrix |
inverse()
Returns the matrix inverse.
|
boolean |
isSingular()
Returns if the matrix is singular.
|
double[] |
solve(double[] b)
Solve A * x = b.
|
void |
solve(Matrix B)
Solve A * X = B.
|
public final Matrix lu
public final int[] ipiv
public final int info
public LU(Matrix lu, int[] ipiv, int info)
lu
- LU decomposition matrixipiv
- the pivot vectorinfo
- info > 0 if the matrix is singularpublic boolean isSingular()
public double det()
public Matrix inverse()
public double[] solve(double[] b)
b
- right hand side of linear system.
On output, b will be overwritten with the solution matrix.java.lang.RuntimeException
- if matrix is singular.public void solve(Matrix B)
B
- right hand side of linear system.
On output, B will be overwritten with the solution matrix.java.lang.RuntimeException
- if matrix is singular.