|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.linear.SingularValueDecompositionImpl
public class SingularValueDecompositionImpl
Calculates the Singular Value Decomposition of a matrix.
The Singular Value Decomposition of matrix A is a set of three matrices: U, Σ and V such that A = U × Σ × VT. Let A be an m × n matrix, then U is an m × m orthogonal matrix, Σ is a m × n diagonal matrix with positive diagonal elements, and V is an n × n orthogonal matrix.
Nested Class Summary | |
---|---|
private static class |
SingularValueDecompositionImpl.Solver
Specialized solver. |
Field Summary | |
---|---|
private RealMatrix |
cachedS
Cached value of S. |
private RealMatrix |
cachedU
Cached value of U. |
private RealMatrix |
cachedUt
Cached value of UT. |
private RealMatrix |
cachedV
Cached value of V. |
private RealMatrix |
cachedVt
Cached value of VT. |
private EigenDecomposition |
eigenDecomposition
Eigen decomposition of the tridiagonal matrix. |
private int |
m
Number of rows of the initial matrix. |
private double[] |
mainBidiagonal
Main diagonal of the bidiagonal matrix. |
private double[] |
mainTridiagonal
Main diagonal of the tridiagonal matrix. |
private int |
n
Number of columns of the initial matrix. |
private double[] |
secondaryBidiagonal
Secondary diagonal of the bidiagonal matrix. |
private double[] |
secondaryTridiagonal
Secondary diagonal of the tridiagonal matrix. |
private double[] |
singularValues
Singular values. |
private BiDiagonalTransformer |
transformer
Transformer to bidiagonal. |
Constructor Summary | |
---|---|
SingularValueDecompositionImpl(RealMatrix matrix)
Calculates the Singular Value Decomposition of the given matrix. |
Method Summary | |
---|---|
double |
getConditionNumber()
Return the condition number of the matrix. |
RealMatrix |
getCovariance(double minSingularValue)
Returns the n × n covariance matrix. |
double |
getNorm()
Returns the L2 norm of the matrix. |
int |
getRank()
Return the effective numerical matrix rank. |
RealMatrix |
getS()
Returns the diagonal matrix Σ of the decomposition. |
double[] |
getSingularValues()
Returns the diagonal elements of the matrix Σ of the decomposition. |
DecompositionSolver |
getSolver()
Get a solver for finding the A × X = B solution in least square sense. |
RealMatrix |
getU()
Returns the matrix U of the decomposition. |
RealMatrix |
getUT()
Returns the transpose of the matrix U of the decomposition. |
RealMatrix |
getV()
Returns the matrix V of the decomposition. |
RealMatrix |
getVT()
Returns the transpose of the matrix V of the decomposition. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int m
private int n
private BiDiagonalTransformer transformer
private double[] mainBidiagonal
private double[] secondaryBidiagonal
private double[] mainTridiagonal
private double[] secondaryTridiagonal
private EigenDecomposition eigenDecomposition
private double[] singularValues
private RealMatrix cachedU
private RealMatrix cachedUt
private RealMatrix cachedS
private RealMatrix cachedV
private RealMatrix cachedVt
Constructor Detail |
---|
public SingularValueDecompositionImpl(RealMatrix matrix) throws InvalidMatrixException
matrix
- The matrix to decompose.
InvalidMatrixException
- (wrapping a ConvergenceException
if algorithm fails to convergeMethod Detail |
---|
public RealMatrix getU() throws InvalidMatrixException
U is an orthogonal matrix, i.e. its transpose is also its inverse.
getU
in interface SingularValueDecomposition
InvalidMatrixException
SingularValueDecomposition.getUT()
public RealMatrix getUT() throws InvalidMatrixException
U is an orthogonal matrix, i.e. its transpose is also its inverse.
getUT
in interface SingularValueDecomposition
InvalidMatrixException
SingularValueDecomposition.getU()
public RealMatrix getS() throws InvalidMatrixException
Σ is a diagonal matrix. The singular values are provided in non-increasing order, for compatibility with Jama.
getS
in interface SingularValueDecomposition
InvalidMatrixException
public double[] getSingularValues() throws InvalidMatrixException
The singular values are provided in non-increasing order, for compatibility with Jama.
getSingularValues
in interface SingularValueDecomposition
InvalidMatrixException
public RealMatrix getV() throws InvalidMatrixException
V is an orthogonal matrix, i.e. its transpose is also its inverse.
getV
in interface SingularValueDecomposition
InvalidMatrixException
SingularValueDecomposition.getVT()
public RealMatrix getVT() throws InvalidMatrixException
V is an orthogonal matrix, i.e. its transpose is also its inverse.
getVT
in interface SingularValueDecomposition
InvalidMatrixException
SingularValueDecomposition.getV()
public RealMatrix getCovariance(double minSingularValue)
The covariance matrix is V × J × VT where J is the diagonal matrix of the inverse of the squares of the singular values.
getCovariance
in interface SingularValueDecomposition
minSingularValue
- value below which singular values are ignored
(a 0 or negative value implies all singular value will be used)
public double getNorm() throws InvalidMatrixException
The L2 norm is max(|A × u|2 / |u|2), where |.|2 denotes the vectorial 2-norm (i.e. the traditional euclidian norm).
getNorm
in interface SingularValueDecomposition
InvalidMatrixException
public double getConditionNumber() throws InvalidMatrixException
getConditionNumber
in interface SingularValueDecomposition
InvalidMatrixException
public int getRank() throws IllegalStateException
The effective numerical rank is the number of non-negligible singular values. The threshold used to identify non-negligible terms is max(m,n) × ulp(s1) where ulp(s1) is the least significant bit of the largest singular value.
getRank
in interface SingularValueDecomposition
IllegalStateException
public DecompositionSolver getSolver()
getSolver
in interface SingularValueDecomposition
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |