/** * Checks to see if the matrix is or is not modified as according to the modified flag. * * @param decomp */ public static void checkModifiedInput(DecompositionInterface decomp) { DenseMatrix64F A = RandomMatrices.createSymmPosDef(4, new Random(0x434)); DenseMatrix64F A_orig = A.copy(); assertTrue(decomp.decompose(A)); boolean modified = !MatrixFeatures.isEquals(A, A_orig); assertTrue(modified + " " + decomp.inputModified(), decomp.inputModified() == modified); }
/** Performs a decomposition and makes sure the input matrix is not modified. */ public static boolean safeDecomposition(DecompositionInterface decomp, DenseMatrix64F A) { DenseMatrix64F A_orig = decomp.inputModified() ? A.copy() : A; return decomp.decompose(A_orig); }