/** * Extracts the rank of a matrix using a preexisting decomposition and default threshold. * * @see #singularThreshold(org.ejml.interfaces.decomposition.SingularValueDecomposition) * * @param svd A precomputed decomposition. Not modified. * @return The rank of the decomposed matrix. */ public static int rank( SingularValueDecomposition svd ) { double threshold = singularThreshold(svd); return rank(svd,threshold); }
/** * Extracts the nullity of a matrix using a preexisting decomposition and default threshold. * * @see #singularThreshold(org.ejml.interfaces.decomposition.SingularValueDecomposition) * * @param svd A precomputed decomposition. Not modified. * @return The nullity of the decomposed matrix. */ public static int nullity( SingularValueDecomposition svd ) { double threshold = singularThreshold(svd); return nullity(svd, threshold); }
public SimpleSVD( DenseMatrix64F mat , boolean compact ) { this.mat = mat; svd = DecompositionFactory.svd(mat.numRows,mat.numCols,true,true,compact); if( !svd.decompose(mat) ) throw new RuntimeException("Decomposition failed"); U = (T)SimpleMatrix.wrap(svd.getU(null,false)); W = (T)SimpleMatrix.wrap(svd.getW(null)); V = (T)SimpleMatrix.wrap(svd.getV(null,false)); // order singular values from largest to smallest SingularOps.descendingOrder(U.getMatrix(),false,W.getMatrix(),V.getMatrix(),false); tol = SingularOps.singularThreshold(svd); }