diff --git a/src/samplefunctional.hh b/src/samplefunctional.hh index c64a608c2da2bc7d3f30f0ed1425cd1dbbcfbcc1..63849e74328546e9f311e5dd766d7ff8cb295c49 100644 --- a/src/samplefunctional.hh +++ b/src/samplefunctional.hh @@ -35,7 +35,9 @@ template <int dimension> class SampleFunctional { } void descentDirection(const SmallVector x, SmallVector &ret) const { - if (x == SmallVector(0.0)) { + // Check the squared norm rather than each component because + // negative_projection() divides by it + if (x.two_norm2() == 0.0) { // If there is a direction of descent, this is it SmallVector const d = smoothGradient(x);