[Numpy-discussion] Managing Rolling Data

Alexander Michael lxander.m at gmail.com
Thu Feb 22 11:23:58 EST 2007


On 2/22/07, Sturla Molden <sturla at molden.no> wrote:
> A ring buffer is O(1) whereas a memmove is O(N). Unless the amount of
> data to be moved are very small, this makes the ringbuffer the more
> attractive solution.
>
> Slicing becomes a little bit more complicated with a ring, but not very
> much. The data are stored in two ordered and contiguous segments: after
> and before the stack pointer (in that order).

I like the ring buffer idea as well. As order matters for some of my
operations, I will need to put the two sides together somehow, but
want to avoid blindly copying into a new array every time I slice on
H. I would also like to avoid writing wrappers for every possible
array operation. Does numpy provide a facility for creating a
concatenated "view" that can be handled like a "normal" array and only
gets copied into contiguous memory when push comes to shove?

This discussion has been really helpful for me as a numpy neophyte,
thanks everyone!

Alex



More information about the NumPy-Discussion mailing list