13 #ifndef MLPACK_METHODS_NEIGHBOR_SEARCH_FURTHEST_NEIGHBOR_SORT_HPP 14 #define MLPACK_METHODS_NEIGHBOR_SEARCH_FURTHEST_NEIGHBOR_SORT_HPP 39 static inline bool IsBetter(
const double value,
const double ref)
41 return (value >= ref);
49 template<
typename TreeType>
51 const TreeType* referenceNode);
59 template<
typename TreeType>
61 const TreeType* referenceNode,
62 const double centerToCenterDistance);
76 template<
typename TreeType>
78 const TreeType* referenceNode,
79 const TreeType* referenceChildNode,
80 const double centerToCenterDistance);
87 template<
typename VecType,
typename TreeType>
89 const TreeType* referenceNode);
97 template<
typename VecType,
typename TreeType>
99 const TreeType* referenceNode,
100 const double pointToCenterDistance);
106 template<
typename VecType,
typename TreeType>
107 static size_t GetBestChild(
const VecType& queryPoint, TreeType& referenceNode)
109 return referenceNode.GetFurthestChild(queryPoint);
116 template<
typename TreeType>
117 static size_t GetBestChild(
const TreeType& queryNode, TreeType& referenceNode)
119 return referenceNode.GetFurthestChild(queryNode);
145 if (a == DBL_MAX || b == DBL_MAX)
154 {
return std::max(a - b, 0.0); }
164 static inline double Relax(
const double value,
const double epsilon)
168 if (value == DBL_MAX || epsilon >= 1)
170 return (1 / (1 - epsilon)) * value;
180 if (distance == DBL_MAX)
182 else if (distance == 0.0)
185 return (1.0 / distance);
207 #include "furthest_neighbor_sort_impl.hpp" static size_t GetBestChild(const TreeType &queryNode, TreeType &referenceNode)
Return the best child according to this sort policy.
Definition: furthest_neighbor_sort.hpp:117
static double ConvertToDistance(const double score)
Convert the given score back to a distance.
Definition: furthest_neighbor_sort.hpp:193
static double ConvertToScore(const double distance)
Convert the given distance to a score.
Definition: furthest_neighbor_sort.hpp:178
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
static double CombineWorst(const double a, const double b)
Return the worst combination of the two distances.
Definition: furthest_neighbor_sort.hpp:153
The core includes that mlpack expects; standard C++ includes and Armadillo.
static double BestPointToNodeDistance(const VecType &queryPoint, const TreeType *referenceNode)
Return the best possible distance between a node and a point.
Definition: furthest_neighbor_sort_impl.hpp:50
static double CombineBest(const double a, const double b)
Return the best combination of the two distances.
Definition: furthest_neighbor_sort.hpp:143
This class implements the necessary methods for the SortPolicy template parameter of the NeighborSear...
Definition: furthest_neighbor_sort.hpp:27
static size_t GetBestChild(const VecType &queryPoint, TreeType &referenceNode)
Return the best child according to this sort policy.
Definition: furthest_neighbor_sort.hpp:107
static double Relax(const double value, const double epsilon)
Return the given value relaxed.
Definition: furthest_neighbor_sort.hpp:164
static bool IsBetter(const double value, const double ref)
Return whether or not value is "better" than ref.
Definition: furthest_neighbor_sort.hpp:39
static double BestDistance()
Return what should represent the best possible distance with this particular sort policy...
Definition: furthest_neighbor_sort.hpp:138
static double WorstDistance()
Return what should represent the worst possible distance with this particular sort policy...
Definition: furthest_neighbor_sort.hpp:129
static double BestNodeToNodeDistance(const TreeType *queryNode, const TreeType *referenceNode)
Return the best possible distance between two nodes.
Definition: furthest_neighbor_sort_impl.hpp:20