C interface for Impulse Response. More...

afError af_filter1D_S (float *d_out, unsigned len_in, const float *d_in, unsigned len_a, const float *h_a, unsigned len_b, const float *h_b, const float *d_init, float *d_final, unsigned Nin, unsigned Ninit)
 
afError af_filter1D_C (cfloat *d_out, unsigned len_in, const cfloat *d_in, unsigned len_a, const float *h_a, unsigned len_b, const float *h_b, const cfloat *d_init, cfloat *d_final, unsigned Nin, unsigned Ninit)
 Complex, single-precision, Transposed direct form II filtering. More...
 
afError af_filter1D_D (double *d_out, unsigned len_in, const double *d_in, unsigned len_a, const double *h_a, unsigned len_b, const double *h_b, const double *d_init, double *d_final, unsigned Nin, unsigned Ninit)
 Double-precision, Transposed direct form II filtering. More...
 
afError af_filter1D_Z (cdouble *d_out, unsigned len_in, const cdouble *d_in, unsigned len_a, const double *h_a, unsigned len_b, const double *h_b, const cdouble *d_init, cdouble *d_final, unsigned Nin, unsigned Ninit)
 Complex, single-precision, Transposed direct form II filtering. More...
 

Detailed Description

C interface for Impulse Response.

Apply an infinite impulse response filter (transposed Direct Form II implementation).

If a is scalar this defaults to the faster Finite Impulse Response, i.e. fir. The IIR is defined as:

\[ a_0*y_{n-1} = b_0*x_{n-1} + b_1*x_{n-2} + \ldots + b_{nb-1}*x_{n-nb-1} - a_1*y_{n-2} - \ldots - a_{na-1}*y_{n-na-1} \]

array a = seq(1, 8);
a = a / 10.0f;
print(a);
// a = 0.1000
// 0.2000
// 0.3000
// 0.4000
// 0.5000
// 0.6000
// 0.7000
// 0.8000
array b = seq(1, 8);
print(b);
// b = 1.0000
// 2.0000
// 3.0000
// 4.0000
// 5.0000
// 6.0000
// 7.0000
// 8.0000
array x = randn(8, 1);
array f = iir(b, a, x);
print(f);
// f = 2.9254
// -7.1836
// 1.0000
// -3.9320
// 25.4702
// -0.0344
// 0.0829
// -2.5098

Function Documentation

afError af_filter1D_S ( float *  d_out,
unsigned  len_in,
const float *  d_in,
unsigned  len_a,
const float *  h_a,
unsigned  len_b,
const float *  h_b,
const float *  d_init,
float *  d_final,
unsigned  Nin,
unsigned  Ninit 
)
Parameters
[out]d_outThe filtered output
[in]len_inSize of input array
[in]d_inInput to the filter
[in]len_aNumber of feed-forward co-efficients (maximum 50)
[in]h_aFeed-forward co-efficients
[in]len_bNumber of feed-forward co-efficients (maximum 50)
[in]h_bFeed-back co-efficients
[in]d_initInitial value of the delay units
[out]d_finalFinal value of the delay units
[in]NinNumber of input batches
[in]NinitNumber of initial conditionsSingle-precision, Transposed direct form II filtering
afError af_filter1D_C ( cfloat d_out,
unsigned  len_in,
const cfloat d_in,
unsigned  len_a,
const float *  h_a,
unsigned  len_b,
const float *  h_b,
const cfloat d_init,
cfloat d_final,
unsigned  Nin,
unsigned  Ninit 
)

Complex, single-precision, Transposed direct form II filtering.

afError af_filter1D_D ( double *  d_out,
unsigned  len_in,
const double *  d_in,
unsigned  len_a,
const double *  h_a,
unsigned  len_b,
const double *  h_b,
const double *  d_init,
double *  d_final,
unsigned  Nin,
unsigned  Ninit 
)

Double-precision, Transposed direct form II filtering.

afError af_filter1D_Z ( cdouble d_out,
unsigned  len_in,
const cdouble d_in,
unsigned  len_a,
const double *  h_a,
unsigned  len_b,
const double *  h_b,
const cdouble d_init,
cdouble d_final,
unsigned  Nin,
unsigned  Ninit 
)

Complex, single-precision, Transposed direct form II filtering.