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