00001 #ifndef WIENERINTERPOLATOR_H_ 00002 #define WIENERINTERPOLATOR_H_ 00003 #include <boost/numeric/ublas/matrix.hpp> 00004 #include <boost/numeric/ublas/vector.hpp> 00005 #include "LSSOFilter.h" 00006 00007 namespace gplib 00008 { 00009 00010 /** \addtogroup sigproc Signal processing methods */ 00011 /* @{ */ 00012 00013 /*!********************************************* 00014 * WienerInterpolator implements a linear prediction filter 00015 * as described in Numerical Recipes, p. 566 , it uses the autocorrelation 00016 * structure of the input data to predict the next sample 00017 * Although it does not work exactly like the adaptive filters it is part of 00018 * the class hierachy for now. The prediction coefficients are stored as Weights, but 00019 * in opposite order to NR memcof, so they can be immediately used for prediction 00020 */ 00021 00022 class WienerInterpolator: public LSSOFilter 00023 { 00024 private: 00025 //! The prediction error within the window used to calculate the filter coefficients 00026 double xms; 00027 public: 00028 //! Return the prediction error 00029 double GetXms() const 00030 { 00031 return xms; 00032 } 00033 //! Calculate the prediction coefficients, the contents of Desired are ignored, this function has to be implemented in the filter class hieraychy 00034 virtual void 00035 AdaptFilter(const gplib::rvec &Input, const gplib::rvec &Desired); 00036 //! A more convenient method to get the prediction coefficients, but unique to this class 00037 gplib::rvec CalcCoefficients(const gplib::rvec &Input) 00038 { 00039 AdaptFilter(Input, Input); 00040 return GetWeights(); 00041 } 00042 //! The constructor needs to know the filterlength 00043 WienerInterpolator(const int filterlength); 00044 virtual ~WienerInterpolator(); 00045 }; 00046 /* @} */ 00047 } 00048 #endif /*WIENERINTERPOLATOR_H_*/
1.5.8