Hi,
I want to copy the contents of a float to the imaginary part of a complex on the gpu. Something like:

a = gpuarray.zeros(1,dtype=float)
c = gpuarray.zeros(1,dtype=complex)
c.gpudata.imag = float.gpudata

I'm not aware of any function which could do this. I tried to write two functions in pycuda-complex.hpp:

    __device__
  value_type set_real (const value_type& __x) {
    _M_re = __x;
    return *this;
  }
  __device__
  value_type set_imag (const value_type& __x) {
    _M_im = __x;
    return *this;
  }

But I'm not sure how to get these functions working.

Is there an easier way? Can this be done using an elementwise kernel?

Kind regards,
Vasco Tenner


_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to