GNU Radio's ADAPT Package

rls_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_RLS_FILTER_FF_IMPL_H
22#define INCLUDED_ADAPT_RLS_FILTER_FF_IMPL_H
23
24#include "config.h"
25#ifdef ARMADILLO_FOUND
26#include <armadillo>
27#endif
28#include <adapt/rls_filter_ff.h>
29#include <gnuradio/filter/fir_filter.h>
30
31 namespace gr {
32 namespace adapt {
33
34 class rls_filter_ff_impl : public rls_filter_ff, filter::kernel::fir_filter_fff {
35 private:
36 void init_internals();
37
38#ifdef ARMADILLO_FOUND
39 arma::fvec d_taps;
40 arma::fvec d_new_taps;
41 arma::fmat d_P;
42#else
43 std::vector<float> d_new_taps;
44 std::vector<std::vector<float>> d_P;
45#endif // ARMADILLO_FOUND
46 bool d_first_input;
47 bool d_updated;
48 float d_error;
49 float d_delta, d_lambda;
50 unsigned d_skip, d_i;
51 bool d_adapt, d_reset;
52
53 protected:
54 float error(const float& desired, const float& out);
55 void update_tap(float& tap, const float& in);
56
57 public:
58 rls_filter_ff_impl(bool first_input,
59 int num_taps,
60 float delta,
61 float lambda,
62 unsigned skip,
63 unsigned decimation,
64 bool adapt,
65 bool reset);
66 ~rls_filter_ff_impl() = default;
67
68 const std::vector<float>& get_taps() override;
69 void set_taps(const std::vector<float>& new_taps) override;
70 float get_delta() const override;
71 void set_delta(float delta) override;
72 float get_lambda() const override;
73 void set_lambda(float lambda) override;
74 unsigned get_skip() const override;
75 void set_skip(unsigned skip) override;
76 bool get_adapt() const override;
77 void set_adapt(bool adapt) override;
78 bool get_reset() const override;
79 void set_reset(bool reset) override;
80
81 // Where all the action really happens
82 int work(int noutput_items,
83 gr_vector_const_void_star& input_items,
84 gr_vector_void_star& output_items);
85};
86
87} // namespace adapt
88} // namespace gr
89
90#endif /* INCLUDED_ADAPT_RLS_FILTER_FF_IMPL_H */
gr::adapt::rls_filter_ff_impl
Definition rls_filter_ff_impl.h:34
gr::adapt::rls_filter_ff_impl::set_reset
void set_reset(bool reset) override
gr::adapt::rls_filter_ff_impl::get_delta
float get_delta() const override
gr::adapt::rls_filter_ff_impl::error
float error(const float &desired, const float &out)
gr::adapt::rls_filter_ff_impl::work
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
gr::adapt::rls_filter_ff_impl::set_taps
void set_taps(const std::vector< float > &new_taps) override
gr::adapt::rls_filter_ff_impl::get_adapt
bool get_adapt() const override
gr::adapt::rls_filter_ff_impl::set_lambda
void set_lambda(float lambda) override
gr::adapt::rls_filter_ff_impl::set_skip
void set_skip(unsigned skip) override
gr::adapt::rls_filter_ff_impl::get_skip
unsigned get_skip() const override
gr::adapt::rls_filter_ff_impl::get_taps
const std::vector< float > & get_taps() override
gr::adapt::rls_filter_ff_impl::set_delta
void set_delta(float delta) override
gr::adapt::rls_filter_ff_impl::update_tap
void update_tap(float &tap, const float &in)
gr::adapt::rls_filter_ff_impl::rls_filter_ff_impl
rls_filter_ff_impl(bool first_input, int num_taps, float delta, float lambda, unsigned skip, unsigned decimation, bool adapt, bool reset)
gr::adapt::rls_filter_ff_impl::get_reset
bool get_reset() const override
gr::adapt::rls_filter_ff_impl::set_adapt
void set_adapt(bool adapt) override
gr::adapt::rls_filter_ff_impl::~rls_filter_ff_impl
~rls_filter_ff_impl()=default
gr::adapt::rls_filter_ff_impl::get_lambda
float get_lambda() const override
gr::adapt::rls_filter_ff
Recursive Least Squares Adaptive Filter (float in/out)
Definition rls_filter_ff.h:38
config.h
gr
Definition iqrd_rls_filter_cc.h:28
rls_filter_ff.h