From 34f65f7c2d7cb85b2fdba52b590ae0e4113d38c4 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Sun, 16 Oct 2011 00:25:30 +0200
Subject: [PATCH] Do away with the collinearity check

---
 src/samplefunctional.hh | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/samplefunctional.hh b/src/samplefunctional.hh
index 1aa0000e..c64a608c 100644
--- a/src/samplefunctional.hh
+++ b/src/samplefunctional.hh
@@ -58,12 +58,7 @@ template <int dimension> class SampleFunctional {
     SmallVector const mg = lowerGradient(x);
     double const pgx = pg * x;
     double const mgx = mg * x;
-    // TODO: collinearity checks suck
-    if (pgx == pg.two_norm() * x.two_norm() &&
-        -mgx == mg.two_norm() * x.two_norm()) {
-      ret = SmallVector(0.0);
-      return;
-    } else if (pgx >= 0 && mgx >= 0) {
+    if (pgx >= 0 && mgx >= 0) {
       ret = pg;
       dverb << "## Directional derivative (as per scalar product w/ "
                "semigradient): " << -(ret * mg)
@@ -74,6 +69,8 @@ template <int dimension> class SampleFunctional {
                "semigradient): " << -(ret * pg)
             << " (coordinates of the restriction)" << std::endl;
     } else {
+      // Includes the case that pg points in direction x and mg
+      // points in direction -x. The projection will then be zero.
       ret = negative_projection(smoothGradient(x), x);
       dverb << "## Directional derivative (as per scalar product w/ "
                "semigradient): " << -(ret * ret)
-- 
GitLab