From a557ccd792492d7c2bb24faf717e06dcd0cf561e Mon Sep 17 00:00:00 2001 From: Max Kahnt <max.kahnt@fu-berlin.de> Date: Tue, 3 Oct 2017 15:22:33 +0200 Subject: [PATCH] Add convenience functions to create result instances. --- dune/matrix-vector/axpy.hh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dune/matrix-vector/axpy.hh b/dune/matrix-vector/axpy.hh index 4672c20..8dd675a 100644 --- a/dune/matrix-vector/axpy.hh +++ b/dune/matrix-vector/axpy.hh @@ -23,7 +23,6 @@ namespace MatrixVector { bool BisScalar, bool CisScalar> struct ScaledProductHelper; - /** \brief Add a product to some matrix or vector * * This function computes a+=b*c. @@ -94,6 +93,21 @@ namespace MatrixVector { isScalar<D>()>::addProduct(a, -b, c, d); } + template <class A, class... BCD> + A getAddProduct(const A& a, BCD&&... bcd) { + auto sum = a; + addProduct(sum, std::forward<BCD>(bcd)...); + return sum; + } + + template <class A, class... BCD> + A getSubtractProduct(const A& a, BCD&&... bcd) { + auto difference = a; + subtractProduct(difference, std::forward<BCD>(bcd)...); + return difference; + } + + /** \brief Internal helper class for product operations * */ -- GitLab