423424425426427428429430431432433434
/** * Returns true if the matrix is singular */ public static boolean singular(Matrix A) throws NotConvergedException { SVD svd = SVD.factorize(A); double[] S = svd.getS(); for (int i = 0; i < S.length; ++i) if (S[i] == 0) return true; return false; }
6061626364656667
public void testStaticFactorize() throws NotConvergedException { assertEquals(A, SVD.factorize(A)); } public void testFactor() throws NotConvergedException { SVD svd = new SVD(A.numRows(), A.numColumns()); assertEquals(A, svd.factor(A.copy())); }