filter#

filter provides an interface for executing IIR and FIR filters on tensors. It is primarily used for IIR filters, but it will call the appropriate functions for FIR if the number of recursive coefficients is 0.

Note

This function is currently is not supported with host-based executors (CPU)

template<typename OpA, size_t NR, size_t NNR, typename FilterType>
__MATX_INLINE__ auto matx::filter(const OpA &a, const std::array<FilterType, NR> h_rec, const std::array<FilterType, NNR> h_nonrec)#

FIR and IIR filtering without a plan

matxFilter_t provides an interface for executing recursive (IIR) and non-recursive (FIR) filters. The IIR filter uses the algorithm from “S. Maleki

and M. Burtscher. “Automatic Hierarchical Parallelization of Linear Recurrences.” 23rd ACM International Conference on Architectural Support for

Programming Languages and Operating Systems. March 2018.” for an optimized implementation on highly-parallel processors. While the IIR implementation is fast for recursive filters, it is inefficient for non-recursive filtering. If the number of recursive coefficients is 0, the filter operation will revert to use an algorithm optimized for non-recursive filters.

Note

If you are only using non-recursive filters, it’s advised to use the convolution API directly instead since it can be easier to use.

Template Parameters:
  • OpA – Input type

  • NR – Number of recursive coefficients

  • NNR – Number of non-recursive coefficients

  • FilterType – Type of filter

Parameters:
  • a – Input operator

  • h_rec – Recursive coefficients

  • h_nonrec – Non-recursive coefficients

Examples#

// Perform an IIR filter on "inView" with rCoeffs and nrCoeffs recursive/non-recursive
// coefficients, respectively
(outView = filter(inView, rCoeffs, nrCoeffs)).run(stream);