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>
74 BallBound(
const ElemType radius,
const VecType& center);
99 size_t Dim()
const {
return center.n_elem; }
113 bool Contains(
const VecType& point)
const;
125 template<
typename OtherVecType>
127 const OtherVecType& point,
138 template<
typename OtherVecType>
140 const OtherVecType& point,
151 template<
typename OtherVecType>
153 const OtherVecType& other,
176 template<
typename MatType>
190 template<
typename Archive>
191 void Serialize(Archive& ar,
const unsigned int version);
195 template<
typename MetricType,
typename VecType>
199 const static bool HasTightBounds =
false;
205 #include "ballbound_impl.hpp" 207 #endif // MLPACK_CORE_TREE_DBALLBOUND_HPP ElemType & Radius()
Modify the radius of the ball.
void Center(VecType ¢er) const
Place the center of BallBound into the given vector.
Linear algebra utility functions, generally performed on matrices or vectors.
A class to obtain compile-time traits about BoundType classes.
ElemType Radius() const
Get the radius of the ball.
ElemType radius
The radius of the ball bound.
MetricType & Metric()
Modify the distance metric used in this bound.
void Serialize(Archive &ar, const unsigned int version)
Serialize the bound.
BallBound()
Empty Constructor.
The core includes that mlpack expects; standard C++ includes and Armadillo.
VecType Vec
A public version of the vector type.
ElemType MinWidth() const
Get the minimum width of the bound (this is same as the diameter).
const MetricType & Metric() const
Returns the distance metric used in this bound.
size_t Dim() const
Get the dimensionality of the ball.
MetricType * metric
The metric used in this bound.
Ball bound encloses a set of points at a specific distance (radius) from a specific point (center)...
~BallBound()
Destructor to release allocated memory.
bool Contains(const VecType &point) const
Determines if a point is within this bound.
bool ownsMetric
To know whether this object allocated memory to the metric member variable.
ElemType MaxDistance(const OtherVecType &point, typename std::enable_if_t< IsVector< OtherVecType >::value > *=0) const
Computes maximum distance.
math::RangeType< ElemType > operator[](const size_t i) const
Get the range in a certain dimension.
VecType::elem_type ElemType
The underlying data type.
VecType & Center()
Modify the center point of the ball.
BallBound & operator=(const BallBound &other)
For the same reason as the copy constructor: to prevent memory leaks.
ElemType MinDistance(const OtherVecType &point, typename std::enable_if_t< IsVector< OtherVecType >::value > *=0) const
Calculates minimum bound-to-point squared distance.
VecType center
The center of the ball bound.
const VecType & Center() const
Get the center point of the ball.
ElemType Diameter() const
Returns the diameter of the ballbound.
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.
const BallBound & operator|=(const BallBound &other)
Expand the bound to include the given node.
If value == true, then VecType is some sort of Armadillo vector or subview.
typename enable_if< B, T >::type enable_if_t