Go to the documentation of this file.
45 template<
typename Treal>
60 A.lowerBound :
B.lowerBound,
61 A.upperBound <
B.upperBound ?
62 A.upperBound :
B.upperBound);
67 else if (other.
empty()) {
89 if ( !intersection.
empty() ) {
119 inline bool cover(Treal
const value)
const {
123 return (value <= upperBound && value >=
lowerBound);
135 throw Failure(
"Interval<Treal>::increase(Treal const) : "
136 "Attempt to increase empty interval.");
165 return *
this + (-1.0 * other);
203 template<
typename Treal>
209 template<
typename Treal>
210 inline Interval<Treal>
operator+(Treal
const value,
211 Interval<Treal>
const & other) {
212 return Interval<Treal>(value + other.lowerBound,
213 value + other.upperBound);
218 template<
typename Treal>
223 assert(other.
low() >= 0);
229 template<
typename Treal>
231 if (upperBound > 2.0 || lowerBound < -1.0)
232 throw Failure(
"Interval<Treal>::puriStep(int) : It is assumed here "
233 "that the interval I is within [-1.0, 2.0]");
247 bool nonEmptyIntervalInZeroToOne =
false;
248 if(upperBound > lowerBound && lowerBound >= 0 && upperBound <= 1)
249 nonEmptyIntervalInZeroToOne =
true;
254 upperBound = 2 * upperBound - upperBound * upperBound;
255 lowerBound = 2 * lowerBound - lowerBound * lowerBound;
256 if(nonEmptyIntervalInZeroToOne && upperBound < lowerBound) {
258 Treal midPoint = (lowerBound + upperBound) / 2;
259 upperBound = lowerBound = midPoint;
265 upperBound = upperBound * upperBound;
266 lowerBound = lowerBound * lowerBound;
270 template<
typename Treal>
272 if (upperBound > 2.0 || lowerBound < -1.0)
273 throw Failure(
"Interval<Treal>::puriStep(int) : It is assumed here "
274 "that the interval I is within [-1.0, 1.0]");
293 template<
typename Treal>
295 if (upperBound > 2.0 || lowerBound < -1.0)
296 throw Failure(
"Interval<Treal>::puriStep(int, real) : It is assumed here "
297 "that the interval I is within [-1.0, 2.0]");
311 bool nonEmptyIntervalInZeroToOne =
false;
312 if(upperBound > lowerBound && lowerBound >= 0 && upperBound <= 1)
313 nonEmptyIntervalInZeroToOne =
true;
318 upperBound = 2 * alpha * upperBound - alpha * alpha * upperBound * upperBound;
319 lowerBound = 2 * alpha * lowerBound - alpha * alpha * lowerBound * lowerBound;
320 if(nonEmptyIntervalInZeroToOne && upperBound < lowerBound) {
322 Treal midPoint = (lowerBound + upperBound) / 2;
323 upperBound = lowerBound = midPoint;
329 upperBound = ( alpha * upperBound + (1-alpha) ) * ( alpha * upperBound + (1-alpha) );
330 lowerBound = ( alpha * lowerBound + (1-alpha) ) * ( alpha * lowerBound + (1-alpha) );
334 template<
typename Treal>
336 if (upperBound > 2.0 || lowerBound < -1.0)
337 throw Failure(
"Interval<Treal>::invPuriStep(int, real) : It is assumed here "
338 "that the interval I is within [-1.0, 2.0]");
358 template<
typename Treal>
364 s<<
"["<<in.
low()<<
", "<<in.
upp()<<
"]";
Treal template_blas_sqrt(Treal x)
Interval< Treal > sqrtInt(Interval< Treal > const &other)
Definition: Interval.h:219
Treal midPoint() const
Definition: Interval.h:115
static Interval intersect(Interval const &A, Interval const &B)
Definition: Interval.h:53
Treal upp() const
Definition: Interval.h:145
void invPuriStep(int poly)
Definition: Interval.h:271
std::ostream & operator<<(std::ostream &s, Interval< Treal > const &in)
Definition: Interval.h:359
void puriStep(int poly, Treal alpha)
Definition: Interval.h:294
Interval< Treal > operator+(Interval< Treal > const &other) const
Definition: Interval.h:170
XmY< TX, TY > operator-(TX const &AA, TY const &BB)
Substraction of two objects of type TX and TY.
Definition: matrix_proxy.h:277
bool overlap(Interval const &other) const
Definition: Interval.h:125
void intersect_always_non_empty(Interval const &other)
Definition: Interval.h:80
Interval< Treal > operator-(Interval< Treal > const &other) const
Definition: Interval.h:164
Treal length() const
Returns the length of the interval.
Definition: Interval.h:109
bool empty() const
Definition: Interval.h:51
Treal lowerBound
Definition: Interval.h:196
Definition: allocate.cc:39
Interval< Treal > operator/(Treal const &value) const
Definition: Interval.h:174
void invPuriStep(int poly, Treal alpha)
Definition: Interval.h:335
Interval< Treal > operator+(Treal const &value) const
Definition: Interval.h:183
Definition: Interval.h:46
void intersect(Interval const &other)
Definition: Interval.h:64
Interval< Treal > operator*(Treal const &value) const
Definition: Interval.h:156
Treal upperBound
Definition: Interval.h:197
void puriStep(int poly)
Definition: Interval.h:230
void increase(Treal const value)
Increases interval with value in both directions.
Definition: Interval.h:133
Interval< Treal > operator-(Treal const &value) const
Definition: Interval.h:180
Interval(Treal low=1, Treal upp=-1)
Definition: Interval.h:48
XYZpUV< TX, TY, TZ, TU, TV > operator+(XYZ< TX, TY, TZ > const &ABC, XY< TU, TV > const &DE)
Addition of two multiplication proxys XYZ and XY.
Definition: matrix_proxy.h:237
void decrease(Treal const value)
Definition: Interval.h:140
Treal low() const
Definition: Interval.h:144
bool cover(Treal const value) const
Definition: Interval.h:119