diff --git a/dune/matrix-vector/axpy.hh b/dune/matrix-vector/axpy.hh index 4672c202c1c00da05c6c00acf4c170065b58d3ab..8dd675a1443eb19c89efcc3f110d52be627eb50d 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 * */