From 6a26da524fef92afb18a4c799f0c7852e6f75bd8 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Mon, 12 Sep 2011 21:14:03 +0200
Subject: [PATCH] Better debugging messages

---
 src/samplefunctional.hh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/samplefunctional.hh b/src/samplefunctional.hh
index 1e01e90c..211ebf71 100644
--- a/src/samplefunctional.hh
+++ b/src/samplefunctional.hh
@@ -53,14 +53,19 @@ class SampleFunctional {
       return;
     } else if (pg * x >= 0 && mg * x >= 0) {
       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;
     } else if (pg * x <= 0 && mg * x <= 0) {
       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;
     } else {
       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;
   }
@@ -138,8 +143,9 @@ void minimise(const Functional J, const typename Functional::SmallVector x,
   { // Debug
     Interval<double> D;
     JRest.subDiff(0, D);
-    Dune::dverb << "## Descent according to JRest.subDiff: " << D[1]
-                << std::endl;
+    Dune::dverb
+        << "## Directional derivative (as per subdifferential of restriction): "
+        << D[1] << " (coordinates of the restriction)" << std::endl;
     assert(D[1] <=
            0); // We should not be minimising in this direction otherwise
   }
-- 
GitLab