/** * A simple convinience function that decomposes the matrix but automatically checks the input ti make * sure is not being modified. * * @param decomp Decomposition which is being wrapped * @param M THe matrix being decomposed. * @param <T> Matrix type. * @return If the decomposition was successful or not. */ public static <T extends DMatrix> boolean decomposeSafe(DecompositionInterface<T> decomp, T M ) { if( decomp.inputModified() ) { return decomp.decompose(M.<T>copy()); } else { return decomp.decompose(M); } } }