mlpack  master
dtb_stat.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_METHODS_EMST_DTB_STAT_HPP
13 #define MLPACK_METHODS_EMST_DTB_STAT_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace emst {
19 
24 class DTBStat
25 {
26  private:
30 
34 
36  double bound;
37 
43 
44  public:
49  DTBStat() :
50  maxNeighborDistance(DBL_MAX),
51  minNeighborDistance(DBL_MAX),
52  bound(DBL_MAX),
53  componentMembership(-1) { }
54 
62  template<typename TreeType>
63  DTBStat(const TreeType& node) :
64  maxNeighborDistance(DBL_MAX),
65  minNeighborDistance(DBL_MAX),
66  bound(DBL_MAX),
67  componentMembership(
68  ((node.NumPoints() == 1) && (node.NumChildren() == 0)) ?
69  node.Point(0) : -1) { }
70 
72  double MaxNeighborDistance() const { return maxNeighborDistance; }
75 
77  double MinNeighborDistance() const { return minNeighborDistance; }
80 
82  double Bound() const { return bound; }
84  double& Bound() { return bound; }
85 
87  int ComponentMembership() const { return componentMembership; }
90 
91 }; // class DTBStat
92 
93 } // namespace emst
94 } // namespace mlpack
95 
96 #endif // MLPACK_METHODS_EMST_DTB_STAT_HPP
double minNeighborDistance
Lower bound on the distance to the nearest neighbor of any point in this node.
Definition: dtb_stat.hpp:33
double MaxNeighborDistance() const
Get the maximum neighbor distance.
Definition: dtb_stat.hpp:72
double & Bound()
Modify the total bound for pruning.
Definition: dtb_stat.hpp:84
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
The core includes that mlpack expects; standard C++ includes and Armadillo.
int componentMembership
The index of the component that all points in this node belong to.
Definition: dtb_stat.hpp:42
double & MaxNeighborDistance()
Modify the maximum neighbor distance.
Definition: dtb_stat.hpp:74
DTBStat()
A generic initializer.
Definition: dtb_stat.hpp:49
int ComponentMembership() const
Get the component membership of this node.
Definition: dtb_stat.hpp:87
double maxNeighborDistance
Upper bound on the distance to the nearest neighbor of any point in this node.
Definition: dtb_stat.hpp:29
double MinNeighborDistance() const
Get the minimum neighbor distance.
Definition: dtb_stat.hpp:77
int & ComponentMembership()
Modify the component membership of this node.
Definition: dtb_stat.hpp:89
double bound
Total bound for pruning.
Definition: dtb_stat.hpp:36
double & MinNeighborDistance()
Modify the minimum neighbor distance.
Definition: dtb_stat.hpp:79
A statistic for use with mlpack trees, which stores the upper bound on distance to nearest neighbors ...
Definition: dtb_stat.hpp:24
DTBStat(const TreeType &node)
This is called when a node is finished initializing.
Definition: dtb_stat.hpp:63
double Bound() const
Get the total bound for pruning.
Definition: dtb_stat.hpp:82