23 #ifndef INCLUDED_SINGLE_POLE_IIR_H 24 #define INCLUDED_SINGLE_POLE_IIR_H 26 #include <gnuradio/filter/api.h> 28 #include <gnuradio/gr_complex.h> 31 namespace CyberRadio {
36 template<
class o_type,
class i_type,
class tap_type>
56 o_type
filter(
const i_type input);
62 void filterN(o_type output[],
const i_type input[],
unsigned long n);
69 if(alpha < 0 || alpha > 1)
70 throw std::out_of_range(
"Alpha must be in [0, 1]\n");
95 template<
class o_type,
class i_type,
class tap_type>
101 if (d_reset_output) {
103 d_reset_output =
false;
105 output = d_alpha * input + d_one_minus_alpha * d_prev_output;
107 d_prev_output = output;
109 return (o_type) output;
113 template<
class o_type,
class i_type,
class tap_type>
116 const i_type input[],
119 for(
unsigned i = 0; i < n; i++)
120 output[i] = filter(input[i]);
128 template<
class i_type>
147 gr_complex
filter(
const i_type input);
153 void filterN(gr_complex output[],
const i_type input[],
unsigned long n);
160 if(alpha < 0 || alpha > 1)
161 throw std::out_of_range(
"Alpha must be in [0, 1]\n");
181 template<
class i_type>
190 return (gr_complex) output;
195 template<
class i_type>
198 const i_type input[],
201 for(
unsigned i = 0; i < n; i++)
202 output[i] =
filter(input[i]);
bool d_reset_output
Definition: single_pole_iir.h:89
void reset()
reset state to zero
Definition: single_pole_iir.h:168
single_pole_iir(tap_type alpha=1.0)
construct new single pole IIR with given alpha
Definition: single_pole_iir.h:45
double d_one_minus_alpha
Definition: single_pole_iir.h:177
void reset()
reset state to zero
Definition: single_pole_iir.h:77
gr_complexd d_prev_output
Definition: single_pole_iir.h:178
single_pole_iir(double alpha=1.0)
construct new single pole IIR with given alpha
Definition: single_pole_iir.h:137
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:115
o_type filter(const i_type input)
compute a single output value.
Definition: single_pole_iir.h:97
tap_type d_one_minus_alpha
Definition: single_pole_iir.h:87
tap_type d_alpha
Definition: single_pole_iir.h:86
void set_taps(tap_type alpha)
install alpha as the current taps.
Definition: single_pole_iir.h:67
void set_taps(double alpha)
install alpha as the current taps.
Definition: single_pole_iir.h:158
Provides GNU Radio blocks.
Definition: NDR651_duc_sink_mk2.h:21
o_type d_prev_output
Definition: single_pole_iir.h:88
o_type prev_output() const
Definition: single_pole_iir.h:83
double d_alpha
Definition: single_pole_iir.h:176
class template for single pole IIR filter
Definition: single_pole_iir.h:37
gr_complexd prev_output() const
Definition: single_pole_iir.h:173