Interface SingularValueDecomposition<T extends Matrix>
 All Superinterfaces:
DecompositionInterface<T>
 All Known Subinterfaces:
SingularValueDecomposition_F32<T>
,SingularValueDecomposition_F64<T>
 All Known Implementing Classes:
SafeSvd_DDRM
,SafeSvd_FDRM
,SvdImplicitQrDecompose_DDRM
,SvdImplicitQrDecompose_FDRM
,SvdImplicitQrDecompose_MT_DDRM
,SvdImplicitQrDecompose_MT_FDRM
public interface SingularValueDecomposition<T extends Matrix> extends DecompositionInterface<T>
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.
Accessor functions for decomposed matrices can return an internally constructed matrix if null is passed in for the optional storage parameter. The exact behavior is implementation specific. If an internally maintained matrix is returned then on the next call to decompose the matrix will be modified. The advantage of this approach is reduced memory overhead.
To create a new instance of SingularValueDecomposition see DecompositionFactory_DDRM and SingularOps_DDRM 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().

Method Summary
Modifier and Type Method Description T
getU(T U, boolean transposed)
Returns the orthogonal 'U' matrix.T
getV(T V, 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.interfaces.decomposition.DecompositionInterface
decompose, inputModified

Method Details

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
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:
U
 Optional storage for U. If null a new instance or internally maintained matrix is returned. Modified.transposed
 If the returned U is transposed. Returns:
 An orthogonal matrix.

getV
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:
V
 Optional storage for v. If null a new instance or internally maintained matrix is returned. Modified.transposed
 If the returned V is transposed. Returns:
 An orthogonal matrix.

getW
Returns a diagonal matrix with the singular values. Order of the singular values is not guaranteed. Parameters:
W
 Optional storage for W. If null a new instance or internally maintained matrix is returned. 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.
