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

Function TEST

test/hamming.cpp:123–160  ·  view source on GitHub ↗

//////////////////////////////// CPP ////////////////////////////////

Source from the content-addressed store, hash-verified

121///////////////////////////////////// CPP ////////////////////////////////
122//
123TEST(HammingMatcher, CPP) {
124 UNSUPPORTED_BACKEND(AF_BACKEND_ONEAPI);
125 using af::array;
126 using af::dim4;
127
128 vector<dim4> numDims;
129 vector<vector<uint>> in;
130 vector<vector<uint>> tests;
131
132 readTests<uint, uint, int>(
133 TEST_DIR "/hamming/hamming_500_5000_dim0_u32.test", numDims, in, tests);
134
135 dim4 qDims = numDims[0];
136 dim4 tDims = numDims[1];
137
138 array query(qDims, &(in[0].front()));
139 array train(tDims, &(in[1].front()));
140
141 array idx, dist;
142 hammingMatcher(idx, dist, query, train, 0, 1);
143
144 vector<uint> goldIdx = tests[0];
145 vector<uint> goldDist = tests[1];
146 size_t nElems = goldIdx.size();
147 uint *outIdx = new uint[nElems];
148 uint *outDist = new uint[nElems];
149
150 idx.host(outIdx);
151 dist.host(outDist);
152
153 for (size_t elIter = 0; elIter < nElems; ++elIter) {
154 ASSERT_EQ(goldDist[elIter], outDist[elIter])
155 << "at: " << elIter << endl;
156 }
157
158 delete[] outIdx;
159 delete[] outDist;
160}
161
162TEST(HammingMatcher64bit, CPP) {
163 UNSUPPORTED_BACKEND(AF_BACKEND_ONEAPI);

Callers

nothing calls this directly

Calls 2

hammingMatcherFunction · 0.85
hostMethod · 0.80

Tested by

no test coverage detected