mlpack  master
Public Member Functions | Private Attributes | Friends | List of all members
mlpack::math::RangeType< T > Class Template Reference

Simple real-valued range. More...

Inheritance diagram for mlpack::math::RangeType< T >:
Inheritance graph
[legend]

Public Member Functions

 RangeType ()
 The upper bound. More...
 
 RangeType (const T point)
 
 RangeType (const T lo, const T hi)
 Initializes to specified range. More...
 
bool Contains (const T d) const
 Determines if a point is contained within the range. More...
 
bool Contains (const RangeType &r) const
 Determines if another range overlaps with this one. More...
 
Hi () const
 Get the upper bound. More...
 
T & Hi ()
 Modify the upper bound. More...
 
Lo () const
 Get the lower bound. More...
 
T & Lo ()
 Modify the lower bound. More...
 
Mid () const
 Gets the midpoint of this range. More...
 
bool operator!= (const RangeType &rhs) const
 Compare with another range for strict equality. More...
 
RangeType operator& (const RangeType &rhs) const
 Shrinks this range to be the overlap with another range; this makes an empty set if there is no overlap. More...
 
RangeTypeoperator&= (const RangeType &rhs)
 Shrinks this range to be the overlap with another range; this makes an empty set if there is no overlap. More...
 
RangeType operator* (const T d) const
 Scale the bounds by the given double. More...
 
RangeTypeoperator*= (const T d)
 Scale the bounds by the given double. More...
 
bool operator< (const RangeType &rhs) const
 Compare with another range. More...
 
bool operator== (const RangeType &rhs) const
 Compare with another range for strict equality. More...
 
bool operator> (const RangeType &rhs) const
 Compare with another range. More...
 
RangeType operator| (const RangeType &rhs) const
 Expands this range to include another range. More...
 
RangeTypeoperator|= (const RangeType &rhs)
 Expands this range to include another range. More...
 
template<typename Archive >
void Serialize (Archive &ar, const unsigned int version)
 Serialize the range object. More...
 
Width () const
 Gets the span of the range (hi - lo). More...
 

Private Attributes

hi
 The lower bound. More...
 
lo
 

Friends

template<typename TT >
RangeType< TT > operator* (const TT d, const RangeType< TT > &r)
 Scale the bounds by the given double. More...
 

Detailed Description

template<typename T = double>
class mlpack::math::RangeType< T >

Simple real-valued range.

It contains an upper and lower bound.

Note that until mlpack 3.0.0, this class is named RangeType<> and for the specification where T is double, you can use math::Range. As of mlpack 3.0.0, this class will be renamed math::Range<>.

Template Parameters
Ttype of element held by this range.

Definition at line 19 of file range.hpp.

Constructor & Destructor Documentation

template<typename T = double>
mlpack::math::RangeType< T >::RangeType ( )
inline

The upper bound.

Initialize to an empty set (where lo > hi).

template<typename T = double>
mlpack::math::RangeType< T >::RangeType ( const T  point)
inline
template<typename T = double>
mlpack::math::RangeType< T >::RangeType ( const T  lo,
const T  hi 
)
inline

Initializes to specified range.

Parameters
loLower bound of the range.
hiUpper bound of the range.

Member Function Documentation

template<typename T = double>
bool mlpack::math::RangeType< T >::Contains ( const T  d) const
inline

Determines if a point is contained within the range.

Parameters
dPoint to check.

Referenced by mlpack::math::RangeType< ElemType >::Hi().

template<typename T = double>
bool mlpack::math::RangeType< T >::Contains ( const RangeType< T > &  r) const
inline

Determines if another range overlaps with this one.

Parameters
rOther range.
Returns
true if ranges overlap at all.
template<typename T = double>
T mlpack::math::RangeType< T >::Hi ( ) const
inline
template<typename T = double>
T& mlpack::math::RangeType< T >::Hi ( )
inline

Modify the upper bound.

Definition at line 68 of file range.hpp.

template<typename T = double>
T mlpack::math::RangeType< T >::Lo ( ) const
inline

Get the lower bound.

Definition at line 61 of file range.hpp.

Referenced by mlpack::bound::HollowBallBound< TMetricType, ElemType >::InnerRadius().

template<typename T = double>
T& mlpack::math::RangeType< T >::Lo ( )
inline

