mlpack: src/mlpack/methods/neighbor_search/neighbor_search_stat.hpp Source File
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;
41  double auxBound;
43  double lastDistance;
44 
45  public:
51  firstBound(SortPolicy::WorstDistance()),
52  secondBound(SortPolicy::WorstDistance()),
53  auxBound(SortPolicy::WorstDistance()),
54  lastDistance(0.0) { }
55 
60  template<typename TreeType>
61  NeighborSearchStat(TreeType& /* node */) :
62  firstBound(SortPolicy::WorstDistance()),
63  secondBound(SortPolicy::WorstDistance()),
64  auxBound(SortPolicy::WorstDistance()),
65  lastDistance(0.0) { }
66 
70  void Reset()
71  {
72  firstBound = SortPolicy::WorstDistance();
73  secondBound = SortPolicy::WorstDistance();
74  auxBound = SortPolicy::WorstDistance();
75  lastDistance = 0.0;
76  }
77 
79  double FirstBound() const { return firstBound; }
81  double& FirstBound() { return firstBound; }
83  double SecondBound() const { return secondBound; }
85  double& SecondBound() { return secondBound; }
87  double AuxBound() const { return auxBound; }
89  double& AuxBound() { return auxBound; }
91  double LastDistance() const { return lastDistance; }
93  double& LastDistance() { return lastDistance; }
94 
96  template<typename Archive>
97  void Serialize(Archive& ar, const unsigned int /* version */)
98  {
99  using data::CreateNVP;
100 
101  ar & CreateNVP(firstBound, "firstBound");
102  ar & CreateNVP(secondBound, "secondBound");
103  ar & CreateNVP(auxBound, "auxBound");
104  ar & CreateNVP(lastDistance, "lastDistance");
105  }
106 };
107 
108 } // namespace neighbor
109 } // namespace mlpack
110 
111 #endif
void Reset()
Reset statistic parameters to initial values.
NeighborSearchStat(TreeType &)
Initialization for a fully initialized node.
double secondBound
The second bound on the node&#39;s neighbor distances (B_2).
double & AuxBound()
Modify the aux bound.
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.
double FirstBound() const
Get the first bound.
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).
Include all of the base components required to write mlpack methods, and the main mlpack Doxygen docu...
double & FirstBound()
Modify the first bound.
double LastDistance() const
Get the last distance calculation.
double & SecondBound()
Modify the second bound.
double auxBound
The aux bound on the node&#39;s neighbor distances (B_aux).
void Serialize(Archive &ar, const unsigned int)
Serialize the statistic to/from an archive.
double SecondBound() const
Get the second bound.
double AuxBound() const
Get the aux bound.
double & LastDistance()
Modify the last distance calculation.