Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

MarkLodato CreatingUfuncs

Unknown edited this page · 1 revision
Clone this wiki locally

You can create NumPy [http://docs.scipy.org/doc/numpy/reference/c-api.ufunc.html 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:

#!python
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.