Wrap Numpy with Cython?

martin.nordstrom87 at gmail.com martin.nordstrom87 at gmail.com
Tue Jun 24 21:59:52 CEST 2008


Hi! I'm trying to wrap numpy with Cython and I've tried to use this
guide to manage this: http://wiki.cython.org/WrappingNumpy
However when I send an array to mysum() it gives me the right answer
only when dtype of the array is float, otherwise it gives me random
answers. The problem may be that the array is converted to a C double
which is just as long as float for Numpyarrays and therefore it works
only when the dtype is float. How do I make a Numpywrapper that works
with an arbitrary dtype?

I've also tried to convert a tuple or list with only numbers in it to
a C array with Cython but I've failed. Does anyone have an example of
how to do this?

Thanks!
Martin



More information about the Python-list mailing list