mlpack 3.4.2
Public Types | Public Member Functions | List of all members
HollowBallBound< TMetricType, ElemType > Class Template Reference

Hollow ball bound encloses a set of points at a specific distance (radius) from a specific point (center) except points at a specific distance from another point (the center of the hole). More...

#include <hollow_ball_bound.hpp>

Public Types

typedef TMetricType MetricType
 A public version of the metric type. More...
 

Public Member Functions

 HollowBallBound ()
 Empty Constructor. More...
 
template<typename VecType >
 HollowBallBound (const ElemType innerRadius, const ElemType outerRadius, const VecType &center)
 Create the ball bound with the specified radius and center. More...
 
 HollowBallBound (const HollowBallBound &other)
 Copy constructor. To prevent memory leaks. More...
 
 HollowBallBound (const size_t dimension)
 Create the ball bound with the specified dimensionality. More...
 
 HollowBallBound (HollowBallBound &&other)
 Move constructor: take possession of another bound. More...
 
 ~HollowBallBound ()
 Destructor to release allocated memory. More...
 
arma::Col< ElemType > & Center ()
 Modify the center point of the ball. More...
 
const arma::Col< ElemType > & Center () const
 Get the center point of the ball. More...
 
template<typename VecType >
void Center (VecType &center) const
 Place the center of BallBound into the given vector. More...
 
bool Contains (const HollowBallBound &other) const
 Determines if another bound is within this bound. More...
 
template<typename VecType >
bool Contains (const VecType &point) const
 Determines if a point is within this bound. More...
 
ElemType Diameter () const
 Returns the diameter of the ballbound. More...
 
size_t Dim () const
 Get the dimensionality of the ball. More...
 
arma::Col< ElemType > & HollowCenter ()
 Modify the center point of the hollow. More...
 
const arma::Col< ElemType > & HollowCenter () const
 Get the center point of the hollow. More...
 
ElemType & InnerRadius ()
 Modify the inner radius of the ball. More...
 
ElemType InnerRadius () const
 Get the innner radius of the ball. More...
 
ElemType MaxDistance (const HollowBallBound &other) const
 Computes maximum distance. More...
 
template<typename VecType >
ElemType MaxDistance (const VecType &point, typename std::enable_if_t< IsVector< VecType >::value > *=0) const
 Computes maximum distance. More...
 
MetricTypeMetric ()
 Modify the distance metric used in this bound. More...
 
const MetricTypeMetric () const
 Returns the distance metric used in this bound. More...
 
ElemType MinDistance (const HollowBallBound &other) const
 Calculates minimum bound-to-bound squared distance. More...
 
template<typename VecType >
ElemType MinDistance (const VecType &point, typename std::enable_if_t< IsVector< VecType >::value > *=0) const
 Calculates minimum bound-to-point squared distance. More...
 
ElemType MinWidth () const
 Get the minimum width of the bound (this is same as the diameter). More...
 
HollowBallBoundoperator= (const HollowBallBound &other)
 For the same reason as the copy constructor: to prevent memory leaks. More...
 
math::RangeType< ElemType > operator[] (const size_t i) const
 Get the range in a certain dimension. More...
 
const HollowBallBoundoperator|= (const HollowBallBound &other)
 Expand the bound to include the given bound. More...
 
template<typename MatType >
const HollowBallBoundoperator|= (const MatType &data)
 Expand the bound to include the given point. More...
 
ElemType & OuterRadius ()
 Modify the outer radius of the ball. More...
 
ElemType OuterRadius () const
 Get the outer radius of the ball. More...
 
math::RangeType< ElemType > RangeDistance (const HollowBallBound &other) const
 Calculates minimum and maximum bound-to-bound distance. More...
 
template<typename VecType >
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. More...
 
template<typename Archive >
void serialize (Archive &ar, const unsigned int version)
 Serialize the bound. More...
 

Detailed Description

template<typename TMetricType = metric::LMetric<2, true>, typename ElemType = double>
class mlpack::bound::HollowBallBound< TMetricType, ElemType >

Hollow ball bound encloses a set of points at a specific distance (radius) from a specific point (center) except points at a specific distance from another point (the center of the hole).

MetricType is the custom metric type that defaults to the Euclidean (L2) distance.

Template Parameters
TMetricTypemetric type used in the distance measure.
ElemTypeType of element (float or double or similar).

Definition at line 33 of file hollow_ball_bound.hpp.

Member Typedef Documentation

◆ MetricType

typedef TMetricType MetricType

A public version of the metric type.

Definition at line 37 of file hollow_ball_bound.hpp.

Constructor & Destructor Documentation

◆ HollowBallBound() [1/5]

Empty Constructor.

◆ HollowBallBound() [2/5]

HollowBallBound ( const size_t  dimension)

Create the ball bound with the specified dimensionality.

Parameters
dimensionDimensionality of ball bound.

◆ HollowBallBound() [3/5]

HollowBallBound ( const ElemType  innerRadius,
const ElemType  outerRadius,
const VecType &  center 
)

Create the ball bound with the specified radius and center.

Parameters
innerRadiusInner radius of ball bound.
outerRadiusOuter radius of ball bound.
centerCenter of ball bound.

◆ HollowBallBound() [4/5]

HollowBallBound ( const HollowBallBound< TMetricType, ElemType > &  other)

Copy constructor. To prevent memory leaks.

◆ HollowBallBound() [5/5]

HollowBallBound ( HollowBallBound< TMetricType, ElemType > &&  other)

Move constructor: take possession of another bound.

◆ ~HollowBallBound()

