[Numpy-discussion] Fast histogram
Thu Apr 17 12:09:13 CDT 2008
>> But even if indices = array, one still needs to do something like:
>> for index in indices: histogram[index] += 1
>> Which is slow in python and fast in C.
> I thought of a broadcasting approach... what are the chances that a
> bins[:] = 0
> bins[ img.flat ] += 1
That doesn't work cumulatively, it seems. Some bins get a value of
'1', but it never gets incremented past that.
It was worth a try, though... in some cases in-place updating seems to
work this way (which is usually a source of confusion on this list,
not the desired result!)
More information about the Numpy-discussion