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);
91 ElemType
Radius()
const {
return radius; }
93 ElemType&
Radius() {
return radius; }
96 const VecType&
Center()
const {
return center; }
101 size_t Dim()
const {
return center.n_elem; }
117 bool Contains(
const VecType& point)
const;
124 void Center(VecType& center)
const { center = this->center; }
131 template<
typename OtherVecType>
133 const OtherVecType& point,
148 template<
typename OtherVecType>
150 const OtherVecType& point,
166 template<
typename OtherVecType>
168 const OtherVecType& other,
194 template<
typename MatType>
203 const MetricType&
Metric()
const {
return *metric; }
208 template<
typename Archive>
209 void serialize(Archive& ar,
const uint32_t version);
213 template<
typename MetricType,
typename VecType>
217 const static bool HasTightBounds =
false;
223 #include "ballbound_impl.hpp" 225 #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
Linear algebra utility functions, generally performed on matrices or vectors.
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.
void serialize(Archive &ar, const uint32_t version)
Serialize the bound.
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.
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.