SYNOPSIS

Public Types

typedef TMetricType MetricType

Need this for Binary Space Partion Tree. typedef VecType Vec

Public Member Functions

BallBound ()

Empty Constructor. BallBound (const size_t dimension)

Create the ball bound with the specified dimensionality. BallBound (const double radius, const VecType &center)

Create the ball bound with the specified radius and center. BallBound (const BallBound &other)

Copy constructor. To prevent memory leaks. ~BallBound ()

Destructor to release allocated memory. const VecType & Center () const

Get the center point of the ball. VecType & Center ()

Modify the center point of the ball. void Centroid (VecType ¢roid) const

Place the centroid of BallBound into the given vector. bool Contains (const VecType &point) const

Determines if a point is within this bound. double Diameter () const

Returns the diameter of the ballbound. double Dim () const

Get the dimensionality of the ball. template<typename OtherVecType > double MaxDistance (const OtherVecType &point, typename boost::enable_if< IsVector< OtherVecType > > *=0) const

Computes maximum distance. double MaxDistance (const BallBound &other) const

Computes maximum distance. TMetricType Metric () const

Returns the distance metric used in this bound. template<typename OtherVecType > double MinDistance (const OtherVecType &point, typename boost::enable_if< IsVector< OtherVecType > > *=0) const

Calculates minimum bound-to-point squared distance. double MinDistance (const BallBound &other) const

Calculates minimum bound-to-bound squared distance. double MinWidth () const

Get the minimum width of the bound (this is same as the diameter). BallBound & operator= (const BallBound &other)

For the same reason as the Copy Constructor. To prevent memory leaks. math::Range operator[] (const size_t i) const

Get the range in a certain dimension. const BallBound & operator|= (const BallBound &other)

Expand the bound to include the given node. template<typename MatType > const BallBound & operator|= (const MatType &data)

Expand the bound to include the given point. double Radius () const

Get the radius of the ball. double & Radius ()

Modify the radius of the ball. 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. math::Range RangeDistance (const BallBound &other) const

Calculates minimum and maximum bound-to-bound distance. std::string ToString () const

Returns a string representation of this object.

Private Attributes

VecType center

The center of the ball bound. TMetricType * metric

The metric used in this bound. bool ownsMetric

To know whether this object allocated memory to the metric member variable. double radius

The radius of the ball bound.

Detailed Description

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>>class mlpack::bound::BallBound< VecType, TMetricType >

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.

Template Parameters:

VecType Type of vector (arma::vec or arma::sp_vec).

TMetricType metric type used in the distance measure.

Definition at line 42 of file ballbound.hpp.

Member Typedef Documentation

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> typedef TMetricType \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::\fBMetricType\fP

Need this for Binary Space Partion Tree.

Definition at line 47 of file ballbound.hpp.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> typedef VecType \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::\fBVec\fP

Definition at line 45 of file ballbound.hpp.

Constructor & Destructor Documentation

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::\fBBallBound\fP ()

Empty Constructor.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::\fBBallBound\fP (const size_tdimension)

Create the ball bound with the specified dimensionality.

Parameters:

dimension Dimensionality of ball bound.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::\fBBallBound\fP (const doubleradius, const VecType ¢er)

Create the ball bound with the specified radius and center.

Parameters:

radius Radius of ball bound.

center Center of ball bound.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::\fBBallBound\fP (const \fBBallBound\fP< VecType, TMetricType > &other)

Copy constructor. To prevent memory leaks.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::~\fBBallBound\fP ()

Destructor to release allocated memory.

Member Function Documentation

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> const VecType& \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::Center () const\fC [inline]\fP

Get the center point of the ball.

Definition at line 103 of file ballbound.hpp.

References mlpack::bound::BallBound< VecType, TMetricType >::center.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> VecType& \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::Center ()\fC [inline]\fP

Modify the center point of the ball.

Definition at line 105 of file ballbound.hpp.

References mlpack::bound::BallBound< VecType, TMetricType >::center.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> void \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::Centroid (VecType ¢roid) const\fC [inline]\fP

Place the centroid of BallBound into the given vector.

Parameters:

centroid Vector which the centroid will be written to.

Definition at line 129 of file ballbound.hpp.

References mlpack::bound::BallBound< VecType, TMetricType >::center.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> bool \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::Contains (const VecType &point) const

Determines if a point is within this bound.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> double \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::Diameter () const\fC [inline]\fP

