GNU Radio 3.6.4.1 C++ API
adaptive_fir_ccf.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2011,2012 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_FILTER_ADAPTIVE_FIR_CCF_H
24 #define INCLUDED_FILTER_ADAPTIVE_FIR_CCF_H
25 
26 #include <filter/api.h>
27 #include <gr_sync_decimator.h>
28 
29 namespace gr {
30  namespace filter {
31 
32  /*!
33  * \brief Adaptive FIR filter with gr_complex input, gr_complex output and float taps
34  * \ingroup filter_blk
35  *
36  * This is a base class to implement an adaptive FIR
37  * filter. Generally, another block will inherit from this one to
38  * build a new type of adaptive filter such as an equalizer.
39  *
40  * This class implements two functions that are designed to be
41  * overloaded by the child class: error(gr_complex out) and
42  * update_tap(float tap, gr_complex in).
43  *
44  * The error() function calculates the error value that will be
45  * used to adjust the taps. The update_tap function then uses the
46  * error and the input signal value to update a particular
47  * tap. Typically, the error is calculated for a given output and
48  * then this is used in a loop to update all of the filter taps in
49  * a loop:
50  *
51  * \code
52  * d_error = error(sum);
53  * for(k = 0; k < l; k++) {
54  * update_tap(d_taps[ntaps-k-1], in[i+k]);
55  * }
56  * \endcode
57  */
59  {
60  public:
61  // gr::filter::adaptive_fir_ccf::sptr
63 
64  /*!
65  * \brief Adaptive FIR filter with gr_complex input, gr_complex output and float taps
66  *
67  * \param name Provides a name to identify this type of algorithm
68  * \param decimation (interger) decimation rate of the filter
69  * \param taps (real) filter taps
70  */
71  static sptr make(const char *name, int decimation,
72  const std::vector<float> &taps);
73 
74  virtual void set_taps(const std::vector<float> &taps) = 0;
75  virtual std::vector<float> taps() = 0;
76  };
77 
78  } /* namespace filter */
79 } /* namespace gr */
80 
81 #endif /* INCLUDED_FILTER_ADAPTIVE_FIR_CCF_H */