I made 2 adjustments to the header file that may be of interest.
I added a simple function for adding a real and complex number together.
Under my implementation (below), the powr function returns incorrect results
when evaluating under the conditions below. I do not think I provided an
optimal solution, but it was a simple fix for my needs.
Since I only square my complex numbers, I created a simple function called _sq
that does the same thing as powr but corrects what occurs below with simple
if-then constructs.
If you are interested in obtaining my code please let me know. See below for an
example of when incorrect results occur. My implementation information is at
the bottom.
the method I used:
return cfloat_powr(s11,2);
the input and subsequent output:
s11.x = 0;
s11.y = 1;
-1. -8.74227766e-08j
s11.x = 0;
s11.y = -1;
-1. +8.74227766e-08j
s11.x = -1;
s11.y = 0;
1. +1.74845553e-07j
s11.x = 1;
s11.y = 1;
-8.74227837e-08+2.00000024j
s11.x = -1;
s11.y = -1;
2.38497648e-08+2.00000024j
Python 2.7.3
OpenCL 2011.2
Pydev
Eclipse Indigo 1.4.1.20110909-1818
Windows 7
GeForce 9100
Driver Update 296.10
Sincerely,
Evan
_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl