From 0bfc50fbb014fdb1c9afb3467402be82f4dfb33f 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] tcgsolver.hh: Use Axy() [[Imported from SVN: r12100]] --- dune/solvers/norms/energynorm.hh | 4 ++-- dune/solvers/solvers/tcgsolver.hh | 12 +++--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/dune/solvers/norms/energynorm.hh b/dune/solvers/norms/energynorm.hh index 26b1317..4726bc6 100644 --- a/dune/solvers/norms/energynorm.hh +++ b/dune/solvers/norms/energynorm.hh @@ -66,7 +66,7 @@ return std::sqrt(this->EnergyNorm<OperatorType,VectorType>::normSquared(f)); } - /** \brief Compute the square of the norm of the given vector + // \brief Compute the square of the norm of the given vector virtual field_type normSquared(const VectorType& f) const { if (iterationStep_ == NULL && matrix_ == NULL) @@ -88,7 +88,7 @@ return ret; } - /** \brief Compute the squared norm for a given vector and matrix + // \brief Compute the squared norm for a given vector and matrix DUNE_DEPRECATED static field_type normSquared(const VectorType& u, const OperatorType& A, const double tol=1e-10) diff --git a/dune/solvers/solvers/tcgsolver.hh b/dune/solvers/solvers/tcgsolver.hh index 69d0916..ef841a9 100644 --- a/dune/solvers/solvers/tcgsolver.hh +++ b/dune/solvers/solvers/tcgsolver.hh @@ -34,18 +34,12 @@ class TruncatedCGSolver : public IterativeSolver<VectorType> return std::max(root1, root2); } - /** \brief Computes <a,Mb>, where M is the norm that defines the trust region - \todo This could be implemented without the temporary. - */ + /** \brief Computes <Mb,a>, where M is the norm that defines the trust region */ field_type trustRegionScalarProduct(const VectorType& a, const VectorType& b) const { - if (trustRegionNormMatrix_) { - VectorType tmp(b.size()); - tmp = 0; - trustRegionNormMatrix_->umv(b, tmp); - return a*tmp; - } + if (trustRegionNormMatrix_) + return Arithmetic::Axy(*trustRegionNormMatrix_, b, a); return a*b; -- GitLab