23 #ifndef __MLPACK_METHODS_NEIGHBOR_SEARCH_NEAREST_NEIGHBOR_SORT_HPP
24 #define __MLPACK_METHODS_NEIGHBOR_SEARCH_NEAREST_NEIGHBOR_SORT_HPP
58 static size_t SortDistance(
const arma::vec& list,
double newDistance);
69 static inline bool IsBetter(
const double value,
const double ref)
79 template<
typename TreeType>
81 const TreeType* referenceNode);
89 template<
typename TreeType>
91 const TreeType* referenceNode,
92 const double centerToCenterDistance);
106 template<
typename TreeType>
108 const TreeType* referenceNode,
109 const TreeType* referenceChildNode,
110 const double centerToCenterDistance);
116 template<
typename TreeType>
118 const TreeType* referenceNode);
126 template<
typename TreeType>
128 const TreeType* referenceNode,
129 const double pointToCenterDistance);
154 return std::max(a - b, 0.0);
162 if (a == DBL_MAX || b == DBL_MAX)
172 #include "nearest_neighbor_sort_impl.hpp"
static double CombineWorst(const double a, const double b)
Return the worst combination of the two distances.
static double CombineBest(const double a, const double b)
Return the best combination of the two distances.
static double WorstDistance()
Return what should represent the worst possible distance with this particular sort policy...
This class implements the necessary methods for the SortPolicy template parameter of the NeighborSear...
static size_t SortDistance(const arma::vec &list, double newDistance)
Return the index in the vector where the new distance should be inserted, or (size_t() - 1) if it sho...
static bool IsBetter(const double value, const double ref)
Return whether or not value is "better" than ref.
static double BestDistance()
Return what should represent the best possible distance with this particular sort policy...
static double BestNodeToNodeDistance(const TreeType *queryNode, const TreeType *referenceNode)
Return the best possible distance between two nodes.
static double BestPointToNodeDistance(const arma::vec &queryPoint, const TreeType *referenceNode)
Return the best possible distance between a node and a point.