| 35 | } |
| 36 | |
| 37 | Real |
| 38 | compute_average_distance(NeighborhoodSearch const& nsearch) |
| 39 | { |
| 40 | unsigned long long res = 0; |
| 41 | auto const& d = nsearch.point_set(0); |
| 42 | unsigned long long count = 0; |
| 43 | for (int i = 0; i < d.n_points(); ++i) |
| 44 | { |
| 45 | std::size_t nn = d.n_neighbors(i); |
| 46 | for (int j = 0; j < nn; ++j) |
| 47 | { |
| 48 | CompactNSearch::PointID const& k = d.neighbor(i, j); |
| 49 | res += std::abs(i - static_cast<int>(k.point_id)); |
| 50 | count++; |
| 51 | } |
| 52 | } |
| 53 | return static_cast<Real>(res) / static_cast<Real>(count); |
| 54 | } |
| 55 | |
| 56 | std::vector<std::vector<unsigned int>> |
| 57 | brute_force_search() |
no test coverage detected