101 if (p_derr) *p_derr <<
"# Newton:" << std::endl <<
"# n r" << std::endl << std::flush;
102 for (
size_t n = 0;
true; n++) {
103 Field rh = P.residue(uh);
104 Float r = P.dual_space_norm(rh);
105 if (p_derr) *p_derr << n <<
" " << r << std::endl << std::flush;
106 if (r <= tol) { tol = r; max_iter = n;
return 0; }
107 if (n == max_iter) { tol = r;
return 1; }
108 P.update_derivative (uh);
109 Field delta_uh = P.derivative_solve (-rh);
int newton(const Problem &P, Field &uh, Float &tol, size_t &max_iter, odiststream *p_derr=0)
see the newton page for the full documentation