# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.algebra.linear.matrix.doubles.factorization.svd

## Class SymmetricSVD

• java.lang.Object
• com.numericalmethod.suanshu.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.

"Pradhan, T., Routray, A., and Kabi, B., "Chapter 13 Comparative Evaluation of Symmetric SVD Algorithms for Real-Time Face and Eye Tracking," in Matrix Information Geometry, Nielsen, F, and Bhatia, R, ED. Springer, 2013, pp. 323.", SymmetricQRAlgorithm
• ### Constructor Summary

Constructors
Constructor and Description
SymmetricSVD(Matrix A)
Calculates the SVD of A.
SymmetricSVD(Matrix A, double epsilon)
Calculates the SVD of A.
• ### Method Summary

All Methods
Modifier and Type Method and Description
DiagonalMatrix D()
Returns the matrix D as in A=UDV'.
double[] getSingularValues()
Returns the singular values (same as the eigenvalues) of A.
ImmutableMatrix U()
Returns the matrix U as in A=UDV'.
ImmutableMatrix Ut()
Returns the matrix U' as in A=UDV'.
ImmutableMatrix V()
Returns the matrix V as in A=UDV'.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### 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 matrix
epsilon - 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:
Ut in interface SVDDecomposition
Returns:
U'
• #### U

public ImmutableMatrix U()
Returns the matrix U as in A=UDV'.
Specified by:
U in interface SVDDecomposition
Returns:
U
• #### getSingularValues

public double[] getSingularValues()
Returns the singular values (same as the eigenvalues) of A.
Specified by:
getSingularValues in interface SVDDecomposition
Returns:
the singular values
• #### V

public ImmutableMatrix V()
Returns the matrix V as in A=UDV'.
Specified by:
V in interface SVDDecomposition
Returns:
V
• #### D

public DiagonalMatrix D()
Returns the matrix D as in A=UDV'.
Specified by:
D in interface SVDDecomposition
Returns:
D