mlpack 3.4.2
Public Member Functions | List of all members
RangeType< T > Class Template Reference

Simple real-valued range. More...

#include <range.hpp>

Public Member Functions

 RangeType ()
 The upper bound. More...
 
 RangeType (const T lo, const T hi)
 Initializes to specified range. More...
 
 RangeType (const T point)
 
bool Contains (const RangeType &r) const
 Determines if another range overlaps with this one. More...
 
bool Contains (const T d) const
 Determines if a point is contained within the range. More...
 
T & Hi ()
 Modify the upper bound. More...
 
Hi () const
 Get the upper bound. More...
 
T & Lo ()
 Modify the lower bound. More...
 
Lo () const
 Get 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...
 

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 34 of file range.hpp.

Constructor & Destructor Documentation

◆ RangeType() [1/3]

RangeType ( )
inline

The upper bound.

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

◆ RangeType() [2/3]

RangeType ( const T  point)
inline

◆ RangeType() [3/3]

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

◆ Contains() [1/2]

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.

◆ Contains() [2/2]

bool Contains ( const T  d) const
inline

Determines if a point is contained within the range.

Parameters
dPoint to check.

◆ Hi() [1/2]

T & Hi ( )
inline

Modify the upper bound.

Definition at line 68 of file range.hpp.

◆ Hi() [2/2]

T Hi ( ) const
inline

◆ Lo() [1/2]

T & Lo ( )
inline

Modify the lower bound.

Definition at line 63 of file range.hpp.

◆ Lo() [2/2]

T Lo ( ) const
inline

Get the lower bound.

Definition at line 61 of file range.hpp.

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

◆ Mid()

T Mid ( ) const
inline

Gets the midpoint of this range.

◆ operator!=()

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

Compare with another range for strict equality.

Parameters
rhsOther range.

◆ operator&()

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.

◆ operator&=()

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.

◆ operator*()

RangeType operator* ( const T  d) const
inline

Scale the bounds by the given double.

Parameters
dScaling factor.

◆ operator*=()

RangeType & operator*= ( const T  d)
inline

Scale the bounds by the given double.

Parameters
dScaling factor.

◆ operator<()

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.

◆ operator==()

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

Compare with another range for strict equality.

Parameters
rhsOther range.

◆ operator>()

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.

◆ operator|()

RangeType operator| ( const RangeType< T > &  rhs) const
inline

Expands this range to include another range.

Parameters
rhsRange to include.

◆ operator|=()

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

Expands this range to include another range.

Parameters
rhsRange to include.

◆ serialize()

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

Serialize the range object.

◆ Width()

T Width ( ) const
inline

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


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