org.jquantlib.math.matrixutilities
Class LUDecomposition
- java.lang.Object
-
- org.jquantlib.math.matrixutilities.LUDecomposition
-
public class LUDecomposition extends java.lang.ObjectLU Decomposition.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. 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.
- See Also:
- JAMA
-
-
Constructor Summary
Constructors Constructor and Description LUDecomposition(Matrix A)LU Decomposition
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doubledet()Determinantint[]getPivot()Return pivot permutation vectorbooleanisNonSingular()Is the matrix nonsingular?MatrixL()Return lower triangular factorMatrixsolve(Matrix B)Solve A*X = BMatrixU()Return upper triangular factor
-
-
-
Constructor Detail
-
LUDecomposition
public LUDecomposition(Matrix A)
LU Decomposition- Parameters:
A- is a rectangular matrix
-
-
Method Detail
-
isNonSingular
public boolean isNonSingular()
Is the matrix nonsingular?- Returns:
- true if U, and hence A, is nonsingular.
-
L
public Matrix L()
Return lower triangular factor- Returns:
- L
-
U
public Matrix U()
Return upper triangular factor- Returns:
- U
-
getPivot
public int[] getPivot()
Return pivot permutation vector- Returns:
- piv
-
det
public double det()
Determinant- Returns:
- det(A)
- Throws:
java.lang.IllegalArgumentException- Matrix must be square
-
solve
public Matrix solve(Matrix B)
Solve A*X = B- Parameters:
B- a Matrix with as many m as A and any number of columns.- Returns:
- X so that L*U*X = B(piv,:)
- Throws:
java.lang.IllegalArgumentException- Matrix row dimensions must agree.LibraryException- Matrix is singular.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG