codac 1.5.6
Loading...
Searching...
No Matches
codac2::Interval Class Reference

Interval class, for representing closed and connected subsets of \(\mathbb{R}\). More...

#include <codac2_Interval.h>

Public Member Functions

 Interval ()
 Creates an interval \([-\infty,\infty]\).
 
 Interval (double a)
 Creates a degenerate interval \([a,a]\), \(a\in\mathbb{R}\).
 
 Interval (double a, double b)
 Creates an interval \([a,b]\), \(a\in\mathbb{R}, b\in\mathbb{R}\).
 
 Interval (const Interval &x)
 Creates an interval from another one.
 
 Interval (const std::array< double, 1 > &array)
 Create an interval \([a,a]\) from a fixed-sized array of size 1.
 
 Interval (const std::array< double, 2 > &array)
 Create an interval \([a,b]\) from a fixed-sized array of size 2.
 
 Interval (std::initializer_list< double > l)
 Create an interval as the hull of a list of values.
 
Intervalinit ()
 Sets the value of this interval to [-oo,oo].
 
Intervalinit (const Interval &x)
 Sets the value of this interval to x.
 
Intervalinit_from_list (const std::list< double > &l)
 Sets the bounds as the hull of a list of values.
 
Intervaloperator= (double x)
 Sets this to x.
 
Intervaloperator= (const Interval &x)
 Sets this to x.
 
bool operator== (const Interval &x) const
 Comparison (equality) between two intervals.
 
bool operator!= (const Interval &x) const
 Comparison (non equality) between two intervals.
 
double lb () const
 Returns the lower bound of this.
 
double ub () const
 Returns the upper bound of this.
 
double mid () const
 Returns the midpoint of this.
 
double mag () const
 Returns the magnitude of this i.e. max(|lower bound|, |upper bound|).
 
double mig () const
 Returns the mignitude of this.
 
double rand () const
 Returns a random value inside the interval.
 
double rad () const
 Returns the radius of this.
 
double diam () const
 Returns the diameter of this.
 
double volume () const
 Returns the diameter of this.
 
Index size () const
 Returns the dimension of this (which is always )
 
void set_empty ()
 Sets this interval to the empty set.
 
bool is_empty () const
 Tests if this is empty.
 
bool contains (const double &x) const
 Tests if this contains x.
 
bool interior_contains (const double &x) const
 Tests if the interior of this contains x.
 
bool is_unbounded () const
 Tests if one of the bounds of this is infinite.
 
bool is_degenerated () const
 Tests if this is degenerated, that is, in the form of \([a,a]\).
 
bool is_integer () const
 Tests if this is an integer, that is, in the form of \([n,n]\) where n is an integer.
 
bool intersects (const Interval &x) const
 Tests if this and x intersect.
 
bool is_disjoint (const Interval &x) const
 Tests if this and x do not intersect.
 
bool overlaps (const Interval &x) const
 Tests if this and x intersect and their intersection has a non-null volume.
 
bool is_subset (const Interval &x) const
 Tests if this is a subset of x.
 
bool is_strict_subset (const Interval &x) const
 Tests if this is a subset of x and not x itself.
 
bool is_interior_subset (const Interval &x) const
 Tests if this is in the interior of x.
 
bool is_strict_interior_subset (const Interval &x) const
 Tests if this is in the interior of x and different from x.
 
bool is_superset (const Interval &x) const
 Tests if this is a superset of x.
 
bool is_strict_superset (const Interval &x) const
 Tests if this is a superset of x and different from x.
 
Intervalinflate (const double &rad)
 Adds [-rad,+rad] to this.
 
bool is_bisectable () const
 Tests if this can be bisected into two non-degenerated intervals.
 
std::pair< Interval, Intervalbisect (float ratio=0.49) const
 Bisects this into two subintervals.
 
std::vector< Intervalcomplementary (bool compactness=true) const
 Computes the complementary of this.
 
std::vector< Intervaldiff (const Interval &y, bool compactness=true) const
 Computes the result of \([x]\[y]\).
 
Intervaloperator|= (const Interval &x)
 Self union of this and x.
 
Intervaloperator&= (const Interval &x)
 Self intersection of this and x.
 
Intervaloperator+= (double x)
 Self addition of this and a real x.
 
Intervaloperator+= (const Interval &x)
 Self addition of this and x.
 
Interval operator- () const
 Substraction of this.
 
Intervaloperator-= (double x)
 Self substraction of this and a real x.
 
Intervaloperator-= (const Interval &x)
 Self substraction of this and x.
 
Intervaloperator*= (double x)
 Self multiplication of this and a real x.
 
Intervaloperator*= (const Interval &x)
 Self multiplication of this and x.
 
Intervaloperator/= (double x)
 Self division of this and a real x.
 
Intervaloperator/= (const Interval &x)
 Self division of this and x.
 

Static Public Member Functions

static Interval empty ()
 Provides an empty interval.
 
static Interval zero ()
 Provides an interval for \([0]\).
 
static Interval one ()
 Provides an interval for \([1]\).
 
static Interval half_pi ()
 Provides an interval for \([\frac{\pi}{2}]\).
 
static Interval pi ()
 Provides an interval for \([\pi]\).
 
static Interval two_pi ()
 Provides an interval for \([2\pi]\).
 

Detailed Description

Interval class, for representing closed and connected subsets of \(\mathbb{R}\).

The class also encapsulates the interval representation provided by the Gaol library.

This class reuses several functions developed for ibex::Interval. See ibex::Interval (IBEX lib, main author: Gilles Chabert) https://ibex-lib.readthedocs.io

Constructor & Destructor Documentation

◆ Interval() [1/6]

codac2::Interval::Interval ( double a)
inline

Creates a degenerate interval \([a,a]\), \(a\in\mathbb{R}\).

Parameters
asingle value contained in the resulting interval
26 : gaol::interval(a)
27 {
28 if(a == -oo || a == oo)
29 set_empty();
30 }
void set_empty()
Sets this interval to the empty set.
Definition codac2_Interval_impl.h:188

◆ Interval() [2/6]

codac2::Interval::Interval ( double a,
double b )
inline

Creates an interval \([a,b]\), \(a\in\mathbb{R}, b\in\mathbb{R}\).

Parameters
alower bound of the interval
bupper bound of the interval
33 : gaol::interval(a,b)
34 { }

◆ Interval() [3/6]

codac2::Interval::Interval ( const Interval & x)
inline

Creates an interval from another one.

Parameters
xthe interval to be copied
37 : gaol::interval(x)
38 { }

◆ Interval() [4/6]

codac2::Interval::Interval ( const std::array< double, 1 > & array)
inlineexplicit

Create an interval \([a,a]\) from a fixed-sized array of size 1.

Parameters
arraythe array of doubles
41 : Interval(array[0])
42 { }
Interval()
Creates an interval .
Definition codac2_Interval_impl.h:21

◆ Interval() [5/6]

codac2::Interval::Interval ( const std::array< double, 2 > & array)
inlineexplicit

Create an interval \([a,b]\) from a fixed-sized array of size 2.

Parameters
arraythe array of doubles
45 : Interval(array[0],array[1])
46 { }

◆ Interval() [6/6]

codac2::Interval::Interval ( std::initializer_list< double > l)
inline

Create an interval as the hull of a list of values.

Parameters
llist of values contained in the resulting interval
49 : Interval()
50 {
52 }
Interval & init_from_list(const std::list< double > &l)
Sets the bounds as the hull of a list of values.
Definition codac2_Interval_impl.h:66

Member Function Documentation

◆ init() [1/2]

Interval & codac2::Interval::init ( )
inline

Sets the value of this interval to [-oo,oo].

Note
This function is used for template purposes.
Returns
a reference to this
55 {
56 *this = Interval(-oo,oo);
57 return *this;
58 }

◆ init() [2/2]

Interval & codac2::Interval::init ( const Interval & x)
inline

Sets the value of this interval to x.

Note
This function is used for template purposes.
Parameters
xthe value for re-initialization
Returns
a reference to this
61 {
62 *this = x;
63 return *this;
64 }

◆ init_from_list()

Interval & codac2::Interval::init_from_list ( const std::list< double > & l)
inline

Sets the bounds as the hull of a list of values.

Note
This function is separated from the constructor for py binding purposes.
Parameters
llist of values contained in the resulting interval
Returns
a reference to this
67 {
68 if(l.size() == 1)
69 *this = Interval(*l.begin());
70
71 else if(l.size() == 2)
72 *this = Interval(*l.begin(),*std::prev(l.end()));
73
74 else
75 {
76 assert_release("'Interval' can only be defined by one or two 'double' values.");
77 }
78
79 return *this;
80 }

◆ operator=() [1/2]

Interval & codac2::Interval::operator= ( double x)
inline

Sets this to x.

Parameters
xreal to be intervalized
Returns
a reference to this
83 {
84 if(x == -oo || x == oo)
85 set_empty();
86 else
87 gaol::interval::operator=(x);
88
89 return *this;
90 }

◆ operator=() [2/2]

Interval & codac2::Interval::operator= ( const Interval & x)
inline

Sets this to x.

Parameters
xinterval to be copied
Returns
a reference to this
93 {
94 gaol::interval::operator=(x);
95 return *this;
96 }

◆ operator==()

bool codac2::Interval::operator== ( const Interval & x) const
inline

Comparison (equality) between two intervals.

Parameters
xinterval to be compared with
Returns
true iff this and x are exactly the same intervals
99 {
100 return (is_empty() && x.is_empty()) || (lb() == x.lb() && ub() == x.ub());
101 }
bool is_empty() const
Tests if this is empty.
Definition codac2_Interval_impl.h:193
double ub() const
Returns the upper bound of this.
Definition codac2_Interval_impl.h:113
double lb() const
Returns the lower bound of this.
Definition codac2_Interval_impl.h:108

◆ operator!=()

bool codac2::Interval::operator!= ( const Interval & x) const
inline

Comparison (non equality) between two intervals.

Parameters
xinterval to be compared with
Returns
true iff this and x are not exactly the same intervals
104 {
105 return !(*this == x);
106 }

◆ lb()

double codac2::Interval::lb ( ) const
inline

Returns the lower bound of this.

Returns
lower bound
109 {
110 return gaol::interval::left();
111 }

◆ ub()

double codac2::Interval::ub ( ) const
inline

Returns the upper bound of this.

Returns
upper bound
114 {
115 return gaol::interval::right();
116 }

◆ mid()

double codac2::Interval::mid ( ) const
inline

Returns the midpoint of this.

Note
The return point is guaranteed to be included in this but not necessarily to be the closest floating point from the real midpoint. In particular, cases are:
  • [empty] -> Quiet NaN
  • [-oo,+oo] -> mid = 0.0
  • [-oo,b] -> mid = -MAXREAL
  • [a,+oo] -> mid = MAXREAL
  • [a,b] -> mid ~ a + .5*(b-a)
Returns
midpoint
119 {
120 double m = gaol::interval::midpoint();
121 gaol::round_upward();
122 return m;
123 }

◆ mag()

double codac2::Interval::mag ( ) const
inline

Returns the magnitude of this i.e. max(|lower bound|, |upper bound|).

Returns
the magnitude of the interval
126 {
127 return gaol::interval::mag();
128 }

◆ mig()

double codac2::Interval::mig ( ) const
inline

Returns the mignitude of this.

+(lower bound) if lower_bound > 0 -(upper bound) if upper_bound < 0 0 otherwise.

Returns
the mignitude of the interval
131 {
132 return gaol::interval::mig();
133 }

◆ rand()

double codac2::Interval::rand ( ) const
inline

Returns a random value inside the interval.

Note
The seed of the pseudo-random number generator is voluntarily initialized outside this function, on demand.
In case of infinite bounds, only floating point values can be returned.
Returns
random value
136 {
137 if(is_empty())
138 return std::numeric_limits<double>::quiet_NaN();
139
140 double a = std::max<double>(next_float(-oo),lb());
141 double b = std::min<double>(previous_float(oo),ub());
142 double r = a + (((double)std::rand())/(double)RAND_MAX)*(b-a);
143 // The above operation may result in a floating point outside the bounds,
144 // due to floating-point errors. Such possible error is corrected below:
145 return std::max<double>(lb(),std::min<double>(r,ub()));
146 }

◆ rad()

double codac2::Interval::rad ( ) const
inline

Returns the radius of this.

Returns
the radius, or 0 if this is empty
149 {
150 if(is_empty())
151 return std::numeric_limits<double>::quiet_NaN();
152
153 else if(is_unbounded())
154 return oo;
155
156 else
157 {
158 double t = mid();
159 double t1 = (t-*this).ub();
160 double t2 = (*this-t).ub();
161 return (t1>t2) ? t1 : t2;
162 }
163 }
bool is_unbounded() const
Tests if one of the bounds of this is infinite.
Definition codac2_Interval_impl.h:208
double mid() const
Returns the midpoint of this.
Definition codac2_Interval_impl.h:118

◆ diam()

double codac2::Interval::diam ( ) const
inline

Returns the diameter of this.

Returns
the diameter, or 0 if this is empty
166 {
167 if(is_empty())
168 return std::numeric_limits<double>::quiet_NaN();
169
170 else
171 {
172 double d = gaol::interval::width();
173 gaol::round_upward();
174 return d;
175 }
176 }

◆ volume()

double codac2::Interval::volume ( ) const
inline

Returns the diameter of this.

Note
This function is used for template purposes. See diam()
Returns
the diameter, or 0 if this is empty
179 {
180 return diam();
181 }
double diam() const
Returns the diameter of this.
Definition codac2_Interval_impl.h:165

◆ size()

Index codac2::Interval::size ( ) const
inline

Returns the dimension of this (which is always )

Note
This function is used for template purposes.
Returns
1
184 {
185 return 1;
186 }

◆ is_empty()

bool codac2::Interval::is_empty ( ) const
inline

Tests if this is empty.

Returns
true in case of empty set
194 {
195 return gaol::interval::is_empty();
196 }

◆ contains()

bool codac2::Interval::contains ( const double & x) const
inline

Tests if this contains x.

Note
x can also be an "open bound", i.e., infinity. So this function is not restricted to a set-membership interpretation.
Parameters
xreal value
Returns
true if this contains x
199 {
200 return gaol::interval::set_contains(x);
201 }

◆ interior_contains()

bool codac2::Interval::interior_contains ( const double & x) const
inline

Tests if the interior of this contains x.

Parameters
xreal value
Returns
true if the interior of this contains x
204 {
205 return !is_empty() && x > lb() && x < ub();
206 }

◆ is_unbounded()

bool codac2::Interval::is_unbounded ( ) const
inline

Tests if one of the bounds of this is infinite.

Note
An empty interval is always bounded
Returns
true if of the bounds of this is infinite
209 {
210 return !gaol::interval::is_finite();
211 }

◆ is_degenerated()

bool codac2::Interval::is_degenerated ( ) const
inline

Tests if this is degenerated, that is, in the form of \([a,a]\).

Note
An empty interval is considered here as degenerated
Returns
true if this is degenerated
214 {
215 return is_empty() || gaol::interval::is_a_double();
216 }

◆ is_integer()

bool codac2::Interval::is_integer ( ) const
inline

Tests if this is an integer, that is, in the form of \([n,n]\) where n is an integer.

Returns
true if this is an integer singleton
219 {
220 return gaol::interval::is_an_int();
221 }

◆ intersects()

bool codac2::Interval::intersects ( const Interval & x) const
inline

Tests if this and x intersect.

