RangeType< T > Class Template Reference

Simple real-valued range. More...

Inheritance diagram for RangeType< T >:

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

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

 
bool operator!= (const RangeType &rhs) const
 Compare with another range for strict equality. 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 uint32_t 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
=
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

◆ 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 T  d) const
inline

Determines if a point is contained within the range.

Parameters
dPoint to check.

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

◆ Contains() [2/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.

◆ Hi() [1/2]

◆ Hi() [2/2]

T& Hi ( )
inline

Modify the upper bound.

Definition at line 68 of file range.hpp.

◆ Lo() [1/2]

T Lo ( ) const
inline

Get the lower bound.

Definition at line 61 of file range.hpp.

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

◆ Lo() [2/2]

T& Lo ( )
inline

Modify the lower bound.

Definition at line 63 of file range.hpp.

◆ Mid()

T Mid ( ) const
inline

Gets the midpoint of this range.

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

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

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

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

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

◆ operator!=()

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

Compare with another range for strict equality.

Parameters
rhsOther range.

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

◆ operator*()

RangeType operator* ( const T  d) const
inline

Scale the bounds by the given double.

Parameters
dScaling factor.

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

◆ operator*=()

RangeType& operator*= ( const T  d)
inline

Scale the bounds by the given double.

Parameters
dScaling factor.

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

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

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

◆ operator==()

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

Compare with another range for strict equality.

Parameters
rhsOther range.

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

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

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

◆ operator|()

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

Expands this range to include another range.

Parameters
rhsRange to include.

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

◆ operator|=()

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

Expands this range to include another range.

Parameters
rhsRange to include.

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

◆ serialize()

void serialize ( Archive &  ar,
const uint32_t  version 
)

Serialize the range object.

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

◆ Width()

T Width ( ) const
inline

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

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

Friends And Related Function Documentation

◆ operator*

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

Scale the bounds by the given double.

Parameters
dScaling factor.
rBounds range.

The documentation for this class was generated from the following file:
  • /home/ryan/src/mlpack.org/_src/mlpack-git/src/mlpack/core/math/range.hpp