Class SingularValueDecomposition
java.lang.Object
cern.colt.matrix.linalg.SingularValueDecomposition
- All Implemented Interfaces:
Serializable
For an m x n matrix A with m >= n, the singular value decomposition is
an m x n orthogonal matrix U, an n x n diagonal matrix S, and
an n x n orthogonal matrix V so that A = U*S*V'.
The singular values, sigma[k] = S[k][k], are ordered so that sigma[0] >= sigma[1] >= ... >= sigma[n-1].
The singular value decomposition always exists, so the constructor will never fail. The matrix condition number and the effective numerical rank can be computed from this decomposition.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intRow and column dimensions.private intRow and column dimensions.private double[]Array for internal storage of singular values.(package private) static final longprivate double[][]Arrays for internal storage of U and V.private double[][]Arrays for internal storage of U and V. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs and returns a new singular value decomposition object; The decomposed matrices can be retrieved via instance methods of the returned decomposition object. -
Method Summary
Modifier and TypeMethodDescriptiondoublecond()Returns the two norm condition number, which is max(S) / min(S).getS()Returns the diagonal matrix of singular values.double[]Returns the diagonal of S, which is a one-dimensional array of singular valuesgetU()Returns the left singular vectors U.getV()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.toString()Returns a String with (propertyName, propertyValue) pairs.
-
Field Details
-
serialVersionUID
static final long serialVersionUID- See Also:
-
U
private double[][] UArrays for internal storage of U and V. -
V
private double[][] VArrays for internal storage of U and V. -
s
private double[] sArray for internal storage of singular values. -
m
private int mRow and column dimensions. -
n
private int nRow and column dimensions.
-
-
Constructor Details
-
SingularValueDecomposition
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() invalid input: '<' A.columns().
-
-
Method Details
-
cond
public double cond()Returns the two norm condition number, which is max(S) / min(S). -
getS
-
getSingularValues
public double[] getSingularValues()Returns the diagonal of S, which is a one-dimensional array of singular values- Returns:
- diagonal of S.
-
getU
-
getV
-
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
-