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

Better debugging messages

parent 91ed6b07
No related branches found
No related tags found
No related merge requests found
...@@ -53,14 +53,19 @@ class SampleFunctional { ...@@ -53,14 +53,19 @@ 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) Dune::dverb << "## Directional derivative (as per scalar product w/ "
"semigradient): " << -(ret * mg)
<< " (coordinates of the restriction)" << std::endl; << " (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) Dune::dverb << "## Directional derivative (as per scalar product w/ "
"semigradient): " << -(ret * pg)
<< " (coordinates of the restriction)" << std::endl; << " (coordinates of the restriction)" << std::endl;
} else { } else {
ret = project(smoothGradient(x), x); ret = project(smoothGradient(x), x);
Dune::dverb << "## Directional derivative (as per scalar product w/ "
"semigradient): " << -(ret * ret)
<< " (coordinates of the restriction)" << std::endl;
} }
ret *= -1; ret *= -1;
} }
...@@ -138,8 +143,9 @@ void minimise(const Functional J, const typename Functional::SmallVector x, ...@@ -138,8 +143,9 @@ void minimise(const Functional J, const typename Functional::SmallVector x,
{ // Debug { // Debug
Interval<double> D; Interval<double> D;
JRest.subDiff(0, D); JRest.subDiff(0, D);
Dune::dverb << "## Descent according to JRest.subDiff: " << D[1] Dune::dverb
<< std::endl; << "## Directional derivative (as per subdifferential of restriction): "
<< D[1] << " (coordinates of the restriction)" << std::endl;
assert(D[1] <= assert(D[1] <=
0); // We should not be minimising in this direction otherwise 0); // We should not be minimising in this direction otherwise
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment