Registered Member
|
I am trying to find an elegant way to calculate a moving average. Until now I have implemented it using the usual way with loops using std::vector, but since I have to use Eigen for some other calculations I thought that it would be a good idea to use Eigen through out the program. Since I am new to Eigen it would be great to get some pointers to what ways a moving average could be implemented taking advantage of Eigen's features. Any ideas?
|
Moderator
|
Your question is too vague. What is the dimensionality? Regular sampling? What about the weighting scheme? etc. Anyway, I think you will still need the main outer loop. The inner one is basically a dot product.
|
Registered Member
|
OK, I am looking for the most simple - the moving mean. I have looked into using
|
Moderator
|
something like that:
for(i...) res(i) = vector.segment(i,n).mean(); ? |
Registered Member
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]