Class LUDecompositionCommonsResult
- java.lang.Object
-
- com.opengamma.strata.math.impl.linearalgebra.LUDecompositionCommonsResult
-
- All Implemented Interfaces:
LUDecompositionResult
,DecompositionResult
public class LUDecompositionCommonsResult extends Object implements LUDecompositionResult
Wrapper for results of the Commons implementation of LU decomposition (LUDecompositionCommons
).
-
-
Constructor Summary
Constructors Constructor Description LUDecompositionCommonsResult(org.apache.commons.math3.linear.LUDecomposition lu)
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getDeterminant()
Return the determinant of the matrix.DoubleMatrix
getL()
Returns the $\mathbf{L}$ matrix of the decomposition.DoubleMatrix
getP()
Returns the rows permutation matrix, $\mathbf{P}$.int[]
getPivot()
Returns the pivot permutation vector.DoubleMatrix
getU()
Returns the $\mathbf{U}$ matrix of the decomposition.double[]
solve(double[] b)
Solves $\mathbf{A}x = b$ where $\mathbf{A}$ is a (decomposed) matrix and $b$ is a vector.DoubleArray
solve(DoubleArray b)
Solves $\mathbf{A}x = b$ where $\mathbf{A}$ is a (decomposed) matrix and $b$ is a vector.DoubleMatrix
solve(DoubleMatrix b)
Solves $\mathbf{A}x = \mathbf{B}$ where $\mathbf{A}$ is a (decomposed) matrix and $\mathbf{B}$ is a matrix.
-
-
-
Method Detail
-
getDeterminant
public double getDeterminant()
Return the determinant of the matrix.- Specified by:
getDeterminant
in interfaceLUDecompositionResult
- Returns:
- determinant of the matrix
-
getL
public DoubleMatrix getL()
Returns the $\mathbf{L}$ matrix of the decomposition.$\mathbf{L}$ is a lower-triangular matrix.
- Specified by:
getL
in interfaceLUDecompositionResult
- Returns:
- the $\mathbf{L}$ matrix
-
getP
public DoubleMatrix getP()
Returns the rows permutation matrix, $\mathbf{P}$.P is a sparse matrix with exactly one element set to 1.0 in each row and each column, all other elements being set to 0.0.
The positions of the 1 elements are given by the
pivot permutation vector
.- Specified by:
getP
in interfaceLUDecompositionResult
- Returns:
- the $\mathbf{P}$ rows permutation matrix
- See Also:
LUDecompositionResult.getPivot()
-
getPivot
public int[] getPivot()
Returns the pivot permutation vector.- Specified by:
getPivot
in interfaceLUDecompositionResult
- Returns:
- the pivot permutation vector
-
getU
public DoubleMatrix getU()
Returns the $\mathbf{U}$ matrix of the decomposition.$\mathbf{U}$ is an upper-triangular matrix.
- Specified by:
getU
in interfaceLUDecompositionResult
- Returns:
- the U matrix
-
solve
public DoubleArray solve(DoubleArray b)
Solves $\mathbf{A}x = b$ where $\mathbf{A}$ is a (decomposed) matrix and $b$ is a vector.- Specified by:
solve
in interfaceDecompositionResult
- Parameters:
b
- the vector to calculate with- Returns:
- the vector x
-
solve
public double[] solve(double[] b)
Solves $\mathbf{A}x = b$ where $\mathbf{A}$ is a (decomposed) matrix and $b$ is a vector.- Specified by:
solve
in interfaceDecompositionResult
- Parameters:
b
- the vector to calculate with- Returns:
- the vector x
-
solve
public DoubleMatrix solve(DoubleMatrix b)
Solves $\mathbf{A}x = \mathbf{B}$ where $\mathbf{A}$ is a (decomposed) matrix and $\mathbf{B}$ is a matrix.- Specified by:
solve
in interfaceDecompositionResult
- Parameters:
b
- the matrix to calculate with- Returns:
- the matrix x
-
-