codac 1.5.6
|
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. | |
Interval & | init (const Interval &x) |
Sets the value of this interval to x. | |
Interval & | init_from_list (const std::list< double > &l) |
Sets the bounds as the hull of a list of values. | |
Interval & | operator= (double x) |
Sets this to x. | |
Interval & | operator= (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 | 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. | |
Interval & | inflate (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, Interval > | bisect (float ratio=0.49) const |
Bisects this into two subintervals. | |
std::vector< Interval > | complementary (bool compactness=true) const |
Computes the complementary of this. | |
std::vector< Interval > | diff (const Interval &y, bool compactness=true) const |
Computes the result of \([x]\[y]\). | |
Interval & | operator|= (const Interval &x) |
Self union of this and x. | |
Interval & | operator&= (const Interval &x) |
Self intersection of this and x. | |
Interval & | operator+= (double x) |
Self addition of this and a real x. | |
Interval & | operator+= (const Interval &x) |
Self addition of this and x. | |
Interval | operator- () const |
Substraction of this. | |
Interval & | operator-= (double x) |
Self substraction of this and a real x. | |
Interval & | operator-= (const Interval &x) |
Self substraction of this and x. | |
Interval & | operator*= (double x) |
Self multiplication of this and a real x. | |
Interval & | operator*= (const Interval &x) |
Self multiplication of this and x. | |
Interval & | operator/= (double x) |
Self division of this and a real x. | |
Interval & | operator/= (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]\). | |
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
|
inline |
Creates a degenerate interval \([a,a]\), \(a\in\mathbb{R}\).
a | single value contained in the resulting interval |
|
inline |
Creates an interval \([a,b]\), \(a\in\mathbb{R}, b\in\mathbb{R}\).
a | lower bound of the interval |
b | upper bound of the interval |
|
inline |
Creates an interval from another one.
x | the interval to be copied |
|
inlineexplicit |
Create an interval \([a,a]\) from a fixed-sized array of size 1.
array | the array of doubles |
|
inlineexplicit |
Create an interval \([a,b]\) from a fixed-sized array of size 2.
array | the array of doubles |
|
inline |
Create an interval as the hull of a list of values.
l | list of values contained in the resulting interval |
Sets the value of this interval to x.
x | the value for re-initialization |
|
inline |
Sets the bounds as the hull of a list of values.
l | list of values contained in the resulting interval |
|
inline |
Sets this to x.
x | real to be intervalized |
Sets this to x.
x | interval to be copied |
|
inline |
Comparison (equality) between two intervals.
x | interval to be compared with |
|
inline |
Comparison (non equality) between two intervals.
x | interval to be compared with |
|
inline |
Returns the lower bound of this.
|
inline |
Returns the upper bound of this.
|
inline |
Returns the midpoint of this.
|
inline |
Returns the magnitude of this i.e. max(|lower bound|, |upper bound|).
|
inline |
Returns the mignitude of this.
+(lower bound) if lower_bound > 0 -(upper bound) if upper_bound < 0 0 otherwise.
|
inline |
Returns a random value inside the interval.
|
inline |
Returns the radius of this.
|
inline |
Returns the diameter of this.
|
inline |
Returns the diameter of this.
|
inline |
Returns the dimension of this (which is always )
|
inline |
Tests if this is empty.
|
inline |
Tests if this contains x.
x | real value |
|
inline |
|
inline |
Tests if one of the bounds of this is infinite.
|
inline |
Tests if this is degenerated, that is, in the form of \([a,a]\).
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Tests if this is a subset of x and not x itself.
x | the other interval |
|
inline |
Tests if this is in the interior of x.
x | the other interval |
|
inline |
Tests if this is in the interior of x and different from x.
x | the other interval |
|
inline |
Tests if this is a superset of x.
x | the other interval |
|
inline |
Tests if this is a superset of x and different from x.
x | the other interval |
|
inline |
Adds [-rad,+rad] to this.
rad | the radius of the inflation |
|
inline |
Bisects this into two subintervals.
ratio | optional proportion of split (0.5 corresponds to middle) |
|
inline |
Computes the complementary of this.
compactness | optional boolean to obtain or not disjoint intervals |
|
inline |
Computes the result of \([x]\[y]\).
y | interval to remove from this |
compactness | optional boolean to obtain or not disjoint intervals |
Self union of this and x.
x | the other interval |
Self intersection of this and x.
x | the other interval |
|
inline |
Self addition of this and a real x.
x | the real to add |
Self addition of this and x.
x | the other interval |
|
inline |
Substraction of this.
|
inline |
Self substraction of this and a real x.
x | the real to substract |
Self substraction of this and x.
x | the other interval |
|
inline |
Self multiplication of this and a real x.
x | the real to multiply |
Self multiplication of this and x.
x | the other interval |
|
inline |
Self division of this and a real x.
x | the real to divide |
Self division of this and x.
x | the other interval |
|
inlinestatic |
Provides an empty interval.
|
inlinestatic |
Provides an interval for \([0]\).
|
inlinestatic |
Provides an interval for \([1]\).
|
inlinestatic |
Provides an interval for \([\frac{\pi}{2}]\).
|
inlinestatic |
Provides an interval for \([\pi]\).
|
inlinestatic |
Provides an interval for \([2\pi]\).