Skip to content
Snippets Groups Projects
Commit 4f2d3647 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Clean up debugging info some more

parent 8fbce1ed
No related branches found
No related tags found
No related merge requests found
...@@ -85,9 +85,13 @@ class SampleFunctional { ...@@ -85,9 +85,13 @@ class SampleFunctional {
if (descDir == SmallVector(0.0)) if (descDir == SmallVector(0.0))
return SmallVector(0.0); return SmallVector(0.0);
// { Debugging
Dune::dverb << "Starting at x with J(x) = " << operator()(x) << std::endl; 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) = " 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 l = 0;
double r = 1; double r = 1;
...@@ -104,16 +108,14 @@ class SampleFunctional { ...@@ -104,16 +108,14 @@ class SampleFunctional {
} }
Dune::dverb << "Interval now [" << l << "," << r << "]" << std::endl; Dune::dverb << "Interval now [" << l << "," << r << "]" << std::endl;
#ifndef NDEBUG { // Debugging
{
SmallVector tmpl = x; SmallVector tmpl = x;
tmpl.axpy(l, descDir); tmpl.axpy(l, descDir);
SmallVector tmpr = x; SmallVector tmpr = x;
tmpr.axpy(r, descDir); tmpr.axpy(r, descDir);
assert(directionalDerivative(tmpl, descDir) < 0); assert(directionalDerivative(tmpl, debug_normalised_dir) < 0);
assert(directionalDerivative(tmpr, descDir) > 0); assert(directionalDerivative(tmpr, debug_normalised_dir) > 0);
} }
#endif
double m = l / 2 + r / 2; double m = l / 2 + r / 2;
SmallVector middle = SmallVector(0.0); SmallVector middle = SmallVector(0.0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment