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 double WorstDistance()
Return what should represent the worst possible distance with this particular sort policy...
static double CombineBest(const double a, const double b)
Return the best combination of the two distances.
Linear algebra utility functions, generally performed on matrices or vectors.
static double Relax(const double value, const double epsilon)
Return the given value relaxed.
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.
This class implements the necessary methods for the SortPolicy template parameter of the NeighborSear...
static double CombineWorst(const double a, const double b)
Return the worst combination of the two distances.
static double ConvertToScore(const double distance)
Convert the given distance to a score.
static size_t GetBestChild(const TreeType &queryNode, TreeType &referenceNode)
Return the best child according to this sort policy.
static double ConvertToDistance(const double score)
Convert the given score back to a distance.
static size_t GetBestChild(const VecType &queryPoint, TreeType &referenceNode)
Return the best child according to this sort policy.
static double BestNodeToNodeDistance(const TreeType *queryNode, const TreeType *referenceNode)
Return the best possible distance between two nodes.
static double BestDistance()
Return what should represent the best possible distance with this particular sort policy...
static bool IsBetter(const double value, const double ref)
Return whether or not value is "better" than ref.