11#ifndef INCLUDED_SINGLE_POLE_IIR_H
12#define INCLUDED_SINGLE_POLE_IIR_H
24template <
class o_type,
class i_type,
class tap_type>
43 o_type
filter(
const i_type input);
49 void filterN(o_type output[],
const i_type input[],
unsigned long n);
56 if (alpha < 0 || alpha > 1)
57 throw std::out_of_range(
"Alpha must be in [0, 1]");
77template <
class o_type,
class i_type,
class tap_type>
82 output = d_alpha * input + d_one_minus_alpha * d_prev_output;
83 d_prev_output = output;
85 return (o_type)output;
89template <
class o_type,
class i_type,
class tap_type>
94 for (
unsigned i = 0; i < n; i++)
95 output[i] = filter(input[i]);
104template <
class i_type>
136 if (alpha < 0 || alpha > 1)
137 throw std::out_of_range(
"Alpha must be in [0, 1]");
154template <
class i_type>
167template <
class i_type>
169 const i_type input[],
172 for (
unsigned i = 0; i < n; i++)
173 output[i] =
filter(input[i]);
gr_complexd prev_output() const
Definition: single_pole_iir.h:146
double d_alpha
Definition: single_pole_iir.h:149
void reset()
reset state to zero
Definition: single_pole_iir.h:144
single_pole_iir(double alpha=1.0)
construct new single pole IIR with given alpha
Definition: single_pole_iir.h:113
void set_taps(double alpha)
install alpha as the current taps.
Definition: single_pole_iir.h:134
double d_one_minus_alpha
Definition: single_pole_iir.h:150
gr_complexd d_prev_output
Definition: single_pole_iir.h:151
class template for single pole IIR filter
Definition: single_pole_iir.h:26
o_type prev_output() const
Definition: single_pole_iir.h:66
single_pole_iir(tap_type alpha=1.0)
construct new single pole IIR with given alpha
Definition: single_pole_iir.h:33
o_type filter(const i_type input)
compute a single output value.
Definition: single_pole_iir.h:78
void reset()
reset state to zero
Definition: single_pole_iir.h:64
tap_type d_one_minus_alpha
Definition: single_pole_iir.h:70
tap_type d_alpha
Definition: single_pole_iir.h:69
o_type d_prev_output
Definition: single_pole_iir.h:71
void filterN(o_type output[], const i_type input[], unsigned long n)
compute an array of N output values. input must have n valid entries.
Definition: single_pole_iir.h:90
void set_taps(tap_type alpha)
install alpha as the current taps.
Definition: single_pole_iir.h:54
std::complex< double > gr_complexd
Definition: gr_complex.h:16
std::complex< float > gr_complex
Definition: gr_complex.h:15
GNU Radio logging wrapper.
Definition: basic_block.h:29