furthest_neighbor_sort.hpp
Go to the documentation of this file.00001
00023 #ifndef __MLPACK_METHODS_NEIGHBOR_SEARCH_FURTHEST_NEIGHBOR_SORT_HPP
00024 #define __MLPACK_METHODS_NEIGHBOR_SEARCH_FURTHEST_NEIGHBOR_SORT_HPP
00025
00026 #include <mlpack/core.hpp>
00027
00028 namespace mlpack {
00029 namespace neighbor {
00030
00037 class FurthestNeighborSort
00038 {
00039 public:
00054 static size_t SortDistance(const arma::vec& list, double newDistance);
00055
00065 static inline bool IsBetter(const double value, const double ref)
00066 {
00067 return (value > ref);
00068 }
00069
00075 template<typename TreeType>
00076 static double BestNodeToNodeDistance(const TreeType* queryNode,
00077 const TreeType* referenceNode);
00078
00085 template<typename TreeType>
00086 static double BestNodeToNodeDistance(const TreeType* queryNode,
00087 const TreeType* referenceNode,
00088 const double centerToCenterDistance);
00089
00102 template<typename TreeType>
00103 static double BestNodeToNodeDistance(const TreeType* queryNode,
00104 const TreeType* referenceNode,
00105 const TreeType* referenceChildNode,
00106 const double centerToCenterDistance);
00107
00113 template<typename TreeType>
00114 static double BestPointToNodeDistance(const arma::vec& queryPoint,
00115 const TreeType* referenceNode);
00116
00123 template<typename TreeType>
00124 static double BestPointToNodeDistance(const arma::vec& queryPoint,
00125 const TreeType* referenceNode,
00126 const double pointToCenterDistance);
00127
00135 static inline double WorstDistance() { return 0; }
00136
00144 static inline double BestDistance() { return DBL_MAX; }
00145
00149 static inline double CombineBest(const double a, const double b)
00150 {
00151 if (a == DBL_MAX || b == DBL_MAX)
00152 return DBL_MAX;
00153 return a + b;
00154 }
00155
00159 static inline double CombineWorst(const double a, const double b)
00160 { return std::max(a - b, 0.0); }
00161 };
00162
00163 };
00164 };
00165
00166
00167 #include "furthest_neighbor_sort_impl.hpp"
00168
00169 #endif