From 156e6e88cfae72ec28abc3b81e2e33546a750ef9 Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Mon, 2 Jun 2014 14:53:46 +0200
Subject: [PATCH] [Cleanup] Avoid recomputation

---
 dune/tectonic/mydirectionalconvexfunction.hh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dune/tectonic/mydirectionalconvexfunction.hh b/dune/tectonic/mydirectionalconvexfunction.hh
index e815fa48..38c73d46 100644
--- a/dune/tectonic/mydirectionalconvexfunction.hh
+++ b/dune/tectonic/mydirectionalconvexfunction.hh
@@ -45,8 +45,9 @@ template <class Nonlinearity> class MyDirectionalConvexFunction {
     Vector uxv = u;
     Arithmetic::addProduct(uxv, x, v);
     phi.directionalSubDiff(uxv, v, D);
-    D[0] += A * x - b;
-    D[1] += A * x - b;
+    auto const Axmb = A * x - b;
+    D[0] += Axmb;
+    D[1] += Axmb;
   }
 
   void domain(Dune::Solvers::Interval<double> &domain) const {
-- 
GitLab