MLPACK  1.0.4
nearest_neighbor_sort.hpp
Go to the documentation of this file.
00001 
00023 #ifndef __MLPACK_METHODS_NEIGHBOR_SEARCH_NEAREST_NEIGHBOR_SORT_HPP
00024 #define __MLPACK_METHODS_NEIGHBOR_SEARCH_NEAREST_NEIGHBOR_SORT_HPP
00025 
00026 #include <mlpack/core.hpp>
00027 
00028 namespace mlpack {
00029 namespace neighbor {
00030 
00041 class NearestNeighborSort
00042 {
00043  public:
00058   static size_t SortDistance(const arma::vec& list, double newDistance);
00059 
00069   static inline bool IsBetter(const double value, const double ref)
00070   {
00071     return (value < ref);
00072   }
00073 
00079   template<typename TreeType>
00080   static double BestNodeToNodeDistance(const TreeType* queryNode,
00081                                        const TreeType* referenceNode);
00082 
00089   template<typename TreeType>
00090   static double BestNodeToNodeDistance(const TreeType* queryNode,
00091                                        const TreeType* referenceNode,
00092                                        const double centerToCenterDistance);
00093 
00106   template<typename TreeType>
00107   static double BestNodeToNodeDistance(const TreeType* queryNode,
00108                                        const TreeType* referenceNode,
00109                                        const TreeType* referenceChildNode,
00110                                        const double centerToCenterDistance);
00116   template<typename TreeType>
00117   static double BestPointToNodeDistance(const arma::vec& queryPoint,
00118                                         const TreeType* referenceNode);
00119 
00126   template<typename TreeType>
00127   static double BestPointToNodeDistance(const arma::vec& queryPoint,
00128                                         const TreeType* referenceNode,
00129                                         const double pointToCenterDistance);
00130 
00138   static inline double WorstDistance() { return DBL_MAX; }
00139 
00147   static inline double BestDistance() { return 0.0; }
00148 };
00149 
00150 }; // namespace neighbor
00151 }; // namespace mlpack
00152 
00153 // Include implementation of templated functions.
00154 #include "nearest_neighbor_sort_impl.hpp"
00155 
00156 #endif