libiir  1.1.1
Functions
Coefficient handling
C library

Functions

struct iir_coeff_t * iir_coeff_new (int nc, const double *c, int nd, const double *d)
 Create IIR coefficient set.
struct iir_coeff_t * iir_coeff_copy (const struct iir_coeff_t *other)
 Create copy of a set of IIR coefficients.
void iir_coeff_free (struct iir_coeff_t *coeff)
 Free IIR coefficient set.
int iir_coeff_get_nc (const struct iir_coeff_t *coeff)
 Query number of C coefficients.
int iir_coeff_get_nd (const struct iir_coeff_t *coeff)
 Query number of D coefficients.
double iir_coeff_get_c (const struct iir_coeff_t *coeff, int idx)
 Get value of C coefficient.
double iir_coeff_get_d (const struct iir_coeff_t *coeff, int idx)
 Get value of D coefficient.

Detailed Description

The functions in this module present an interface for managing the set of coefficients of a single IIR filter instance. See Structure of IIR filter for the definition of a coefficient set. The coefficient sets form the basic building block of an IIR filter instance (see Basic IIR filtering), which may chain several IIR filters in sequence.

Function Documentation

struct iir_coeff_t* iir_coeff_new ( int  nc,
const double *  c,
int  nd,
const double *  d 
)
read

Create IIR coefficient set.

Parameters
ncNumber of c coefficients.
cArray of c coefficients.
ndNumber of d coefficients.
dArray of d coefficients.
Returns
Pointer to new general IIR filter object.

This function creates a new set of IIR filter coefficients which may be used to create filter instances through iir_filter_new() or chained on to existing instances through iir_filter().

See Structure of IIR filter for a full explanation of the parameters.

struct iir_coeff_t* iir_coeff_copy ( const struct iir_coeff_t *  other)
read

Create copy of a set of IIR coefficients.

Parameters
otherSet of IIR filter coefficients to copy.
Returns
Pointer to new general IIR filter object.

Performs a deep copy of the set of IIR coefficients contained within other.

void iir_coeff_free ( struct iir_coeff_t *  coeff)

Free IIR coefficient set.

Parameters
coeffPointer to IIR coefficient object. May be 0.

Frees a set of IIR filter coefficients previously allocated through iir_coeff_new(). Can be called on a null pointer without consequences. Note that iir_filter_new() and iir_filter_chain() actually store a copy of the coefficients, so it is possible to free coeff even if existing filters are still using its coefficient values.

int iir_coeff_get_nc ( const struct iir_coeff_t *  coeff)

Query number of C coefficients.

Parameters
coeffPointer to IIR coefficient object.
Returns
Number of C coefficients (≥1).
int iir_coeff_get_nd ( const struct iir_coeff_t *  coeff)

Query number of D coefficients.

Parameters
coeffPointer to IIR coefficient object.
Returns
Number of D coefficients (≥1).
double iir_coeff_get_c ( const struct iir_coeff_t *  coeff,
int  idx 
)

Get value of C coefficient.

Parameters
coeffPointer to IIR coefficient object.
idxIndex of coefficient (≥0, < iir_coeff_get_nc()).
Returns
C coefficient value.
double iir_coeff_get_d ( const struct iir_coeff_t *  coeff,
int  idx 
)

Get value of D coefficient.

Parameters
coeffPointer to IIR coefficient object.
idxIndex of coefficient (≥0, < iir_coeff_get_nd()).
Returns
D coefficient value.