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>
94 const VecType&
Center()
const {
return center; }
99 size_t Dim()
const {
return center.n_elem; }
113 bool Contains(
const VecType& point)
const;
120 void Center(VecType& center)
const { center = this->center; }
125 template<
typename OtherVecType>
138 template<
typename OtherVecType>
151 template<
typename OtherVecType>
153 const OtherVecType& other,
176 template<
typename MatType>
185 const MetricType&
Metric()
const {
return *metric; }
190 template<
typename Archive>
191 void Serialize(Archive& ar,
const unsigned int version);
195 template<
typename MetricType,
typename VecType>
205 #include "ballbound_impl.hpp"
207 #endif // MLPACK_CORE_TREE_DBALLBOUND_HPP
ElemType Radius() const
Get the radius of the ball.
BallBound()
Empty Constructor.
VecType Vec
A public version of the vector type.
A class to obtain compile-time traits about BoundType classes.
ElemType MinWidth() const
Get the minimum width of the bound (this is same as the diameter).
size_t Dim() const
Get the dimensionality of the ball.
void Serialize(Archive &ar, const unsigned int version)
Serialize the bound.
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)...
bool Contains(const VecType &point) const
Determines if a point is within this bound.
void Center(VecType ¢er) const
Place the center of BallBound into the given vector.
math::RangeType< ElemType > RangeDistance(const OtherVecType &other, typename boost::enable_if< IsVector< OtherVecType >> *=0) const
Calculates minimum and maximum bound-to-point distance.
const VecType & Center() const
Get the center point of the ball.
ElemType MaxDistance(const OtherVecType &point, typename boost::enable_if< IsVector< OtherVecType >> *=0) const
Computes maximum distance.
const BallBound & operator|=(const BallBound &other)
Expand the bound to include the given node.
math::RangeType< ElemType > operator[](const size_t i) const
Get the range in a certain dimension.
~BallBound()
Destructor to release allocated memory.
ElemType MinDistance(const OtherVecType &point, typename boost::enable_if< IsVector< OtherVecType >> *=0) const
Calculates minimum bound-to-point squared distance.
ElemType Diameter() const
Returns the diameter of the ballbound.
BallBound & operator=(const BallBound &other)
For the same reason as the copy constructor: to prevent memory leaks.
static const bool HasTightBounds
If true, then the bounds for each dimension are tight.
MetricType & Metric()
Modify the distance metric used in this bound.
const MetricType & Metric() const
Returns the distance metric used in this bound.
VecType & Center()
Modify the center point of the ball.
If value == true, then VecType is some sort of Armadillo vector or subview.