GNU Radio 3.6.5.1 C++ API
adaptive_fir_ccc.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_CCC_H
24 #define INCLUDED_FILTER_ADAPTIVE_FIR_CCC_H
25 
26 #include <filter/api.h>
27 #include <gr_sync_decimator.h>
28 #include <filter/fir_filter.h>
29 
30 namespace gr {
31  namespace filter {
32 
33  /*!
34  * \brief Adaptive FIR filter with gr_complex input, gr_complex output and gr_complex taps
35  * \ingroup filter_blk
36  *
37  * \details
38  * This is a base class to implement an adaptive FIR
39  * filter. Generally, another block will inherit from this one to
40  * build a new type of adaptive filter such as an equalizer.
41  *
42  * This class implements two functions that are designed to be
43  * overloaded by the child class: error(gr_complex out) and
44  * update_tap(gr_complex tap, gr_complex in).
45  *
46  * The error() function calculates the error value that will be
47  * used to adjust the taps. The update_tap function then uses the
48  * error and the input signal value to update a particular
49  * tap. Typically, the error is calculated for a given output and
50  * then this is used in a loop to update all of the filter taps in
51  * a loop:
52  *
53  * \code
54  * d_error = error(sum);
55  * for(k = 0; k < l; k++) {
56  * update_tap(d_taps[ntaps-k-1], in[i+k]);
57  * }
58  * \endcode
59  *
60  * See digital::cma_equalizer_cc and digital::lms_dd_equalizer_cc
61  * for example usage.
62  */
64  {
65  public:
66  // gr::filter::adaptive_fir_ccc::sptr
68 
69  /*!
70  * \brief Adaptive FIR filter with gr_complex input, gr_complex output and gr_complex taps
71  *
72  * \param name Provides a name to identify this type of algorithm
73  * \param decimation (interger) decimation rate of the filter
74  * \param taps (complex) filter taps
75  */
76  static sptr make(const char *name, int decimation,
77  const std::vector<gr_complex> &taps);
78 
79  virtual void set_taps(const std::vector<gr_complex> &taps) = 0;
80  virtual std::vector<gr_complex> taps() const = 0;
81  };
82 
83  } /* namespace filter */
84 } /* namespace gr */
85 
86 #endif /* INCLUDED_FILTER_ADAPTIVE_FIR_CCC_H */