// Test cholesky
System.out.println("Testing cholesky");
double[][] aposdef = matmul(a,transpose(a));
Cholesky ach = new Cholesky(aposdef);
ach.solve(r,y);
sbeps = 5.e-15;
localflag = maxel(vecsub(matmul(aposdef,y),r)) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** cholesky: Error in solve() method");
}
ranvec(y);
double[] yy = new double[y.length];
ach.elmult(y,r);
ach.elsolve(r,yy);
sbeps = 5.e-15;
localflag = maxel(vecsub(y,yy)) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** cholesky: Error in method elmult() or elsolve()");
}
double[][] ainv = buildMatrix(a);
ach.inverse(ainv);
sbeps = 5.e-15;
localflag = maxel(matsub(matmul(ainv,aposdef),ident(aposdef.length,1.))) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** cholesky: Error in method inverse()");