|
From: | Matt Ettus |
Subject: | Re: [Discuss-gnuradio] Moving average and history |
Date: | Tue, 10 Feb 2009 09:19:30 -0800 |
User-agent: | Thunderbird 2.0.0.19 (X11/20090105) |
Whoops, forget about skipping the history(), of course it couldn't work. However, by adding a state buffer to the class, the first for() loop can be skipped. For long MAs, this would save some multiplications and only increase memory usage by one item_size.
The reason we don't do that is that floating point numbers will have numerical errors. If you add thousands of floats together, and then subtract them all out, you won't get zero. This error will accumulate over time and become unstable. That is why we start our accumulation over again periodically.
Matt
[Prev in Thread] | Current Thread | [Next in Thread] |