Parameters
xthe other interval
Returns
true if the intervals intersect
224 {
225 return !is_empty() && !x.is_empty() && lb() <= x.ub() && ub() >= x.lb();
226 }

◆ is_disjoint()

bool codac2::Interval::is_disjoint ( const Interval & x) const
inline

Tests if this and x do not intersect.

Parameters
xthe other interval
Returns
true if the intervals are disjoint
229 {
230 return is_empty() || x.is_empty() || lb() > x.ub() || ub() < x.lb();
231 }

◆ overlaps()

bool codac2::Interval::overlaps ( const Interval & x) const
inline

Tests if this and x intersect and their intersection has a non-null volume.

Parameters
xthe other interval
Returns
true if some interior points (of this or x) belong to their intersection
234 {
235 return !is_empty() && !x.is_empty() && ub() > x.lb() && x.ub() > lb();
236 }

◆ is_subset()

bool codac2::Interval::is_subset ( const Interval & x) const
inline

Tests if this is a subset of x.

Note
If this is empty, always returns true
Parameters
xthe other interval
Returns
true iff this interval is a subset of x
239 {
240 return is_empty() || (!x.is_empty() && x.lb() <= lb() && x.ub() >= ub());
241 }

◆ is_strict_subset()

bool codac2::Interval::is_strict_subset ( const Interval & x) const
inline

Tests if this is a subset of x and not x itself.

Note
In particular, \([-\infty,\infty]\) is not a strict subset of \([-\infty,\infty]\) and \(\varnothing\) is not a strict subset of \(\varnothing\), although in both cases, the first is inside the interior of the second.
Parameters
xthe other interval
Returns
true iff this interval is a strict subset of x
244 {
245 return !x.is_empty() && (is_empty() || (x.lb() < lb() && x.ub() >= ub()) || (x.ub() > ub() && x.lb() <= lb()));
246 }

◆ is_interior_subset()

bool codac2::Interval::is_interior_subset ( const Interval & x) const
inline

Tests if this is in the interior of x.

Note
In particular, \([-\infty,\infty]\) is in the interior of \([-\infty,\infty]\) and \(\varnothing\) is in the interior of \(\varnothing\).
Parameters
xthe other interval
Returns
true iff this interval is in the interior of x
249 {
250 return is_empty() || (!x.is_empty() && (x.lb() == -oo || x.lb() < lb()) && (x.ub() == oo || x.ub() > ub()));
251 }

◆ is_strict_interior_subset()

bool codac2::Interval::is_strict_interior_subset ( const Interval & x) const
inline

Tests if this is in the interior of x and different from x.

Note
In particular, \([-\infty,\infty]\) is not strictly in the interior of \([-\infty,\infty]\) and \(\varnothing\) is not strictly in the interior of \(\varnothing\).
Parameters
xthe other interval
Returns
true iff this interval is a strict interior subset of x
254 {
255 return !x.is_empty() && (is_empty() || (
256 (x.lb() < lb() && (x.ub() == oo || x.ub() > ub()))
257 || (x.ub() > ub() && (x.lb() == -oo || x.lb() < lb()))
258 ));
259 }

◆ is_superset()

bool codac2::Interval::is_superset ( const Interval & x) const
inline

Tests if this is a superset of x.

Note
If this is empty, always returns true
Parameters
xthe other interval
Returns
true iff this interval is a superset of x
262 {
263 return x.is_subset(*this);
264 }

◆ is_strict_superset()

bool codac2::Interval::is_strict_superset ( const Interval & x) const
inline

Tests if this is a superset of x and different from x.

See also
is_strict_subset()
Parameters
xthe other interval
Returns
true iff this interval is a strict superset of x
267 {
268 return x.is_strict_subset(*this);
269 }

◆ inflate()

Interval & codac2::Interval::inflate ( const double & rad)
inline

Adds [-rad,+rad] to this.

Parameters
radthe radius of the inflation
Returns
a reference to this
272 {
273 (*this) += Interval(-rad,rad);
274 return *this;
275 }
double rad() const
Returns the radius of this.
Definition codac2_Interval_impl.h:148

