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

Add more debugging output

parent 177a91a3
No related branches found
No related tags found
No related merge requests found
...@@ -51,8 +51,12 @@ class SampleFunctional { ...@@ -51,8 +51,12 @@ class SampleFunctional {
return; return;
} else if (pg * x >= 0 && mg * x >= 0) { } else if (pg * x >= 0 && mg * x >= 0) {
ret = pg; ret = pg;
Dune::dverb << "## Expected directional derivative: " << -(pg * mg)
<< " (coordinates of the restriction)" << std::endl;
} else if (pg * x <= 0 && mg * x <= 0) { } else if (pg * x <= 0 && mg * x <= 0) {
ret = mg; ret = mg;
Dune::dverb << "## Expected directional derivative: " << -(mg * pg)
<< " (coordinates of the restriction)" << std::endl;
} else { } else {
ret = project(smoothGradient(x), x); ret = project(smoothGradient(x), x);
} }
...@@ -129,6 +133,15 @@ void minimise(const Functional J, const typename Functional::SmallVector x, ...@@ -129,6 +133,15 @@ void minimise(const Functional J, const typename Functional::SmallVector x,
MyDirectionalConvexFunctionType JRest(JRestA, JRestb, phi, x, descDir); MyDirectionalConvexFunctionType JRest(JRestA, JRestb, phi, x, descDir);
// }}} // }}}
{ // Debug
Interval<double> D;
JRest.subDiff(0, D);
Dune::dverb << "## Descent according to JRest.subDiff: " << D[1]
<< std::endl;
assert(D[1] <=
0); // We should not be minimising in this direction otherwise
}
// FIXME: default values are used // FIXME: default values are used
Bisection bisection; Bisection bisection;
int count; int count;
......
...@@ -108,6 +108,8 @@ void testSampleFunctionNonsmooth() { ...@@ -108,6 +108,8 @@ void testSampleFunctionNonsmooth() {
functionTester(J, start, 6); functionTester(J, start, 6);
} }
std::cout << std::endl; std::cout << std::endl;
std::cout << std::endl;
std::cout << std::endl;
{ {
start = b; start = b;
start /= (b.two_norm() - 1e-12); // Make sure the norm is above 1; start /= (b.two_norm() - 1e-12); // Make sure the norm is above 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment