[Pyrex] How to pass the data element of a Numeric Array to a c function
Vineet Jain
vineet at eswap.com
Sat May 22 00:48:43 CEST 2004
I've just started using Pyrex and love what it has been able to do for me in
such a short period of time. As I move more and more of my stuff over to
Pyrex I have a few questions:
1. I have a c binding function between my python code and a c library. In
that function I'm currently doing the following:
#define FDATA(p) ((float *) (((PyArrayObject *)p)->data))
localCvariable = FDATA(NumericPythonArray);
some_c_function(localCVariable)
How can I do the same in pyrex. I've tried:
some_c_function(NumericPythonArray.data)
but that gives me an exception that cannot convert python object to
(float(*))
2. Is there a more efficient way to call Numeric functions directly from
pyrex. For instance when I do
from numeric import zeros, searchsorted
when I call zeros does it call the c function directly or does it have to go
through some python interface.
Thanks,
Vineet
More information about the Pyrex
mailing list