Class SVDecompositionCommonsResult
- java.lang.Object
-
- com.opengamma.strata.math.impl.linearalgebra.SVDecompositionCommonsResult
-
- All Implemented Interfaces:
SVDecompositionResult
,DecompositionResult
public class SVDecompositionCommonsResult extends Object implements SVDecompositionResult
Wrapper for results of the Commons implementation of singular value decompositionSVDecompositionCommons
.
-
-
Constructor Summary
Constructors Constructor Description SVDecompositionCommonsResult(org.apache.commons.math3.linear.SingularValueDecomposition svd)
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getConditionNumber()
Returns the condition number of the matrix.double
getNorm()
Returns the $L_2$ norm of the matrix.int
getRank()
Returns the effective numerical matrix rank.DoubleMatrix
getS()
Returns the diagonal matrix $\mathbf{\Sigma}$ of the decomposition.double[]
getSingularValues()
Returns the diagonal elements of the matrix $\mathbf{\Sigma}$ of the decomposition.DoubleMatrix
getU()
Returns the matrix $\mathbf{U}$ of the decomposition.DoubleMatrix
getUT()
Returns the transpose of the matrix $\mathbf{U}$ of the decomposition.DoubleMatrix
getV()
Returns the matrix $\mathbf{V}$ of the decomposition.DoubleMatrix
getVT()
Returns the transpose of the matrix $\mathbf{V}$ 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
-
getConditionNumber
public double getConditionNumber()
Returns the condition number of the matrix.- Specified by:
getConditionNumber
in interfaceSVDecompositionResult
- Returns:
- condition number of the matrix
-
getNorm
public double getNorm()
Returns the $L_2$ norm of the matrix.The $L_2$ norm is $\max\left(\frac{|\mathbf{A} \times U|_2}{|U|_2}\right)$, where $|.|_2$ denotes the vectorial 2-norm (i.e. the traditional Euclidian norm).
- Specified by:
getNorm
in interfaceSVDecompositionResult
- Returns:
- norm
-
getRank
public int getRank()
Returns the effective numerical matrix rank.The effective numerical rank is the number of non-negligible singular values. The threshold used to identify non-negligible terms is $\max(m, n) \times \mathrm{ulp}(S_1)$, where $\mathrm{ulp}(S_1)$ is the least significant bit of the largest singular value.
- Specified by:
getRank
in interfaceSVDecompositionResult
- Returns:
- effective numerical matrix rank
-
getS
public DoubleMatrix getS()
Returns the diagonal matrix $\mathbf{\Sigma}$ of the decomposition.$\mathbf{\Sigma}$ is a diagonal matrix. The singular values are provided in non-increasing order.
- Specified by:
getS
in interfaceSVDecompositionResult
- Returns:
- the $\mathbf{\Sigma}$ matrix
-
getSingularValues
public double[] getSingularValues()
Returns the diagonal elements of the matrix $\mathbf{\Sigma}$ of the decomposition.The singular values are provided in non-increasing order.
- Specified by:
getSingularValues
in interfaceSVDecompositionResult
- Returns:
- the diagonal elements of the $\mathbf{\Sigma}$ matrix
-
getU
public DoubleMatrix getU()
Returns the matrix $\mathbf{U}$ of the decomposition.$\mathbf{U}$ is an orthogonal matrix, i.e. its transpose is also its inverse.
- Specified by:
getU
in interfaceSVDecompositionResult
- Returns:
- the $\mathbf{U}$ matrix
-
getUT
public DoubleMatrix getUT()
Returns the transpose of the matrix $\mathbf{U}$ of the decomposition.$\mathbf{U}$ is an orthogonal matrix, i.e. its transpose is also its inverse.
- Specified by:
getUT
in interfaceSVDecompositionResult
- Returns:
- the U matrix (or null if decomposed matrix is singular)
-
getV
public DoubleMatrix getV()
Returns the matrix $\mathbf{V}$ of the decomposition.$\mathbf{V}$ is an orthogonal matrix, i.e. its transpose is also its inverse.
- Specified by:
getV
in interfaceSVDecompositionResult
- Returns:
- the $\mathbf{V}$ matrix
-
getVT
public DoubleMatrix getVT()
Returns the transpose of the matrix $\mathbf{V}$ of the decomposition.$\mathbf{V}$ is an orthogonal matrix, i.e. its transpose is also its inverse.
- Specified by:
getVT
in interfaceSVDecompositionResult
- Returns:
- the $\mathbf{V}$ 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
-
-