| 22 | |
| 23 | template<typename T> |
| 24 | Array<T> iir(const Array<T> &b, const Array<T> &a, const Array<T> &x) { |
| 25 | AF_BATCH_KIND type = x.ndims() == 1 ? AF_BATCH_NONE : AF_BATCH_SAME; |
| 26 | if (x.ndims() != b.ndims()) { |
| 27 | type = (x.ndims() < b.ndims()) ? AF_BATCH_RHS : AF_BATCH_LHS; |
| 28 | } |
| 29 | |
| 30 | // Extract the first N elements |
| 31 | Array<T> c = convolve<T, T>(x, b, type, 1, true); |
| 32 | dim4 cdims = c.dims(); |
| 33 | cdims[0] = x.dims()[0]; |
| 34 | c.resetDims(cdims); |
| 35 | |
| 36 | Array<T> y = createEmptyArray<T>(c.dims()); |
| 37 | |
| 38 | getQueue().enqueue(kernel::iir<T>, y, c, a); |
| 39 | |
| 40 | return y; |
| 41 | } |
| 42 | |
| 43 | #define INSTANTIATE(T) \ |
| 44 | template Array<T> iir(const Array<T> &b, const Array<T> &a, \ |