MLPACK  1.0.7
periodichrectbound.hpp
Go to the documentation of this file.
1 
24 #ifndef __MLPACK_CORE_TREE_PERIODICHRECTBOUND_HPP
25 #define __MLPACK_CORE_TREE_PERIODICHRECTBOUND_HPP
26 
27 #include <mlpack/core.hpp>
28 
29 namespace mlpack {
30 namespace bound {
31 
37 template<int t_pow = 2>
39 {
40  public:
45 
50  PeriodicHRectBound(arma::vec box);
51 
52  /***
53  * Copy constructor and copy operator. These are necessary because we do our
54  * own memory management.
55  */
58 
63 
67  void SetBoxSize(arma::vec box);
68 
72  const arma::vec& Box() const { return box; }
73 
77  void Clear();
78 
80  size_t Dim() const { return dim; }
81 
85  math::Range& operator[](size_t i);
86  const math::Range operator[](size_t i) const;
87 
88  /***
89  * Calculates the centroid of the range. This does not factor in periodic
90  * coordinates, so the centroid may not necessarily be inside the given box.
91  *
92  * @param centroid Vector to write the centroid to.
93  */
94  void Centroid(arma::vec& centroid) const;
95 
100  double MinDistance(const arma::vec& point) const;
101 
108  double MinDistance(const PeriodicHRectBound& other) const;
109 
114  double MaxDistance(const arma::vec& point) const;
115 
120  double MaxDistance(const PeriodicHRectBound& other) const;
121 
126  math::Range RangeDistance(const arma::vec& point) const;
127 
132  math::Range RangeDistance(const PeriodicHRectBound& other) const;
133 
137  PeriodicHRectBound& operator|=(const arma::vec& vector);
138 
143 
147  bool Contains(const arma::vec& point) const;
148 
152  std::string ToString() const;
153 
154  private:
156  size_t dim;
157  arma::vec box;
158 };
159 
160 }; // namespace bound
161 }; // namespace mlpack
162 
163 #include "periodichrectbound_impl.hpp"
164 
165 #endif // __MLPACK_CORE_TREE_PERIODICHRECTBOUND_HPP