PLearn 0.1
|
represents a real range: i.e. one of ]low,high[ ; [low,high[; [low,high]; ]low,high] More...
#include <RealMapping.h>
Public Member Functions | |
RealRange () | |
RealRange (char leftbracket_, real low_, real high_, char rightbracket_) | |
real | span () |
void | checkbrackets () const |
void | print (ostream &out) const |
void | write (ostream &out) const |
void | read (PStream &in) |
string | getString () const |
bool | contains (real val) const |
Compare RealRange and real: the relation is either: Range `contains` real Range < real, if higher bound < real Range > real, if lower bound > real. | |
bool | operator< (real x) const |
bool | operator> (real x) const |
bool | operator< (const RealRange &x) const |
bool | operator> (const RealRange &x) const |
bool | operator== (const RealRange &rr) const |
Public Attributes | |
real | low |
real | high |
char | leftbracket |
char | rightbracket |
represents a real range: i.e. one of ]low,high[ ; [low,high[; [low,high]; ]low,high]
Definition at line 53 of file RealMapping.h.
PLearn::RealRange::RealRange | ( | ) | [inline] |
Definition at line 62 of file RealMapping.h.
: // default construvtor low(0), high(0), leftbracket(']'), rightbracket('[') {}
PLearn::RealRange::RealRange | ( | char | leftbracket_, |
real | low_, | ||
real | high_, | ||
char | rightbracket_ | ||
) | [inline] |
Definition at line 67 of file RealMapping.h.
: low(low_), high(high_), leftbracket(leftbracket_), rightbracket(rightbracket_) { checkbrackets(); }
void PLearn::RealRange::checkbrackets | ( | ) | const [inline] |
Definition at line 73 of file RealMapping.h.
References PLERROR.
Referenced by PLearn::operator>>().
{ if( (leftbracket!='[' && leftbracket!=']') || (rightbracket!='[' && rightbracket!=']') ) PLERROR("In RealRange: Brackets must be either '[' or ']'"); }
Compare RealRange and real: the relation is either: Range `contains` real Range < real, if higher bound < real Range > real, if lower bound > real.
Definition at line 115 of file RealMapping.cc.
References PLearn::fast_exact_is_equal().
{ return (val>=low) && (val<=high) && (!fast_exact_is_equal(val, low) || leftbracket=='[') && (!fast_exact_is_equal(val, high) || rightbracket==']'); }
string PLearn::RealRange::getString | ( | ) | const |
Definition at line 103 of file RealMapping.cc.
{ ostringstream s; s << leftbracket << low << ' ' << high << rightbracket; return s.str(); // // char s[50]; // sprintf(s,"%c%f %f%c",leftbracket,low,high,rightbracket); // return s; }
Definition at line 121 of file RealMapping.cc.
References PLearn::fast_exact_is_equal().
{ return high < x || (fast_exact_is_equal(high, x) && rightbracket == '['); }
Compare 2 RealRanges: This can be used to sort a list of RealRanges, or to build a map indexed by RealRanges. Note that ordering of ranges is only properly defined for ranges that do not overlap.
Definition at line 127 of file RealMapping.cc.
References PLearn::fast_exact_is_equal(), leftbracket, and low.
{ return high < x.low || (fast_exact_is_equal(high, x.low) && (rightbracket=='[' || x.leftbracket==']')); }
Definition at line 133 of file RealMapping.cc.
References PLearn::fast_exact_is_equal(), high, leftbracket, low, and rightbracket.
{ return (fast_exact_is_equal(rr.low, low) && fast_exact_is_equal(rr.high,high) && rr.leftbracket == leftbracket && rr.rightbracket == rightbracket); }
Definition at line 124 of file RealMapping.cc.
References PLearn::fast_exact_is_equal().
{ return low > x || (fast_exact_is_equal(low, x) && leftbracket == ']'); }
Definition at line 130 of file RealMapping.cc.
References PLearn::fast_exact_is_equal(), high, and rightbracket.
{ return low > x.high || (fast_exact_is_equal(low, x.high) && (leftbracket==']' || x.rightbracket=='[')); }
void PLearn::RealRange::print | ( | ostream & | out | ) | const [inline] |
Definition at line 79 of file RealMapping.h.
Referenced by PLearn::operator<<().
{ out << leftbracket << low << ' ' << high << rightbracket; }
void PLearn::RealRange::read | ( | PStream & | in | ) | [inline] |
Definition at line 85 of file RealMapping.h.
Referenced by PLearn::read(), and PLearn::RealMapping::read().
{ in >> leftbracket >> low >> high >> rightbracket; checkbrackets(); }
real PLearn::RealRange::span | ( | ) | [inline] |
Definition at line 71 of file RealMapping.h.
References PLearn::abs().
void PLearn::RealRange::write | ( | ostream & | out | ) | const [inline] |
Definition at line 82 of file RealMapping.h.
Referenced by PLearn::write().
{ out << leftbracket << low << ' ' << high << rightbracket; }
Definition at line 57 of file RealMapping.h.
Referenced by PLearn::BasisSelectionRegressor::appendCandidateFunctionsOfSingleField(), PLearn::ConvertToPyObject< RealRange >::newPyObject(), PLearn::operator<<(), operator==(), operator>(), and PLearn::operator>>().
Definition at line 58 of file RealMapping.h.
Referenced by PLearn::ConvertToPyObject< RealRange >::newPyObject(), operator<(), PLearn::operator<<(), operator==(), and PLearn::operator>>().
Definition at line 56 of file RealMapping.h.
Referenced by PLearn::BasisSelectionRegressor::appendCandidateFunctionsOfSingleField(), PLearn::ConvertToPyObject< RealRange >::newPyObject(), operator<(), PLearn::operator<<(), operator==(), and PLearn::operator>>().
Definition at line 59 of file RealMapping.h.
Referenced by PLearn::ConvertToPyObject< RealRange >::newPyObject(), PLearn::operator<<(), operator==(), operator>(), and PLearn::operator>>().