Commit ed60ee52e572860523ce61ae59598aef4f53a145

Authored by David Mayerich
1 parent b28f312d

added addition to cvec3

Showing 1 changed file with 13 additions and 0 deletions   Show diff stats
stim/math/vec3.h
... ... @@ -312,6 +312,19 @@ std::string str() const{
312 312  
313 313 return result;
314 314 }
  315 +
  316 + /// @param rhs is the right-hand-side operator for the addition
  317 + CUDA_CALLABLE cvec3<T> operator+(cvec3<T> rhs) const {
  318 + return vec3< std::complex<T> >::operator+(rhs);
  319 + }
  320 + /// @param rhs is the right-hand-side operator for adding a real vector to a complex vector
  321 + CUDA_CALLABLE cvec3<T> operator+(vec3<T> rhs) const {
  322 + cvec3<T> result;
  323 + result.ptr[0] = vec3< std::complex<T> >::ptr[0] + rhs[0];
  324 + result.ptr[1] = vec3< std::complex<T> >::ptr[1] + rhs[1];
  325 + result.ptr[2] = vec3< std::complex<T> >::ptr[2] + rhs[2];
  326 + return result;
  327 + }
315 328 }; //end class cvec3
316 329 } //end namespace tira
317 330  
... ...