[Numpy-discussion] A Cython apply_along_axis function

Sturla Molden sturla at molden.no
Fri Dec 3 07:42:50 EST 2010

> It's hard to write Cython code that can handle all dtypes and
> arbitrary number of dimensions. The former is typically dealt with
> using templates, but what do people do about the latter?

There are number of ways to do it. NumPy's C API has an iterator that
returns an axis on demand. Mine just collects an array with pointers to
the first element in each axis. The latter is more friendly to
parallelization (OpenMP or Python threads with released GIL), which is why
I wrote it, otherwise it has no advantage over NumPy's.


More information about the NumPy-Discussion mailing list