diff options
author | Arnur Nigmetov <a.nigmetov@gmail.com> | 2018-01-20 19:11:29 +0100 |
---|---|---|
committer | Arnur Nigmetov <a.nigmetov@gmail.com> | 2018-01-20 19:11:29 +0100 |
commit | 0cc35ad04f9c2997014d7cf62a12f697e79fb534 (patch) | |
tree | 744c07bc2c12fba193934ac98417c5063bead189 /geom_matching/wasserstein/include/dnn/local/search-functors.h | |
parent | 3552ce68bc7654df35da471bd937b09a9fde101f (diff) |
Major rewrite, templatized version
Diffstat (limited to 'geom_matching/wasserstein/include/dnn/local/search-functors.h')
-rw-r--r-- | geom_matching/wasserstein/include/dnn/local/search-functors.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/geom_matching/wasserstein/include/dnn/local/search-functors.h b/geom_matching/wasserstein/include/dnn/local/search-functors.h index f257d0c..1419f22 100644 --- a/geom_matching/wasserstein/include/dnn/local/search-functors.h +++ b/geom_matching/wasserstein/include/dnn/local/search-functors.h @@ -1,8 +1,12 @@ -#ifndef DNN_LOCAL_SEARCH_FUNCTORS_H -#define DNN_LOCAL_SEARCH_FUNCTORS_H +#ifndef HERA_WS_DNN_LOCAL_SEARCH_FUNCTORS_H +#define HERA_WS_DNN_LOCAL_SEARCH_FUNCTORS_H #include <boost/range/algorithm/heap_algorithm.hpp> +namespace hera +{ +namespace ws +{ namespace dnn { @@ -28,7 +32,7 @@ struct NNRecord typedef typename HandleDistance::PointHandle PointHandle; typedef typename HandleDistance::DistanceType DistanceType; - NNRecord() { result.d = std::numeric_limits<DistanceType>::infinity(); } + NNRecord() { result.d = std::numeric_limits<DistanceType>::max(); } DistanceType operator()(PointHandle p, DistanceType d) { if (d < result.d) { result.p = p; result.d = d; } return result.d; } HandleDistance result; }; @@ -67,7 +71,7 @@ struct kNNRecord result.push_back(HandleDistance(p,d)); boost::push_heap(result); if (result.size() < k) - return std::numeric_limits<DistanceType>::infinity(); + return std::numeric_limits<DistanceType>::max(); } else if (d < result[0].d) { boost::pop_heap(result); @@ -84,6 +88,8 @@ struct kNNRecord HDContainer result; }; -} +} // dnn +} // ws +} // hera #endif // DNN_LOCAL_SEARCH_FUNCTORS_H |