org.ejml.alg.dense.decomposition
Interface SingularValueDecomposition<T extends Matrix64F>

All Superinterfaces:
DecompositionInterface<T>
All Known Implementing Classes:
SvdImplicitQrDecompose

public interface SingularValueDecomposition<T extends Matrix64F>
extends DecompositionInterface<T>

This is an abstract class for computing the singular value decomposition (SVD) of a matrix, which is defined as:

A = U * W * V T

where A is m by n, and U and V are orthogonal matrices, and W is a diagonal matrix.

The dimension of U,W,V depends if it is a compact SVD or not. If not compact then U is m by m, W is m by n, V is n by n. If compact then let s be the number of singular values, U is m by s, W is s by s, and V is n by s.

To create a new instance of SingularValueDecomposition see DecompositionFactory.svd(int, int) and SingularOps contains additional helpful SVD related functions.

*Note* that the ordering of singular values is not guaranteed, unless done so by a specific implementation. The singular values can be put into descending order while adjusting U and V using SingularOps.descendingOrder(org.ejml.data.DenseMatrix64F, boolean, org.ejml.data.DenseMatrix64F, org.ejml.data.DenseMatrix64F, boolean) SingularOps.descendingOrder()}.

Author:
Peter Abeles

Method Summary
 double[] getSingularValues()
          Returns the singular values.
 T getU(boolean transposed)
           Returns the orthogonal 'U' matrix.
 T getV(boolean transposed)
           Returns the orthogonal 'V' matrix.
 T getW(T W)
          Returns a diagonal matrix with the singular values.
 boolean isCompact()
          If true then compact matrices are returned.
 int numberOfSingularValues()
          The number of singular values in the matrix.
 int numCols()
          Number of columns in the decomposed matrix.
 int numRows()
          Number of rows in the decomposed matrix.
 
Methods inherited from interface org.ejml.alg.dense.decomposition.DecompositionInterface
decompose, inputModified
 

Method Detail

getSingularValues

double[] getSingularValues()
Returns the singular values. This is the diagonal elements of the W matrix in the decomposition. Ordering of singular values is not guaranteed..

Returns:
Singular values. Note this array can be longer than the number of singular values. Extra elements have no meaning.

numberOfSingularValues

int numberOfSingularValues()
The number of singular values in the matrix. This is equal to the length of the smallest side.

Returns:
Number of singular values in the matrix.

isCompact

boolean isCompact()
If true then compact matrices are returned.

Returns:
true if results use compact notation.

getU

T getU(boolean transposed)

Returns the orthogonal 'U' matrix.

Internally the SVD algorithm might compute U transposed or it might not. To avoid an unnecessary double transpose the option is provided to select if the transpose is returned.

Parameters:
transposed - If the returned U is transposed.
Returns:
An orthogonal matrix.

getV

T getV(boolean transposed)

Returns the orthogonal 'V' matrix.

Internally the SVD algorithm might compute V transposed or it might not. To avoid an unnecessary double transpose the option is provided to select if the transpose is returned.

Parameters:
transposed - If the returned V is transposed.
Returns:
An orthogonal matrix.

getW

T getW(T W)
Returns a diagonal matrix with the singular values. Order of the singular values is not guaranteed.

Parameters:
W - If not null then the W matrix is written to it. Modified.
Returns:
Diagonal matrix with singular values along the diagonal.

numRows

int numRows()
Number of rows in the decomposed matrix.

Returns:
Number of rows in the decomposed matrix.

numCols

int numCols()
Number of columns in the decomposed matrix.

Returns:
Number of columns in the decomposed matrix.


Copyright © 2012. All Rights Reserved.