On 04/12/15 23:06, Peter Otten wrote:
> duncan smith wrote:
>
>> Hello,
>> I'm trying to find a computationally efficient way of identifying
>> unique subarrays, counting them and returning an array containing only
>> the unique subarrays and a corresponding 1D array of counts. The
>> follow
On 04/12/15 22:36, Albert-Jan Roskam wrote:
> Hi
>
> (Sorry for topposting)
>
> numpy.ravel is faster than numpy.flatten (no copy)
> numpy.empty is faster than numpy.zeros
> numpy.fromiter might be useful to avoid the loop (just a hunch)
>
> Albert-Jan
>
Thanks, I'd forgotten the difference be
duncan smith wrote:
> Hello,
> I'm trying to find a computationally efficient way of identifying
> unique subarrays, counting them and returning an array containing only
> the unique subarrays and a corresponding 1D array of counts. The
> following code works, but is a bit slow.
>
> ###
Hi
(Sorry for topposting)
numpy.ravel is faster than numpy.flatten (no copy)
numpy.empty is faster than numpy.zeros
numpy.fromiter might be useful to avoid the loop (just a hunch)
Albert-Jan
> From: duncan@invalid.invalid
> Subject: counting unique numpy subarrays
> Date: Fri, 4 Dec 2
Hello,
I'm trying to find a computationally efficient way of identifying
unique subarrays, counting them and returning an array containing only
the unique subarrays and a corresponding 1D array of counts. The
following code works, but is a bit slow.
###
from collections import C