GNU Radio v3.6.2-149-ga6d285d9 C++ API
|
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 * 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 gr_sync_decimator 00063 { 00064 public: 00065 // gr::filter::adaptive_fir_ccc::sptr 00066 typedef boost::shared_ptr<adaptive_fir_ccc> sptr; 00067 00068 /*! 00069 * \brief Adaptive FIR filter with gr_complex input, gr_complex output and gr_complex taps 00070 * 00071 * \param name Provides a name to identify this type of algorithm 00072 * \param decimation (interger) decimation rate of the filter 00073 * \param taps (complex) filter taps 00074 */ 00075 static sptr make(const char *name, int decimation, 00076 const std::vector<gr_complex> &taps); 00077 00078 virtual void set_taps(const std::vector<gr_complex> &taps) = 0; 00079 virtual std::vector<gr_complex> taps() const = 0; 00080 }; 00081 00082 } /* namespace filter */ 00083 } /* namespace gr */ 00084 00085 #endif /* INCLUDED_FILTER_ADAPTIVE_FIR_CCC_H */