GNU Radio's ADAPT Package

lms_filter_ff.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_FF_H
23#define INCLUDED_ADAPT_LMS_FILTER_FF_H
24
25#include <adapt/api.h>
26#include <gnuradio/sync_decimator.h>
27
28 namespace gr {
29 namespace adapt {
30
31/*!
32 * \brief Least Mean Squares Adaptive Filter (float in/out)
33 * \ingroup adapt
34 *
35 * \details
36 * This block implements an LMS-based adaptive filter.
37 */
38 class ADAPT_API lms_filter_ff : virtual public gr::sync_decimator {
39 protected:
40 virtual float error(const float& desired, const float& out) = 0;
41 virtual void update_tap(float& tap, const float& in) = 0;
42
43 public:
44 typedef boost::shared_ptr<lms_filter_ff> sptr;
45
46 /*!
47 * Make an LMS adaptive filter
48 *
49 * \param first_input Specifies whether first input is reference or error signal (bool)
50 * \param num_taps Number of taps in the filter (int)
51 * \param mu Gain of the update loop (float)
52 * \param skip Specifies how many samples are skipped between
53 * successive filter updates (unsigned)
54 * \param decimation Decimation rate of the filter (unsigned)
55 * \param adapt Controls whether filter taps are being updated (bool)
56 * \param bypass Bypass filter (bool)
57 * \param reset Reset filter taps (bool)
58 */
59 static sptr make(bool first_input,
60 int num_taps,
61 float mu,
62 unsigned skip,
63 unsigned decimation,
64 bool adapt,
65 bool bypass,
66 bool reset);
67
68 virtual void set_taps(const std::vector<float>& taps) = 0;
69 virtual const std::vector<float>& get_taps() = 0;
70 virtual float get_mu() const = 0;
71 virtual void set_mu(float mu) = 0;
72 virtual unsigned get_skip() const = 0;
73 virtual void set_skip(unsigned skip) = 0;
74 virtual bool get_adapt() const = 0;
75 virtual void set_adapt(bool adapt) = 0;
76 virtual bool get_bypass() const = 0;
77 virtual void set_bypass(bool bypass) = 0;
78 virtual bool get_reset() const = 0;
79 virtual void set_reset(bool reset) = 0;
80};
81
82} // namespace adapt
83} // namespace gr
84
85#endif /* INCLUDED_ADAPT_LMS_FILTER_FF_H */
api.h
ADAPT_API
#define ADAPT_API
Definition api.h:31
gr::adapt::lms_filter_ff
Least Mean Squares Adaptive Filter (float in/out)
Definition lms_filter_ff.h:38
gr::adapt::lms_filter_ff::make
static sptr make(bool first_input, int num_taps, float mu, unsigned skip, unsigned decimation, bool adapt, bool bypass, bool reset)
gr::adapt::lms_filter_ff::set_bypass
virtual void set_bypass(bool bypass)=0
gr::adapt::lms_filter_ff::set_skip
virtual void set_skip(unsigned skip)=0
gr::adapt::lms_filter_ff::get_skip
virtual unsigned get_skip() const =0
gr::adapt::lms_filter_ff::error
virtual float error(const float &desired, const float &out)=0
gr::adapt::lms_filter_ff::get_adapt
virtual bool get_adapt() const =0
gr::adapt::lms_filter_ff::get_mu
virtual float get_mu() const =0
gr::adapt::lms_filter_ff::get_taps
virtual const std::vector< float > & get_taps()=0
gr::adapt::lms_filter_ff::set_reset
virtual void set_reset(bool reset)=0
gr::adapt::lms_filter_ff::get_bypass
virtual bool get_bypass() const =0
gr::adapt::lms_filter_ff::get_reset
virtual bool get_reset() const =0
gr::adapt::lms_filter_ff::set_taps
virtual void set_taps(const std::vector< float > &taps)=0
gr::adapt::lms_filter_ff::set_mu
virtual void set_mu(float mu)=0
gr::adapt::lms_filter_ff::update_tap
virtual void update_tap(float &tap, const float &in)=0
gr::adapt::lms_filter_ff::sptr
boost::shared_ptr< lms_filter_ff > sptr
Definition lms_filter_ff.h:44
gr::adapt::lms_filter_ff::set_adapt
virtual void set_adapt(bool adapt)=0
gr
Definition iqrd_rls_filter_cc.h:28