diff --git a/dune/solvers/norms/energynorm.hh b/dune/solvers/norms/energynorm.hh index 702d0fce6faad2cfb67a3994da7d8f102db5c4d2..26b1317558e93d409ca1a9fde40b941a8baf38e7 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) {