[Numpy-discussion] Multidimension array access in C via Python API

Stefan Seefeld stefan at seefeld.name
Tue Apr 5 13:42:24 EDT 2016

On 05.04.2016 13:24, Antoine Pitrou wrote:
> On Tue, 5 Apr 2016 08:39:39 -0700 (MST)
> mpc <matt.p.conte at gmail.com> wrote:
>> This is the reason I'm doing this in the first place, because I made a pure
>> python version but it runs really slow for larger data sets, so I'm
>> basically rewriting the same function but using the Python and Numpy C API,
>> but if you're saying it won't run any faster then maybe I'm going at it the
>> wrong way. (Why use the C function version if it's the same speed anyway?)
> The Python and Numpy C API are generally not very user-friendly
> compared to Python code, even hand-optimized.
> Cython will let you write code that looks quite close to normal Python
> code, but with additional annotations for better performance.  Or you
> can try Numba, a just-in-time compiler for scientific code that
> understand Numpy arrays:
> http://numba.pydata.org/

And just for the record: there is also Boost.Python, if you already have
a C++ library you want to bind to Python. There even is a Boost.NumPy
project, which however isn't formally part of Boost yet. Still, it may
be an inspiration...:




      ...ich hab' noch einen Koffer in Berlin...

More information about the NumPy-Discussion mailing list