Returns the diameter of the ballbound.

Definition at line 191 of file ballbound.hpp.

References mlpack::bound::BallBound< VecType, TMetricType >::radius.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> double \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::Dim () const\fC [inline]\fP

Get the dimensionality of the ball.

Definition at line 108 of file ballbound.hpp.

References mlpack::bound::BallBound< VecType, TMetricType >::center.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> template<typename OtherVecType > double \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::MaxDistance (const OtherVecType &point, typename boost::enable_if< \fBIsVector\fP< OtherVecType > > * = \fC0\fP) const

Computes maximum distance.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> double \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::MaxDistance (const \fBBallBound\fP< VecType, TMetricType > &other) const

Computes maximum distance.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> TMetricType \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::Metric () const\fC [inline]\fP

Returns the distance metric used in this bound.

Definition at line 196 of file ballbound.hpp.

References mlpack::bound::BallBound< VecType, TMetricType >::metric.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> template<typename OtherVecType > double \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::MinDistance (const OtherVecType &point, typename boost::enable_if< \fBIsVector\fP< OtherVecType > > * = \fC0\fP) const

Calculates minimum bound-to-point squared distance.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> double \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::MinDistance (const \fBBallBound\fP< VecType, TMetricType > &other) const

Calculates minimum bound-to-bound squared distance.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> double \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::MinWidth () const\fC [inline]\fP

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 114 of file ballbound.hpp.

References mlpack::bound::BallBound< VecType, TMetricType >::radius.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> \fBBallBound\fP& \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::operator= (const \fBBallBound\fP< VecType, TMetricType > &other)

For the same reason as the Copy Constructor. To prevent memory leaks.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> \fBmath::Range\fP \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::operator[] (const size_ti) const

Get the range in a certain dimension.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> const \fBBallBound\fP& \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::operator|= (const \fBBallBound\fP< VecType, TMetricType > &other)

Expand the bound to include the given node.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> template<typename MatType > const \fBBallBound\fP& \fBmlpack::bound::BallBound\fP< 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.

Template Parameters:

MatType Type of matrix; could be arma::mat, arma::spmat, or a vector.

data Data points to add.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> double \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::Radius () const\fC [inline]\fP

Get the radius of the ball.

Definition at line 98 of file ballbound.hpp.

References mlpack::bound::BallBound< VecType, TMetricType >::radius.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> double& \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::Radius ()\fC [inline]\fP

Modify the radius of the ball.

Definition at line 100 of file ballbound.hpp.

References mlpack::bound::BallBound< VecType, TMetricType >::radius.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> template<typename OtherVecType > \fBmath::Range\fP \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::RangeDistance (const OtherVecType &other, typename boost::enable_if< \fBIsVector\fP< OtherVecType > > * = \fC0\fP) const

Calculates minimum and maximum bound-to-point distance.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> \fBmath::Range\fP \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::RangeDistance (const \fBBallBound\fP< VecType, TMetricType > &other) const

Calculates minimum and maximum bound-to-bound distance. Example: bound1.MinDistanceSq(other) for minimum distance.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> std::string \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::ToString () const

Returns a string representation of this object.

Member Data Documentation

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> VecType \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::center\fC [private]\fP

The center of the ball bound.

Definition at line 55 of file ballbound.hpp.

Referenced by mlpack::bound::BallBound< VecType, TMetricType >::Center(), mlpack::bound::BallBound< VecType, TMetricType >::Centroid(), and mlpack::bound::BallBound< VecType, TMetricType >::Dim().

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> TMetricType* \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::metric\fC [private]\fP

The metric used in this bound.

Definition at line 58 of file ballbound.hpp.

Referenced by mlpack::bound::BallBound< VecType, TMetricType >::Metric().

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> bool \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::ownsMetric\fC [private]\fP

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 66 of file ballbound.hpp.

template<typename VecType = arma::vec, typename TMetricType = metric::LMetric<2, true>> double \fBmlpack::bound::BallBound\fP< VecType, TMetricType >::radius\fC [private]\fP

The radius of the ball bound.

Definition at line 52 of file ballbound.hpp.

Referenced by mlpack::bound::BallBound< VecType, TMetricType >::Diameter(), mlpack::bound::BallBound< VecType, TMetricType >::MinWidth(), and mlpack::bound::BallBound< VecType, TMetricType >::Radius().

Author

Generated automatically by Doxygen for MLPACK from the source code.