Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #85 from mbrubake/feature/complex-mod
Add ability to set real and imaginary components of complex numbers
  • Loading branch information
inducer committed Aug 27, 2015
2 parents 440936b + 4e25f3f commit 6930bdd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pycuda/cuda/pycuda-complex.hpp
Expand Up @@ -87,6 +87,10 @@ struct complex {
value_type real() const { return _M_re; }
__device__
value_type imag() const { return _M_im; }
__device__
void real(value_type val) { _M_re = val; }
__device__
void imag(value_type val) { _M_im = val; }

// Arithmetic op= operations involving one real argument.

Expand Down Expand Up @@ -223,6 +227,8 @@ struct _STLP_CLASS_DECLSPEC complex<float> {
// Element access.
value_type __device__ real() const { return _M_re; }
value_type __device__ imag() const { return _M_im; }
void __device__ real(value_type val) { _M_re = val; }
void __device__ imag(value_type val) { _M_im = val; }

// Arithmetic op= operations involving one real argument.

Expand Down Expand Up @@ -393,6 +399,10 @@ struct _STLP_CLASS_DECLSPEC complex<double> {
value_type real() const { return _M_re; }
__device__
value_type imag() const { return _M_im; }
__device__
void real(value_type val) { _M_re = val; }
__device__
void imag(value_type val) { _M_im = val; }

// Arithmetic op= operations involving one real argument.

Expand Down

0 comments on commit 6930bdd

Please sign in to comment.