RTF_CREATE_FILTER(3)

πŸ’– RTF_CREATE_FILTER πŸ’–

okay bestie, we're diving into rtf_create_filter(3) from the rtfilter library β€” and yes, the vibe is "custom filter, made by you, for you" ✨


🌸 NAME 🌸

rtf_create_filter β€” creates a custom filter πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <rtfilter.h>

hfilter rtf_create_filter(unsigned int nchann, int proctype,
                          unsigned int num_len, const void *num,
                          unsigned int denum_len, const void *denum,
                          int type);

πŸ¦‹ DESCRIPTION πŸ¦‹

So this function creates and initializes a digital linear filter, and it's giving rational Z-transform realness πŸ’– It processes nchann channels, and the data type it's working with is whatever proctype says.

The numerator and the denominator of that rational expression? They come from two arrays β€” num and denum β€” holding the coefficients in ascending order of the 2 polynoms. How many elements live in each array is controlled by num_len and enum_len. And here's the cute part: denum_len is allowed to be equal to zero, and denum is allowed to be NULL too 🫢 In that case, the denominator just gets set to 1. The data type of the values inside num and denum is specified by type.

proctype and type have to be one of these constants, no cap:

  • RTF_FLOAT β€” specifies real single precision (float)
  • RTF_DOUBLE β€” specifies real double precision (double)
  • RTF_CFLOAT β€” specifies complex single precision (complex float)
  • RTF_CDOUBLE β€” specifies complex double precision (complex double)

Now, the expected data type of the filter's output has the same precision as the one specified by proctype, and it's complex if proctype or type specifies a complex type. Said otherwise (fr fr):

  • If proctype is RTF_FLOAT or RTF_CFLOAT, then the output data type will have single precision. Otherwise it will have double precision.
  • If proctype or type specifies a complex type, then the output will be complex as well. Otherwise, it will be real.

rtf_create_filter() can be used to use a filter that has been designed somewhere else πŸ‘€ In particular, this function can be used directly with the output of filter design function of MATLAB. In such case, the usual B and A arrays returned by the filter design functions corresponds exactly to num and denum respectively. iconic tbh πŸŽ€


πŸ’€ RETURN VALUE πŸ’€

Returns the handle to the created filter in case of success, NULL otherwise. that's it, that's the deal 🫑


πŸ”₯ PERFORMANCE CONSIDERATION πŸ”₯

See note of rtf_filter(3) β€” yes, go look, it's important, I'm not gonna gatekeep 🌈


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page bestie, you ate πŸ’… EPFL, 2010, RTF_CREATE_FILTER(3) β€” go build something gorgeous with it πŸ¦‹βœ¨

πŸ“¦ where this page comes from