GNU Radio's ADAPT Package
lms_filter_cc.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2019 <+YOU OR YOUR COMPANY+>.
4 *
5 * This is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3, or (at your option)
8 * any later version.
9 *
10 * This software is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this software; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street,
18 * Boston, MA 02110-1301, USA.
19 */
20
21
22#ifndef INCLUDED_ADAPT_LMS_FILTER_CC_H
23#define INCLUDED_ADAPT_LMS_FILTER_CC_H
24
25#include <adapt/api.h>
26#include <gnuradio/sync_decimator.h>
27
28namespace gr {
29namespace adapt {
30
31/*!
32 * \brief Least Mean Squares Adaptive Filter (complex in/out)
33 * \ingroup adapt
34 *
35 * \details
36 * This block implements a complex LMS-based adaptive filter [1].
37 *
38 * [1] Widrow, Bernard, John McCool, and Michael Ball. "The complex LMS algorithm." Proceedings of
39 * the IEEE 63.4 (1975): 719-720.
40 */
41class ADAPT_API lms_filter_cc : virtual public gr::sync_decimator {
42 protected:
43 virtual gr_complex error(const gr_complex& desired, const gr_complex& out) = 0;
44 virtual void update_tap(gr_complex& tap, const gr_complex& in) = 0;
45
46 public:
47 typedef boost::shared_ptr<lms_filter_cc> sptr;
48
49 /*!
50 * Make an LMS adaptive filter
51 *
52 * \param first_input Specifies whether first input is reference or error signal (bool)
53 * \param num_taps Number of taps in the filter (int)
54 * \param mu Gain of the update loop (float)
55 * \param skip Specifies how many samples are skipped between
56 * successive filter updates (unsigned)
57 * \param decimation Decimation rate of the filter (unsigned)
58 * \param adapt Controls whether filter taps are being updated (bool)
59 * \param bypass Bypass filter (bool)
60 * \param reset Reset filter taps (bool)
61 */
62 static sptr make(bool first_input,
63 int num_taps,
64 float mu,
65 unsigned skip,
66 unsigned decimation,
67 bool adapt,
68 bool bypass,
69 bool reset);
70
71 virtual void set_taps(const std::vector<gr_complex>& taps) = 0;
72 virtual const std::vector<gr_complex>& get_taps() = 0;
73 virtual float get_mu() const = 0;
74 virtual void set_mu(float mu) = 0;
75 virtual unsigned get_skip() const = 0;
76 virtual void set_skip(unsigned skip) = 0;
77 virtual bool get_adapt() const = 0;
78 virtual void set_adapt(bool adapt) = 0;
79 virtual bool get_bypass() const = 0;
80 virtual void set_bypass(bool bypass) = 0;
81 virtual bool get_reset() const = 0;
82 virtual void set_reset(bool reset) = 0;
83};
84
85} // namespace adapt
86} // namespace gr
87
88#endif /* INCLUDED_ADAPT_LMS_FILTER_CC_H */
#define ADAPT_API
Definition: api.h:31
Least Mean Squares Adaptive Filter (complex in/out)
Definition: lms_filter_cc.h:41
virtual void set_bypass(bool bypass)=0
virtual unsigned get_skip() const =0
static sptr make(bool first_input, int num_taps, float mu, unsigned skip, unsigned decimation, bool adapt, bool bypass, bool reset)
virtual void set_reset(bool reset)=0
virtual void update_tap(gr_complex &tap, const gr_complex &in)=0
virtual void set_taps(const std::vector< gr_complex > &taps)=0
virtual void set_skip(unsigned skip)=0
virtual const std::vector< gr_complex > & get_taps()=0
virtual bool get_adapt() const =0
virtual float get_mu() const =0
boost::shared_ptr< lms_filter_cc > sptr
Definition: lms_filter_cc.h:47
virtual void set_mu(float mu)=0
virtual bool get_reset() const =0
virtual void set_adapt(bool adapt)=0
virtual gr_complex error(const gr_complex &desired, const gr_complex &out)=0
virtual bool get_bypass() const =0
Definition: iqrd_rls_filter_cc.h:28