SuanShu, a Java numerical and statistical library

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

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

public class SVD
extends java.lang.Object
implements SVDDecomposition

The SVD decomposition of a matrix.

Given a tall matrix A of dimension m x n, where m >= n we find orthogonal matrices U and V such that

U' %*% A %*% V = D
Alternatively,
U %*% D %*% V' = A

See Also:
Wikipedia: Singular value decomposition

Nested Class Summary
static class SVD.Method
          the methods available to compute eigenvalues and eigenvectors
 
Field Summary
 double epsilon
          a precision parameter: when a number |x| ≤ ε, it is considered 0
 
Constructor Summary
SVD(Matrix A, boolean doUV)
          Construct an instance of the SVD decomposition.
SVD(Matrix A, boolean doUV, SVD.Method method, double epsilon)
          Construct an instance of the 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

SVD

public SVD(Matrix A,
           boolean doUV,
           SVD.Method method,
           double epsilon)
Construct an instance of the SVD decomposition.

Parameters:
A - a matrix
doUV - true if only the singular values are wanted; U and V are not computed
method - choose one of the algorithms in SVD.Method
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0

SVD

public SVD(Matrix A,
           boolean doUV)
Construct an instance of the SVD decomposition.

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