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().
Modifier and Type | Method and 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.
|
decompose, inputModified
int numberOfSingularValues()
boolean isCompact()
T getU(T U, 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.
U
- Optional storage for U. If null a new instance or internally maintained matrix is returned. Modified.transposed
- If the returned U is transposed.T getV(T V, 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.
V
- Optional storage for v. If null a new instance or internally maintained matrix is returned. Modified.transposed
- If the returned V is transposed.T getW(T W)
W
- Optional storage for W. If null a new instance or internally maintained matrix is returned. Modified.int numRows()
int numCols()