MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / iirA0Test

Function iirA0Test

test/iir.cpp:82–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80
81template<typename T>
82void iirA0Test(const int xrows, const int xcols, const int brows,
83 const int bcols) {
84 SUPPORTED_TYPE_CHECK(T);
85 try {
86 dtype ty = (dtype)dtype_traits<T>::af_type;
87 array x = randu(xrows, xcols, ty);
88 array b = randu(brows, bcols, ty);
89 array a = randu(1, bcols, ty);
90 array bNorm = b / tile(a, brows);
91
92 array y = iir(b, a, x);
93 array c = convolve1(x, bNorm, AF_CONV_EXPAND);
94
95 const int ycols = xcols * bcols;
96 const int crows = xrows + brows - 1;
97 const int yrows = xrows;
98
99 vector<T> hy(yrows * ycols);
100 vector<T> hc(crows * ycols);
101
102 y.host(&hy[0]);
103 c.host(&hc[0]);
104
105 for (int j = 0; j < ycols; j++) {
106 for (int i = 0; i < yrows; i++) {
107 ASSERT_NEAR(real(hy[j * yrows + i]), real(hc[j * crows + i]),
108 0.01);
109 }
110 }
111 } catch (exception &ex) { FAIL() << ex.what(); }
112}
113
114TYPED_TEST(filter, iirA0VecVec) { iirA0Test<TypeParam>(10000, 1, 1000, 1); }
115

Callers

nothing calls this directly

Calls 6

randuFunction · 0.85
convolve1Function · 0.85
hostMethod · 0.80
realFunction · 0.70
tileFunction · 0.50
iirFunction · 0.50

Tested by

no test coverage detected