mlpack  master
ra_query_stat.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_RANN_RA_QUERY_STAT_HPP
14 #define MLPACK_METHODS_RANN_RA_QUERY_STAT_HPP
15 
16 #include <mlpack/prereqs.hpp>
17 
19 
22 
23 namespace mlpack {
24 namespace neighbor {
25 
34 template<typename SortPolicy>
36 {
37  public:
42  RAQueryStat() : bound(SortPolicy::WorstDistance()), numSamplesMade(0) { }
43 
47  template<typename TreeType>
48  RAQueryStat(const TreeType& /* node */) :
49  bound(SortPolicy::WorstDistance()),
51  { }
52 
54  double Bound() const { return bound; }
56  double& Bound() { return bound; }
57 
59  size_t NumSamplesMade() const { return numSamplesMade; }
61  size_t& NumSamplesMade() { return numSamplesMade; }
62 
64  template<typename Archive>
65  void Serialize(Archive& ar, const unsigned int /* version */)
66  {
67  ar & data::CreateNVP(bound, "bound");
68  ar & data::CreateNVP(numSamplesMade, "numSamplesMade");
69  }
70 
71  private:
73  double bound;
76 };
77 
78 } // namespace neighbor
79 } // namespace mlpack
80 
81 #endif
size_t numSamplesMade
The minimum number of samples made by any query in this node.
double Bound() const
Get the bound.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
Extra data for each node in the tree.
The core includes that mlpack expects; standard C++ includes and Armadillo.
FirstShim< T > CreateNVP(T &t, const std::string &name, typename std::enable_if_t< HasSerialize< T >::value > *=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.
void Serialize(Archive &ar, const unsigned int)
Serialize the statistic.
size_t NumSamplesMade() const
Get the number of samples made.
double & Bound()
Modify the bound.
RAQueryStat(const TreeType &)
Initialization for a node.
size_t & NumSamplesMade()
Modify the number of samples made.
double bound
The bound on the node&#39;s neighbor distances.
RAQueryStat()
Initialize the statistic with the worst possible distance according to our sorting policy...