Modify the lower bound.

Definition at line 63 of file range.hpp.

template<typename T = double>
T mlpack::math::RangeType< T >::Mid ( ) const
inline

Gets the midpoint of this range.

Referenced by mlpack::math::RangeType< ElemType >::Hi().

template<typename T = double>
bool mlpack::math::RangeType< T >::operator!= ( const RangeType< T > &  rhs) const
inline

Compare with another range for strict equality.

Parameters
rhsOther range.

Referenced by mlpack::math::RangeType< ElemType >::Hi().

template<typename T = double>
RangeType mlpack::math::RangeType< T >::operator& ( const RangeType< T > &  rhs) const
inline

Shrinks this range to be the overlap with another range; this makes an empty set if there is no overlap.

Parameters
rhsOther range.

Referenced by mlpack::math::RangeType< ElemType >::Hi().

template<typename T = double>
RangeType& mlpack::math::RangeType< T >::operator&= ( const RangeType< T > &  rhs)
inline

Shrinks this range to be the overlap with another range; this makes an empty set if there is no overlap.

Parameters
rhsOther range.

Referenced by mlpack::math::RangeType< ElemType >::Hi().

template<typename T = double>
RangeType mlpack::math::RangeType< T >::operator* ( const T  d) const
inline

Scale the bounds by the given double.

Parameters
dScaling factor.

Referenced by mlpack::math::RangeType< ElemType >::Hi().

template<typename T = double>
RangeType& mlpack::math::RangeType< T >::operator*= ( const T  d)
inline

Scale the bounds by the given double.

Parameters
dScaling factor.

Referenced by mlpack::math::RangeType< ElemType >::Hi().

template<typename T = double>
bool mlpack::math::RangeType< T >::operator< ( const RangeType< T > &  rhs) const
inline

Compare with another range.

For Range objects x and y, x < y means that x is strictly less than y and does not overlap at all.

Parameters
rhsOther range.

Referenced by mlpack::math::RangeType< ElemType >::Hi().

template<typename T = double>
bool mlpack::math::RangeType< T >::operator== ( const RangeType< T > &  rhs) const
inline

Compare with another range for strict equality.

Parameters
rhsOther range.

Referenced by mlpack::math::RangeType< ElemType >::Hi().

template<typename T = double>
bool mlpack::math::RangeType< T >::operator> ( const RangeType< T > &  rhs) const
inline

Compare with another range.

For Range objects x and y, x < y means that x is strictly less than y and does not overlap at all.

Parameters
rhsOther range.

Referenced by mlpack::math::RangeType< ElemType >::Hi().

template<typename T = double>
RangeType mlpack::math::RangeType< T >::operator| ( const RangeType< T > &  rhs) const
inline

Expands this range to include another range.

Parameters
rhsRange to include.

Referenced by mlpack::math::RangeType< ElemType >::Hi().

template<typename T = double>
RangeType& mlpack::math::RangeType< T >::operator|= ( const RangeType< T > &  rhs)
inline

Expands this range to include another range.

Parameters
rhsRange to include.

Referenced by mlpack::math::RangeType< ElemType >::Hi().

template<typename T = double>
template<typename Archive >
void mlpack::math::RangeType< T >::Serialize ( Archive &  ar,
const unsigned int  version 
)

Serialize the range object.

Referenced by mlpack::math::RangeType< ElemType >::Hi().

template<typename T = double>
T mlpack::math::RangeType< T >::Width ( ) const
inline

Gets the span of the range (hi - lo).

Referenced by mlpack::math::RangeType< ElemType >::Hi().

Friends And Related Function Documentation

template<typename T = double>
template<typename TT >
RangeType<TT> operator* ( const TT  d,
const RangeType< TT > &  r 
)
friend

Scale the bounds by the given double.

Parameters
dScaling factor.

Member Data Documentation

template<typename T = double>
T mlpack::math::RangeType< T >::hi
private

The lower bound.

Definition at line 38 of file range.hpp.

Referenced by mlpack::math::RangeType< ElemType >::Hi().

template<typename T = double>
T mlpack::math::RangeType< T >::lo
private

Definition at line 37 of file range.hpp.

Referenced by mlpack::math::RangeType< ElemType >::Lo().


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