12 #ifndef MLPACK_CORE_TREE_BALLBOUND_HPP 13 #define MLPACK_CORE_TREE_BALLBOUND_HPP 30 template<
typename MetricType = metric::LMetric<2, true>,
31 typename VecType = arma::vec>
73 BallBound(
const ElemType radius,
const VecType& center);
88 ElemType
Radius()
const {
return radius; }
90 ElemType&
Radius() {
return radius; }
93 const VecType&
Center()
const {
return center; }
98 size_t Dim()
const {
return center.n_elem; }
114 bool Contains(
const VecType& point)
const;
121 void Center(VecType& center)
const { center = this->center; }
128 template<
typename OtherVecType>
130 const OtherVecType& point,
145 template<
typename OtherVecType>
147 const OtherVecType& point,
163 template<
typename OtherVecType>
165 const OtherVecType& other,
191 template<
typename MatType>
200 const MetricType&
Metric()
const {
return *metric; }
205 template<
typename Archive>
206 void serialize(Archive& ar,
const unsigned int version);
210 template<
typename MetricType,
typename VecType>
214 const static bool HasTightBounds =
false;
220 #include "ballbound_impl.hpp" 222 #endif // MLPACK_CORE_TREE_DBALLBOUND_HPP ElemType MinDistance(const OtherVecType &point, typename std::enable_if_t< IsVector< OtherVecType >::value > *=0) const
Calculates minimum bound-to-point squared distance.
math::RangeType< ElemType > RangeDistance(const OtherVecType &other, typename std::enable_if_t< IsVector< OtherVecType >::value > *=0) const
Calculates minimum and maximum bound-to-point distance.
BallBound()
Empty Constructor.
VecType Vec
A public version of the vector type.
typename enable_if< B, T >::type enable_if_t
A class to obtain compile-time traits about BoundType classes.
ElemType & Radius()
Modify the radius of the ball.
The core includes that mlpack expects; standard C++ includes and Armadillo.
VecType::elem_type ElemType
The underlying data type.
Ball bound encloses a set of points at a specific distance (radius) from a specific point (center)...
ElemType Radius() const
Get the radius of the ball.
math::RangeType< ElemType > operator[](const size_t i) const
Get the range in a certain dimension.
size_t Dim() const
Get the dimensionality of the ball.
ElemType Diameter() const
Returns the diameter of the ballbound.
bool Contains(const VecType &point) const
Determines if a point is within this bound.
void serialize(Archive &ar, const unsigned int version)
Serialize the bound.
const BallBound & operator|=(const BallBound &other)
Expand the bound to include the given node.
ElemType MinWidth() const
Get the minimum width of the bound (this is same as the diameter).
const VecType & Center() const
Get the center point of the ball.
~BallBound()
Destructor to release allocated memory.
BallBound & operator=(const BallBound &other)
For the same reason as the copy constructor: to prevent memory leaks.
MetricType & Metric()
Modify the distance metric used in this bound.
VecType & Center()
Modify the center point of the ball.
void Center(VecType ¢er) const
Place the center of BallBound into the given vector.
If value == true, then VecType is some sort of Armadillo vector or subview.
const MetricType & Metric() const
Returns the distance metric used in this bound.
ElemType MaxDistance(const OtherVecType &point, typename std::enable_if_t< IsVector< OtherVecType >::value > *=0) const
Computes maximum distance.