From 03b85de8042455b50437853c6876d02efee9167c Mon Sep 17 00:00:00 2001
From: Elias Pipping <elias.pipping@fu-berlin.de>
Date: Fri, 13 Sep 2013 22:52:22 +0000
Subject: [PATCH] energynorm.hh: Use Axy()

[[Imported from SVN: r12099]]
---
 dune/solvers/norms/energynorm.hh | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/dune/solvers/norms/energynorm.hh b/dune/solvers/norms/energynorm.hh
index 702d0fce..26b13175 100644
--- a/dune/solvers/norms/energynorm.hh
+++ b/dune/solvers/norms/energynorm.hh
@@ -4,6 +4,7 @@
 #include <cmath>
 
 #include "norm.hh"
+#include <dune/solvers/common/arithmetic.hh>
 #include <dune/solvers/iterationsteps/lineariterationstep.hh>
 
     /** \brief Vector norm induced by linear operator
@@ -66,7 +67,6 @@
         }
 
         /** \brief Compute the square of the norm of the given vector
-            \todo This could be implemented without the temporary. */
         virtual field_type normSquared(const VectorType& f) const
         {
             if (iterationStep_ == NULL && matrix_ == NULL)
@@ -76,10 +76,7 @@
                 ? *(iterationStep_->getMatrix())
                 : *matrix_;
 
-            VectorType tmp(f.size());
-            A.mv(f, tmp);
-
-            field_type const ret = f*tmp;
+            const field_type ret = Arithmetic::Axy(A, f, f);
 
             if (ret < 0)
             {
@@ -92,15 +89,11 @@
         }
 
         /** \brief Compute the squared norm for a given vector and matrix
-            \todo This could be implemented without the temporary. */
         DUNE_DEPRECATED static field_type normSquared(const VectorType& u,
                                                       const OperatorType& A,
                                                       const double tol=1e-10)
         {
-            VectorType tmp(u.size());
-            A.mv(u, tmp);
-
-            double const ret = u*tmp;
+            const field_type ret = Arithmetic::Axy(A, u, u);
 
             if (ret < 0)
             {
-- 
GitLab