33 if(verbose) cout <<
"Steepest descent magnitude " <<
std::sqrt(x_u_norm_sq) <<
", Newton's method magnitude " <<
std::sqrt(x_n_norm_sq) << endl;
34 if(deltaSq < x_u_norm_sq) {
37 if(verbose) cout <<
"In steepest descent region with fraction " <<
std::sqrt(deltaSq / x_u_norm_sq) <<
" of steepest descent magnitude" << endl;
39 }
else if(deltaSq < x_n_norm_sq) {
41 return ComputeBlend(
delta, dx_u, dx_n, verbose);
43 assert(deltaSq >= x_n_norm_sq);
44 if(verbose) cout <<
"In pure Newton's method region" << endl;
56 const double un =
dot(x_u, x_n);
57 const double uu =
dot(x_u, x_u);
58 const double nn =
dot(x_n, x_n);
61 const double a = uu - 2.*un +
nn;
62 const double b = 2. * (un - uu);
67 double tau1 = (-
b + sqrt_b_m4ac) / (2.*
a);
68 double tau2 = (-
b - sqrt_b_m4ac) / (2.*
a);
73 if(-eps <= tau1 && tau1 <= 1.0 + eps) {
74 assert(!(-eps <= tau2 && tau2 <= 1.0 + eps));
77 assert(-eps <= tau2 && tau2 <= 1.0 + eps);
82 if(verbose) cout <<
"In blend region with fraction " << tau <<
" of Newton's method point" << endl;