# SuanShu, a Java numerical and statistical library

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

## Class GolubKahanSVD

• java.lang.Object
• com.numericalmethod.suanshu.algebra.linear.matrix.doubles.factorization.svd.GolubKahanSVD
• All Implemented Interfaces:
SVDDecomposition

public class GolubKahanSVD
extends Object
implements SVDDecomposition
Golub-Kahan algorithm does the SVD decomposition of a tall matrix in two stages.
1. First, it reduces the matrix to a bidiagonal matrix using a sequence of Householder transformations.
2. Second, it reduces the super-diagonal of the bidiagonal matrix to 0s, using a sequence of Givens transformations.
"G. H. Golub, C. F. van Loan, "Algorithm 8.6.2," Matrix Computations, 3rd edition."
• ### Constructor Summary

Constructors
Constructor and Description
GolubKahanSVD(Matrix A, boolean doUV, boolean normalize, double epsilon)
Run the Golub-Kahan SVD decomposition on a tall matrix.
GolubKahanSVD(Matrix A, boolean doUV, boolean normalize, double epsilon, int maxIterations)
Runs the Golub-Kahan SVD decomposition on a tall matrix.
• ### Constructor Detail

• #### GolubKahanSVD

public GolubKahanSVD(Matrix A,
boolean doUV,
boolean normalize,
double epsilon)
Run the Golub-Kahan SVD decomposition on a tall matrix.
Parameters:
A - a tall matrix
doUV - false if to compute only the singular values but not U and V
normalize - true if to sort the singular values in descending order and make them positive
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
Throws:
IllegalArgumentException - if A is not tall
• #### GolubKahanSVD

public GolubKahanSVD(Matrix A,
boolean doUV,
boolean normalize,
double epsilon,
int maxIterations)
Runs the Golub-Kahan SVD decomposition on a tall matrix.
Parameters:
A - a tall matrix
doUV - false if to compute only the singular values but not U and V
normalize - true if to sort the singular values in descending order and make them positive
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
maxIterations - the maximum number of iterations
Throws:
IllegalArgumentException - if A is not tall
• ### Method Detail

• #### getSingularValues

public double[] getSingularValues()
Description copied from interface: SVDDecomposition
Get the normalized, hence positive, singular values. They may differ from the values in D if this computation turns off normalization.
Specified by:
getSingularValues in interface SVDDecomposition
Returns:
the singular values
• #### U

public Matrix U()
Description copied from interface: SVDDecomposition
Get the U matrix as in SVD decomposition.
Specified by:
U in interface SVDDecomposition
Returns:
U
• #### Ut

public Matrix Ut()
Description copied from interface: SVDDecomposition
Get the transpose of U, i.e., U().t().
Specified by:
Ut in interface SVDDecomposition
Returns:
U().t()
• #### V

public Matrix V()
Description copied from interface: SVDDecomposition
Get the V matrix as in SVD decomposition.
Specified by:
V in interface SVDDecomposition
Returns:
V