GNU Radio's ADAPT Package
rls_filter_cc_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_CC_IMPL_H
22#define INCLUDED_ADAPT_RLS_FILTER_CC_IMPL_H
23
24#include "config.h"
25#ifdef ARMADILLO_FOUND
26#include <armadillo>
27#endif
28#include <adapt/rls_filter_cc.h>
29#include <gnuradio/filter/fir_filter.h>
30
31namespace gr {
32namespace adapt {
33
34class rls_filter_cc_impl : public rls_filter_cc, filter::kernel::fir_filter_ccc {
35 private:
36 void init_internals();
37
38#ifdef ARMADILLO_FOUND
39 arma::cx_fvec d_taps;
40 arma::cx_fvec d_new_taps;
41 arma::cx_fmat d_P;
42#else
43 std::vector<gr_complex> d_new_taps;
44 std::vector<std::vector<gr_complex>> d_P;
45#endif // ARMADILLO_FOUND
46 bool d_first_input;
47 bool d_updated;
48 gr_complex d_error;
49 float d_delta, d_lambda;
50 unsigned d_skip, d_i;
51 bool d_adapt, d_reset;
52
53 protected:
54 gr_complex error(const gr_complex& desired, const gr_complex& out);
55 void update_tap(gr_complex& tap, const gr_complex& in);
56
57 public:
58 rls_filter_cc_impl(bool firs_input,
59 int num_taps,
60 float mu,
61 float eps,
62 unsigned skip,
63 unsigned decimation,
64 bool adapt,
65 bool reset);
67
68 const std::vector<gr_complex>& get_taps() override;
69 void set_taps(const std::vector<gr_complex>& 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_CC_IMPL_H */
Definition: rls_filter_cc_impl.h:34
void set_lambda(float lambda) override
void update_tap(gr_complex &tap, const gr_complex &in)
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
void set_adapt(bool adapt) override
void set_delta(float delta) override
float get_delta() const override
unsigned get_skip() const override
float get_lambda() const override
void set_skip(unsigned skip) override
bool get_reset() const override
const std::vector< gr_complex > & get_taps() override
void set_taps(const std::vector< gr_complex > &new_taps) override
void set_reset(bool reset) override
bool get_adapt() const override
gr_complex error(const gr_complex &desired, const gr_complex &out)
rls_filter_cc_impl(bool firs_input, int num_taps, float mu, float eps, unsigned skip, unsigned decimation, bool adapt, bool reset)
Recursive Least Squares Adaptive Filter (complex in/out)
Definition: rls_filter_cc.h:38
Definition: iqrd_rls_filter_cc.h:28