Ball bound encloses a set of points at a specific distance (radius) from a specific point (center). More...
Public Types | |
typedef VecType::elem_type | ElemType |
The underlying data type. More... | |
typedef VecType | Vec |
A public version of the vector type. More... | |
Public Member Functions | |
BallBound () | |
Empty Constructor. More... | |
BallBound (const size_t dimension) | |
Create the ball bound with the specified dimensionality. More... | |
BallBound (const ElemType 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... | |
ElemType | Diameter () const |
Returns the diameter of the ballbound. More... | |
size_t | Dim () const |
Get the dimensionality of the ball. More... | |
template < typename OtherVecType > | |
ElemType | MaxDistance (const OtherVecType &point, typename std::enable_if_t< IsVector< OtherVecType >::value > *=0) const |
Computes maximum distance. More... | |
ElemType | MaxDistance (const BallBound &other) const |
Computes maximum distance. More... | |
const MetricType & | Metric () const |
Returns the distance metric used in this bound. More... | |
MetricType & | Metric () |
Modify the distance metric used in this bound. More... | |
template < typename OtherVecType > | |
ElemType | MinDistance (const OtherVecType &point, typename std::enable_if_t< IsVector< OtherVecType >::value > *=0) const |
Calculates minimum bound-to-point squared distance. More... | |
ElemType | MinDistance (const BallBound &other) const |
Calculates minimum bound-to-bound squared distance. More... | |
ElemType | 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... | |
BallBound & | operator= (BallBound &&other) |
Move assignment operator. More... | |
math::RangeType< ElemType > | 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... | |
ElemType | Radius () const |
Get the radius of the ball. More... | |
ElemType & | Radius () |
Modify the radius of the ball. More... | |
template < typename OtherVecType > | |
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. More... | |
math::RangeType< ElemType > | RangeDistance (const BallBound &other) const |
Calculates minimum and maximum bound-to-bound distance. More... | |
template < typename Archive > | |
void | serialize (Archive &ar, const uint32_t version) |
Serialize the bound. More... | |
Ball bound encloses a set of points at a specific distance (radius) from a specific point (center).
MetricType is the custom metric type that defaults to the Euclidean (L2) distance.
MetricType | metric type used in the distance measure. |
VecType | Type of vector (arma::vec or arma::sp_vec or similar). |
Definition at line 32 of file ballbound.hpp.
typedef VecType::elem_type ElemType |
The underlying data type.
Definition at line 36 of file ballbound.hpp.
typedef VecType Vec |
A public version of the vector type.
Definition at line 38 of file ballbound.hpp.
BallBound | ( | ) |
Empty Constructor.
BallBound | ( | const size_t | dimension | ) |
Create the ball bound with the specified dimensionality.
dimension | Dimensionality of ball bound. |
Create the ball bound with the specified radius and center.
radius | Radius of ball bound. |
center | Center of ball bound. |
Copy constructor. To prevent memory leaks.
Move constructor: take possession of another bound.
~BallBound | ( | ) |
Destructor to release allocated memory.
|
inline |
Get the center point of the ball.
Definition at line 96 of file ballbound.hpp.
Referenced by ProjVector::Project().
|
inline |
Modify the center point of the ball.
Definition at line 98 of file ballbound.hpp.
|
inline |
Place the center of BallBound into the given vector.
center | Vector which the centroid will be written to. |
Definition at line 124 of file ballbound.hpp.
References BallBound< MetricType, VecType >::MaxDistance(), BallBound< MetricType, VecType >::MinDistance(), BallBound< MetricType, VecType >::operator|=(), and BallBound< MetricType, VecType >::RangeDistance().
bool Contains | ( | const VecType & | point | ) | const |
Determines if a point is within this bound.
point | Point to check the condition. |
Referenced by BallBound< MetricType, VecType >::MinWidth().
|
inline |
Returns the diameter of the ballbound.
Definition at line 200 of file ballbound.hpp.
|
inline |
Get the dimensionality of the ball.
Definition at line 101 of file ballbound.hpp.
ElemType MaxDistance | ( | const OtherVecType & | point, |
typename std::enable_if_t< IsVector< OtherVecType >::value > * | = 0 |
||
) | const |
Computes maximum distance.
point | Point to which the maximum distance is requested. |
Referenced by BallBound< MetricType, VecType >::Center().
Computes maximum distance.
other | Bound to which the maximum distance is requested. |
|
inline |
Returns the distance metric used in this bound.
Definition at line 203 of file ballbound.hpp.
|
inline |
Modify the distance metric used in this bound.
Definition at line 205 of file ballbound.hpp.
References BallBound< MetricType, VecType >::serialize().
ElemType MinDistance | ( | const OtherVecType & | point, |
typename std::enable_if_t< IsVector< OtherVecType >::value > * | = 0 |
||
) | const |
Calculates minimum bound-to-point squared distance.
point | Point to which the minimum distance is requested. |
Referenced by BallBound< MetricType, VecType >::Center().
Calculates minimum bound-to-bound squared distance.
other | Bound to which the minimum distance is requested. |
|
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 107 of file ballbound.hpp.
References BallBound< MetricType, VecType >::Contains(), and BallBound< MetricType, VecType >::operator[]().
For the same reason as the copy constructor: to prevent memory leaks.
math::RangeType<ElemType> operator[] | ( | const size_t | i | ) | const |
Get the range in a certain dimension.
Referenced by BallBound< MetricType, VecType >::MinWidth().
Expand the bound to include the given node.
Referenced by BallBound< MetricType, VecType >::Center().
const BallBound& 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 91 of file ballbound.hpp.
Referenced by ProjVector::Project().
|
inline |
Modify the radius of the ball.
Definition at line 93 of file ballbound.hpp.
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.
other | Point to which the minimum and maximum distances are requested. |
Referenced by BallBound< MetricType, VecType >::Center().
math::RangeType<ElemType> RangeDistance | ( | const BallBound< MetricType, VecType > & | other | ) | const |
Calculates minimum and maximum bound-to-bound distance.
Example: bound1.MinDistanceSq(other) for minimum distance.
other | Bound to which the minimum and maximum distances are requested. |
void serialize | ( | Archive & | ar, |
const uint32_t | version | ||
) |
Serialize the bound.
Referenced by BallBound< MetricType, VecType >::Metric().