19#include <gaol/gaol_interval.h>
31 struct is_interval_based<
Interval> : std::true_type {};
34 struct is_ctc<
Interval> : std::false_type {};
37 struct is_sep<
Interval> : std::false_type {};
49 class Interval :
protected gaol::interval,
public DomainInterface<Interval,double>
53 using DegeneratedType = double;
87 explicit Interval(
const std::array<double,1>& array);
94 explicit Interval(
const std::array<double,2>& array);
101 Interval(std::initializer_list<double> l);
334 bool contains(
const double& x)
const;
495 std::pair<Interval,Interval>
bisect(
float ratio = 0.49)
const;
503 std::vector<Interval>
complementary(
bool compactness =
true)
const;
512 std::vector<Interval>
diff(
const Interval& y,
bool compactness =
true)
const;
651 void*
operator new(std::size_t
size)
653 return ::operator
new(
size);
656 void operator delete(
void* ptr)
658 ::operator
delete(ptr);
665 #define _dec_friend_interval2_arithm_op(f) \
666 friend Interval f(double, const Interval&); \
667 friend Interval f(const Interval&, double); \
668 friend Interval f(const Interval&, const Interval&); \
670 _dec_friend_interval2_arithm_op(
operator&)
671 _dec_friend_interval2_arithm_op(
operator|)
672 _dec_friend_interval2_arithm_op(
operator+)
673 _dec_friend_interval2_arithm_op(
operator-)
674 _dec_friend_interval2_arithm_op(
operator*)
675 _dec_friend_interval2_arithm_op(
operator/)
677 #define _dec_friend_interval2_unary_op(f) \
678 friend Interval f(const Interval&); \
680 _dec_friend_interval2_unary_op(
sqr)
681 _dec_friend_interval2_unary_op(
sqrt)
682 _dec_friend_interval2_unary_op(
exp)
683 _dec_friend_interval2_unary_op(
log)
684 _dec_friend_interval2_unary_op(
cos)
685 _dec_friend_interval2_unary_op(
sin)
686 _dec_friend_interval2_unary_op(
tan)
687 _dec_friend_interval2_unary_op(
acos)
688 _dec_friend_interval2_unary_op(
asin)
689 _dec_friend_interval2_unary_op(
atan)
690 _dec_friend_interval2_unary_op(
cosh)
691 _dec_friend_interval2_unary_op(
sinh)
692 _dec_friend_interval2_unary_op(
tanh)
693 _dec_friend_interval2_unary_op(
acosh)
694 _dec_friend_interval2_unary_op(
asinh)
695 _dec_friend_interval2_unary_op(
atanh)
696 _dec_friend_interval2_unary_op(
abs)
697 _dec_friend_interval2_unary_op(
sign)
698 _dec_friend_interval2_unary_op(
integer)
699 _dec_friend_interval2_unary_op(
floor)
700 _dec_friend_interval2_unary_op(
ceil)
702 #define _dec_friend_interval2_binary_op(f) \
703 friend Interval f(const Interval&, const Interval&); \
705 _dec_friend_interval2_binary_op(
max)
706 _dec_friend_interval2_binary_op(
min)
707 _dec_friend_interval2_binary_op(
atan2)
712 _dec_friend_interval2_binary_op(
pow)
718 friend struct AcosOp;
724 friend struct AsinOp;
725 friend struct AtanOp;
726 friend struct Atan2Op;
728 friend struct CoshOp;
734 friend struct SinhOp;
736 friend struct SqrtOp;
738 friend struct TanhOp;
756 Interval operator""_i(
long double x);
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:50
double smig() const
Returns the signed mignitude of this.
Definition codac2_Interval_impl.h:158
bool is_unbounded() const
Tests if one of the bounds of this is infinite.
Definition codac2_Interval_impl.h:236
Interval & operator*=(double x)
Self multiplication of this and a real x.
Definition codac2_Interval_impl.h:554
Interval & operator-=(double x)
Self substraction of this and a real x.
Definition codac2_Interval_impl.h:539
bool operator==(const Interval &x) const
Comparison (equality) between two intervals.
Definition codac2_Interval_impl.h:100
bool is_empty() const
Tests if this is empty.
Definition codac2_Interval_impl.h:221
double mig() const
Returns the mignitude of this.
Definition codac2_Interval_impl.h:148
bool is_bisectable() const
Tests if this can be bisected into two non-degenerated intervals.
Definition codac2_Interval_impl.h:310
friend Interval chi(const Interval &, const Interval &, const Interval &)
Return if , if , else.
Definition codac2_Interval_operations_impl.h:299
Interval & inflate(const double &rad)
Adds [-rad,+rad] to this.
Definition codac2_Interval_impl.h:304
static Interval one()
Provides an interval for .
Definition codac2_Interval_impl.h:594
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:68
double ub() const
Returns the upper bound of this.
Definition codac2_Interval_impl.h:131
bool intersects(const Interval &x) const
Tests if this and x intersect.
Definition codac2_Interval_impl.h:256
double volume() const
Returns the diameter of this.
Definition codac2_Interval_impl.h:206
bool interior_contains(const double &x) const
Tests if the interior of this contains x.
Definition codac2_Interval_impl.h:231
static Interval pi()
Provides an interval for .
Definition codac2_Interval_impl.h:604
double rand() const
Returns a random value inside the interval.
Definition codac2_Interval_impl.h:163
std::pair< Interval, Interval > bisect(float ratio=0.49) const
Bisects this into two subintervals.
Definition codac2_Interval_impl.h:318
bool is_integer() const
Tests if this is an integer, that is, in the form of where n is an integer.
Definition codac2_Interval_impl.h:246
friend std::ostream & operator<<(std::ostream &os, const Interval &x)
Streams out this.
Definition codac2_Interval_impl.h:614
std::vector< Interval > diff(const Interval &y, bool compactness=true) const
Computes the result of .
Definition codac2_Interval_impl.h:370
bool is_strict_subset(const Interval &x) const
Tests if this is a subset of x and not x itself.
Definition codac2_Interval_impl.h:276
bool is_interior_subset(const Interval &x) const
Tests if this is in the interior of x.
Definition codac2_Interval_impl.h:281
bool is_degenerated() const
Tests if this is degenerated, that is, in the form of .
Definition codac2_Interval_impl.h:241
Interval & operator/=(double x)
Self division of this and a real x.
Definition codac2_Interval_impl.h:569
double diam() const
Returns the diameter of this.
Definition codac2_Interval_impl.h:193
BoolInterval operator<(const Interval &x) const
Comparison (strict less-than) between this and x.
Definition codac2_Interval_impl.h:110
Interval & operator+=(double x)
Self addition of this and a real x.
Definition codac2_Interval_impl.h:519
bool is_disjoint(const Interval &x) const
Tests if this and x do not intersect.
Definition codac2_Interval_impl.h:261
Interval & operator&=(const Interval &x)
Self intersection of this and x.
Definition codac2_Interval_impl.h:513
static Interval zero()
Provides an interval for .
Definition codac2_Interval_impl.h:589
Index size() const
Returns the dimension of this (which is always ).
Definition codac2_Interval_impl.h:211
bool is_superset(const Interval &x) const
Tests if this is a superset of x.
Definition codac2_Interval_impl.h:294
double rad() const
Returns the radius of this.
Definition codac2_Interval_impl.h:176
double mag() const
Returns the magnitude of this i.e. max(|lower bound|, |upper bound|).
Definition codac2_Interval_impl.h:143
bool overlaps(const Interval &x) const
Tests if this and x intersect and their intersection has a non-null volume.
Definition codac2_Interval_impl.h:266
void set_empty()
Sets this interval to the empty set.
Definition codac2_Interval_impl.h:216
bool is_subset(const Interval &x) const
Tests if this is a subset of x.
Definition codac2_Interval_impl.h:271
Interval & operator|=(const Interval &x)
Self union of this and x.
Definition codac2_Interval_impl.h:507
Interval & operator=(double x)
Sets this to x.
Definition codac2_Interval_impl.h:84
friend Interval pow(const Interval &, double)
Returns , .
Definition codac2_Interval_operations_impl.h:40
Interval()
Creates an interval .
Definition codac2_Interval_impl.h:23
bool contains(const double &x) const
Tests if this contains x.
Definition codac2_Interval_impl.h:226
bool operator!=(const Interval &x) const
Comparison (non equality) between two intervals.
Definition codac2_Interval_impl.h:105
double lb() const
Returns the lower bound of this.
Definition codac2_Interval_impl.h:126
bool has_integer_bounds() const
Checks whether the interval has integer lower and upper bounds.
Definition codac2_Interval_impl.h:251
static Interval two_pi()
Provides an interval for .
Definition codac2_Interval_impl.h:609
bool is_strict_interior_subset(const Interval &x) const
Tests if this is in the interior of x and different from x.
Definition codac2_Interval_impl.h:286
Interval & init()
Sets the value of this interval to [-oo,oo].
Definition codac2_Interval_impl.h:56
BoolInterval operator>(const Interval &x) const
Comparison (strict greater-than) between this and x.
Definition codac2_Interval_impl.h:121
double smag() const
Returns the signed magnitude of this i.e. lower bound if |lower bound|>|upper bound|,...
Definition codac2_Interval_impl.h:153
bool is_strict_superset(const Interval &x) const
Tests if this is a superset of x and different from x.
Definition codac2_Interval_impl.h:299
double mid() const
Returns the midpoint of this.
Definition codac2_Interval_impl.h:136
static Interval empty()
Provides an empty interval.
Definition codac2_Interval_impl.h:584
Interval operator-() const
Substraction of this.
Definition codac2_Interval_impl.h:534
static Interval half_pi()
Provides an interval for .
Definition codac2_Interval_impl.h:599
auto operator|(const MatrixBase< OtherDerived > &x) const
Returns the element-wise union of this matrix with another.
Definition codac2_Matrix_addons_IntervalMatrixBase.h:280
auto complementary() const
Computes the complementary set of this interval vector (or interval row).
Definition codac2_MatrixBase_addons_IntervalVector.h:31
Definition codac2_OctaSym.h:21
Interval ceil(const Interval &x)
Returns ceil of .
Definition codac2_Interval_operations_impl.h:294
Interval atan(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:133
Interval max(const Interval &x, const Interval &y)
Returns .
Definition codac2_Interval_operations_impl.h:274
double prev_float(double x)
Returns the previous representable double-precision floating-point value before x.
Definition codac2_Interval_impl.h:630
Interval operator*(const Interval &x, double y)
Returns with .
Definition codac2_Interval_impl.h:461
Interval asinh(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:237
Interval atanh(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:257
Interval sqrt(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:26
Interval operator/(const Interval &x, double y)
Returns with .
Definition codac2_Interval_impl.h:484
Interval cosh(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:205
Interval floor(const Interval &x)
Returns floor of .
Definition codac2_Interval_operations_impl.h:289
Interval sinh(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:216
Interval acos(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:119
Ellipsoid operator+(const Ellipsoid &e1, const Ellipsoid &e2)
Compute the Minkowski sum of two ellipsoids.
Interval atan2(const Interval &y, const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:140
Interval log(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:85
std::ostream & operator<<(std::ostream &os, const BoolInterval &x)
Streams out a BoolInterval.
Definition codac2_BoolInterval.h:131
CtcInterType< typenameC1::ContractedTypes >::Ctc operator&(const C1 &c1, const C2 &c2)
Builds an intersection contractor from two contractors.
Definition codac2_CtcInter.h:229
Interval operator-(const Interval &x, double y)
Returns with .
Definition codac2_Interval_impl.h:438
BoolInterval
Enumeration representing a boolean interval.
Definition codac2_BoolInterval.h:26
double next_float(double x)
Returns the next representable double-precision floating-point value after x.
Definition codac2_Interval_impl.h:635
Interval cos(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:98
Interval exp(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:78
Interval tanh(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:223
Interval sqr(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:21
Interval root(const Interval &x, int p)
Returns the p-th root: .
Definition codac2_Interval_operations_impl.h:60
Interval abs(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:264
Interval asin(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:126
Interval integer(const Interval &x)
Returns the largest integer interval included in .
Definition codac2_Interval_operations_impl.h:284
Interval min(const Interval &x, const Interval &y)
Returns .
Definition codac2_Interval_operations_impl.h:269
Interval acosh(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:230
Interval sign(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:279
Interval sin(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:105
Interval tan(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:112