Martin Spacek wrote:
>
> Actually, your original version is just as fast as the take() version.
> Both are about 9X faster than numpy.mean() on my system. I prefer the
> take() version because you only have to pass a single argument to
> mean_accum()
I forgot to mention that all my indices ar
Tim Hochberg wrote:
> I'm actually surprised that the take version is faster than my original
> version since it makes a big ol' copy. I guess this is an indication
> that indexing is more expensive than I realize. That's why nothing beats
> measuring!
Actually, your original version is just
Martin Spacek wrote:
> Tim Hochberg wrote:
>
>
>> Here's an approach (mean_accumulate) that avoids making any copies of
>> the data. It runs almost 4x as fast as your approach (called baseline
>> here) on my box. Perhaps this will be useful:
>>
>>
> --snip--
>
>> def mean_accumulate(da
Tim Hochberg wrote:
> Here's an approach (mean_accumulate) that avoids making any copies of
> the data. It runs almost 4x as fast as your approach (called baseline
> here) on my box. Perhaps this will be useful:
>
--snip--
> def mean_accumulate(data, indices):
> result = np.zeros([32, 32],
Travis Oliphant wrote:
>
> If frameis is 1-D, then you should be able to use
>
> temp = data.take(frameis,axis=0)
>
> for the first step. This can be quite a bit faster (and is a big
> reason why take is still around). There are several reasons for this
> (one of which is that index check
A Dissabte 26 Agost 2006 12:26, Travis Oliphant va escriure:
> If frameis is 1-D, then you should be able to use
>
> temp = data.take(frameis,axis=0)
>
> for the first step. This can be quite a bit faster (and is a big
> reason why take is still around). There are several reasons for this
> (on
Martin Spacek wrote:
> Hello,
>
> I'm a bit ignorant of optimization in numpy.
>
> I have a movie with 65535 32x32 frames stored in a 3D array of uint8
> with shape (65535, 32, 32). I load it from an open file f like this:
>
> >>> import numpy as np
> >>> data = np.fromfile(f, np.uint8, count=65
Martin Spacek wrote:
> Hello,
>
> I'm a bit ignorant of optimization in numpy.
>
> I have a movie with 65535 32x32 frames stored in a 3D array of uint8
> with shape (65535, 32, 32). I load it from an open file f like this:
>
> >>> import numpy as np
> >>> data = np.fromfile(f, np.uint8, count=65