[SciPy-dev] Should ndimage.measurements.* should return lists if index is a list?

Thouis (Ray) Jones thouis@broad.mit....
Fri May 1 13:02:09 CDT 2009


2009/5/1 Stéfan van der Walt <stefan@sun.ac.za>:
> 2009/5/1 Thouis (Ray) Jones <thouis@broad.mit.edu>:
>> Everything goes through a single labeled_reduce function, which
>> handles all the label/index interactions without needing any type
>> conversions.
>
> Looks like _labeled_reduce and _labeled_reduce2 can possibly be
> combined, saving some duplication.  I see there is also a
> labeled_reduce, but I haven't looked at that in too much detail.

Yes, the _labeled_reduce and _labeled_reduce2 could be combined.  I
wrote them separately because I thought they might end up more
different than they did, and because they might end up different when
translated to Cython.

labeled_reduce is intended as a user-exposed function.

The new code's about 5 times slower than the current tree, *not*
taking into account time spent in the _labeled_reduce function(s).
Most of that time is the call to argsort() and the subsequent
reorderings in labeled_reduce.  There might be some tricks to avoid
those.

The code is 10-20 times slower altogether.

Ray Jones


More information about the Scipy-dev mailing list