## 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
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.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### LUDecompositionCommonsResult

public LUDecompositionCommonsResult​(org.apache.commons.math3.linear.LUDecomposition lu)
Creates an instance.
Parameters:
lu - The result of the LU decomposition, not null. $\mathbf{L}$ cannot be singular.
• ### Method Detail

• #### getDeterminant

public double getDeterminant()
Return the determinant of the matrix.
Specified by:
getDeterminant in interface LUDecompositionResult
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 interface LUDecompositionResult
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 interface LUDecompositionResult
Returns:
the $\mathbf{P}$ rows permutation matrix
LUDecompositionResult.getPivot()
• #### getPivot

public int[] getPivot()
Returns the pivot permutation vector.
Specified by:
getPivot in interface LUDecompositionResult
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 interface LUDecompositionResult
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 interface DecompositionResult
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 interface DecompositionResult
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 interface DecompositionResult
Parameters:
b - the matrix to calculate with
Returns:
the matrix x