code: public static int rank(SingularValueDecomposition_F64 svd , double threshold ) {
          int numRank=0;
  
          double w[]= svd.getSingularValues();
  
          int N = svd.numberOfSingularValues();
  
          for( int j = 0; j < N; j++ ) {
              if( w[j] > threshold)
                  numRank++;
          }
  
          return numRank;
      }
docs: Extracts the rank of a matrix using a preexisting decomposition.
  
  @see #singularThreshold(SingularValueDecomposition_F64)
  
  @param svd A precomputed decomposition.  Not modified.
  @param threshold Tolerance used to determine of a singular value is singular.
  @return The rank of the decomposed matrix.