Simple real-valued range. More...
Public Member Functions | |
bool | Contains (double d) const |
Determines if a point is contained within the range. | |
bool | Contains (double d) const |
Determines if a point is contained within the range. | |
DRange (double lo_in, double hi_in) | |
Initializes to specified values. | |
DRange (double lo_in, double hi_in) | |
Initializes to specified values. | |
EXPAND_EQUALS (DRange) | |
EXPAND_EQUALS (DRange) | |
EXPAND_HETERO_LESS_THAN (double, DRange) | |
EXPAND_HETERO_LESS_THAN (DRange, double) | |
EXPAND_HETERO_LESS_THAN (double, DRange) | |
EXPAND_HETERO_LESS_THAN (DRange, double) | |
EXPAND_LESS_THAN (DRange) | |
EXPAND_LESS_THAN (DRange) | |
void | Init (double lo_in, double hi_in) |
Initializes to a range of values. | |
void | Init (double lo_in, double hi_in) |
Initializes to a range of values. | |
void | InitEmptySet () |
Initialize to an empty set, where lo > hi. | |
void | InitEmptySet () |
Initialize to an empty set, where lo > hi. | |
void | InitUniversalSet () |
Initializes to -infinity to infinity. | |
void | InitUniversalSet () |
Initializes to -infinity to infinity. | |
double | interpolate (double factor) const |
Interpolates (factor) * hi + (1 - factor) * lo. | |
double | interpolate (double factor) const |
Interpolates (factor) * hi + (1 - factor) * lo. | |
void | MaxWith (double v) |
Takes the maximum of upper and lower bounds independently. | |
void | MaxWith (const DRange &range) |
Takes the maximum of upper and lower bounds independently. | |
void | MaxWith (double v) |
Takes the maximum of upper and lower bounds independently. | |
void | MaxWith (const DRange &range) |
Takes the maximum of upper and lower bounds independently. | |
double | mid () const |
Gets the midpoint of this range. | |
double | mid () const |
Gets the midpoint of this range. | |
void | MinWith (double v) |
Takes the minimum of upper and lower bounds independently. | |
void | MinWith (const DRange &range) |
Takes the minimum of upper and lower bounds independently. | |
void | MinWith (double v) |
Takes the minimum of upper and lower bounds independently. | |
void | MinWith (const DRange &range) |
Takes the minimum of upper and lower bounds independently. | |
OBJECT_TRAVERSAL (DRange) | |
OBJECT_TRAVERSAL (DRange) | |
const DRange & | operator&= (const DRange &other) |
Shrinks range to be the overlap with another range, becoming an empty set if there is no overlap. | |
const DRange & | operator&= (double d) |
Sets this range to include only the specified value, or becomes an empty set if the range does not contain the number. | |
const DRange & | operator&= (const DRange &other) |
Shrinks range to be the overlap with another range, becoming an empty set if there is no overlap. | |
const DRange & | operator&= (double d) |
Sets this range to include only the specified value, or becomes an empty set if the range does not contain the number. | |
const DRange & | operator*= (double d) |
Scales upper and lower bounds. | |
const DRange & | operator*= (double d) |
Scales upper and lower bounds. | |
const DRange & | operator+= (double d) |
Adds to the upper and lower independently. | |
const DRange & | operator+= (const DRange &other) |
Sums the upper and lower independently. | |
const DRange & | operator+= (double d) |
Adds to the upper and lower independently. | |
const DRange & | operator+= (const DRange &other) |
Sums the upper and lower independently. | |
const DRange & | operator-= (double d) |
Subtracts from the upper and lower independently. | |
const DRange & | operator-= (const DRange &other) |
Subtracts from the upper and lower. | |
const DRange & | operator-= (double d) |
Subtracts from the upper and lower independently. | |
const DRange & | operator-= (const DRange &other) |
Subtracts from the upper and lower. | |
const DRange & | operator|= (const DRange &other) |
Expands range to include the other range. | |
const DRange & | operator|= (double d) |
Simulate an union by growing the range if necessary. | |
const DRange & | operator|= (const DRange &other) |
Expands range to include the other range. | |
const DRange & | operator|= (double d) |
Simulate an union by growing the range if necessary. | |
void | Reset (double lo_in, double hi_in) |
Resets to a range of values. | |
void | Reset (double lo_in, double hi_in) |
Resets to a range of values. | |
double | width () const |
Gets the span of the range, hi - lo. | |
double | width () const |
Gets the span of the range, hi - lo. | |
Public Attributes | |
double | hi |
The upper bound. | |
double | lo |
The lower bound. | |
Friends | |
DRange | operator* (double d, const DRange &r) |
Scales upper and lower bounds. | |
DRange | operator* (const DRange &r, double d) |
Scales upper and lower bounds. | |
DRange | operator* (double d, const DRange &r) |
Scales upper and lower bounds. | |
DRange | operator* (const DRange &r, double d) |
Scales upper and lower bounds. | |
DRange | operator+ (const DRange &a, double b) |
DRange | operator+ (const DRange &a, const DRange &b) |
DRange | operator+ (const DRange &a, double b) |
DRange | operator+ (const DRange &a, const DRange &b) |
DRange | operator- (const DRange &a, double b) |
DRange | operator- (const DRange &a, const DRange &b) |
DRange | operator- (const DRange &r) |
Scales upper and lower bounds. | |
DRange | operator- (const DRange &a, double b) |
DRange | operator- (const DRange &a, const DRange &b) |
DRange | operator- (const DRange &r) |
Scales upper and lower bounds. | |
bool | operator< (double a, const DRange &b) |
Compares if a value is STRICTLY less than this range. | |
bool | operator< (const DRange &a, double b) |
Compares if this is STRICTLY less than a value. | |
bool | operator< (const DRange &a, const DRange &b) |
Compares if this is STRICTLY less than another range. | |
bool | operator< (double a, const DRange &b) |
Compares if a value is STRICTLY less than this range. | |
bool | operator< (const DRange &a, double b) |
Compares if this is STRICTLY less than a value. | |
bool | operator< (const DRange &a, const DRange &b) |
Compares if this is STRICTLY less than another range. | |
bool | operator== (const DRange &a, const DRange &b) |
Compares if this is STRICTLY equal to another range. | |
bool | operator== (const DRange &a, const DRange &b) |
Compares if this is STRICTLY equal to another range. |
Simple real-valued range.
Definition at line 244 of file math_lib.h.
DRange::DRange | ( | double | lo_in, | |
double | hi_in | |||
) | [inline] |
Initializes to specified values.
Definition at line 262 of file math_lib.h.
DRange::DRange | ( | double | lo_in, | |
double | hi_in | |||
) | [inline] |
Initializes to specified values.
Definition at line 262 of file math_lib.h.
bool DRange::Contains | ( | double | d | ) | const [inline] |
Determines if a point is contained within the range.
Definition at line 535 of file math_lib.h.
bool DRange::Contains | ( | double | d | ) | const [inline] |
Determines if a point is contained within the range.
Definition at line 535 of file math_lib.h.
References hi.
void DRange::Init | ( | double | lo_in, | |
double | hi_in | |||
) | [inline] |
void DRange::Init | ( | double | lo_in, | |
double | hi_in | |||
) | [inline] |
void DRange::InitEmptySet | ( | ) | [inline] |
Initialize to an empty set, where lo > hi.
Definition at line 267 of file math_lib.h.
void DRange::InitEmptySet | ( | ) | [inline] |
Initialize to an empty set, where lo > hi.
Definition at line 267 of file math_lib.h.
References hi.
Referenced by DHrectBound< t_pow >::Reset().
void DRange::InitUniversalSet | ( | ) | [inline] |
Initializes to -infinity to infinity.
Definition at line 273 of file math_lib.h.
void DRange::InitUniversalSet | ( | ) | [inline] |
double DRange::interpolate | ( | double | factor | ) | const [inline] |
Interpolates (factor) * hi + (1 - factor) * lo.
Definition at line 312 of file math_lib.h.
double DRange::interpolate | ( | double | factor | ) | const [inline] |
Interpolates (factor) * hi + (1 - factor) * lo.
Definition at line 312 of file math_lib.h.
References width().
void DRange::MaxWith | ( | double | v | ) | [inline] |
Takes the maximum of upper and lower bounds independently.
Definition at line 481 of file math_lib.h.
void DRange::MaxWith | ( | const DRange & | range | ) | [inline] |
Takes the maximum of upper and lower bounds independently.
Definition at line 457 of file math_lib.h.
void DRange::MaxWith | ( | double | v | ) | [inline] |
Takes the maximum of upper and lower bounds independently.
Definition at line 481 of file math_lib.h.
References hi.
void DRange::MaxWith | ( | const DRange & | range | ) | [inline] |
Takes the maximum of upper and lower bounds independently.
Definition at line 457 of file math_lib.h.
double DRange::mid | ( | ) | const [inline] |
double DRange::mid | ( | ) | const [inline] |
Gets the midpoint of this range.
Definition at line 305 of file math_lib.h.
References hi.
Referenced by DHrectBound< t_pow >::CalculateMidpoint(), DHrectBound< t_pow >::CalculateMidpointOverwrite(), and DHrectBound< t_pow >::MinToMidSq().
void DRange::MinWith | ( | double | v | ) | [inline] |
Takes the minimum of upper and lower bounds independently.
Definition at line 493 of file math_lib.h.
void DRange::MinWith | ( | const DRange & | range | ) | [inline] |
Takes the minimum of upper and lower bounds independently.
Definition at line 469 of file math_lib.h.
void DRange::MinWith | ( | double | v | ) | [inline] |
Takes the minimum of upper and lower bounds independently.
Definition at line 493 of file math_lib.h.
References hi.
void DRange::MinWith | ( | const DRange & | range | ) | [inline] |
Takes the minimum of upper and lower bounds independently.
Definition at line 469 of file math_lib.h.
Shrinks range to be the overlap with another range, becoming an empty set if there is no overlap.
Definition at line 360 of file math_lib.h.
const DRange& DRange::operator&= | ( | double | d | ) | [inline] |
Sets this range to include only the specified value, or becomes an empty set if the range does not contain the number.
Definition at line 333 of file math_lib.h.
Shrinks range to be the overlap with another range, becoming an empty set if there is no overlap.
Definition at line 360 of file math_lib.h.
const DRange& DRange::operator&= | ( | double | d | ) | [inline] |
Sets this range to include only the specified value, or becomes an empty set if the range does not contain the number.
Definition at line 333 of file math_lib.h.
References hi.
const DRange& DRange::operator*= | ( | double | d | ) | [inline] |
const DRange& DRange::operator*= | ( | double | d | ) | [inline] |
const DRange& DRange::operator+= | ( | double | d | ) | [inline] |
Adds to the upper and lower independently.
Definition at line 413 of file math_lib.h.
Sums the upper and lower independently.
Definition at line 396 of file math_lib.h.
const DRange& DRange::operator+= | ( | double | d | ) | [inline] |
Adds to the upper and lower independently.
Definition at line 413 of file math_lib.h.
References hi.
Sums the upper and lower independently.
Definition at line 396 of file math_lib.h.
const DRange& DRange::operator-= | ( | double | d | ) | [inline] |
Subtracts from the upper and lower independently.
Definition at line 420 of file math_lib.h.
Subtracts from the upper and lower.
THIS SWAPS THE ORDER OF HI AND LO, assuming a worst case result. This is NOT an undo of the + operator.
Definition at line 406 of file math_lib.h.
const DRange& DRange::operator-= | ( | double | d | ) | [inline] |
Subtracts from the upper and lower independently.
Definition at line 420 of file math_lib.h.
References hi.
Subtracts from the upper and lower.
THIS SWAPS THE ORDER OF HI AND LO, assuming a worst case result. This is NOT an undo of the + operator.
Definition at line 406 of file math_lib.h.
Expands range to include the other range.
Definition at line 346 of file math_lib.h.
const DRange& DRange::operator|= | ( | double | d | ) | [inline] |
Simulate an union by growing the range if necessary.
Definition at line 319 of file math_lib.h.
Expands range to include the other range.
Definition at line 346 of file math_lib.h.
const DRange& DRange::operator|= | ( | double | d | ) | [inline] |
Simulate an union by growing the range if necessary.
Definition at line 319 of file math_lib.h.
References hi.
void DRange::Reset | ( | double | lo_in, | |
double | hi_in | |||
) | [inline] |
Resets to a range of values.
Since there is no dynamic memory this is the same as Init, but calling Reset instead of Init probably looks more similar to surrounding code.
Definition at line 290 of file math_lib.h.
void DRange::Reset | ( | double | lo_in, | |
double | hi_in | |||
) | [inline] |
Resets to a range of values.
Since there is no dynamic memory this is the same as Init, but calling Reset instead of Init probably looks more similar to surrounding code.
Definition at line 290 of file math_lib.h.
References hi.
double DRange::width | ( | ) | const [inline] |
Gets the span of the range, hi - lo.
Definition at line 298 of file math_lib.h.
double DRange::width | ( | ) | const [inline] |
Gets the span of the range, hi - lo.
Definition at line 298 of file math_lib.h.
References hi.
Referenced by interpolate().
Scales upper and lower bounds.
Definition at line 390 of file math_lib.h.
Scales upper and lower bounds.
Definition at line 384 of file math_lib.h.
Scales upper and lower bounds.
Definition at line 390 of file math_lib.h.
Scales upper and lower bounds.
Definition at line 384 of file math_lib.h.
Scales upper and lower bounds.
Definition at line 371 of file math_lib.h.
Scales upper and lower bounds.
Definition at line 371 of file math_lib.h.
bool operator< | ( | double | a, | |
const DRange & | b | |||
) | [friend] |
Compares if a value is STRICTLY less than this range.
Definition at line 527 of file math_lib.h.
bool operator< | ( | const DRange & | a, | |
double | b | |||
) | [friend] |
Compares if this is STRICTLY less than a value.
Definition at line 520 of file math_lib.h.
Compares if this is STRICTLY less than another range.
Definition at line 505 of file math_lib.h.
bool operator< | ( | double | a, | |
const DRange & | b | |||
) | [friend] |
Compares if a value is STRICTLY less than this range.
Definition at line 527 of file math_lib.h.
bool operator< | ( | const DRange & | a, | |
double | b | |||
) | [friend] |
Compares if this is STRICTLY less than a value.
Definition at line 520 of file math_lib.h.
Compares if this is STRICTLY less than another range.
Definition at line 505 of file math_lib.h.
Compares if this is STRICTLY equal to another range.
Definition at line 512 of file math_lib.h.
Compares if this is STRICTLY equal to another range.
Definition at line 512 of file math_lib.h.
double DRange::hi |
The upper bound.
Definition at line 253 of file math_lib.h.
Referenced by DHrectBound< t_pow >::Add(), Contains(), Init(), InitEmptySet(), InitUniversalSet(), MaxWith(), mid(), DHrectBound< t_pow >::MidDistanceSq(), DHrectBound< t_pow >::MinDistanceSq(), DHrectBound< t_pow >::MinimaxDistanceSq(), DHrectBound< t_pow >::MinToMidSq(), MinWith(), operator&=(), operator*=(), operator+=(), operator-=(), operator|=(), DHrectBound< t_pow >::PeriodicMaxDistanceSq(), DHrectBound< t_pow >::PeriodicMinDistanceSq(), DHrectBound< t_pow >::RangeDistanceSq(), EpanKernel::RangeUnnormOnSq(), GaussianStarKernel::RangeUnnormOnSq(), GaussianKernel::RangeUnnormOnSq(), Reset(), DatasetScaler::ScaleDataByMinMax(), DatasetScaler::TranslateDataByMin(), and width().
double DRange::lo |
The lower bound.
Definition at line 249 of file math_lib.h.
Referenced by DHrectBound< t_pow >::Add(), Contains(), Init(), InitEmptySet(), InitUniversalSet(), interpolate(), MaxWith(), mid(), DHrectBound< t_pow >::MidDistanceSq(), DHrectBound< t_pow >::MinDistanceSq(), DHrectBound< t_pow >::MinimaxDistanceSq(), DHrectBound< t_pow >::MinToMidSq(), MinWith(), operator&=(), operator*=(), operator+=(), operator-=(), operator|=(), DHrectBound< t_pow >::PeriodicMaxDistanceSq(), DHrectBound< t_pow >::PeriodicMinDistanceSq(), DHrectBound< t_pow >::RangeDistanceSq(), EpanKernel::RangeUnnormOnSq(), GaussianStarKernel::RangeUnnormOnSq(), GaussianKernel::RangeUnnormOnSq(), Reset(), DatasetScaler::ScaleDataByMinMax(), DatasetScaler::TranslateDataByMin(), and width().