31 #ifndef FLANN_GROUND_TRUTH_H_
32 #define FLANN_GROUND_TRUTH_H_
41 template <
typename Distance>
46 typedef typename Distance::ResultType DistanceType;
49 int* match =
new int[n];
50 DistanceType* dists =
new DistanceType[n];
52 dists[0] = distance(dataset[0], query, dataset.
cols);
56 for (
size_t i=1; i<dataset.
rows; ++i) {
57 DistanceType tmp = distance(dataset[i], query, dataset.
cols);
63 else if (tmp < dists[dcnt-1]) {
70 while (j>=1 && dists[j]<dists[j-1]) {
77 for (
size_t i=0; i<nn; ++i) {
78 matches[i] = match[i+skip];
86 template <
typename Distance>
90 for (
size_t i=0; i<testset.
rows; ++i) {
91 find_nearest<Distance>(dataset, testset[i], matches[i], matches.
cols, skip, d);
double Distance(const Point3D< Real > &p1, const Point3D< Real > &p2)
void find_nearest(const Matrix< typename Distance::ElementType > &dataset, typename Distance::ElementType *query, size_t *matches, size_t nn, size_t skip=0, Distance distance=Distance())
void compute_ground_truth(const Matrix< typename Distance::ElementType > &dataset, const Matrix< typename Distance::ElementType > &testset, Matrix< size_t > &matches, int skip=0, Distance d=Distance())
void swap(cloudViewer::core::SmallVectorImpl< T > &LHS, cloudViewer::core::SmallVectorImpl< T > &RHS)
Implement std::swap in terms of SmallVector swap.