Mark Lodato wrote: > I wrote a small library for creating Numpy ufuncs using Cython. Just > copy the pxd and pxi linked at > http://wiki.cython.org/MarkLodato/CreatingUfuncs and include the pxi > at the top of your file. Then you can create 1-input/1-output or > 2-input/1-output ufuncs operating of floats, doubles, or long doubles > easily. > > Really nice! Excuse my ignorance about ufuncs, but is there a function pointer call overhead for every element this way, or is it all macro based? > I'd be happy to hear any comments or suggestions you have. Perhaps > this can be distributed with Cython? It would be really nice to be > able to easily create ufuncs in Cython right out of the box. > Definitely. It could be part of numpy.pxd I think; either that, or make a pxd package and have numpy.ufunc as a sub-pxd.
I wouldn't like to ship it as "pxi" (because include is kind of discouraged these days and it is not good if the Cython standard lib requires it). I think all the functions can be put in a pxd if you mark them "inline". (An alternative is to create a numpy_cython_ufuncs module in Cython/Runtime, but not unless we have to). It would be best if you would play around in Cython/Includes and submit a patch. Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
