On Mon, Feb 09, 2009 at 01:43:41PM +0100, Martin Braun wrote: > [code] > > Here's what I don't understand: the state for the MA (as for all > filters) is saved implicitly in the history. However, in this special > case, the state is simply one scalar value (saved in 'sum'). The way > this is implemented, that state has to be recalculated every time work() > is called. So, why bother with history() and not simply make 'sum' a > class property? Would that screw up the scheduling? > > The reason I ask is if I write a MA block for vectors, using history() > means keeping vector_length x MA_length samples in some buffer and > running as many extra multiplications every time work() is called. Of > course, I'd prefer to solve this the GNU Radio way, but in this case it > would seem a waste of memory and CPU cycles.
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. Next time I'll think about it twice :) Martin -- Dipl.-Ing. Martin Braun Phone: +49-(0)721-608 3790 Institut fuer Nachrichtentechnik Fax: +49-(0)721-608 6071 Universitaet Karlsruhe (TH) http://www.int.uni-karlsruhe.de/
pgptWi7aVSo9n.pgp
Description: PGP signature
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio