[SciPy-user] Passing numpy array to a c function

Stéfan van der Walt stefan at sun.ac.za
Mon Apr 21 01:49:14 EDT 2008


On 21/04/2008, Christopher Brown <c-b at asu.edu> wrote:
>  Thanks. That solved one problem. The length is now printing correctly.
>  But the bigger problem seems to be with the float64 type.
>
>  I added the following to my function:
>
>    if (array->descr->type_num == PyArray_DOUBLE) {
>      printf("Double!\n");

You're looking for NPY_DOUBLE here.

You'll find Travis Oliphant's book (http://www.tramy.us/) tremendously
helpful in accessing the NumPy C API.  The book is being released for
free at SciPy 2008, but at $35 it's a bargain anyway.

Regards
Stéfan



More information about the SciPy-User mailing list