◆ is_bisectable()

bool codac2::Interval::is_bisectable ( ) const
inline

Tests if this can be bisected into two non-degenerated intervals.

Note
Examples of non bisectable intervals are [0,next_float(0)] or [DBL_MAX,+oo).
Returns
true iff this can be bisected
278 {
279 if(is_empty())
280 return false;
281 double m = mid();
282 return lb() < m && m < ub();
283 }

◆ bisect()

std::pair< Interval, Interval > codac2::Interval::bisect ( float ratio = 0.49) const
inline

Bisects this into two subintervals.

Precondition
is_bisectable() must be true
0 < ratio < 1
Parameters
ratiooptional proportion of split (0.5 corresponds to middle)
Returns
a pair of resulting subintervals
286 {
287 assert_release(is_bisectable());
288 assert_release(Interval(0,1).interior_contains(ratio));
289
290 if(lb() == -oo)
291 {
292 if(ub() == oo)
293 return { Interval(-oo,0), Interval(0,oo) };
294 else
295 return { Interval(-oo,-std::numeric_limits<double>::max()), Interval(-std::numeric_limits<double>::max(),ub()) };
296 }
297
298 else if(ub() == oo)
299 return { Interval(lb(),std::numeric_limits<double>::max()), Interval(std::numeric_limits<double>::max(),oo) };
300
301 else
302 {
303 double m;
304
305 if(ratio == 0.5)
306 m = mid();
307
308 else
309 {
310 m = lb() + ratio*diam();
311 if(m >= ub())
312 m = next_float(lb());
313
314 assert(m < ub());
315 }
316
317 return { Interval(lb(),m), Interval(m,ub()) };
318 }
319 }
bool is_bisectable() const
Tests if this can be bisected into two non-degenerated intervals.
Definition codac2_Interval_impl.h:277
bool interior_contains(const double &x) const
Tests if the interior of this contains x.
Definition codac2_Interval_impl.h:203

◆ complementary()

std::vector< Interval > codac2::Interval::complementary ( bool compactness = true) const
inline

Computes the complementary of this.

Parameters
compactnessoptional boolean to obtain or not disjoint intervals
Returns
a vector of complementary intervals
322 {
323 if(is_empty() || (compactness && is_degenerated()))
324 return { {-oo,oo} };
325
326 std::vector<Interval> l;
327
328 if(lb() > -oo)
329 l.push_back({-oo,lb()});
330
331 if(ub() < oo)
332 l.push_back({ub(),oo});
333
334 return l;
335 }
bool is_degenerated() const
Tests if this is degenerated, that is, in the form of .
Definition codac2_Interval_impl.h:213

◆ diff()

std::vector< Interval > codac2::Interval::diff ( const Interval & y,
bool compactness = true ) const
inline

Computes the result of \([x]\[y]\).

Parameters
yinterval to remove from this
compactnessoptional boolean to obtain or not disjoint intervals
Returns
a vector of resulting diff intervals
338 {
339 if(compactness && is_degenerated())
340 {
341 if(is_empty() || y.contains(lb()))
342 return {};
343 else
344 return { *this };
345 }
346
347 std::vector<Interval> l;
348 for(const auto& li : y.complementary(compactness))
349 {
350 Interval inter = li & *this;
351 if(!inter.is_degenerated())
352 l.push_back(inter);
353 }
354
355 return l;
356 }

◆ operator|=()

Interval & codac2::Interval::operator|= ( const Interval & x)
inline

Self union of this and x.

Parameters
xthe other interval
Returns
a reference to this
475 {
476 gaol::interval::operator|=(x);
477 return *this;
478 }

◆ operator&=()

Interval & codac2::Interval::operator&= ( const Interval & x)
inline

Self intersection of this and x.

Parameters
xthe other interval
Returns
a reference to this
481 {
482 gaol::interval::operator&=(x);
483 return *this;
484 }

◆ operator+=() [1/2]