Destructor to release allocated memory.

Member Function Documentation

◆ Center() [1/3]

arma::Col< ElemType > & Center ( )
inline

Modify the center point of the ball.

Definition at line 105 of file hollow_ball_bound.hpp.

◆ Center() [2/3]

const arma::Col< ElemType > & Center ( ) const
inline

Get the center point of the ball.

Definition at line 103 of file hollow_ball_bound.hpp.

◆ Center() [3/3]

void Center ( VecType &  center) const
inline

Place the center of BallBound into the given vector.

Parameters
centerVector which the centroid will be written to.

Definition at line 145 of file hollow_ball_bound.hpp.

◆ Contains() [1/2]

bool Contains ( const HollowBallBound< TMetricType, ElemType > &  other) const

Determines if another bound is within this bound.

Parameters
otherBound to check the condition.

◆ Contains() [2/2]

bool Contains ( const VecType &  point) const

Determines if a point is within this bound.

Parameters
pointPoint to check the condition.

◆ Diameter()

ElemType Diameter ( ) const
inline

Returns the diameter of the ballbound.

Definition at line 226 of file hollow_ball_bound.hpp.

References RangeType< T >::Hi().

◆ Dim()

size_t Dim ( ) const
inline

Get the dimensionality of the ball.

Definition at line 113 of file hollow_ball_bound.hpp.

◆ HollowCenter() [1/2]

arma::Col< ElemType > & HollowCenter ( )
inline

Modify the center point of the hollow.

Definition at line 110 of file hollow_ball_bound.hpp.

◆ HollowCenter() [2/2]

const arma::Col< ElemType > & HollowCenter ( ) const
inline

Get the center point of the hollow.

Definition at line 108 of file hollow_ball_bound.hpp.

◆ InnerRadius() [1/2]

ElemType & InnerRadius ( )
inline

Modify the inner radius of the ball.

Definition at line 100 of file hollow_ball_bound.hpp.

References RangeType< T >::Lo().

◆ InnerRadius() [2/2]

ElemType InnerRadius ( ) const
inline

Get the innner radius of the ball.

Definition at line 98 of file hollow_ball_bound.hpp.

References RangeType< T >::Lo().

◆ MaxDistance() [1/2]

ElemType MaxDistance ( const HollowBallBound< TMetricType, ElemType > &  other) const

Computes maximum distance.

Parameters
otherBound to which the maximum distance is requested.

◆ MaxDistance() [2/2]

ElemType MaxDistance ( const VecType &  point,
typename std::enable_if_t< IsVector< VecType >::value > *  = 0 
) const

Computes maximum distance.

Parameters
pointPoint to which the maximum distance is requested.

◆ Metric() [1/2]

MetricType & Metric ( )
inline

Modify the distance metric used in this bound.

Definition at line 231 of file hollow_ball_bound.hpp.

◆ Metric() [2/2]

const MetricType & Metric ( ) const
inline

Returns the distance metric used in this bound.

Definition at line 229 of file hollow_ball_bound.hpp.

◆ MinDistance() [1/2]

ElemType MinDistance ( const HollowBallBound< TMetricType, ElemType > &  other) const

Calculates minimum bound-to-bound squared distance.

Parameters
otherBound to which the minimum distance is requested.

◆ MinDistance() [2/2]

ElemType MinDistance ( const VecType &  point,
typename std::enable_if_t< IsVector< VecType >::value > *  = 0 
) const

Calculates minimum bound-to-point squared distance.

Parameters
pointPoint to which the minimum distance is requested.

◆ MinWidth()

ElemType MinWidth ( ) const
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 119 of file hollow_ball_bound.hpp.

References RangeType< T >::Hi().

◆ operator=()

HollowBallBound & operator= ( const HollowBallBound< TMetricType, ElemType > &  other)

For the same reason as the copy constructor: to prevent memory leaks.

◆ operator[]()

math::RangeType< ElemType > operator[] ( const size_t  i) const

Get the range in a certain dimension.

◆ operator|=() [1/2]

const HollowBallBound & operator|= ( const HollowBallBound< TMetricType, ElemType > &  other)

Expand the bound to include the given bound.

The centroid will not be moved.

Template Parameters
MatTypeType of matrix; could be arma::mat, arma::spmat, or a vector.
dataData points to add.

◆ operator|=() [2/2]

const HollowBallBound & operator|= ( const MatType &  data)

Expand the bound to include the given point.

The centroid will not be moved.

Template Parameters
MatTypeType of matrix; could be arma::mat, arma::spmat, or a vector.
dataData points to add.

◆ OuterRadius() [1/2]

ElemType & OuterRadius ( )
inline

Modify the outer radius of the ball.

Definition at line 95 of file hollow_ball_bound.hpp.

References RangeType< T >::Hi().

◆ OuterRadius() [2/2]

ElemType OuterRadius ( ) const
inline

Get the outer radius of the ball.

Definition at line 93 of file hollow_ball_bound.hpp.

References RangeType< T >::Hi().

◆ RangeDistance() [1/2]

math::RangeType< ElemType > RangeDistance ( const HollowBallBound< TMetricType, ElemType > &  other) const

Calculates minimum and maximum bound-to-bound distance.

Example: bound1.MinDistanceSq(other) for minimum distance.

Parameters
otherBound to which the minimum and maximum distances are requested.

◆ RangeDistance() [2/2]

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.

Parameters
otherPoint to which the minimum and maximum distances are requested.

◆ serialize()

void serialize ( Archive &  ar,
const unsigned int  version 
)

Serialize the bound.


The documentation for this class was generated from the following file: