mlpack
|
Simple real-valued range. More...
#include <range.hpp>
Public Member Functions | |
RangeType () | |
The upper bound. More... | |
RangeType (const T point) | |
Initialize a range to enclose only the given point. | |
RangeType (const T lo, const T hi) | |
Initializes to specified range. More... | |
T | Lo () const |
Get the lower bound. | |
T & | Lo () |
Modify the lower bound. | |
T | Hi () const |
Get the upper bound. | |
T & | Hi () |
Modify the upper bound. | |
T | Width () const |
Gets the span of the range (hi - lo). More... | |
T | Mid () const |
Gets the midpoint of this range. | |
RangeType & | operator|= (const RangeType &rhs) |
Expands this range to include another range. More... | |
RangeType | operator| (const RangeType &rhs) const |
Expands this range to include another range. More... | |
RangeType & | operator &= (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 RangeType &rhs) const |
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) |
Scale the bounds by the given double. More... | |
RangeType | operator* (const T d) const |
Scale the bounds by the given double. 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 for strict equality. More... | |
bool | operator< (const RangeType &rhs) const |
Compare with another range. More... | |
bool | operator> (const RangeType &rhs) const |
Compare with another 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... | |
template<typename Archive > | |
void | serialize (Archive &ar, const uint32_t version) |
Serialize the range object. More... | |
Friends | |
template<typename TT > | |
RangeType< TT > | operator* (const TT d, const RangeType< TT > &r) |
Scale the bounds by the given double. More... | |
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<>.
T | type of element held by this range. |
|
inline |
The upper bound.
Initialize the range to 0.
Initialize to an empty set (where lo > hi).
|
inline |
Initializes to specified range.
Initializes the range to the specified values.
lo | Lower bound of the range. |
hi | Upper bound of the range. |
|
inline |
Determines if a point is contained within the range.
d | Point to check. |
|
inline |
Determines if another range overlaps with this one.
Determines if this range overlaps with another range.
r | Other range. |
|
inline |
Shrinks this range to be the overlap with another range; this makes an empty set if there is no overlap.
rhs | Other range. |
|
inline |
Shrinks this range to be the overlap with another range; this makes an empty set if there is no overlap.
rhs | Other range. |
|
inline |
Compare with another range for strict equality.
rhs | Other range. |
|
inline |
Scale the bounds by the given double.
d | Scaling factor. |
|
inline |
Scale the bounds by the given double.
d | Scaling factor. |
|
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.
rhs | Other range. |
For Range objects x and y, x < y means that x is strictly less than y and does not overlap at all.
|
inline |
Compare with another range for strict equality.
rhs | Other range. |
|
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.
rhs | Other range. |
|
inline |
Expands this range to include another range.
rhs | Range to include. |
|
inline |
Expands this range to include another range.
Expands range to include the other range.
rhs | Range to include. |
void mlpack::math::RangeType< T >::serialize | ( | Archive & | ar, |
const uint32_t | version | ||
) |
Serialize the range object.
Serialize the range.
|
inline |
Gets the span of the range (hi - lo).
Gets the span of the range, hi - lo.
Returns 0 if the range is negative.
|
friend |
Scale the bounds by the given double.
d | Scaling factor. |
r | Bounds range. |