SingularValueDecomposition { public int getRank() { int r = 0; for (int i = 0; i < singularValues.length; i++) { if (singularValues[i] > tol) { r++; } } return r; } SingularValueDecomposition(final RealMatrix matrix); RealMatrix getU(); RealMatrix getUT(); RealMatrix getS(); double[] getSingularValues(); RealMatrix getV(); RealMatrix getVT(); RealMatrix getCovariance(final double minSingularValue); double getNorm(); double getConditionNumber(); double getInverseConditionNumber(); int getRank(); DecompositionSolver getSolver();  }
@Test public void testRank() { double[][] d = { { 1, 1, 1 }, { 0, 0, 0 }, { 1, 2, 3 } }; RealMatrix m = new Array2DRowRealMatrix(d); SingularValueDecomposition svd = new SingularValueDecomposition(m); Assert.assertEquals(2, svd.getRank()); }