[Numpy-discussion] A numpy accumulator...
Tom K.
tpk@kraussfamily....
Mon Oct 5 21:49:15 CDT 2009
Christopher Barker wrote:
>
>
> What do folks think? is this useful? What would you change, etc?
>
Chris - I really like this and find it useful. I would change the name to
something like "growable" or "ArrayList" - accumulator seems like an object
for cumulative summation. I think the right amount to grow is 2x - this
provides an amortized O(log n) append. If the array doesn't have to grow,
the cost is 1 - no copies - whereas if you have to grow, the cost is n
copies. Is 2x optimal? Perhaps the configurable grow ratio is a good
thing, although giving a knob means people are going to set it wrong.
I would also vote "+1" for an ND version of this (growing only a single
dimension). Keeping 2x for each of n dimensions, while conceivable, would
be 2**n extra memory, and hence probably too costly.
Cheers,
Tom K.
--
View this message in context: http://www.nabble.com/A-numpy-accumulator...-tp25726568p25762136.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.
More information about the NumPy-Discussion
mailing list