On 05.04.2016 13:24, Antoine Pitrou wrote: > On Tue, 5 Apr 2016 08:39:39 -0700 (MST) > mpc <matt.p.co...@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...: http://stefanseefeld.github.io/boost.python/doc/html/index.html https://github.com/ndarray/Boost.NumPy Regards, Stefan -- ...ich hab' noch einen Koffer in Berlin... _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion