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

Function TEST

test/fftconvolve.cpp:346–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346TEST(FFTConvolve1, CPP) {
347 vector<dim4> numDims;
348 vector<vector<float>> in;
349 vector<vector<float>> tests;
350
351 readTests<float, float, int>(string(TEST_DIR "/convolve/vector.test"),
352 numDims, in, tests);
353
354 //![ex_image_convolve1]
355 // vector<dim4> numDims;
356 // vector<vector<float> > in;
357 array signal(numDims[0], &(in[0].front()));
358 // signal dims = [32 1 1 1]
359 array filter(numDims[1], &(in[1].front()));
360 // filter dims = [4 1 1 1]
361
362 array output = fftConvolve1(signal, filter, AF_CONV_EXPAND);
363 // output dims = [32 1 1 1] - same as input since expand(3rd argument is
364 // false) None of the dimensions > 1 has lenght > 1, so no batch mode is
365 // activated.
366 //![ex_image_convolve1]
367
368 vector<float> currGoldBar = tests[0];
369 size_t nElems = output.elements();
370 vector<float> outData(nElems);
371 output.host(&outData.front());
372
373 for (size_t elIter = 0; elIter < nElems; ++elIter) {
374 ASSERT_NEAR(currGoldBar[elIter], outData[elIter], 1e-2)
375 << "at: " << elIter << endl;
376 }
377}
378
379TEST(FFTConvolve2, CPP) {
380 vector<dim4> numDims;

Callers

nothing calls this directly

Calls 11

fftConvolve1Function · 0.85
fftConvolve2Function · 0.85
fftConvolve3Function · 0.85
randuFunction · 0.85
constantFunction · 0.85
fftConvolveFunction · 0.85
hostMethod · 0.80
absFunction · 0.70
convolveFunction · 0.50
convolve2Function · 0.50
elementsMethod · 0.45

Tested by

no test coverage detected