6162636465666768697071
BlockMatrix64F B; long prev = System.currentTimeMillis(); for( long i = 0; i < numTrials; i++ ) { if( alg.inputModified()) B = A.copy(); else B = A; if( !alg.decompose(B) ) { throw new RuntimeException("Bad matrix");
109110111112113114115116117118119
public static boolean isPositiveDefinite( DenseMatrix64F A ) { if( !isSquare(A)) return false; CholeskyDecompositionInner chol = new CholeskyDecompositionInner(true); if( chol.inputModified() ) A = A.copy(); return chol.decompose(A); }
3738394041424344454647
// it will need to create a copy in this case Dummy dummy = new Dummy(2,true,true,2,3); SingularValueDecomposition decomp = new SafeSvd(dummy); assertFalse(decomp.inputModified()); decomp.decompose(A); assertTrue(A != dummy.passedInMatrix);
4647484950515253545556
assertTrue(A != dummy.passedInMatrix); // now no need to make a copy dummy = new Dummy(2,true,false,2,3); decomp = new SafeSvd(dummy); assertFalse(decomp.inputModified()); decomp.decompose(A); assertTrue(A == dummy.passedInMatrix); }