GNU Radio 3.6.5 C++ API

adaptive_fir_ccc.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2011,2012 Free Software Foundation, Inc.
00004  *
00005  * This file is part of GNU Radio
00006  *
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  *
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef INCLUDED_FILTER_ADAPTIVE_FIR_CCC_H
00024 #define INCLUDED_FILTER_ADAPTIVE_FIR_CCC_H
00025 
00026 #include <filter/api.h>
00027 #include <gr_sync_decimator.h>
00028 #include <filter/fir_filter.h>
00029 
00030 namespace gr {
00031   namespace filter {
00032 
00033     /*!
00034      * \brief Adaptive FIR filter with gr_complex input, gr_complex output and gr_complex taps
00035      * \ingroup filter_blk
00036      *
00037      * \details
00038      * This is a base class to implement an adaptive FIR
00039      * filter. Generally, another block will inherit from this one to
00040      * build a new type of adaptive filter such as an equalizer.
00041      *
00042      * This class implements two functions that are designed to be
00043      * overloaded by the child class: error(gr_complex out) and
00044      * update_tap(gr_complex tap, gr_complex in).
00045      *
00046      * The error() function calculates the error value that will be
00047      * used to adjust the taps. The update_tap function then uses the
00048      * error and the input signal value to update a particular
00049      * tap. Typically, the error is calculated for a given output and
00050      * then this is used in a loop to update all of the filter taps in
00051      * a loop:
00052      *
00053      * \code
00054      *     d_error = error(sum);
00055      *     for(k = 0; k < l; k++) {
00056      *       update_tap(d_taps[ntaps-k-1], in[i+k]);
00057      *     }
00058      * \endcode
00059      *
00060      * See digital::cma_equalizer_cc and digital::lms_dd_equalizer_cc
00061      * for example usage.
00062      */
00063     class FILTER_API adaptive_fir_ccc : virtual public gr_sync_decimator
00064     {
00065     public:
00066       // gr::filter::adaptive_fir_ccc::sptr
00067       typedef boost::shared_ptr<adaptive_fir_ccc> sptr;
00068 
00069       /*!
00070        * \brief Adaptive FIR filter with gr_complex input, gr_complex output and gr_complex taps
00071        *
00072        * \param name Provides a name to identify this type of algorithm
00073        * \param decimation (interger) decimation rate of the filter
00074        * \param taps (complex) filter taps
00075        */
00076       static sptr make(const char *name, int decimation,
00077                                   const std::vector<gr_complex> &taps);
00078 
00079       virtual void set_taps(const std::vector<gr_complex> &taps) = 0;
00080       virtual std::vector<gr_complex> taps() const = 0;
00081     };
00082 
00083   } /* namespace filter */
00084 } /* namespace gr */
00085 
00086 #endif /* INCLUDED_FILTER_ADAPTIVE_FIR_CCC_H */