diff --git a/dune/solvers/computeenergy.hh b/dune/solvers/computeenergy.hh index ec904ec7c78937c283df7595a37e3bb208d35f81..f38a0729fe765fbf47857121ba1ff484fa7ef362 100644 --- a/dune/solvers/computeenergy.hh +++ b/dune/solvers/computeenergy.hh @@ -6,22 +6,13 @@ template <class M, class V> double computeEnergy(const M& mat, const V& x, const V& rhs) { - V tmp(x.size()); - tmp = 0; - Arithmetic::addProduct(tmp, mat, x); -// std::cout << "tmp*x: " << (tmp*x) << " rhs*x: " << (rhs*x) << std::endl; -// exit(0); - return 0.5*(tmp*x) - rhs*x; + return 0.5*Arithmetic::Axy(mat,x,x) - rhs*x; } template <class M, class V> double computeEnergy(const M& mat, const V& x) { - V tmp(x.size()); - tmp = 0; - Arithmetic::addProduct(tmp, mat, x); - - return 0.5*(tmp*x); + return 0.5*Arithmetic::Axy(mat,x,x); } #endif