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

Function trsCPPConjTest

test/transpose.cpp:195–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193
194template<typename T>
195void trsCPPConjTest(dim_t d0, dim_t d1 = 1, dim_t d2 = 1, dim_t d3 = 1) {
196 vector<dim4> numDims;
197
198 dim4 dims(d0, d1, d2, d3);
199
200 SUPPORTED_TYPE_CHECK(T);
201
202 array input = randu(dims, (af_dtype)dtype_traits<T>::af_type);
203 array output_t = transpose(input, false);
204 array output_c = transpose(input, true);
205
206 T *tData = new T[dims.elements()];
207 T *cData = new T[dims.elements()];
208 output_t.host((void *)tData);
209 output_c.host((void *)cData);
210
211 size_t nElems = dims.elements();
212 for (size_t elIter = 0; elIter < nElems; ++elIter) {
213 ASSERT_NEAR(real(tData[elIter]), real(cData[elIter]), 1e-6)
214 << "at: " << elIter << endl;
215 ASSERT_NEAR(-imag(tData[elIter]), imag(cData[elIter]), 1e-6)
216 << "at: " << elIter << endl;
217 }
218
219 // cleanup
220 delete[] tData;
221 delete[] cData;
222}
223
224TEST(Transpose, CPP_c32_CONJ40x40) { trsCPPConjTest<cfloat>(40, 40); }
225

Callers

nothing calls this directly

Calls 6

randuFunction · 0.85
hostMethod · 0.80
realFunction · 0.70
imagFunction · 0.70
transposeFunction · 0.50
elementsMethod · 0.45

Tested by

no test coverage detected