GNU Radio 3.7.0 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_H 00024 #define INCLUDED_FILTER_ADAPTIVE_FIR_H 00025 00026 #include <gnuradio/filter/api.h> 00027 #include <gnuradio/filter/fir_filter.h> 00028 00029 namespace gr { 00030 namespace filter { 00031 namespace kernel { 00032 00033 /*! 00034 * \brief Adaptive FIR filter kernel with gr_complex input, 00035 * gr_complex output and gr_complex taps 00036 * 00037 * This class implements an adaptive FIR filter. Any class 00038 * actually wanting to use adaptive FIRs will contain an object of 00039 * this class. 00040 */ 00041 class FILTER_API adaptive_fir_ccc : public fir_filter_ccc 00042 { 00043 public: 00044 adaptive_fir_ccc(int decimation, 00045 const std::vector<gr_complex> &taps); 00046 ~adaptive_fir_ccc(); 00047 00048 protected: 00049 // Override to calculate error signal per output 00050 virtual gr_complex error(const gr_complex &out) = 0; 00051 00052 // Override to calculate new weight from old, corresponding input 00053 virtual void update_tap(gr_complex &tap, const gr_complex &in) = 0; 00054 00055 gr_complex d_error; 00056 }; 00057 00058 00059 /*! 00060 * \brief Adaptive FIR filter kernel with gr_complex input, 00061 * gr_complex output and float taps 00062 * 00063 * This class implements an adaptive FIR filter. Any class 00064 * actually wanting to use adaptive FIRs will contain an object of 00065 * this class. 00066 */ 00067 class FILTER_API adaptive_fir_ccf : public fir_filter_ccf 00068 { 00069 public: 00070 adaptive_fir_ccf(int decimation, 00071 const std::vector<float> &taps); 00072 ~adaptive_fir_ccf(); 00073 00074 protected: 00075 // Override to calculate error signal per output 00076 virtual float error(const gr_complex &out) = 0; 00077 00078 // Override to calculate new weight from old, corresponding input 00079 virtual void update_tap(float &tap, const gr_complex &in) = 0; 00080 00081 float d_error; 00082 }; 00083 00084 } /* namespace kernel */ 00085 } /* namespace filter */ 00086 } /* namespace gr */ 00087 00088 #endif /* INCLUDED_FILTER_ADAPTIVE_FIR_H */