mlpack  2.0.1
neighbor_search_stat.hpp
Go to the documentation of this file.
1 
15 #ifndef __MLPACK_METHODS_NEIGHBOR_SEARCH_NEIGHBOR_SEARCH_STAT_HPP
16 #define __MLPACK_METHODS_NEIGHBOR_SEARCH_NEIGHBOR_SEARCH_STAT_HPP
17 
18 #include <mlpack/core.hpp>
19 
20 namespace mlpack {
21 namespace neighbor {
22 
27 template<typename SortPolicy>
29 {
30  private:
33  double firstBound;
38  double secondBound;
40  double bound;
41 
45  double lastDistance;
46 
47  public:
53  firstBound(SortPolicy::WorstDistance()),
54  secondBound(SortPolicy::WorstDistance()),
55  bound(SortPolicy::WorstDistance()),
56  lastDistance(0.0) { }
57 
62  template<typename TreeType>
63  NeighborSearchStat(TreeType& /* node */) :
64  firstBound(SortPolicy::WorstDistance()),
65  secondBound(SortPolicy::WorstDistance()),
66  bound(SortPolicy::WorstDistance()),
67  lastDistance(0.0) { }
68 
70  double FirstBound() const { return firstBound; }
72  double& FirstBound() { return firstBound; }
74  double SecondBound() const { return secondBound; }
76  double& SecondBound() { return secondBound; }
78  double Bound() const { return bound; }
80  double& Bound() { return bound; }
82  double LastDistance() const { return lastDistance; }
84  double& LastDistance() { return lastDistance; }
85 
87  template<typename Archive>
88  void Serialize(Archive& ar, const unsigned int /* version */)
89  {
90  using data::CreateNVP;
91 
92  ar & CreateNVP(firstBound, "firstBound");
93  ar & CreateNVP(secondBound, "secondBound");
94  ar & CreateNVP(bound, "bound");
95  ar & CreateNVP(lastDistance, "lastDistance");
96  }
97 };
98 
99 } // namespace neighbor
100 } // namespace mlpack
101 
102 #endif
NeighborSearchStat(TreeType &)
Initialization for a fully initialized node.
double secondBound
The second bound on the node&#39;s neighbor distances (B_2).
Linear algebra utility functions, generally performed on matrices or vectors.
FirstShim< T > CreateNVP(T &t, const std::string &name, typename boost::enable_if< HasSerialize< T >>::type *=0)
Call this function to produce a name-value pair; this is similar to BOOST_SERIALIZATION_NVP(), but should be used for types that have a Serialize() function (or contain a type that has a Serialize() function) instead of a serialize() function.
double lastDistance
The last distance evaluation.
Extra data for each node in the tree.
void * lastDistanceNode
The last distance evaluation node.
NeighborSearchStat()
Initialize the statistic with the worst possible distance according to our sorting policy...
double firstBound
The first bound on the node&#39;s neighbor distances (B_1).
double SecondBound() const
Get the second bound.
double Bound() const
Get the overall bound (the better of the two bounds).
double & Bound()
Modify the overall bound (it should be the better of the two bounds).
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
double & FirstBound()
Modify the first bound.
double & SecondBound()
Modify the second bound.
double LastDistance() const
Get the last distance calculation.
double bound
The better of the two bounds.
void Serialize(Archive &ar, const unsigned int)
Serialize the statistic to/from an archive.
double FirstBound() const
Get the first bound.
double & LastDistance()
Modify the last distance calculation.