LMSCanceller.cpp

Go to the documentation of this file.
00001 #include "LMSCanceller.h"
00002 #include "CFatalException.h"
00003 #include <iostream>
00004 #include <iterator>
00005 using namespace std;
00006 
00007 LMSCanceller::LMSCanceller(const int inputsize):
00008 LSSOFilter(inputsize),
00009 mu(1)
00010 {
00011 }
00012 
00013 LMSCanceller::LMSCanceller(const int inputsize, const double Mymu):
00014 LSSOFilter(inputsize),
00015 mu(Mymu)
00016 {
00017 }
00018 
00019 LMSCanceller::~LMSCanceller()
00020 {}
00021 
00022 void LMSCanceller::AdaptFilter(const gplib::rvec &Input, const gplib::rvec &Desired)
00023 {
00024         if (Input.size() != GetInputLength() || Input.size() != Weights.size() || Desired.size() != GetOutputLength())
00025                 throw CFatalException("Input or Desired do not have expected size !");
00026         
00027         SetEpsilon(Desired - GetFilterOutput()); //Calculate the last prediction error
00028         double step = ublas::prec_inner_prod(Input,Input); //the power of the input data
00029         const double delta = 0.0001; // We introduce delta to improve stability for small values
00030         step = mu/(step+delta);  //here see Haykin, p 323
00031         Weights += 2.0 * step * GetEpsilon()(0) * Input; //update Filter based on prediction error
00032 }

Generated on Fri Jul 4 15:30:20 2008 for GPLIB++ by  doxygen 1.5.5