00001 #ifndef LSSOFILTER_H_ 00002 #define LSSOFILTER_H_ 00003 00004 /** \addtogroup sigproc Signal processing methods */ 00005 /* @{ */ 00006 00007 00008 00009 #include "AdaptiveFilter.h" 00010 //! Base class for least squares filter with a single output value 00011 /*!***************************************************** 00012 * Base class for Least-Square filters with a single output value 00013 * currently used for LMS and RLS filters, implements all virtual 00014 * functions from CAdaptiveFilters apart from AdaptFilter, which 00015 * depends on the functionality of the individual filter 00016 * 00017 * 00018 * *****************************************************/ 00019 class LSSOFilter : public AdaptiveFilter 00020 { 00021 private: 00022 //! For single output values the weights can be stored in a vector 00023 gplib::rvec Weights; 00024 public: 00025 //! The way to calculate the output is the same for all single output filters, we implement it here 00026 virtual void CalcOutput(const gplib::rvec &Input, gplib::rvec &Output); 00027 //! For single channel output we can also just return the output as a double 00028 double CalcOutput(const gplib::rvec &Input) 00029 { 00030 gplib::rvec temp; 00031 CalcOutput(Input, temp); 00032 return temp(0); 00033 } 00034 //! Return the current set of weights 00035 const gplib::rvec &GetWeights() 00036 { 00037 return Weights; 00038 } 00039 //! Implement the abstract function from adaptive filter, in this case just another name for GetWeights 00040 virtual const gplib::rvec &GetWeightsAsVector() 00041 { 00042 return Weights; 00043 } 00044 //! Print the weights to output stream 00045 virtual void PrintWeights(std::ostream &output); 00046 //! The constructor only needs the filter length, outputsize for Adaptive filter is 1 00047 LSSOFilter(const int filterlength); 00048 virtual ~LSSOFilter(); 00049 //! We declare friend classes for easier access to the Weight vector 00050 friend class LMSCanceller; 00051 friend class RLSCanceller; 00052 friend class AMRLSCanceller; 00053 friend class WienerInterpolator; 00054 }; 00055 /* @} */ 00056 #endif /*CLSSOFILTER_H_*/
1.5.5