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