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

Function firTest

test/iir.cpp:43–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41
42template<typename T>
43void firTest(const int xrows, const int xcols, const int brows,
44 const int bcols) {
45 SUPPORTED_TYPE_CHECK(T);
46 try {
47 dtype ty = (dtype)dtype_traits<T>::af_type;
48 array x = randu(xrows, xcols, ty);
49 array b = randu(brows, bcols, ty);
50
51 array y = fir(b, x);
52 array c = convolve1(x, b, AF_CONV_EXPAND);
53
54 const int ycols = xcols * bcols;
55 const int crows = xrows + brows - 1;
56 const int yrows = xrows;
57
58 vector<T> hy(yrows * ycols);
59 vector<T> hc(crows * ycols);
60
61 y.host(&hy[0]);
62 c.host(&hc[0]);
63
64 for (int j = 0; j < ycols; j++) {
65 for (int i = 0; i < yrows; i++) {
66 ASSERT_NEAR(real(hy[j * yrows + i]), real(hc[j * crows + i]),
67 0.01);
68 }
69 }
70 } catch (exception &ex) { FAIL() << ex.what(); }
71}
72
73TYPED_TEST(filter, firVecVec) { firTest<TypeParam>(10000, 1, 1000, 1); }
74

Callers

nothing calls this directly

Calls 5

randuFunction · 0.85
firFunction · 0.85
convolve1Function · 0.85
hostMethod · 0.80
realFunction · 0.70

Tested by

no test coverage detected