GPLIB++
LSSOFilter.cpp
Go to the documentation of this file.
1 #include "LSSOFilter.h"
2 #include <iostream>
3 
4 namespace gplib
5  {
6 
7  const int maxoutputchannels = 1;
8 
9  LSSOFilter::LSSOFilter(const int filterlength) :
10  AdaptiveFilter(filterlength, maxoutputchannels), Weights(filterlength)
11  {
12  //set all weights to zero
13  Weights.clear();
14  }
15 
17  {
18  }
19 
20  void LSSOFilter::PrintWeights(std::ostream &output)
21  {
22  //print all filter weights to a single line
23  std::copy(Weights.begin(), Weights.end(),
24  std::ostream_iterator<double>(output, " "));
25  output << std::endl;
26  }
27 
28  void LSSOFilter::CalcOutput(const gplib::rvec &Input, gplib::rvec &Output)
29  {
30  //for a single output value the filter output is
31  //simply the inner product of the input with the filter weigths
32  Output(0) = ublas::prec_inner_prod(Input, Weights);
33  SetOutput(Output);
34  }
35  }
virtual void PrintWeights(std::ostream &output)
Print the weights to output stream.
Definition: LSSOFilter.cpp:20
const int maxoutputchannels
Definition: LSSOFilter.cpp:7
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
virtual ~LSSOFilter()
Definition: LSSOFilter.cpp:16
void SetOutput(const gplib::rvec &Out)
Possibility for derived classes to set output.
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