Interval & codac2::Interval::operator+= ( double x)
inline

Self addition of this and a real x.

Parameters
xthe real to add
Returns
a reference to this
487 {
488 if(x == -oo || x == oo)
489 set_empty();
490 else
491 gaol::interval::operator+=(x);
492 return *this;
493 }

◆ operator+=() [2/2]

Interval & codac2::Interval::operator+= ( const Interval & x)
inline

Self addition of this and x.

Parameters
xthe other interval
Returns
a reference to this
496 {
497 gaol::interval::operator+=(x);
498 return *this;
499 }

◆ operator-()

Interval codac2::Interval::operator- ( ) const
inline

Substraction of this.

Returns
(- this)
502 {
503 return 0.-*this;
504 }

◆ operator-=() [1/2]

Interval & codac2::Interval::operator-= ( double x)
inline

Self substraction of this and a real x.

Parameters
xthe real to substract
Returns
a reference to this
507 {
508 if(x == -oo || x == oo)
509 set_empty();
510 else
511 gaol::interval::operator-=(x);
512 return *this;
513 }

◆ operator-=() [2/2]

Interval & codac2::Interval::operator-= ( const Interval & x)
inline

Self substraction of this and x.

Parameters
xthe other interval
Returns
a reference to this
516 {
517 gaol::interval::operator-=(x);
518 return *this;
519 }

◆ operator*=() [1/2]

Interval & codac2::Interval::operator*= ( double x)
inline

Self multiplication of this and a real x.

Parameters
xthe real to multiply
Returns
a reference to this
522 {
523 if(x == -oo || x == oo)
524 set_empty();
525 else
526 gaol::interval::operator*=(x);
527 return *this;
528 }

◆ operator*=() [2/2]

Interval & codac2::Interval::operator*= ( const Interval & x)
inline

Self multiplication of this and x.

Parameters
xthe other interval
Returns
a reference to this
531 {
532 gaol::interval::operator*=(x);
533 return *this;
534 }

◆ operator/=() [1/2]

Interval & codac2::Interval::operator/= ( double x)
inline

Self division of this and a real x.

Parameters
xthe real to divide
Returns
a reference to this
537 {
538 if(x == -oo || x == oo)
539 set_empty();
540 else
541 gaol::interval::operator/=(x);
542 return *this;
543 }

◆ operator/=() [2/2]

Interval & codac2::Interval::operator/= ( const Interval & x)
inline

Self division of this and x.

Note
This computation is more efficient than the non-self div operator, because it calculates the union of this/x as intermediate result.
Parameters
xthe other interval
Returns
a reference to this
546 {
547 gaol::interval::operator/=(x);
548 return *this;
549 }

◆ empty()

Interval codac2::Interval::empty ( )
inlinestatic

Provides an empty interval.

Returns
an empty set
552 {
553 return std::numeric_limits<double>::quiet_NaN();
554 }

◆ zero()

Interval codac2::Interval::zero ( )
inlinestatic

Provides an interval for \([0]\).

Returns
an interval containing \(0\)
557 {
558 return gaol::interval::zero();
559 }

◆ one()

Interval codac2::Interval::one ( )
inlinestatic

Provides an interval for \([1]\).

Returns
an interval containing \(1\)
562 {
563 return gaol::interval::one();
564 }

◆ half_pi()

Interval codac2::Interval::half_pi ( )
inlinestatic

Provides an interval for \([\frac{\pi}{2}]\).

Returns
an interval containing \(\frac{\pi}{2}\)
567 {
568 return gaol::interval::half_pi();
569 }

◆ pi()

Interval codac2::Interval::pi ( )
inlinestatic

Provides an interval for \([\pi]\).

Returns
an interval containing \(\pi\)
572 {
573 return gaol::interval::pi();
574 }

◆ two_pi()

Interval codac2::Interval::two_pi ( )
inlinestatic

Provides an interval for \([2\pi]\).

Returns
an interval containing \(2\pi\)
577 {
578 return gaol::interval::two_pi();
579 }

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