ballbound.hpp

Go to the documentation of this file.
00001 
00023 #ifndef __MLPACK_CORE_TREE_BALLBOUND_HPP
00024 #define __MLPACK_CORE_TREE_BALLBOUND_HPP
00025 
00026 #include <mlpack/core.hpp>
00027 #include <mlpack/core/metrics/lmetric.hpp>
00028 
00029 namespace mlpack {
00030 namespace bound {
00031 
00037 template<typename VecType = arma::vec>
00038 class BallBound
00039 {
00040  public:
00041   typedef VecType Vec;
00042 
00043  private:
00044   double radius;
00045   VecType center;
00046 
00047  public:
00048   BallBound() : radius(0) { }
00049 
00055   BallBound(const size_t dimension) : radius(0), center(dimension) { }
00056 
00063   BallBound(const double radius, const VecType& center) :
00064       radius(radius), center(center) { }
00065 
00067   double Radius() const { return radius; }
00069   double& Radius() { return radius; }
00070 
00072   const VecType& Center() const { return center; }
00074   VecType& Center() { return center; }
00075 
00076   // Get the range in a certain dimension.
00077   math::Range operator[](const size_t i) const;
00078 
00082   bool Contains(const VecType& point) const;
00083 
00091   void CalculateMidpoint(VecType& centroid) const;
00092 
00096   double MinDistance(const VecType& point) const;
00097 
00101   double MinDistance(const BallBound& other) const;
00102 
00106   double MaxDistance(const VecType& point) const;
00107 
00111   double MaxDistance(const BallBound& other) const;
00112 
00116   math::Range RangeDistance(const VecType& other) const;
00117 
00123   math::Range RangeDistance(const BallBound& other) const;
00124 
00128   const BallBound& operator|=(const BallBound& other);
00129 
00138   template<typename MatType>
00139   const BallBound& operator|=(const MatType& data);
00140 
00144   std::string ToString() const;
00145 
00146 };
00147 
00148 }; // namespace bound
00149 }; // namespace mlpack
00150 
00151 #include "ballbound_impl.hpp"
00152 
00153 #endif // __MLPACK_CORE_TREE_DBALLBOUND_HPP

Generated on 29 Sep 2016 for MLPACK by  doxygen 1.6.1