GNU Radio's ADAPT Package
qrd_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_QRD_RLS_FILTER_FF_IMPL_H
22#define INCLUDED_ADAPT_QRD_RLS_FILTER_FF_IMPL_H
23
24#include "config.h"
25#ifdef ARMADILLO_FOUND
26#include <armadillo>
27#endif
29#include <gnuradio/filter/fir_filter.h>
30
31namespace gr {
32namespace adapt {
33
34class qrd_rls_filter_ff_impl : public qrd_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_U, d_dq2;
42#else
43 std::vector<float> d_new_taps;
44 std::vector<std::vector<float>> d_U;
45 std::vector<float> d_dq2;
46#endif // ARMADILLO_FOUND
47 bool d_updated;
48 float d_delta, d_lambda;
49 unsigned d_skip, d_i;
50 bool d_adapt, d_reset;
51
52 protected:
53 float error(const float& desired, const float& out);
54
55 public:
57 float delta,
58 float lambda,
59 unsigned skip,
60 unsigned decimation,
61 bool adapt,
62 bool reset);
64
65 const std::vector<float>& get_taps() override;
66 void set_taps(const std::vector<float>& new_taps) override;
67 float get_delta() const override;
68 void set_delta(float delta) override;
69 float get_lambda() const override;
70 void set_lambda(float lambda) override;
71 unsigned get_skip() const override;
72 void set_skip(unsigned skip) override;
73 bool get_adapt() const override;
74 void set_adapt(bool adapt) override;
75 bool get_reset() const override;
76 void set_reset(bool reset) override;
77
78 // Where all the action really happens
79 int work(int noutput_items,
80 gr_vector_const_void_star& input_items,
81 gr_vector_void_star& output_items);
82};
83
84} // namespace adapt
85} // namespace gr
86
87#endif /* INCLUDED_ADAPT_QRD_RLS_FILTER_FF_IMPL_H */
Definition: qrd_rls_filter_ff_impl.h:34
void set_delta(float delta) override
void set_reset(bool reset) override
bool get_reset() const override
const std::vector< float > & get_taps() override
float get_delta() const override
bool get_adapt() const override
void set_taps(const std::vector< float > &new_taps) override
qrd_rls_filter_ff_impl(int num_taps, float delta, float lambda, unsigned skip, unsigned decimation, bool adapt, bool reset)
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
float error(const float &desired, const float &out)
void set_adapt(bool adapt) override
void set_skip(unsigned skip) override
float get_lambda() const override
unsigned get_skip() const override
void set_lambda(float lambda) override
QR Decomposition Recursive Least Squares Adaptive Filter (float in/out)
Definition: qrd_rls_filter_ff.h:38
Definition: iqrd_rls_filter_cc.h:28