SingularValueDecomposition
cern.colt.matrix.linalg

## Class SingularValueDecomposition

• All Implemented Interfaces:
Serializable

public class SingularValueDecompositionextends Objectimplements Serializable
For an m x n matrix A with m >= n, the singular value decomposition isan m x n orthogonal matrix U, an n x n diagonal matrix S, andan n x n orthogonal matrix V so that A = U*S*V'.

The singular values, sigma[k] = S[k][k], are ordered so thatsigma[0] >= sigma[1] >= ... >= sigma[n-1].

The singular value decomposition always exists, so the constructor willnever fail. The matrix condition number and the effective numericalrank can be computed from this decomposition.

Serialized Form
• ### Constructor Summary

Constructors
Constructor and Description
SingularValueDecomposition(DoubleMatrix2D Arg)
Constructs and returns a new singular value decomposition object; The decomposed matrices can be retrieved via instance methods of the returned decomposition object.
• ### Method Summary

Methods
Modifier and TypeMethod and Description
doublecond()
Returns the two norm condition number, which is max(S) / min(S).
DoubleMatrix2DgetS()
Returns the diagonal matrix of singular values.
double[]getSingularValues()
Returns the diagonal of S, which is a one-dimensional array of singular values
DoubleMatrix2DgetU()
Returns the left singular vectors U.
DoubleMatrix2DgetV()
Returns the right singular vectors V.
doublenorm2()
Returns the two norm, which is max(S).
intrank()
Returns the effective numerical matrix rank, which is the number of nonnegligible singular values.
StringtoString()
Returns a String with (propertyName, propertyValue) pairs.
• ### Constructor Detail

• #### SingularValueDecomposition

public SingularValueDecomposition(DoubleMatrix2D Arg)
Constructs and returns a new singular value decomposition object; The decomposed matrices can be retrieved via instance methods of the returned decomposition object.
Parameters:
A - A rectangular matrix.
Throws:
IllegalArgumentException - if A.rows() < A.columns().
• ### Method Detail

• #### cond

public double cond()
Returns the two norm condition number, which is max(S) / min(S).
• #### getS

public DoubleMatrix2D getS()
Returns the diagonal matrix of singular values.
Returns:
S
• #### getSingularValues

public double[] getSingularValues()
Returns the diagonal of S, which is a one-dimensional array of singular values
Returns:
diagonal of S.
• #### getU

public DoubleMatrix2D getU()
Returns the left singular vectors U.
Returns:
U
• #### getV

public DoubleMatrix2D getV()
Returns the right singular vectors V.
Returns:
V
• #### norm2

public double norm2()
Returns the two norm, which is max(S).
• #### rank

public int rank()
Returns the effective numerical matrix rank, which is the number of nonnegligible singular values.
• #### toString

public String toString()
Returns a String with (propertyName, propertyValue) pairs.Useful for debugging or to quickly get the rough picture.For example,
rank          : 3trace         : 0
Overrides:
toString in class Object