Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-12 Thread Richard O'Keefe
I did mention that it was one of eight implementations that I tried. In fact you broke it with your change. It is important ***NOT*** to keep a running sum but a running MEAN. The line m := ((self at: i) - (self at: d)) / width + m was written that way for a reason. I did think of renaming

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-12 Thread Cédrick Béler
Fully agree on proper names. === I don’t know if this is because of free confinement time but I can keep on asking questions so I share some I hope will make sense (for the sake of discussion). For instance, I'm wondering if tests on conditions so as to raise proper exceptions is a good

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-12 Thread Sven Van Caekenberghe
> On 12 Apr 2020, at 13:53, Cédrick Béler wrote: > > Beautiful ^^ I also like it. But why the single letter variable names ? Why not: SequenceableCollection>>#runningMeans: width | means sum index | means := Array new: self size - width + 1. sum := 0. 1 to: width do: [ :each |

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-12 Thread Cédrick Béler
Beautiful ^^ I would vote for inclusion in the base image ? With your explanation as comments. I’ll play with it. Thanks Cedrick > Le 12 avr. 2020 à 12:19, Richard O'Keefe a écrit : > >  > I have coded and benchmarked 8 different running mean algorithms. > In the presence of inexact

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-12 Thread Richard O'Keefe
I have coded and benchmarked 8 different running mean algorithms. In the presence of inexact numbers it is not as accurate as redoing the sums, but it's pretty close, and it's fast. If "width" is not an integer or is out of range, an error will be reported by #new: or #at:[put:]. It's based on