diff --git a/src/samplefunctional.hh b/src/samplefunctional.hh index 1aa0000e20398d69fd95be3439a78ffe257959f5..c64a608c2da2bc7d3f30f0ed1425cd1dbbcfbcc1 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)