[Numpy-discussion] Rolling window (moving average, moving std, and more)
erik at rigtorp.com
Mon Jan 3 08:37:21 EST 2011
On Mon, Jan 3, 2011 at 05:13, Sebastian Haase <seb.haase at gmail.com> wrote:
> Hi Erik,
> This is really neat ! Do I understand correctly, that you mean by
> "stride tricks", that your rolling_window is _not_ allocating any new
> memory ?
Yes, it's only a view.
> IOW, If I have a large array using 500MB of memory, say of float32 of
> shape 125,1000,1000 and I want the last axis rolling of window size
> 11, what would the peak memory usage of that operation be ?
It's only a view of the array, no copying is done. Though some
operations like np.std() will copy the array, but that's more of a
bug. In general It's hard to imagine any speedup gains by copying a
> How about renaming the option `window` to `window_size` (first I was
> thinking of things like hamming and hanning windows...)... ?
More information about the NumPy-Discussion