Package org.ejml.simple
Class SimpleSVD<T extends SimpleBase>
- java.lang.Object
-
- org.ejml.simple.SimpleSVD<T>
-
public class SimpleSVD<T extends SimpleBase> extends java.lang.ObjectWrapper around SVD for simple matrix. See
SVD is defined as the following decomposition:SingularValueDecompositionfor more details.
A = U * W * V T where A is m by n, and U and V are orthogonal matrices, and W is a diagonal matrixTolerance for singular values is Math.max(mat.numRows,mat.numCols) * W.get(0,0) * UtilEjml.EPS; where W.get(0,0) is the largest singular value.
-
-
Constructor Summary
Constructors Constructor Description SimpleSVD(org.ejml.data.Matrix mat, boolean compact)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetSingleValue(int index)Returns the specified singular value.double[]getSingularValues()Returns an array of all the singular valuesorg.ejml.interfaces.decomposition.SingularValueDecompositiongetSVD()Returns the underlying decomposition that this is a wrapper around.TgetU()Returns the orthogonal 'U' matrix.TgetV()Returns the orthogonal 'V' matrix.TgetW()Returns a diagonal matrix with the singular values.intnullity()The nullity of the decomposed matrix.SimpleMatrixnullSpace()Computes the null space from an SVD.doublequality()Computes the quality of the computed decomposition.intrank()Returns the rank of the decomposed matrix.
-
-
-
Method Detail
-
getU
public T getU()
Returns the orthogonal 'U' matrix.
- Returns:
- An orthogonal m by m matrix.
-
getW
public T getW()
Returns a diagonal matrix with the singular values. The singular values are ordered from largest to smallest.- Returns:
- Diagonal matrix with singular values along the diagonal.
-
getV
public T getV()
Returns the orthogonal 'V' matrix.
- Returns:
- An orthogonal n by n matrix.
-
quality
public double quality()
Computes the quality of the computed decomposition. A value close to or less than 1e-15 is considered to be within machine precision.
This function must be called before the original matrix has been modified or else it will produce meaningless results.
- Returns:
- Quality of the decomposition.
-
nullSpace
public SimpleMatrix nullSpace()
Computes the null space from an SVD. For more information seeSingularOps_DDRM.nullSpace(org.ejml.interfaces.decomposition.SingularValueDecomposition_F64<org.ejml.data.DMatrixRMaj>, org.ejml.data.DMatrixRMaj, double).- Returns:
- Null space vector.
-
getSingleValue
public double getSingleValue(int index)
Returns the specified singular value.- Parameters:
index- Which singular value is to be returned.- Returns:
- A singular value.
-
getSingularValues
public double[] getSingularValues()
Returns an array of all the singular values
-
rank
public int rank()
Returns the rank of the decomposed matrix.- Returns:
- The matrix's rank
- See Also:
SingularOps_DDRM.rank(SingularValueDecomposition_F64, double)
-
nullity
public int nullity()
The nullity of the decomposed matrix.- Returns:
- The matrix's nullity
- See Also:
SingularOps_DDRM.nullity(SingularValueDecomposition_F64, double)
-
getSVD
public org.ejml.interfaces.decomposition.SingularValueDecomposition getSVD()
Returns the underlying decomposition that this is a wrapper around.- Returns:
- SingularValueDecomposition
-
-