scipy/scipy — pull request #261 by thouis (2012-07-05 13:06:56+00:00)
Title: ENH: Rewrite ndimage.label() in Cython

This reimplements ndimage.label() in Cython, with the following results:
+ easier to read code
+ faster (roughly 3x on my MacBook Pro)
+ output array can be nearly any numpy type (not just int32)
+ if passed in, output array is used for scratch space (minimal overhead)

Downsides:
- Uses type templating, so requires a dev version of Cython as of 2012-07
(Cython 0.17+ should work)
- The type templating results in a very large C file (there's a small
function that gets instantiated N^2 times for the N types the
function takes as input/output).

New tests have been added to ensure that label() returns the same
values as before, and to test new functionality (in-place operation).