//////////////////////////////// CPP ////////////////////////////////
| 183 | ///////////////////////////////////// CPP //////////////////////////////// |
| 184 | // |
| 185 | TEST(NearestNeighbourSSD, CPP) { |
| 186 | UNSUPPORTED_BACKEND(AF_BACKEND_ONEAPI); |
| 187 | vector<dim4> numDims; |
| 188 | vector<vector<uint>> in; |
| 189 | vector<vector<uint>> tests; |
| 190 | |
| 191 | readTests<uint, uint, uint>(TEST_DIR |
| 192 | "/nearest_neighbour/ssd_500_5000_dim0.test", |
| 193 | numDims, in, tests); |
| 194 | |
| 195 | dim4 qDims = numDims[0]; |
| 196 | dim4 tDims = numDims[1]; |
| 197 | |
| 198 | array query(qDims, &(in[0].front())); |
| 199 | array train(tDims, &(in[1].front())); |
| 200 | |
| 201 | array idx, dist; |
| 202 | nearestNeighbour(idx, dist, query, train, 0, 1, AF_SSD); |
| 203 | |
| 204 | vector<uint> goldIdx = tests[0]; |
| 205 | vector<uint> goldDist = tests[1]; |
| 206 | size_t nElems = goldIdx.size(); |
| 207 | uint *outIdx = new uint[nElems]; |
| 208 | uint *outDist = new uint[nElems]; |
| 209 | |
| 210 | idx.host(outIdx); |
| 211 | dist.host(outDist); |
| 212 | |
| 213 | for (size_t elIter = 0; elIter < nElems; ++elIter) { |
| 214 | ASSERT_EQ(goldDist[elIter], outDist[elIter]) |
| 215 | << "at: " << elIter << endl; |
| 216 | } |
| 217 | |
| 218 | delete[] outIdx; |
| 219 | delete[] outDist; |
| 220 | } |
| 221 | |
| 222 | TEST(NearestNeighbourSAD, CPP) { |
| 223 | UNSUPPORTED_BACKEND(AF_BACKEND_ONEAPI); |
nothing calls this directly
no test coverage detected