diff --git a/src/bisection-example-new.cc b/src/bisection-example-new.cc index 972203c935dd27b22c1d8f27fd2f5d5275299c9b..ee6e3cb673f0f612db76fc3b7eaa053df3570fb4 100644 --- a/src/bisection-example-new.cc +++ b/src/bisection-example-new.cc @@ -85,9 +85,13 @@ class SampleFunctional { if (descDir == SmallVector(0.0)) return SmallVector(0.0); + // { Debugging Dune::dverb << "Starting at x with J(x) = " << operator()(x) << std::endl; + SmallVector debug_normalised_dir = descDir; + debug_normalised_dir /= debug_normalised_dir.two_norm(); Dune::dverb << "Minimizing in direction w with dJ(x,w) = " - << directionalDerivative(x, descDir) << std::endl; + << directionalDerivative(x, debug_normalised_dir) << std::endl; + // } double l = 0; double r = 1; @@ -104,16 +108,14 @@ class SampleFunctional { } Dune::dverb << "Interval now [" << l << "," << r << "]" << std::endl; -#ifndef NDEBUG - { + { // Debugging SmallVector tmpl = x; tmpl.axpy(l, descDir); SmallVector tmpr = x; tmpr.axpy(r, descDir); - assert(directionalDerivative(tmpl, descDir) < 0); - assert(directionalDerivative(tmpr, descDir) > 0); + assert(directionalDerivative(tmpl, debug_normalised_dir) < 0); + assert(directionalDerivative(tmpr, debug_normalised_dir) > 0); } -#endif double m = l / 2 + r / 2; SmallVector middle = SmallVector(0.0);