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

Function fftTest

test/threading.cpp:255–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253
254template<typename inType, typename outType, bool isInverse>
255void fftTest(int targetDevice, string pTestFile, dim_t pad0 = 0, dim_t pad1 = 0,
256 dim_t pad2 = 0) {
257 SUPPORTED_TYPE_CHECK(inType);
258 SUPPORTED_TYPE_CHECK(outType);
259
260 vector<dim4> numDims;
261 vector<vector<inType>> in;
262 vector<vector<outType>> tests;
263
264 readTestsFromFile<inType, outType>(pTestFile, numDims, in, tests);
265
266 dim4 dims = numDims[0];
267 af_array outArray = 0;
268 af_array inArray = 0;
269
270 ASSERT_SUCCESS(af_set_device(targetDevice));
271
272 ASSERT_SUCCESS(af_create_array(&inArray, &(in[0].front()), dims.ndims(),
273 dims.get(),
274 (af_dtype)dtype_traits<inType>::af_type));
275
276 if (isInverse) {
277 switch (dims.ndims()) {
278 case 1:
279 ASSERT_SUCCESS(af_ifft(&outArray, inArray, 1.0, pad0));
280 break;
281 case 2:
282 ASSERT_SUCCESS(af_ifft2(&outArray, inArray, 1.0, pad0, pad1));
283 break;
284 case 3:
285 ASSERT_SUCCESS(
286 af_ifft3(&outArray, inArray, 1.0, pad0, pad1, pad2));
287 break;
288 default:
289 throw std::runtime_error(
290 "This error shouldn't happen, pls check");
291 }
292 } else {
293 switch (dims.ndims()) {
294 case 1:
295 ASSERT_SUCCESS(af_fft(&outArray, inArray, 1.0, pad0));
296 break;
297 case 2:
298 ASSERT_SUCCESS(af_fft2(&outArray, inArray, 1.0, pad0, pad1));
299 break;
300 case 3:
301 ASSERT_SUCCESS(
302 af_fft3(&outArray, inArray, 1.0, pad0, pad1, pad2));
303 break;
304 default:
305 throw std::runtime_error(
306 "This error shouldn't happen, pls check");
307 }
308 }
309
310 size_t out_size = tests[0].size();
311 outType* outData = new outType[out_size];
312 ASSERT_SUCCESS(af_get_data_ptr((void*)outData, outArray));

Callers

nothing calls this directly

Calls 13

absFunction · 0.70
af_set_deviceFunction · 0.50
af_create_arrayFunction · 0.50
af_ifftFunction · 0.50
af_ifft2Function · 0.50
af_ifft3Function · 0.50
af_fftFunction · 0.50
af_fft2Function · 0.50
af_fft3Function · 0.50
af_get_data_ptrFunction · 0.50
af_release_arrayFunction · 0.50
ndimsMethod · 0.45

Tested by

no test coverage detected