}
}
// solve H d = -g, evaluate error at new location
//double[] d = DoubleMatrix.solve(H, g);
double[] d = (new Matrix(H)).lu().solve(new Matrix(g, nparm)).getRowPackedCopy();
//double[] na = DoubleVector.add(a, d);
double[] na = (new Matrix(a, nparm)).plus(new Matrix(d, nparm)).getRowPackedCopy();
double e1 = chiSquared(x, na, y, s, f);
if (verbose > 0) {
System.out.println("\n\niteration "+iter+" lambda = "+lambda);
System.out.print("a = ");
(new Matrix(a, nparm)).print(10, 2);
if (verbose > 1) {
System.out.print("H = ");
(new Matrix(H)).print(10, 2);
System.out.print("g = ");
(new Matrix(g, nparm)).print(10, 2);
System.out.print("d = ");
(new Matrix(d, nparm)).print(10, 2);
}
System.out.print("e0 = " + e0 + ": ");
System.out.print("moved from ");
(new Matrix(a, nparm)).print(10, 2);
System.out.print("e1 = " + e1 + ": ");
if (e1 < e0) {
System.out.print("to ");
(new Matrix(na, nparm)).print(10, 2);
}
else {
System.out.println("move rejected");
}
}