commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (O'brien, Tim)
Subject Re: [math][patch] New RollingUnivariateImpl
Date Fri, 16 May 2003 16:31:39 GMT
On Fri, 2003-05-16 at 11:04, Mark R. Diggory wrote:
> My implementation requires no such thing! ;-) 

My apologies.

> Look at it again, it "rolls" around the array simply replacing the last value in the
> with the new value in the window and increments the index representing 
> the beginning of the array (when this index reaches the end of the array 
> it gets mod'ed to send it back to the beginning of the array. No 
> elements "move". The array doesn't change size, this is an extremely 
> efficient design.

It is.

> Don't get me wrong, but doesn't your implementation actually produce an 
> array that has an unused portion at the beginning?

See ContractableDoubleArray, storage is reclaimed when the internal
storage exceed the number of elements by the factor defined in

> I don't see where storage is reclaimed at the beginning of the array 
> because you always copy the array starting at 0. 

Again, check out ContractableDoubleArray - the contract function takes
care of reclaiming unused space, only if the criteria are met.  If your
contractionCriteria is 2.0, and you have 100 elements, you are
gauranteed that the internal storage array will be between 101 and 200
in length.  Then benefit here is that, memory is reclaimed only once
every one hundred "rolls".

> I think it really may be wiser to separate the functionalities of 
> Rolling and Expanding, At least until theres a clear methodology for the 
> best implementation of each and a clear means of combining them.

Expandable and Contractable double arrays as a storage mechanism for
Univariates provide a benefit in that they preserve the order of the
values added to Univariate.

I t might be useful to have a FixedDoubleArray which supports the
rolling functionality described in your patch, but, in general, these
objects provide usefulness outside of Univariate.  Essentially, I don't
want an implementation of Univariate to have to worry about storage.

> I'll chill now. Cheers,
> Mark
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message