From ed60ee52e572860523ce61ae59598aef4f53a145 Mon Sep 17 00:00:00 2001 From: David Mayerich Date: Wed, 13 Oct 2021 15:46:00 -0500 Subject: [PATCH] added addition to cvec3 --- stim/math/vec3.h | 13 +++++++++++++ 1 file changed, 13 insertions(+), 0 deletions(-) diff --git a/stim/math/vec3.h b/stim/math/vec3.h index 1a52ea0..533075c 100644 --- a/stim/math/vec3.h +++ b/stim/math/vec3.h @@ -312,6 +312,19 @@ std::string str() const{ return result; } + + /// @param rhs is the right-hand-side operator for the addition + CUDA_CALLABLE cvec3 operator+(cvec3 rhs) const { + return vec3< std::complex >::operator+(rhs); + } + /// @param rhs is the right-hand-side operator for adding a real vector to a complex vector + CUDA_CALLABLE cvec3 operator+(vec3 rhs) const { + cvec3 result; + result.ptr[0] = vec3< std::complex >::ptr[0] + rhs[0]; + result.ptr[1] = vec3< std::complex >::ptr[1] + rhs[1]; + result.ptr[2] = vec3< std::complex >::ptr[2] + rhs[2]; + return result; + } }; //end class cvec3 } //end namespace tira -- libgit2 0.21.4