SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.matrix.doubles.factorization.svd
Class GloubKahanSVD

java.lang.Object
  extended by com.numericalmethod.suanshu.matrix.doubles.factorization.svd.GloubKahanSVD
All Implemented Interfaces:
SVDDecomposition

public class GloubKahanSVD
extends java.lang.Object
implements SVDDecomposition

This class implements the SVD decomposition of a tall matrix using the Gloub-Kahan SVD algorithm.

There are two steps.

  1. In the first step, the matrix is reduced to a bidiagonal matrix using a sequence of Householder transformations.
  2. In the second step, we iteratively reduce the super-diagonal of the bidiagonal matrix to 0s, using a sequence of Givens transformations.

If only the singular values are needed, we can save computation by not computing U and V.

See Also:
"Algorithm 8.6.2. Matrix Computations, 3rd edition. Golub G. H., van Loan C. F."

Field Summary
 double epsilon
          a precision parameter: when a number |x| ≤ ε, it is considered 0
 
Constructor Summary
GloubKahanSVD(Matrix A, boolean doUV, boolean normalize, double epsilon)
          Perform the Gloub-Kahan SVD decomposition.
 
Method Summary
 DiagonalMatrix D()
          Get a copy of D as in U' %*% A %*% V = D U %*% D %*% V' = A
 double[] singularValues()
          Get an array of the normalized, hence positive, singular values.
 Matrix U()
          Get a copy of U as in U' %*% A %*% V = D U %*% D %*% V' = A
 Matrix Ut()
          Get a copy of U.t() as in U.t() %*% A %*% V = D U %*% D %*% V' = A
 Matrix V()
          Get a copy of V as in U' %*% A %*% V = D U %*% D %*% V' = A
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

epsilon

public final double epsilon
a precision parameter: when a number |x| ≤ ε, it is considered 0

Constructor Detail

GloubKahanSVD

public GloubKahanSVD(Matrix A,
                     boolean doUV,
                     boolean normalize,
                     double epsilon)
Perform the Gloub-Kahan SVD decomposition.

Parameters:
A - a tall matrix
doUV - true if only the singular values are wanted; U and V are not computed
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:
java.lang.IllegalArgumentException - if A is not tall
Method Detail

singularValues

public double[] singularValues()
Description copied from interface: SVDDecomposition
Get an array of the normalized, hence positive, singular values. It may differ from D if this class is constructed with normalization off.

Specified by:
singularValues in interface SVDDecomposition
Returns:
the singular values

D

public DiagonalMatrix D()
Description copied from interface: SVDDecomposition
Get a copy of D as in
 U' %*% A %*% V = D
 U %*% D %*% V' = A
 

Specified by:
D in interface SVDDecomposition
Returns:
a copy of D

U

public Matrix U()
Description copied from interface: SVDDecomposition
Get a copy of U as in
 U' %*% A %*% V = D
 U %*% D %*% V' = A
 

Specified by:
U in interface SVDDecomposition
Returns:
a copy of U

Ut

public Matrix Ut()
Description copied from interface: SVDDecomposition
Get a copy of U.t() as in
 U.t() %*% A %*% V = D
 U %*% D %*% V' = A
 

Specified by:
Ut in interface SVDDecomposition
Returns:
a copy of U.t()

V

public Matrix V()
Description copied from interface: SVDDecomposition
Get a copy of V as in
 U' %*% A %*% V = D
 U %*% D %*% V' = A
 

Specified by:
V in interface SVDDecomposition
Returns:
a copy of V

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.