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

Function stdevAllTest

test/stdev.cpp:210–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208
209template<typename T>
210void stdevAllTest(string pFileName, const bool useDeprecatedAPI = false) {
211 typedef typename sdOutType<T>::type outType;
212 SUPPORTED_TYPE_CHECK(T);
213 SUPPORTED_TYPE_CHECK(outType);
214
215 vector<dim4> numDims;
216 vector<vector<int>> in;
217 vector<vector<float>> tests;
218
219 readTestsFromFile<int, float>(pFileName, numDims, in, tests);
220
221 dim4 dims = numDims[0];
222 vector<T> input(in[0].size());
223 transform(in[0].begin(), in[0].end(), input.begin(), convert_to<T, int>);
224
225 array a(dims, &(input.front()));
226#pragma GCC diagnostic push
227#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
228 outType b = (useDeprecatedAPI ? stdev<outType>(a)
229 : stdev<outType>(a, AF_VARIANCE_POPULATION));
230#pragma GCC diagnostic pop
231
232 vector<outType> currGoldBar(tests[0].size());
233 transform(tests[0].begin(), tests[0].end(), currGoldBar.begin(),
234 convert_to<outType, float>);
235
236 ASSERT_NEAR(::real(currGoldBar[0]), ::real(b), 1.0e-3);
237 ASSERT_NEAR(::imag(currGoldBar[0]), ::imag(b), 1.0e-3);
238}
239
240TYPED_TEST(StandardDev, All) {
241 stdevAllTest<TypeParam>(string(TEST_DIR "/stdev/mat_10x10_scalar.test"));

Callers

nothing calls this directly

Calls 3

realFunction · 0.70
imagFunction · 0.70
transformFunction · 0.50

Tested by

no test coverage detected