12#ifndef MLPACK_CORE_TREE_HOLLOW_BALL_BOUND_HPP
13#define MLPACK_CORE_TREE_HOLLOW_BALL_BOUND_HPP
31template<
typename TMetricType = metric::LMetric<2, true>,
32 typename ElemType =
double>
43 arma::Col<ElemType> center;
45 arma::Col<ElemType> hollowCenter;
75 template<
typename VecType>
77 const ElemType outerRadius,
78 const VecType& center);
103 const arma::Col<ElemType>&
Center()
const {
return center; }
105 arma::Col<ElemType>&
Center() {
return center; }
108 const arma::Col<ElemType>&
HollowCenter()
const {
return hollowCenter; }
113 size_t Dim()
const {
return center.n_elem; }
129 template<
typename VecType>
144 template<
typename VecType>
145 void Center(VecType& center)
const { center = this->center; }
152 template<
typename VecType>
169 template<
typename VecType>
187 template<
typename VecType>
189 const VecType& other,
210 template<
typename MatType>
234 template<
typename Archive>
235 void serialize(Archive& ar,
const unsigned int version);
239template<
typename MetricType,
typename ElemType>
249#include "hollow_ball_bound_impl.hpp"
Hollow ball bound encloses a set of points at a specific distance (radius) from a specific point (cen...
math::RangeType< ElemType > RangeDistance(const HollowBallBound &other) const
Calculates minimum and maximum bound-to-bound distance.
void Center(VecType ¢er) const
Place the center of BallBound into the given vector.
math::RangeType< ElemType > operator[](const size_t i) const
Get the range in a certain dimension.
HollowBallBound(HollowBallBound &&other)
Move constructor: take possession of another bound.
HollowBallBound(const ElemType innerRadius, const ElemType outerRadius, const VecType ¢er)
Create the ball bound with the specified radius and center.
const MetricType & Metric() const
Returns the distance metric used in this bound.
bool Contains(const VecType &point) const
Determines if a point is within this bound.
TMetricType MetricType
A public version of the metric type.
HollowBallBound(const size_t dimension)
Create the ball bound with the specified dimensionality.
ElemType Diameter() const
Returns the diameter of the ballbound.
void serialize(Archive &ar, const unsigned int version)
Serialize the bound.
ElemType & InnerRadius()
Modify the inner radius of the ball.
bool Contains(const HollowBallBound &other) const
Determines if another bound is within this bound.
ElemType MinDistance(const VecType &point, typename std::enable_if_t< IsVector< VecType >::value > *=0) const
Calculates minimum bound-to-point squared distance.
const arma::Col< ElemType > & HollowCenter() const
Get the center point of the hollow.
size_t Dim() const
Get the dimensionality of the ball.
arma::Col< ElemType > & Center()
Modify the center point of the ball.
const arma::Col< ElemType > & Center() const
Get the center point of the ball.
ElemType MaxDistance(const HollowBallBound &other) const
Computes maximum distance.
math::RangeType< ElemType > RangeDistance(const VecType &other, typename std::enable_if_t< IsVector< VecType >::value > *=0) const
Calculates minimum and maximum bound-to-point distance.
HollowBallBound(const HollowBallBound &other)
Copy constructor. To prevent memory leaks.
MetricType & Metric()
Modify the distance metric used in this bound.
ElemType MinDistance(const HollowBallBound &other) const
Calculates minimum bound-to-bound squared distance.
ElemType OuterRadius() const
Get the outer radius of the ball.
~HollowBallBound()
Destructor to release allocated memory.
arma::Col< ElemType > & HollowCenter()
Modify the center point of the hollow.
ElemType MinWidth() const
Get the minimum width of the bound (this is same as the diameter).
const HollowBallBound & operator|=(const MatType &data)
Expand the bound to include the given point.
HollowBallBound & operator=(const HollowBallBound &other)
For the same reason as the copy constructor: to prevent memory leaks.
HollowBallBound()
Empty Constructor.
ElemType InnerRadius() const
Get the innner radius of the ball.
ElemType & OuterRadius()
Modify the outer radius of the ball.
ElemType MaxDistance(const VecType &point, typename std::enable_if_t< IsVector< VecType >::value > *=0) const
Computes maximum distance.
const HollowBallBound & operator|=(const HollowBallBound &other)
Expand the bound to include the given bound.
Simple real-valued range.
T Lo() const
Get the lower bound.
T Hi() const
Get the upper bound.
Linear algebra utility functions, generally performed on matrices or vectors.
typename enable_if< B, T >::type enable_if_t
The core includes that mlpack expects; standard C++ includes and Armadillo.
If value == true, then VecType is some sort of Armadillo vector or subview.
A class to obtain compile-time traits about BoundType classes.
static const bool HasTightBounds
If true, then the bounds for each dimension are tight.