mlpack
2.0.1
|
Ball bound encloses a set of points at a specific distance (radius) from a specific point (center). More...
Public Types | |
typedef TMetricType | MetricType |
Needed for BinarySpaceTree. More... | |
typedef VecType | Vec |
Public Member Functions | |
BallBound () | |
Empty Constructor. More... | |
BallBound (const size_t dimension) | |
Create the ball bound with the specified dimensionality. More... | |
BallBound (const double radius, const VecType ¢er) | |
Create the ball bound with the specified radius and center. More... | |
BallBound (const BallBound &other) | |
Copy constructor. To prevent memory leaks. More... | |
BallBound (BallBound &&other) | |
Move constructor: take possession of another bound. More... | |
~BallBound () | |
Destructor to release allocated memory. More... | |
const VecType & | Center () const |
Get the center point of the ball. More... | |
VecType & | Center () |
Modify the center point of the ball. More... | |
void | Center (VecType ¢er) const |
Place the center of BallBound into the given vector. More... | |
bool | Contains (const VecType &point) const |
Determines if a point is within this bound. More... | |
double | Diameter () const |
Returns the diameter of the ballbound. More... | |
double | Dim () const |
Get the dimensionality of the ball. More... | |
template<typename OtherVecType > | |
double | MaxDistance (const OtherVecType &point, typename boost::enable_if< IsVector< OtherVecType > > *=0) const |
Computes maximum distance. More... | |
double | MaxDistance (const BallBound &other) const |
Computes maximum distance. More... | |
const TMetricType & | Metric () const |
Returns the distance metric used in this bound. More... | |
TMetricType & | Metric () |
Modify the distance metric used in this bound. More... | |
template<typename OtherVecType > | |
double | MinDistance (const OtherVecType &point, typename boost::enable_if< IsVector< OtherVecType > > *=0) const |
Calculates minimum bound-to-point squared distance. More... | |
double | MinDistance (const BallBound &other) const |
Calculates minimum bound-to-bound squared distance. More... | |
double | MinWidth () const |
Get the minimum width of the bound (this is same as the diameter). More... | |
BallBound & | operator= (const BallBound &other) |
For the same reason as the copy constructor: to prevent memory leaks. More... | |
math::Range | operator[] (const size_t i) const |
Get the range in a certain dimension. More... | |
const BallBound & | operator|= (const BallBound &other) |
Expand the bound to include the given node. More... | |
template<typename MatType > | |
const BallBound & | operator|= (const MatType &data) |
Expand the bound to include the given point. More... | |
double | Radius () const |
Get the radius of the ball. More... | |
double & | Radius () |
Modify the radius of the ball. More... | |
template<typename OtherVecType > | |
math::Range | RangeDistance (const OtherVecType &other, typename boost::enable_if< IsVector< OtherVecType > > *=0) const |
Calculates minimum and maximum bound-to-point distance. More... | |
math::Range | RangeDistance (const BallBound &other) const |
Calculates minimum and maximum bound-to-bound distance. More... | |
template<typename Archive > | |
void | Serialize (Archive &ar, const unsigned int version) |
Serialize the bound. More... | |
Private Attributes | |
VecType | center |
The center of the ball bound. More... | |
TMetricType * | metric |
The metric used in this bound. More... | |
bool | ownsMetric |
To know whether this object allocated memory to the metric member variable. More... | |
double | radius |
The radius of the ball bound. More... | |
Ball bound encloses a set of points at a specific distance (radius) from a specific point (center).
TMetricType is the custom metric type that defaults to the Euclidean (L2) distance.
VecType | Type of vector (arma::vec or arma::sp_vec). |
TMetricType | metric type used in the distance measure. |
Definition at line 34 of file ballbound.hpp.
typedef TMetricType mlpack::bound::BallBound< VecType, TMetricType >::MetricType |
Needed for BinarySpaceTree.
Definition at line 39 of file ballbound.hpp.
typedef VecType mlpack::bound::BallBound< VecType, TMetricType >::Vec |
Definition at line 37 of file ballbound.hpp.
mlpack::bound::BallBound< VecType, TMetricType >::BallBound | ( | ) |
Empty Constructor.
mlpack::bound::BallBound< VecType, TMetricType >::BallBound | ( | const size_t | dimension | ) |
Create the ball bound with the specified dimensionality.
dimension | Dimensionality of ball bound. |
mlpack::bound::BallBound< VecType, TMetricType >::BallBound | ( | const double | radius, |
const VecType & | center | ||
) |
Create the ball bound with the specified radius and center.
radius | Radius of ball bound. |
center | Center of ball bound. |
mlpack::bound::BallBound< VecType, TMetricType >::BallBound | ( | const BallBound< VecType, TMetricType > & | other | ) |
Copy constructor. To prevent memory leaks.
mlpack::bound::BallBound< VecType, TMetricType >::BallBound | ( | BallBound< VecType, TMetricType > && | other | ) |
Move constructor: take possession of another bound.
mlpack::bound::BallBound< VecType, TMetricType >::~BallBound | ( | ) |
Destructor to release allocated memory.
|
inline |
Get the center point of the ball.
Definition at line 95 of file ballbound.hpp.
References mlpack::bound::BallBound< VecType, TMetricType >::center.
|
inline |
Modify the center point of the ball.
Definition at line 97 of file ballbound.hpp.
References mlpack::bound::BallBound< VecType, TMetricType >::center.
|
inline |
Place the center of BallBound into the given vector.
center | Vector which the centroid will be written to. |
Definition at line 121 of file ballbound.hpp.
References mlpack::bound::BallBound< VecType, TMetricType >::center.
bool mlpack::bound::BallBound< VecType, TMetricType >::Contains | ( | const VecType & | point | ) | const |
Determines if a point is within this bound.
|
inline |
Returns the diameter of the ballbound.
Definition at line 183 of file ballbound.hpp.
References mlpack::bound::BallBound< VecType, TMetricType >::radius.
|
inline |
Get the dimensionality of the ball.
Definition at line 100 of file ballbound.hpp.
double mlpack::bound::BallBound< VecType, TMetricType >::MaxDistance | ( | const OtherVecType & | point, |
typename boost::enable_if< IsVector< OtherVecType > > * | = 0 |
||
) | const |
Computes maximum distance.
double mlpack::bound::BallBound< VecType, TMetricType >::MaxDistance | ( | const BallBound< VecType, TMetricType > & | other | ) | const |
Computes maximum distance.
|
inline |
Returns the distance metric used in this bound.
Definition at line 186 of file ballbound.hpp.
References mlpack::bound::BallBound< VecType, TMetricType >::metric.
|
inline |
Modify the distance metric used in this bound.
Definition at line 188 of file ballbound.hpp.
References mlpack::bound::BallBound< VecType, TMetricType >::metric.
double mlpack::bound::BallBound< VecType, TMetricType >::MinDistance | ( | const OtherVecType & | point, |
typename boost::enable_if< IsVector< OtherVecType > > * | = 0 |
||
) | const |
Calculates minimum bound-to-point squared distance.
double mlpack::bound::BallBound< VecType, TMetricType >::MinDistance | ( | const BallBound< VecType, TMetricType > & | other | ) | const |
Calculates minimum bound-to-bound squared distance.
|
inline |
Get the minimum width of the bound (this is same as the diameter).
For ball bounds, width along all dimensions remain same.
Definition at line 106 of file ballbound.hpp.
BallBound& mlpack::bound::BallBound< VecType, TMetricType >::operator= | ( | const BallBound< VecType, TMetricType > & | other | ) |
For the same reason as the copy constructor: to prevent memory leaks.
math::Range mlpack::bound::BallBound< VecType, TMetricType >::operator[] | ( | const size_t | i | ) | const |
Get the range in a certain dimension.
const BallBound& mlpack::bound::BallBound< VecType, TMetricType >::operator|= | ( | const BallBound< VecType, TMetricType > & | other | ) |
Expand the bound to include the given node.
const BallBound& mlpack::bound::BallBound< VecType, TMetricType >::operator|= | ( | const MatType & | data | ) |
Expand the bound to include the given point.
The centroid is recalculated to be the center of all of the given points.
MatType | Type of matrix; could be arma::mat, arma::spmat, or a vector. |
data | Data points to add. |
|
inline |
Get the radius of the ball.
Definition at line 90 of file ballbound.hpp.
References mlpack::bound::BallBound< VecType, TMetricType >::radius.
|
inline |
Modify the radius of the ball.
Definition at line 92 of file ballbound.hpp.
References mlpack::bound::BallBound< VecType, TMetricType >::radius.
math::Range mlpack::bound::BallBound< VecType, TMetricType >::RangeDistance | ( | const OtherVecType & | other, |
typename boost::enable_if< IsVector< OtherVecType > > * | = 0 |
||
) | const |
Calculates minimum and maximum bound-to-point distance.
math::Range mlpack::bound::BallBound< VecType, TMetricType >::RangeDistance | ( | const BallBound< VecType, TMetricType > & | other | ) | const |
Calculates minimum and maximum bound-to-bound distance.
Example: bound1.MinDistanceSq(other) for minimum distance.
void mlpack::bound::BallBound< VecType, TMetricType >::Serialize | ( | Archive & | ar, |
const unsigned int | version | ||
) |
Serialize the bound.
|
private |
The center of the ball bound.
Definition at line 45 of file ballbound.hpp.
Referenced by mlpack::bound::BallBound< VecType, TMetricType >::Center().
|
private |
The metric used in this bound.
Definition at line 47 of file ballbound.hpp.
Referenced by mlpack::bound::BallBound< VecType, TMetricType >::Metric().
|
private |
To know whether this object allocated memory to the metric member variable.
This will be true except in the copy constructor and the overloaded assignment operator. We need this to know whether we should delete the metric member variable in the destructor.
Definition at line 55 of file ballbound.hpp.
|
private |
The radius of the ball bound.
Definition at line 43 of file ballbound.hpp.
Referenced by mlpack::bound::BallBound< VecType, TMetricType >::Diameter(), and mlpack::bound::BallBound< VecType, TMetricType >::Radius().