In fact, since you just want to average the last N samples, you can just keep an accumulator and divide by N once you want the mean. This would just cost two adds per sample (accumulator and counter) and one divide when reading. Should be the most efficient. No need for a list or anything.
Why not a rolling average? Constant in time and space.
ReplyDeleteA rolling average would work too, and would probably have similar results, wouldn't it?
ReplyDeleteYes should.
ReplyDeleteIn fact, since you just want to average the last N samples, you can just keep an accumulator and divide by N once you want the mean. This would just cost two adds per sample (accumulator and counter) and one divide when reading. Should be the most efficient. No need for a list or anything.
Does anybody remember the time, when users also write a little bit more text then just throw out a simple link ?
ReplyDeleteThomas Lodewick follow the link and you will get a bunch of text to read!
ReplyDelete+Thomas Lodewick I didn't want to repeat myself.
ReplyDeleteOh, ok .... this is a uncommended linklist ... I dind't knew that.
ReplyDeleteI see that the post didn't have a summary now. Next time I'll try to include one.
ReplyDeleteJim McKeeth You get the point - nice :-)
ReplyDelete