public class LUDecomposition extends Object
The LU decompostion 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(double[][] A)
Constructor.
|
LUDecomposition(double[][] A,
boolean overwrite)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double |
det()
Returns the matrix determinant
|
double[][] |
getL()
Returns the lower triangular factor.
|
int[] |
getPivot()
Returns the pivot permutation vector.
|
double[][] |
getU()
Returns the upper triangular factor.
|
double[][] |
inverse()
Returns the matrix inverse.
|
boolean |
isSingular()
Returns true if the matrix is singular or false otherwise.
|
void |
solve(double[] b)
Solve A * x = b.
|
void |
solve(double[][] B)
Solve A * X = B.
|
void |
solve(double[][] B,
double[][] X)
Solve A * X = B.
|
void |
solve(double[] b,
double[] x)
Solve A * x = b.
|
public LUDecomposition(double[][] A)
A - rectangular matrixpublic LUDecomposition(double[][] A,
boolean overwrite)
A - rectangular matrixoverwrite - if the decomposition will be taken in place. If true,
the decomposition will be stored in the input matrix to save space. It
is very useful in practice if the matrix is huge. Otherwise, a new
matrix will created to store the decomposition.public boolean isSingular()
public double[][] getL()
public double[][] getU()
public int[] getPivot()
public double det()
public double[][] inverse()
public void solve(double[] b)
b - right hand side of linear system. On output, it will be
overwritten with the solution vectorRuntimeException - if matrix is singular.public void solve(double[] b,
double[] x)
b - right hand side of linear system.x - the solution vector.RuntimeException - if matrix is singular.public void solve(double[][] B)
B - right hand side of linear system. On output, B will be
overwritten with the solution matrix.RuntimeException - if matrix is singular.public void solve(double[][] B,
double[][] X)
B - right hand side of linear system.X - the solution matrix.RuntimeException - if matrix is singular.Copyright © 2015. All rights reserved.