Hi All,

I just discovered some mistakes in my last e-mail. Some of my problems are solved, others still exists. I'll give the corrections and solved problems in this email below

On 10/16/2012 05:15 PM, Vasco wrote:
Closely related (in mathematical sense) is the following statement:
 >>> z = abs(x)*exp(1.j*angle(y))
NotImplementedError: multi-d slicing is not yet implemented
>>> z = abs(x)*cumath.exp(1.j*cumath.atan(y.imag/y.real))
Is this whole calculation done on the GPU? Or is it done on the CPU?

I want to apply this at a 2d array.
I tried:
gpu_a = gpuarray.to_gpu(np.array([[1.+2.j,3.+4.j],[5.+6.j,7.+8.j]]))
gpu_b = gpuarray.to_gpu(np.array([[-1.-2.j,-3.-4.j],[-5.-6.j,-7.-8.j]]))
set_intensity = ElementwiseKernel(
      # """Sets z: intensity from x and phase from y"""
     "pycuda::complex<float> *z, pycuda::complex<float>
*x,pycuda::complex<float> *y",
     "pycuda::complex<float> j(0,1);z[i] = abs(x[i]) *
exp(j*tan(y[i].real()/y[i].imag()))",
     "set_intensity",
     preamble="#include <pycuda-complex.hpp>",)
set_intensity(gpu_b,gpu_a,gpu_a)
print gpu_b
Here I made a mistake in the mathematics, it should be:
"pycuda::complex<float> j(0,1);z[i] = abs(x[i]) * exp(j*atan(y[i].imag()/y[i].real()))",

But it still only alters the first row

Groet,
Vasco

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

Reply via email to