mlpack  2.2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Friends | List of all members
RangeType< T > Class Template Reference

Simple real-valued range. More...

Inheritance diagram for 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...
 

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>
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

RangeType ( )
inline

The upper bound.

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

RangeType ( const T  point)
inline
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

bool Contains ( const T  d) const
inline

Determines if a point is contained within the range.

Parameters
dPoint to check.
bool 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.
T Hi ( ) const
inline
T& Hi ( )
inline

Modify the upper bound.

Definition at line 68 of file range.hpp.

T Lo ( ) const
inline

Get the lower bound.

Definition at line 61 of file range.hpp.

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

T& Lo ( )
inline

Modify the lower bound.

Definition at line 63 of file range.hpp.

T Mid ( ) const
inline

Gets the midpoint of this range.

bool operator!= ( const RangeType< T > &  rhs) const
inline

Compare with another range for strict equality.

Parameters
rhsOther range.
RangeType 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.
RangeType& 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.
RangeType operator* ( const T  d) const
inline

Scale the bounds by the given double.

Parameters
dScaling factor.
RangeType& operator*= ( const T  d)
inline

Scale the bounds by the given double.

Parameters
dScaling factor.
bool 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.
bool operator== ( const RangeType< T > &  rhs) const
inline

Compare with another range for strict equality.

Parameters
rhsOther range.
bool 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.
RangeType operator| ( const RangeType< T > &  rhs) const
inline

Expands this range to include another range.

Parameters
rhsRange to include.
RangeType& operator|= ( const RangeType< T > &  rhs)
inline

Expands this range to include another range.

Parameters
rhsRange to include.
void Serialize ( Archive &  ar,
const unsigned int  version 
)

Serialize the range object.

T Width ( ) const
inline

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

Friends And Related Function Documentation

RangeType<TT> operator* ( const TT  d,
const RangeType< TT > &  r 
)
friend

Scale the bounds by the given double.

Parameters
dScaling factor.

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