GPLIB++
LSSOFilter.h
Go to the documentation of this file.
1 #ifndef LSSOFILTER_H_
2 #define LSSOFILTER_H_
3 
4 #include "AdaptiveFilter.h"
5 
6 namespace gplib
7  {
8  /** \addtogroup sigproc Signal processing methods */
9  /* @{ */
10 
11  //! Base class for least squares filter with a single output value
12  /*!*****************************************************
13  * Base class for Least-Square filters with a single output value
14  * currently used for LMS and RLS filters, implements all virtual
15  * functions from AdaptiveFilters apart from AdaptFilter, which
16  * depends on the functionality of the individual filter
17  *
18  *
19  * *****************************************************/
20  class LSSOFilter: public AdaptiveFilter
21  {
22  private:
23  //! For single output values the weights can be stored in a vector
24  gplib::rvec Weights;
25  protected:
26  gplib::rvec &SetWeights()
27  {
28  return Weights;
29  }
30  public:
31  //! The way to calculate the output is the same for all single output filters, we implement it here
32  virtual void CalcOutput(const gplib::rvec &Input, gplib::rvec &Output);
33  //! For single channel output we can also just return the output as a double
34  double CalcOutput(const gplib::rvec &Input)
35  {
36  gplib::rvec temp;
37  CalcOutput(Input, temp);
38  return temp(0);
39  }
40  //! Return the current set of weights
41  const gplib::rvec &GetWeights()
42  {
43  return Weights;
44  }
45  //! Implement the abstract function from adaptive filter, in this case just another name for GetWeights
46  virtual const gplib::rvec &GetWeightsAsVector()
47  {
48  return Weights;
49  }
50  //! Print the weights to output stream
51  virtual void PrintWeights(std::ostream &output);
52  //! The constructor only needs the filter length, outputsize for Adaptive filter is 1
53  LSSOFilter(const int filterlength);
54  virtual ~LSSOFilter();
55  //! We declare friend classes for easier access to the Weight vector
56  };
57  /* @} */
58  }
59 #endif /*CLSSOFILTER_H_*/
const gplib::rvec & GetWeights()
Return the current set of weights.
Definition: LSSOFilter.h:41
virtual void PrintWeights(std::ostream &output)
Print the weights to output stream.
Definition: LSSOFilter.cpp:20
virtual const gplib::rvec & GetWeightsAsVector()
Implement the abstract function from adaptive filter, in this case just another name for GetWeights...
Definition: LSSOFilter.h:46
A generic base class for all types of adaptive filters.
LSSOFilter(const int filterlength)
The constructor only needs the filter length, outputsize for Adaptive filter is 1.
Definition: LSSOFilter.cpp:9
gplib::rvec & SetWeights()
Definition: LSSOFilter.h:26
virtual ~LSSOFilter()
Definition: LSSOFilter.cpp:16
Base class for least squares filter with a single output value.
Definition: LSSOFilter.h:20
double CalcOutput(const gplib::rvec &Input)
For single channel output we can also just return the output as a double.
Definition: LSSOFilter.h:34
virtual void CalcOutput(const gplib::rvec &Input, gplib::rvec &Output)
The way to calculate the output is the same for all single output filters, we implement it here...
Definition: LSSOFilter.cpp:28