Class SymmetricSVD
- java.lang.Object
-
- dev.nm.algebra.linear.matrix.doubles.factorization.svd.SymmetricSVD
-
- All Implemented Interfaces:
SVDDecomposition
public class SymmetricSVD extends Object implements SVDDecomposition
This algorithm calculates the Singular Value Decomposition (SVD) of a square, symmetric matrix A using QR algorithm. A=UDV', where U and V are orthogonal matrices. D is a diagonal matrix. We use QR algorithm to compute the eigenvalues of A, and the orthogonal matrix Q, so that Q'AQ is a diagonal matrix. The orthogonal matrix U equals Q. To make the entries in D non-negative, we flip the sign of the columns of V that correspond to negative entries of D. The remaining columns in V are the same as those in Q.- See Also:
SymmetricQRAlgorithm
-
-
Constructor Summary
Constructors Constructor Description SymmetricSVD(Matrix A)Calculates the SVD of A.SymmetricSVD(Matrix A, double epsilon)Calculates the SVD of A.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DiagonalMatrixD()Returns the matrix D as in A=UDV'.double[]getSingularValues()Returns the singular values (same as the eigenvalues) of A.ImmutableMatrixU()Returns the matrix U as in A=UDV'.ImmutableMatrixUt()Returns the matrix U' as in A=UDV'.ImmutableMatrixV()Returns the matrix V as in A=UDV'.
-
-
-
Constructor Detail
-
SymmetricSVD
public SymmetricSVD(Matrix A)
Calculates the SVD of A.- Parameters:
A- a symmetric matrix- Throws:
IllegalArgumentException- if A is not square or if A is not symmetric
-
SymmetricSVD
public SymmetricSVD(Matrix A, double epsilon)
Calculates the SVD of A.- Parameters:
A- a symmetric matrixepsilon- a precision parameter: when a number |x| ≤ ε, it is considered 0- Throws:
IllegalArgumentException- if A is not square or if A is not symmetric
-
-
Method Detail
-
Ut
public ImmutableMatrix Ut()
Returns the matrix U' as in A=UDV'.- Specified by:
Utin interfaceSVDDecomposition- Returns:
- U'
-
U
public ImmutableMatrix U()
Returns the matrix U as in A=UDV'.- Specified by:
Uin interfaceSVDDecomposition- Returns:
- U
-
getSingularValues
public double[] getSingularValues()
Returns the singular values (same as the eigenvalues) of A.- Specified by:
getSingularValuesin interfaceSVDDecomposition- Returns:
- the singular values
-
V
public ImmutableMatrix V()
Returns the matrix V as in A=UDV'.- Specified by:
Vin interfaceSVDDecomposition- Returns:
- V
-
D
public DiagonalMatrix D()
Returns the matrix D as in A=UDV'.- Specified by:
Din interfaceSVDDecomposition- Returns:
- D
-
-