28inline void interval::init()
30 c.inf = ap_scalar_alloc();
31 c.sup = ap_scalar_alloc();
34inline interval::interval(ap_interval_t* i)
48 ap_interval_set(&
c,
const_cast<ap_interval_t*
>(&x.
c));
54 ap_interval_set_scalar(&
c,
62 ap_interval_set_int(&
c, inf, sup);
68 ap_interval_set_int(&
c, inf, sup);
74 ap_interval_set_double(&
c, inf, sup);
86 ap_interval_set_mpq(&
c,
87 const_cast<mpq_class&
>(inf).get_mpq_t(),
88 const_cast<mpq_class&
>(sup).get_mpq_t());
94 ap_interval_set_mpfr(&
c,inf,sup);
100 ap_interval_set_top(&
c);
106 ap_interval_set_bottom(&
c);
115 ap_scalar_free(
c.inf);
116ap_scalar_free(
c.sup);
127 ap_interval_set(&
c,
const_cast<ap_interval_t*
>(&x.
c));
133 ap_interval_set_top(&
c);
139 ap_interval_set_bottom(&
c);
148 ap_interval_set(&
c,
const_cast<ap_interval_t*
>(&x.
c));
154 ap_interval_set_scalar(&
c,
162 ap_interval_set_int(&
c, inf, sup);
168 ap_interval_set_int(&
c, inf, sup);
174 ap_interval_set_double(&
c, inf, sup);
180 ap_interval_set_frac(&
c, inf.
num, inf.
den, sup.
num, sup.
den);
186 ap_interval_set_mpq(&
c,
187 const_cast<mpq_class&
>(inf).get_mpq_t(),
188 const_cast<mpq_class&
>(sup).get_mpq_t());
194 ap_interval_set_mpfr(&
c,inf,sup);
200 ap_interval_set_top(&
c);
206 ap_interval_set_bottom(&
c);
213inline void swap(interval& a, interval &b)
215 ap_interval_swap(&a.c, &b.c);
224 return reinterpret_cast<scalar&
>(*
c.inf);
229 return reinterpret_cast<scalar&
>(*
c.sup);
234 return reinterpret_cast<const scalar&
>(*
c.inf);
239 return reinterpret_cast<const scalar&
>(*
c.sup);
246inline std::ostream&
operator<< (std::ostream& os,
const interval& s)
248 return os <<
'[' << s.get_inf() <<
',' << s.get_sup() <<
']';
253 ap_interval_fprint(stream,
const_cast<ap_interval_t*
>(&
c));
262 return ap_interval_is_top(
const_cast<ap_interval_t*
>(&
c));
267 return ap_interval_is_bottom(
const_cast<ap_interval_t*
>(&
c));
272 return ap_interval_is_leq(
const_cast<ap_interval_t*
>(&a.c),
273 const_cast<ap_interval_t*
>(&b.c));
278 return ap_interval_is_leq(
const_cast<ap_interval_t*
>(&b.c),
279 const_cast<ap_interval_t*
>(&a.c));
282inline bool operator< (
const interval&a,
const interval &b)
284 return ap_interval_cmp(
const_cast<ap_interval_t*
>(&a.c),
285 const_cast<ap_interval_t*
>(&b.c)) == -1;
288inline bool operator> (
const interval&a,
const interval &b)
290 return ap_interval_cmp(
const_cast<ap_interval_t*
>(&a.c),
291 const_cast<ap_interval_t*
>(&b.c)) == 1;
296 return ap_interval_equal(
const_cast<ap_interval_t*
>(&a.c),
297 const_cast<ap_interval_t*
>(&b.c));
302 return !ap_interval_equal(
const_cast<ap_interval_t*
>(&a.c),
303 const_cast<ap_interval_t*
>(&b.c));
308 return (
interval::order)ap_interval_cmp(
const_cast<ap_interval_t*
>(&a.c),
309 const_cast<ap_interval_t*
>(&b.c));
318 ap_interval_neg(&
c, &
c);
330 return ap_interval_hash(
const_cast<ap_interval_t*
>(&
c));
364 : sz(size), c(ap_interval_array_alloc(size))
368 : sz(x.sz), c(ap_interval_array_alloc(x.sz))
370 for (
size_t i=0;i<
sz;i++)
371 ap_interval_set(
c[i], x.
c[i]);
375 : sz(x.size()), c(ap_interval_array_alloc(x.size()))
377 for (
size_t i=0;i<
sz;i++)
378 ap_interval_set(
c[i],
const_cast<ap_interval_t*
>(x[i].get_ap_interval_t()));
382 : sz(size), c(ap_interval_array_alloc(size))
384 for (
size_t i=0;i<
size;i++)
385 ap_interval_set(
c[i],
const_cast<ap_interval_t*
>(x[i].get_ap_interval_t()));
395 ap_interval_array_free(
c,
sz);
406 ap_interval_array_free(
c,
sz);
408 c = ap_interval_array_alloc(
sz);
410 for (
size_t i=0;i<
sz;i++)
411 ap_interval_set(
c[i], x.
c[i]);
418 if (
sz != x.size()) {
419 ap_interval_array_free(
c,
sz);
421 c = ap_interval_array_alloc(
sz);
423 for (
size_t i=0;i<
sz;i++)
424 ap_interval_set(
c[i],
const_cast<ap_interval_t*
>(x[i].get_ap_interval_t()));
430 for (
size_t i=0;i<
sz;i++)
431 ap_interval_set(
c[i],
const_cast<ap_interval_t*
>(x[i].get_ap_interval_t()));
439inline interval_array::operator std::vector<interval>()
const
441 std::vector<interval> v = std::vector<interval>(sz);
442 for (
size_t i=0;i<sz;i++)
443 ap_interval_set(v[i].get_ap_interval_t(), c[i]);
451inline std::ostream&
operator<< (std::ostream& os,
const interval_array& s)
454 for (
size_t i=0;i<s.sz;i++)
455 os << s.get(i) <<
" ";
461 fprintf(stream,
"{ " );
462 for (
size_t i=0;i<
sz;i++) {
463 ap_interval_fprint(stream,
const_cast<ap_interval_t*
>(
c[i]));
464 fprintf(stream,
" ");
477{
return reinterpret_cast<interval**
>(
c); }
481 if (i >=
sz)
throw std::out_of_range(
"apron::interval_array::get(size_t)");
482 return reinterpret_cast<interval&
>(*
c[i]);
487 if (i >=
sz)
throw std::out_of_range(
"apron::interval_array::get(size_t)");
488 return reinterpret_cast<interval&
>(*
c[i]);
493 return reinterpret_cast<interval&
>(*
c[i]);
498 return reinterpret_cast<interval&
>(*
c[i]);
bool operator==(const abstract0 &x, const abstract0 &y)
Definition apxx_abstract0_inline.hh:409
bool operator<=(const abstract0 &x, const abstract0 &y)
Definition apxx_abstract0_inline.hh:421
bool operator>(const abstract0 &x, const abstract0 &y)
Definition apxx_abstract0_inline.hh:433
bool operator<(const abstract0 &x, const abstract0 &y)
Definition apxx_abstract0_inline.hh:438
bool operator>=(const abstract0 &x, const abstract0 &y)
Definition apxx_abstract0_inline.hh:428
bool operator!=(const abstract0 &x, const abstract0 &y)
Definition apxx_abstract0_inline.hh:416
std::ostream & operator<<(std::ostream &os, const abstract0 &s)
Definition apxx_abstract0_inline.hh:292
int cmp(const coeff &a, const coeff &b)
Definition apxx_coeff_inline.hh:414
void swap(coeff &a, coeff &b)
Definition apxx_coeff_inline.hh:381
array of interval(s).
Definition apxx_interval.hh:302
interval_array(size_t size, ap_interval_t **c)
Internal use only. Reference an array created with ap_interval_array_alloc.
Definition apxx_interval_inline.hh:355
size_t sz
Array size.
Definition apxx_interval.hh:306
interval ** contents()
Returns a pointer to the start of the array of elements used internally.
Definition apxx_interval_inline.hh:476
ap_interval_t ** c
Array of pointers to intervals.
Definition apxx_interval.hh:307
const ap_interval_t *const * get_ap_interval_t_array() const
Returns a pointer to the internal APRON object stored in *this.
Definition apxx_interval_inline.hh:505
interval_array & operator=(const interval_array &x)
Copies an interval array into *this.
Definition apxx_interval_inline.hh:402
size_t size() const
Returns the array size.
Definition apxx_interval_inline.hh:473
interval & get(size_t i)
Definition apxx_interval_inline.hh:479
~interval_array()
Frees the space occupied by the array and all its elements.
Definition apxx_interval_inline.hh:393
interval & operator[](size_t i)
Returns a (modifiable) reference to an element, no bound checking.
Definition apxx_interval_inline.hh:491
void print(FILE *stream=stdout) const
Prints to a C stream.
Definition apxx_interval_inline.hh:459
Interval (ap_interval_t wrapper).
Definition apxx_interval.hh:47
void neg()
Negates *this.
Definition apxx_interval_inline.hh:316
bool is_top() const
Whether *this equals ]-oo;+oo[.
Definition apxx_interval_inline.hh:260
interval & set(const interval &x)
Copies an interval into *this.
Definition apxx_interval_inline.hh:146
scalar & get_inf()
Gets a (modifiable) reference to the lower bound.
Definition apxx_interval_inline.hh:222
void init()
Internal initialisation.
Definition apxx_interval_inline.hh:28
interval & operator=(const interval &x)
Copies an interval into *this.
Definition apxx_interval_inline.hh:125
long hash() const
Returns a hash code.
Definition apxx_interval_inline.hh:328
interval operator-() const
Returns a new interval which is the opposite of *this.
Definition apxx_interval_inline.hh:321
scalar & get_sup()
Gets a (modifiable) reference to the upper bound.
Definition apxx_interval_inline.hh:227
~interval()
Definition apxx_interval_inline.hh:113
order
Returned by ordering functions.
Definition apxx_interval.hh:66
bool is_bottom() const
Whether *this represents an empty interval.
Definition apxx_interval_inline.hh:265
interval()
Makes a new interval [0,0] with double bounds.
Definition apxx_interval_inline.hh:40
const ap_interval_t * get_ap_interval_t() const
Returns a pointer to the internal APRON object stored in *this.
Definition apxx_interval_inline.hh:336
void print(FILE *stream=stdout) const
Prints to a C stream.
Definition apxx_interval_inline.hh:251
ap_interval_t c
Structure managed by APRON.
Definition apxx_interval.hh:50
Scalar (ap_scalar_t wrapper).
Definition apxx_scalar.hh:89
const ap_scalar_t * get_ap_scalar_t() const
Returns a pointer to the internal APRON object stored in *this.
Definition apxx_scalar_inline.hh:449
Empty interval or domain, to simplify initialisations and assignments.
Definition apxx_interval.hh:33
A fraction with native int coefficients, to simplify initialisations and assignments.
Definition apxx_scalar.hh:41
unsigned long den
Denominator.
Definition apxx_scalar.hh:44
long num
Numerator.
Definition apxx_scalar.hh:43
Full interval (]-oo,+oo[) or domain, to simplify initialisations and assignments.
Definition apxx_interval.hh:27