24 #ifndef PPL_Interval_inlines_hh
25 #define PPL_Interval_inlines_hh 1
29 template <
typename Boundary,
typename Info>
36 template <
typename Boundary,
typename Info>
42 template <
typename Boundary,
typename Info>
51 template <
typename Boundary,
typename Info>
56 template <
typename Boundary,
typename Info>
61 template <
typename Boundary,
typename Info>
67 namespace Interval_NS {
69 template <
typename Boundary,
typename Info>
70 inline const Boundary&
74 template <
typename Boundary,
typename Info>
75 inline const Boundary&
79 template <
typename Boundary,
typename Info>
104 template <
typename T>
109 template <
typename T>
115 template <
typename T>
122 template <
typename T>
128 template <
typename T>
136 template <
typename T>
143 template <
typename T>
147 if (
f_info(x).may_be_empty) {
156 template <
typename T1,
typename T2>
177 template <
typename T1,
typename T2>
189 template <
typename Boundary,
typename Info>
190 template <
typename T>
206 template <
typename Boundary,
typename Info>
207 template <
typename T>
225 template <
typename Boundary,
typename Info>
226 template <
typename T>
239 template <
typename To_Boundary,
typename To_Info>
240 template <
typename From>
259 template <
typename To_Boundary,
typename To_Info>
260 template <
typename From>
279 template <
typename To_Boundary,
typename To_Info>
280 template <
typename From1,
typename From2>
309 template <
typename Boundary,
typename Info>
310 template <
typename Type>
327 template <
typename To_Boundary,
typename To_Info>
328 template <
typename From>
339 template <
typename To_Boundary,
typename To_Info>
340 template <
typename From1,
typename From2>
362 template <
typename To_Boundary,
typename To_Info>
363 template <
typename From>
381 info().clear_boundary_properties(
LOWER);
386 info().clear_boundary_properties(
UPPER);
393 template <
typename To_Boundary,
typename To_Info>
394 template <
typename From1,
typename From2>
432 template <
typename To_Boundary,
typename To_Info>
433 template <
typename From>
449 info().clear_boundary_properties(
UPPER);
459 info().clear_boundary_properties(
UPPER);
469 info().clear_boundary_properties(
LOWER);
479 info().clear_boundary_properties(
LOWER);
485 return intersect_assign(x);
508 template <
typename To_Boundary,
typename To_Info>
509 template <
typename From>
525 info().clear_boundary_properties(
UPPER);
537 info().clear_boundary_properties(
UPPER);
548 info().clear_boundary_properties(
LOWER);
560 info().clear_boundary_properties(
LOWER);
570 return intersect_assign(x);
590 template <
typename To_Boundary,
typename To_Info>
591 template <
typename From>
612 template <
typename To_Boundary,
typename To_Info>
613 template <
typename From1,
typename From2>
636 else if (inf_sign > 0) {
652 template <
typename To_Boundary,
typename To_Info>
653 template <
typename From1,
typename From2>
676 else if (inf_sign > 0) {
708 template <
typename To_Boundary,
typename To_Info>
709 template <
typename From1,
typename From2>
738 if (ls == 0 && us == 0) {
742 return set_infinities();
744 if (ls < 0 || us < 0) {
745 inf_sign = -inf_sign;
850 if (
gt(
LOWER, to_lower, to_info,
LOWER, tmp, tmp_info)) {
861 if (
lt(
UPPER, upper(), to_info,
UPPER, tmp, tmp_info)) {
883 template <
typename To_Boundary,
typename To_Info>
884 template <
typename From1,
typename From2>
897 if (yls == 0 && yus == 0) {
906 return set_infinities();
908 if (yls < 0 || yus < 0) {
909 inf_sign = -inf_sign;
987 template <
typename B,
typename Info,
typename T>
995 template <
typename B,
typename Info,
typename T>
1003 template <
typename B,
typename Info>
1004 inline Interval<B, Info>
1011 template <
typename B,
typename Info,
typename T>
1019 template <
typename B,
typename Info,
typename T>
1027 template <
typename B,
typename Info>
1028 inline Interval<B, Info>
1035 template <
typename B,
typename Info,
typename T>
1043 template <
typename B,
typename Info,
typename T>
1051 template <
typename B,
typename Info>
1052 inline Interval<B, Info>
1059 template <
typename B,
typename Info,
typename T>
1067 template <
typename B,
typename Info,
typename T>
1075 template <
typename B,
typename Info>
1076 inline Interval<B, Info>
1083 template <
typename Boundary,
typename Info>
1084 inline std::ostream&
1085 operator<<(std::ostream& os, const Interval<Boundary, Info>& x) {
1089 if (x.is_singleton()) {
1093 os << (x.lower_is_open() ?
"(" :
"[");
1107 os << (x.upper_is_open() ?
")" :
"]");
1111 template <
typename Boundary,
typename Info>
1116 info().ascii_dump(s);
1124 template <
typename Boundary,
typename Info>
1129 if (!(s >> str) || str !=
"info") {
1135 if (!(s >> str) || str !=
"lower") {
1141 if (!(s >> str) || str !=
"upper") {
1158 template <
typename Interval_Boundary_Type>
1160 typedef Interval_Boundary_Type
type;
1163 #if PPL_SUPPORTED_DOUBLE
1166 typedef double type;
1221 template <
typename Boundary,
typename Info>
1229 #endif // !defined(PPL_Interval_inlines_hh)
Enable_If< Is_Singleton< T >::value, Interval< B, Info > >::type operator*(const Interval< B, Info > &x, const T &y)
Enable_If< Is_Singleton< Type >::value||Is_Interval< Type >::value, bool >::type can_be_exactly_joined_to(const Type &x) const
bool operator!=(const Box< ITV > &x, const Box< ITV > &y)
The empty element, i.e., the empty set.
The computed result is exact.
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type is_singleton_integer(const T &x)
Interval_Info_Null< Scalar_As_Interval_Policy > Scalar_As_Interval_Info
void swap(CO_Tree &x, CO_Tree &y)
I_Result
The result of an operation on intervals.
bool f_is_singleton(const Interval< Boundary, Info > &x)
void swap(Interval< Boundary, Info > &x, Interval< Boundary, Info > &y)
Result div_assign_z(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type1, const T1 &x1, const Info1 &info1, int x1s, Boundary_Type type2, const T2 &x2, const Info2 &info2, int x2s)
Enable_If< Is_Singleton< T >::value, bool >::type f_is_empty(const T &x)
void ascii_dump(std::ostream &s) const
Helper class to select the appropriate numerical type to perform boundary computations so as to reduc...
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
Enable_If< Has_Assign_Or_Swap< T >::value, void >::type assign_or_swap(T &to, T &from)
Enable_If< Is_Native_Or_Checked< T >::value, void >::type ascii_dump(std::ostream &s, const T &t)
bool lt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Result may be empty or not empty.
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type difference_assign(const From &x)
Assigns to *this the smallest interval containing the set-theoretic difference of *this and x...
int infinity_sign() const
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type is_integer(const T &x)
void m_swap(Interval &y)
Swaps *this with y.
const Boundary & f_upper(const Interval< Boundary, Info > &x)
Result
Possible outcomes of a checked arithmetic computation.
bool gt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Operation is undefined for some combination of values.
signed signed signed signed signed char signed signed signed signed signed int signed long long
void max_assign(N &x, const N &y)
Assigns to x the maximum between x and y.
Enable_If< Is_Singleton< T >::value, Interval< B, Info > >::type operator/(const Interval< B, Info > &x, const T &y)
signed signed signed signed signed char signed signed signed signed signed int signed long signed long signed long signed long signed long long unsigned short
memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type check_empty_arg(const T &x)
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type refine_universal(Relation_Symbol rel, const From &x)
Refines to so that it satisfies the universal relation rel with x.
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type contains(const T &y) const
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type sub_assign(const From1 &x, const From2 &y)
static const Property SPECIAL(Property::SPECIAL_)
Result assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info, bool should_shrink=false)
Result neg_assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info)
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type refine_existential(Relation_Symbol rel, const From &x)
Refines to according to the existential relation rel with x.
I_Result assign(Degenerate_Element e)
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type add_assign(const From1 &x, const From2 &y)
bool is_open(Boundary_Type type, const T &x, const Info &info)
Relation_Symbol
Relation symbols.
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir unsigned int
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type is_disjoint_from(const T &y) const
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
Greater than or equal to.
const Info & f_info(const Interval< Boundary, Info > &x)
Enable_If< Is_Native< T >::value, memory_size_type >::type external_memory_in_bytes(const T &)
For native types, returns the size in bytes of the memory managed by the type of the (unused) paramet...
bool ascii_load(std::istream &s)
bool eq(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
const Scalar_As_Interval_Info SCALAR_INFO
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type is_not_a_number(const T &x)
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type ascii_load(std::istream &s, T &t)
Enable_If< Is_Singleton< T >::value, bool >::type f_is_singleton(const T &x)
Result sub_assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type neg_assign(const From &x)
Result mul_assign_z(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type1, const T1 &x1, const Info1 &info1, int x1s, Boundary_Type type2, const T2 &x2, const Info2 &info2, int x2s)
bool ge(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
#define PPL_DIRTY_TEMP(T, id)
Result complement(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info)
Interval_Boundary_Type type
The universe element, i.e., the whole vector space.
bool is_singleton() const
A generic, not necessarily closed, possibly restricted interval.
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir From1
const Boundary & f_lower(const Interval< Boundary, Info > &x)
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type div_assign(const From1 &x, const From2 &y)
Result mul_assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Plus_Infinity PLUS_INFINITY
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type intersect_assign(const From &x)
The entire library is confined to this namespace.
Enable_If< Is_Singleton< T >::value, Interval< B, Info > >::type operator+(const Interval< B, Info > &x, const T &y)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Minus_Infinity MINUS_INFINITY
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
Result add_assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
From bool Type Type Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir Rounding_Dir From2
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type strictly_contains(const T &y) const
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type join_assign(const From &x)
I_Result combine(Result l, Result u)
bool f_is_empty(const Interval< Boundary, Info > &x)
From bool Type Type Rounding_Dir From
int sgn_b(Boundary_Type type, const T &x, const Info &info)
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type mul_assign(const From1 &x, const From2 &y)
Interval_Info_Null_Open< Scalar_As_Interval_Policy > Scalar_As_Interval_Info_Open
const_bool_nodef(may_be_empty, true)
#define PPL_USED(v)
No-op macro that allows to avoid unused variable warnings from the compiler.
bool operator==(const Box< ITV > &x, const Box< ITV > &y)
Enable_If< Is_Singleton< T >::value, Interval< B, Info > >::type operator-(const Interval< B, Info > &x, const T &y)
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
A class that provides a type member called type equivalent to T if and only if b is true...
Enable_If< Is_Native_Or_Checked< T >::value, int >::type infinity_sign(const T &x)
void min_assign(N &x, const N &y)
Assigns to x the minimum between x and y.
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)