MLPACK  1.0.10
hrectbound.hpp
Go to the documentation of this file.
1 
24 #ifndef __MLPACK_CORE_TREE_HRECTBOUND_HPP
25 #define __MLPACK_CORE_TREE_HRECTBOUND_HPP
26 
27 #include <mlpack/core.hpp>
30 
31 namespace mlpack {
32 namespace bound {
33 
43 template<int Power = 2, bool TakeRoot = true>
45 {
46  public:
49 
53  HRectBound();
54 
59  HRectBound(const size_t dimension);
60 
62  HRectBound(const HRectBound& other);
64  HRectBound& operator=(const HRectBound& other);
65 
67  ~HRectBound();
68 
73  void Clear();
74 
76  size_t Dim() const { return dim; }
77 
80  math::Range& operator[](const size_t i) { return bounds[i]; }
82  const math::Range& operator[](const size_t i) const { return bounds[i]; }
83 
85  double MinWidth() const { return minWidth; }
87  double& MinWidth() { return minWidth; }
88 
94  void Centroid(arma::vec& centroid) const;
95 
101  template<typename VecType>
102  double MinDistance(const VecType& point,
103  typename boost::enable_if<IsVector<VecType> >* = 0) const;
104 
110  double MinDistance(const HRectBound& other) const;
111 
117  template<typename VecType>
118  double MaxDistance(const VecType& point,
119  typename boost::enable_if<IsVector<VecType> >* = 0) const;
120 
126  double MaxDistance(const HRectBound& other) const;
127 
134  math::Range RangeDistance(const HRectBound& other) const;
135 
142  template<typename VecType>
143  math::Range RangeDistance(const VecType& point,
144  typename boost::enable_if<IsVector<VecType> >* = 0)
145  const;
146 
154  template<typename MatType>
155  HRectBound& operator|=(const MatType& data);
156 
160  HRectBound& operator|=(const HRectBound& other);
161 
165  template<typename VecType>
166  bool Contains(const VecType& point) const;
167 
171  double Diameter() const;
172 
176  std::string ToString() const;
177 
184 
185  private:
187  size_t dim;
191  double minWidth;
192 };
193 
194 }; // namespace bound
195 }; // namespace mlpack
196 
197 #include "hrectbound_impl.hpp"
198 
199 #endif // __MLPACK_CORE_TREE_HRECTBOUND_HPP