[SciPy-user] SciPy and Cython
Mon Jan 19 13:24:52 CST 2009
2009/1/19 Lorenzo Isella <firstname.lastname@example.org>:
> I am used to resorting to f2py for the numerical intensive bottlenecks
> of my Python codes.
> However, I have recently come across Cython. From the examples on:
> it looks like I can directly write my functions in Python and then
> easily build a Cython extension.
> This sounds sweet music to me, but the fact is that more often than
> now my functions would need a scipy array as an input.
> I read somewhere that Cython is better integrated with numpy rather
> than scipy; is this really the case?
> Can anyone tell me if there is any caveat I should be aware of when
> writing Cython extensions which operate on, let's say, numpy arrays?
Yes, Cython is very well suited to just the sort of use you describe.
If you'd like to see what it looks like, the current development
versions of scipy include the module scipy.spatial, which contains a
pure python and a derived cython implementation of kd-trees.
More information about the SciPy-user