MLPACK  1.0.4
hrectbound.hpp
Go to the documentation of this file.
00001 
00024 #ifndef __MLPACK_CORE_TREE_HRECTBOUND_HPP
00025 #define __MLPACK_CORE_TREE_HRECTBOUND_HPP
00026 
00027 #include <mlpack/core.hpp>
00028 #include <mlpack/core/math/range.hpp>
00029 
00030 namespace mlpack {
00031 namespace bound {
00032 
00042 template<int Power = 2, bool TakeRoot = false>
00043 class HRectBound
00044 {
00045  public:
00049   HRectBound();
00050 
00055   HRectBound(const size_t dimension);
00056 
00057   /***
00058    * Copy constructor; necessary to prevent memory leaks.
00059    */
00060   HRectBound(const HRectBound& other);
00061   HRectBound& operator=(const HRectBound& other); // Same as copy constructor.
00062 
00066   ~HRectBound();
00067 
00072   void Clear();
00073 
00075   size_t Dim() const { return dim; }
00076 
00080   math::Range& operator[](const size_t i);
00081   const math::Range& operator[](const size_t i) const;
00082 
00088   void Centroid(arma::vec& centroid) const;
00089 
00095   template<typename VecType>
00096   double MinDistance(const VecType& point) const;
00097 
00103   double MinDistance(const HRectBound& other) const;
00104 
00110   template<typename VecType>
00111   double MaxDistance(const VecType& point) const;
00112 
00118   double MaxDistance(const HRectBound& other) const;
00119 
00126   math::Range RangeDistance(const HRectBound& other) const;
00127 
00134   template<typename VecType>
00135   math::Range RangeDistance(const VecType& point) const;
00136 
00144   template<typename MatType>
00145   HRectBound& operator|=(const MatType& data);
00146 
00150   HRectBound& operator|=(const HRectBound& other);
00151 
00155   template<typename VecType>
00156   bool Contains(const VecType& point) const;
00157 
00158  private:
00160   size_t dim;
00162   math::Range* bounds;
00163 };
00164 
00165 }; // namespace bound
00166 }; // namespace mlpack
00167 
00168 #include "hrectbound_impl.hpp"
00169 
00170 #endif // __MLPACK_CORE_TREE_HRECTBOUND_HPP