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

Stéfan van der Walt stefan@sun.ac...
Mon Apr 21 00:49:14 CDT 2008

On 21/04/2008, Christopher Brown <c-b@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.


More information about the SciPy-user mailing list