On Thu, Jun 2, 2011 at 5:42 PM,  <josef.p...@gmail.com> wrote:
> On Wed, Jun 1, 2011 at 9:35 PM, David Cournapeau <courn...@gmail.com> wrote:
>> On Thu, Jun 2, 2011 at 1:49 AM, Mark Miller <markperrymil...@gmail.com> 
>> wrote:
>>> Not quite. Bincount is fine if you have a set of approximately
>>> sequential numbers. But if you don't....
>>
>> Even worse, it fails miserably if you sequential numbers but with a high 
>> shift.
>>
>> np.bincount([100000001, 100000002]) # will take a lof of memory
>>
>> Doing bincount with dict is faster in those cases.
>
> same with negative numbers, but in these cases I just subtract the min
> and we are back to the fast bincount case

Indeed, you can also deal with large numbers which are not consecutive
by using a lookup-table. All those methods are quite error-prone in
general, and reallly, there is no reason why bincount could not handle
the general case,

cheers,

David
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to