GNU Radio 3.7.0 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 <gnuradio/filter/api.h>
00027 #include <gnuradio/sync_decimator.h>
00028 
00029 namespace gr {
00030   namespace filter {
00031 
00032     /*!
00033      * \brief Adaptive FIR filter with gr_complex input, gr_complex output and gr_complex taps
00034      * \ingroup filter_blk
00035      *
00036      * \details
00037      * This is a base class to implement an adaptive FIR
00038      * filter. Generally, another block will inherit from this one to
00039      * build a new type of adaptive filter such as an equalizer.
00040      *
00041      * This class implements two functions that are designed to be
00042      * overloaded by the child class: error(gr_complex out) and
00043      * update_tap(gr_complex tap, gr_complex in).
00044      *
00045      * The error() function calculates the error value that will be
00046      * used to adjust the taps. The update_tap function then uses the
00047      * error and the input signal value to update a particular
00048      * tap. Typically, the error is calculated for a given output and
00049      * then this is used in a loop to update all of the filter taps in
00050      * a loop:
00051      *
00052      * \code
00053      *     d_error = error(sum);
00054      *     for(k = 0; k < l; k++) {
00055      *       update_tap(d_taps[ntaps-k-1], in[i+k]);
00056      *     }
00057      * \endcode
00058      *
00059      * See digital::cma_equalizer_cc and digital::lms_dd_equalizer_cc
00060      * for example usage.
00061      */
00062     class FILTER_API adaptive_fir_ccc : virtual public sync_decimator
00063     {
00064     protected:
00065       
00066     public:
00067       // gr::filter::adaptive_fir_ccc::sptr
00068       typedef boost::shared_ptr<adaptive_fir_ccc> sptr;
00069 
00070       /*!
00071        * \brief Adaptive FIR filter with gr_complex input, gr_complex output and gr_complex taps
00072        *
00073        * \param name Provides a name to identify this type of algorithm
00074        * \param decimation (interger) decimation rate of the filter
00075        * \param taps (complex) filter taps
00076        */
00077       static sptr make(const char *name, int decimation,
00078                        const std::vector<gr_complex> &taps);
00079 
00080       virtual void set_taps(const std::vector<gr_complex> &taps) = 0;
00081       virtual std::vector<gr_complex> taps() const = 0;
00082     };
00083 
00084   } /* namespace filter */
00085 } /* namespace gr */
00086 
00087 #endif /* INCLUDED_FILTER_ADAPTIVE_FIR_CCC_H */