[SciPy-User] C-API - Dealing with pointers to cfloat type

Robert Pickel robert.pickel at gmail.com
Sat Jan 30 21:04:17 EST 2010


Hello,

 

I'm attempting to integrate an algorithm in a numpy extension written in C.

The extension compiles, but testing shows the data is not being transferred
properly.

 

 

On the Python side:

                    thing=array([1.0+1j, 1.0+1j, 1.0+1j], dtype=cfloat)

                    mymodule.dothing(thing)

 

On the C side:

                    npy_cfloat *mydat;

                    mydat=(npy_cfloat)PyArray_GETPTR1(passedobj, 1);

               printf("%f", mydat->real);

               ... 

               return(...)

 

                I always get 0.000 printed... 

 

Modifying the code to pass an array of floats from python and mydat of type
float seems to work as expected. The problem seems to be dealing with
complex data types.

My build environment is win7(64), vs2008, python26(win32)+numpy1.4.0   .

 

I'd appreciate any advice I can get on this.

 

Thanks,

Bob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20100130/c2398d99/attachment.html>


More information about the SciPy-User mailing list