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 <rao...@gmail.com> a écrit : > > > 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 Welford's > stable update. > > Of course this approach does NOT work for trimmed or Winsorised > means or for medians or any kind of robust estimate of location. > > SequenceableCollection > methods for: 'summarising' > runningMeans: width > |a m d| > a := Array new: self size - width + 1. > m := 0. > 1 to: width do: [:i | > m := (self at: i) + m]. > m := m / width. > d := 1. > a at: d put: m. > width + 1 to: self size do: [:i | > m := ((self at: i) - (self at: d)) / width + m. > d := d + 1. > a at: d put: m]. > ^a > > > > >