GNU Radio 3.7.0 C++ API
adaptive_fir_ccf.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_CCF_H
00024 #define INCLUDED_FILTER_ADAPTIVE_FIR_CCF_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 float 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(float 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     class FILTER_API adaptive_fir_ccf : virtual public sync_decimator
00060     {
00061     public:
00062       // gr::filter::adaptive_fir_ccf::sptr
00063       typedef boost::shared_ptr<adaptive_fir_ccf> sptr;
00064 
00065       /*!
00066        * \brief Adaptive FIR filter with gr_complex input, gr_complex output and float taps
00067        *
00068        * \param name Provides a name to identify this type of algorithm
00069        * \param decimation (interger) decimation rate of the filter
00070        * \param taps (real) filter taps
00071        */
00072       static sptr make(const char *name, int decimation,
00073                                   const std::vector<float> &taps);
00074 
00075       virtual void set_taps(const std::vector<float> &taps) = 0;
00076       virtual std::vector<float> taps() = 0;
00077     };
00078 
00079   } /* namespace filter */
00080 } /* namespace gr */
00081 
00082 #endif /* INCLUDED_FILTER_ADAPTIVE_FIR_CCF_H */