From 5b7d2836f09cf92e4191d550a49ca0a35253ab98 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Fri, 16 Sep 2011 15:29:34 +0200 Subject: [PATCH] Fix logic (missing minus) --- src/samplefunctional.hh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/samplefunctional.hh b/src/samplefunctional.hh index 4a6427fd..fcebf5cc 100644 --- a/src/samplefunctional.hh +++ b/src/samplefunctional.hh @@ -41,7 +41,12 @@ class SampleFunctional { func_.rightDifferential(0.0) * d.two_norm(); // TODO: is this correct? double combinedDecline = smoothDecline + nonlinearDecline; - ret = (combinedDecline < 0) ? d : SmallVector(0.0); + if (combinedDecline < 0) { + ret = d; + ret *= -1; + } else { + ret = SmallVector(0.0); + } return; } -- GitLab