MLPACK  1.0.7
Public Member Functions | Private Attributes | Friends | List of all members
mlpack::math::Range Class Reference

Simple real-valued range. More...

Public Member Functions

 Range ()
 The upper bound. More...
 
 Range (const double point)
 
 Range (const double lo, const double hi)
 Initializes to specified range. More...
 
bool Contains (const double d) const
 Determines if a point is contained within the range. More...
 
bool Contains (const Range &r) const
 Determines if another range overlaps with this one. More...
 
double Hi () const
 Get the upper bound. More...
 
double & Hi ()
 Modify the upper bound. More...
 
double Lo () const
 Get the lower bound. More...
 
double & Lo ()
 Modify the lower bound. More...
 
double Mid () const
 Gets the midpoint of this range. More...
 
bool operator!= (const Range &rhs) const
 Compare with another range for strict equality. More...
 
Range operator& (const Range &rhs) const
 Shrinks this range to be the overlap with another range; this makes an empty set if there is no overlap. More...
 
Rangeoperator&= (const Range &rhs)
 Shrinks this range to be the overlap with another range; this makes an empty set if there is no overlap. More...
 
Range operator* (const double d) const
 Scale the bounds by the given double. More...
 
Rangeoperator*= (const double d)
 Scale the bounds by the given double. More...
 
bool operator< (const Range &rhs) const
 Compare with another range. More...
 
bool operator== (const Range &rhs) const
 Compare with another range for strict equality. More...
 
bool operator> (const Range &rhs) const
 Compare with another range. More...
 
Range operator| (const Range &rhs) const
 Expands this range to include another range. More...
 
Rangeoperator|= (const Range &rhs)
 Expands this range to include another range. More...
 
std::string ToString () const
 Returns a string representation of an object. More...
 
double Width () const
 Gets the span of the range (hi - lo). More...
 

Private Attributes

double hi
 The lower bound. More...
 
double lo
 

Friends

Range operator* (const double d, const Range &r)
 Scale the bounds by the given double. More...
 

Detailed Description

Simple real-valued range.

It contains an upper and lower bound.

Definition at line 31 of file range.hpp.

Constructor & Destructor Documentation

mlpack::math::Range::Range ( )
inline

The upper bound.

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

mlpack::math::Range::Range ( const double  point)
inline
mlpack::math::Range::Range ( const double  lo,
const double  hi 
)
inline

Initializes to specified range.

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

Member Function Documentation

bool mlpack::math::Range::Contains ( const double  d) const
inline

Determines if a point is contained within the range.

Parameters
dPoint to check.
bool mlpack::math::Range::Contains ( const Range r) const
inline

Determines if another range overlaps with this one.

Parameters
rOther range.
Returns
true if ranges overlap at all.
double mlpack::math::Range::Hi ( ) const
inline

Get the upper bound.

Definition at line 63 of file range.hpp.

References hi.

double& mlpack::math::Range::Hi ( )
inline

Modify the upper bound.

Definition at line 65 of file range.hpp.

References hi.

double mlpack::math::Range::Lo ( ) const
inline

Get the lower bound.

Definition at line 58 of file range.hpp.

References lo.

double& mlpack::math::Range::Lo ( )
inline

Modify the lower bound.

Definition at line 60 of file range.hpp.

References lo.

double mlpack::math::Range::Mid ( ) const
inline

Gets the midpoint of this range.

bool mlpack::math::Range::operator!= ( const Range rhs) const
inline

Compare with another range for strict equality.

Parameters
rhsOther range.
Range mlpack::math::Range::operator& ( const Range 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.
Range& mlpack::math::Range::operator&= ( const Range 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.
Range mlpack::math::Range::operator* ( const double  d) const
inline

Scale the bounds by the given double.

Parameters
dScaling factor.
Range& mlpack::math::Range::operator*= ( const double  d)
inline

Scale the bounds by the given double.

Parameters
dScaling factor.
bool mlpack::math::Range::operator< ( const Range 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 mlpack::math::Range::operator== ( const Range rhs) const
inline

Compare with another range for strict equality.

Parameters
rhsOther range.
bool mlpack::math::Range::operator> ( const Range 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.
Range mlpack::math::Range::operator| ( const Range rhs) const
inline

Expands this range to include another range.

Parameters
rhsRange to include.
Range& mlpack::math::Range::operator|= ( const Range rhs)
inline

Expands this range to include another range.

Parameters
rhsRange to include.
std::string mlpack::math::Range::ToString ( ) const
inline

Returns a string representation of an object.

double mlpack::math::Range::Width ( ) const
inline

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

Friends And Related Function Documentation

Range operator* ( const double  d,
const Range r 
)
friend

Scale the bounds by the given double.

Parameters
dScaling factor.

Member Data Documentation

double mlpack::math::Range::hi
private

The lower bound.

Definition at line 35 of file range.hpp.

Referenced by Hi().

double mlpack::math::Range::lo
private

Definition at line 34 of file range.hpp.

Referenced by Lo().


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