4 namespace ublas = boost::numeric::ublas;
12 const double MyLambda,
const double MyAlpha) :
14 Lambdaminus(MyLambda / 2.0), S(inputsize, inputsize), Psi(inputsize),
15 Alpha(MyAlpha), factor1(inputsize, inputsize), factor2(inputsize,
16 inputsize), I(inputsize)
18 std::fill_n(S.data().begin(), inputsize * inputsize, 0.0);
19 std::fill_n(Psi.begin(), inputsize, 0.0);
27 const gplib::rvec &Desired)
35 factor1 = I - ublas::outer_prod(
GetK(), Input);
36 factor2 = I - ublas::outer_prod(Input,
GetK());
37 rmat temp1(ublas::prec_prod(factor1, S));
38 S = ublas::prec_prod(temp1, factor2);
39 S += ublas::outer_prod(
GetK(),
GetK());
43 Psi = prec_prod(factor1, Psi) + prec_prod(S, Input) *
GetEpsilon()(0);
const gplib::rvec & GetEpsilon() const
Return the last estimation error.
const gplib::rvec & GetK()
AMRLSCanceller(const int inputsize, const double MyDelta, const double MyLambda, const double MyAlpha)
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 .
Implements a recursive least-squares adaptive filter, as described in Haykin, p. 443.
virtual ~AMRLSCanceller()
virtual void AdaptFilter(const gplib::rvec &Input, const gplib::rvec &Desired)
Adapt the filter weights given the Input and Desired vectors.
double GetLambda()
Get the current forgetting factor.
const gplib::rmat & GetP()