From 78d3d801474e771db4c6b9d05f487ef785f99bb3 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Mon, 4 Jun 2018 12:58:41 +0200 Subject: [PATCH] Added == and != operators --- src/algebra/TinyVector.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/algebra/TinyVector.hpp b/src/algebra/TinyVector.hpp index d9661606b..0b4149428 100644 --- a/src/algebra/TinyVector.hpp +++ b/src/algebra/TinyVector.hpp @@ -32,6 +32,21 @@ public: return N; } + KOKKOS_INLINE_FUNCTION + bool operator==(const TinyVector& v) const + { + for (size_t i=0; i<N; ++i) { + if (m_values[i] != v.m_values[i]) return false; + } + return true; + } + + KOKKOS_INLINE_FUNCTION + bool operator!=(const TinyVector& v) const + { + return not this->operator==(v); + } + KOKKOS_INLINE_FUNCTION T operator,(const TinyVector& v) const { -- GitLab