From bdf4739ac8900948ed94366c8140733dff67ecee Mon Sep 17 00:00:00 2001 From: Simon Praetorius <simon.praetorius@tu-dresden.de> Date: Tue, 4 Dec 2018 15:57:52 -0500 Subject: [PATCH] added negation operator for FieldMatrix --- src/amdis/common/FieldMatVec.hpp | 3 +++ src/amdis/common/FieldMatVec.inc.hpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/amdis/common/FieldMatVec.hpp b/src/amdis/common/FieldMatVec.hpp index add41977..6a316262 100644 --- a/src/amdis/common/FieldMatVec.hpp +++ b/src/amdis/common/FieldMatVec.hpp @@ -197,6 +197,9 @@ namespace Dune template <class T, int M, int N> FieldMatrix<T,N,M> trans(FieldMatrix<T, M, N> const& A); + template <class T, int M, int N> + FieldMatrix<T,M,N> operator-(FieldMatrix<T, M, N> A); + template <class T, int M, int N, class S, std::enable_if_t<std::is_convertible<S,T>::value, int> = 0> diff --git a/src/amdis/common/FieldMatVec.inc.hpp b/src/amdis/common/FieldMatVec.inc.hpp index c0d56410..cadb8d3a 100644 --- a/src/amdis/common/FieldMatVec.inc.hpp +++ b/src/amdis/common/FieldMatVec.inc.hpp @@ -349,6 +349,11 @@ FieldMatrix<T,N,M> trans(FieldMatrix<T, M, N> const& A) return At; } +template <class T, int M, int N> +FieldMatrix<T,M,N> operator-(FieldMatrix<T,M,N> A) +{ + return A *= -1; +} template <class T, int M, int N, class S, std::enable_if_t<std::is_convertible<S,T>::value, int>> -- GitLab