GPLIB++
WienerInterpolator.h
Go to the documentation of this file.
1 #ifndef WIENERINTERPOLATOR_H_
2 #define WIENERINTERPOLATOR_H_
3 #include <boost/numeric/ublas/matrix.hpp>
4 #include <boost/numeric/ublas/vector.hpp>
5 #include "LSSOFilter.h"
6 
7 namespace gplib
8  {
9 
10  /** \addtogroup sigproc Signal processing methods */
11  /* @{ */
12 
13  /*!*********************************************
14  * WienerInterpolator implements a linear prediction filter
15  * as described in Numerical Recipes, p. 566 , it uses the autocorrelation
16  * structure of the input data to predict the next sample
17  * Although it does not work exactly like the adaptive filters it is part of
18  * the class hierachy for now. The prediction coefficients are stored as Weights, but
19  * in opposite order to NR memcof, so they can be immediately used for prediction
20  */
21 
23  {
24  private:
25  //! The prediction error within the window used to calculate the filter coefficients
26  double xms;
27  public:
28  //! Return the prediction error
29  double GetXms() const
30  {
31  return xms;
32  }
33  //! Calculate the prediction coefficients, the contents of Desired are ignored, this function has to be implemented in the filter class hieraychy
34  virtual void
35  AdaptFilter(const gplib::rvec &Input, const gplib::rvec &Desired);
36  //! A more convenient method to get the prediction coefficients, but unique to this class
37  gplib::rvec CalcCoefficients(const gplib::rvec &Input)
38  {
39  AdaptFilter(Input, Input);
40  return GetWeights();
41  }
42  //! The constructor needs to know the filterlength
43  WienerInterpolator(const int filterlength);
44  virtual ~WienerInterpolator();
45  };
46  /* @} */
47  }
48 #endif /*WIENERINTERPOLATOR_H_*/
const gplib::rvec & GetWeights()
Return the current set of weights.
Definition: LSSOFilter.h:41
WienerInterpolator(const int filterlength)
The constructor needs to know the filterlength.
double GetXms() const
Return the prediction error.
gplib::rvec CalcCoefficients(const gplib::rvec &Input)
A more convenient method to get the prediction coefficients, but unique to this class.
Base class for least squares filter with a single output value.
Definition: LSSOFilter.h:20
virtual void AdaptFilter(const gplib::rvec &Input, const gplib::rvec &Desired)
Calculate the prediction coefficients, the contents of Desired are ignored, this function has to be i...