GNU Radio's ADAPT Package

lms_filter_ff_impl.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2018 <+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#ifndef INCLUDED_ADAPT_LMS_FILTER_FF_IMPL_H
22#define INCLUDED_ADAPT_LMS_FILTER_FF_IMPL_H
23
24#include "config.h"
25#ifdef ARMADILLO_FOUND
26#include <armadillo>
27#endif
28#include <adapt/lms_filter_ff.h>
29#include <gnuradio/filter/fir_filter.h>
30
31 namespace gr {
32 namespace adapt {
33
34 class lms_filter_ff_impl : public lms_filter_ff, filter::kernel::fir_filter_fff {
35 private:
36#ifdef ARMADILLO_FOUND
37 arma::fvec d_taps;
38 arma::fvec d_new_taps;
39#else
40 std::vector<float> d_new_taps;
41#endif // ARMADILLO_FOUND
42 bool d_first_input;
43 bool d_updated;
44 float d_error;
45 float d_mu;
46 unsigned d_skip, d_i;
47 bool d_adapt, d_bypass, d_reset;
48
49 protected:
50 float error(const float& desired, const float& out);
51 void update_tap(float& tap, const float& in);
52
53 public:
54 lms_filter_ff_impl(bool first_input,
55 int num_taps,
56 float mu,
57 unsigned skip,
58 unsigned decimation,
59 bool adapt,
60 bool bypass,
61 bool reset);
62 ~lms_filter_ff_impl() = default;
63
64 const std::vector<float>& get_taps() override;
65 void set_taps(const std::vector<float>& new_taps) override;
66 float get_mu() const override;
67 void set_mu(float mu) override;
68 unsigned get_skip() const override;
69 void set_skip(unsigned skip) override;
70 bool get_adapt() const override;
71 void set_adapt(bool adapt) override;
72 bool get_bypass() const override;
73 void set_bypass(bool bypass) override;
74 bool get_reset() const override;
75 void set_reset(bool reset) override;
76
77 // Where all the action really happens
78 int work(int noutput_items,
79 gr_vector_const_void_star& input_items,
80 gr_vector_void_star& output_items);
81};
82
83} // namespace adapt
84} // namespace gr
85
86#endif /* INCLUDED_ADAPT_LMS_FILTER_FF_IMPL_H */
gr::adapt::lms_filter_ff_impl
Definition lms_filter_ff_impl.h:34
gr::adapt::lms_filter_ff_impl::set_skip
void set_skip(unsigned skip) override
gr::adapt::lms_filter_ff_impl::get_bypass
bool get_bypass() const override
gr::adapt::lms_filter_ff_impl::get_skip
unsigned get_skip() const override
gr::adapt::lms_filter_ff_impl::get_reset
bool get_reset() const override
gr::adapt::lms_filter_ff_impl::set_reset
void set_reset(bool reset) override
gr::adapt::lms_filter_ff_impl::set_taps
void set_taps(const std::vector< float > &new_taps) override
gr::adapt::lms_filter_ff_impl::get_taps
const std::vector< float > & get_taps() override
gr::adapt::lms_filter_ff_impl::set_mu
void set_mu(float mu) override
gr::adapt::lms_filter_ff_impl::work
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
gr::adapt::lms_filter_ff_impl::lms_filter_ff_impl
lms_filter_ff_impl(bool first_input, int num_taps, float mu, unsigned skip, unsigned decimation, bool adapt, bool bypass, bool reset)
gr::adapt::lms_filter_ff_impl::update_tap
void update_tap(float &tap, const float &in)
gr::adapt::lms_filter_ff_impl::set_bypass
void set_bypass(bool bypass) override
gr::adapt::lms_filter_ff_impl::set_adapt
void set_adapt(bool adapt) override
gr::adapt::lms_filter_ff_impl::get_adapt
bool get_adapt() const override
gr::adapt::lms_filter_ff_impl::error
float error(const float &desired, const float &out)
gr::adapt::lms_filter_ff_impl::~lms_filter_ff_impl
~lms_filter_ff_impl()=default
gr::adapt::lms_filter_ff_impl::get_mu
float get_mu() const override
gr::adapt::lms_filter_ff
Least Mean Squares Adaptive Filter (float in/out)
Definition lms_filter_ff.h:38
config.h
lms_filter_ff.h
gr
Definition iqrd_rls_filter_cc.h:28