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 doublegetConditionNumber()Returns the condition number of the matrix.doublegetNorm()Returns the $L_2$ norm of the matrix.intgetRank()Returns the effective numerical matrix rank.DoubleMatrixgetS()Returns the diagonal matrix $\mathbf{\Sigma}$ of the decomposition.double[]getSingularValues()Returns the diagonal elements of the matrix $\mathbf{\Sigma}$ of the decomposition.DoubleMatrixgetU()Returns the matrix $\mathbf{U}$ of the decomposition.DoubleMatrixgetUT()Returns the transpose of the matrix $\mathbf{U}$ of the decomposition.DoubleMatrixgetV()Returns the matrix $\mathbf{V}$ of the decomposition.DoubleMatrixgetVT()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.DoubleArraysolve(DoubleArray b)Solves $\mathbf{A}x = b$ where $\mathbf{A}$ is a (decomposed) matrix and $b$ is a vector.DoubleMatrixsolve(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:
getConditionNumberin 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:
getNormin 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:
getRankin 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:
getSin 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:
getSingularValuesin 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:
getUin 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:
getUTin 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:
getVin 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:
getVTin 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:
solvein 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:
solvein 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:
solvein interfaceDecompositionResult- Parameters:
b- the matrix to calculate with- Returns:
- the matrix x
-
-