Skip to content

MarkLodato CreatingUfuncs

Unknown edited this page · 1 revision
Clone this wiki locally

You can create NumPy [ ufuncs] easily using the following files: attachment:numpy_ufunc_api.pxd attachment:numpy_ufuncs.pxi

The following example makes a ufunc for calling the system "lgamma" function:

include "numpy_ufuncs.pxi"

cdef extern from "math.h":
    double lgammad "lgamma" (double)
    float lgammaf(float)
    long double lgammal(long double)

lgamma = register_ufunc_fdg(lgammaf, lgammad, lgammal,
    "lgamma", "log gamma function", PyUFunc_None)
Something went wrong with that request. Please try again.