GPLIB++
RLSCanceller.h
Go to the documentation of this file.
1 #ifndef RLSCANCELLER_H
2 #define RLSCANCELLER_H
3 
4 #include "LSSOFilter.h"
5 #include "VecMat.h"
6 
7 namespace gplib
8  {
9 
10  /** \addtogroup sigproc Signal processing methods */
11  /* @{ */
12  //! Implements a recursive least-squares adaptive filter, as described in Haykin, p. 443
13  /*! The RLS filter is a more eeffective, but computationally much more expensive version
14  * of the LMS filter.
15  */
16  class RLSCanceller: public LSSOFilter
17  {
18  private:
19  double delta;
20  double lambda;
21  gplib::rmat P;
22  gplib::rvec pi;
23  gplib::rvec k;
24  protected:
25  const gplib::rmat &GetP()
26  {
27  return P;
28  }
29  const gplib::rvec &GetPi()
30  {
31  return pi;
32  }
33  const gplib::rvec &GetK()
34  {
35  return k;
36  }
37  public:
38  //! Set the forgetting factor \f$ \lambda \f$, usually \f$ \lambda \ll 1 \f$
39  void SetLambda(const double Mylambda)
40  {
41  lambda = Mylambda;
42  }
43  //! Get the current forgetting factor
44  double GetLambda()
45  {
46  return lambda;
47  }
48  //! Set the regularization factor
49  void SetDelta(const double Mydelta)
50  {
51  delta = Mydelta;
52  }
53  double GetDelta()
54  {
55  return delta;
56  }
57  virtual void
58  AdaptFilter(const gplib::rvec &Input, const gplib::rvec &Desired);
59  RLSCanceller(const int inputsize);
60  RLSCanceller(const int inputsize, const double MyDelta,
61  const double MyLambda);
62  virtual ~RLSCanceller();
63  };
64  /* @} */
65  }
66 #endif // RLSCANCELLER_H
const gplib::rvec & GetK()
Definition: RLSCanceller.h:33
virtual void AdaptFilter(const gplib::rvec &Input, const gplib::rvec &Desired)
Adapt the filter weights given the Input and Desired vectors.
void SetLambda(const double Mylambda)
Set the forgetting factor , usually .
Definition: RLSCanceller.h:39
Implements a recursive least-squares adaptive filter, as described in Haykin, p. 443.
Definition: RLSCanceller.h:16
void SetDelta(const double Mydelta)
Set the regularization factor.
Definition: RLSCanceller.h:49
RLSCanceller(const int inputsize)
Base class for least squares filter with a single output value.
Definition: LSSOFilter.h:20
const gplib::rvec & GetPi()
Definition: RLSCanceller.h:29
double GetLambda()
Get the current forgetting factor.
Definition: RLSCanceller.h:44
const gplib::rmat & GetP()
Definition: RLSCanceller.h:25