Update to isl-0.20-65-gb822a210
[polly-mirror.git] / lib / External / isl / include / isl / cpp.h
blobde0da10c22598488178bbd820a3b10476d868966
1 /// These are automatically generated C++ bindings for isl.
2 ///
3 /// isl is a library for computing with integer sets and maps described by
4 /// Presburger formulas. On top of this, isl provides various tools for
5 /// polyhedral compilation, ranging from dependence analysis over scheduling
6 /// to AST generation.
8 #ifndef ISL_CPP
9 #define ISL_CPP
11 #include <isl/val.h>
12 #include <isl/aff.h>
13 #include <isl/set.h>
14 #include <isl/map.h>
15 #include <isl/ilp.h>
16 #include <isl/union_set.h>
17 #include <isl/union_map.h>
18 #include <isl/flow.h>
19 #include <isl/schedule.h>
20 #include <isl/schedule_node.h>
21 #include <isl/ast_build.h>
23 #include <isl/ctx.h>
24 #include <isl/options.h>
26 #include <functional>
27 #include <memory>
28 #include <stdexcept>
29 #include <string>
31 /* ISL_USE_EXCEPTIONS should be defined to 1 if exceptions are available.
32 * gcc and clang define __cpp_exceptions; MSVC and xlC define _CPPUNWIND.
33 * If exceptions are not available, any error condition will result
34 * in an abort.
36 #ifndef ISL_USE_EXCEPTIONS
37 #if defined(__cpp_exceptions) || defined(_CPPUNWIND)
38 #define ISL_USE_EXCEPTIONS 1
39 #else
40 #define ISL_USE_EXCEPTIONS 0
41 #endif
42 #endif
44 namespace isl {
46 class ctx {
47 isl_ctx *ptr;
48 public:
49 /* implicit */ ctx(isl_ctx *ctx) : ptr(ctx) {}
50 isl_ctx *release() {
51 auto tmp = ptr;
52 ptr = nullptr;
53 return tmp;
55 isl_ctx *get() {
56 return ptr;
60 /* Macros hiding try/catch.
61 * If exceptions are not available, then no exceptions will be thrown and
62 * there is nothing to catch.
64 #if ISL_USE_EXCEPTIONS
65 #define ISL_CPP_TRY try
66 #define ISL_CPP_CATCH_ALL catch (...)
67 #else
68 #define ISL_CPP_TRY if (1)
69 #define ISL_CPP_CATCH_ALL if (0)
70 #endif
72 #if ISL_USE_EXCEPTIONS
74 /* Class capturing isl errors.
76 * The what() return value is stored in a reference counted string
77 * to ensure that the copy constructor and the assignment operator
78 * do not throw any exceptions.
80 class exception : public std::exception {
81 std::shared_ptr<std::string> what_str;
83 protected:
84 inline exception(const char *what_arg, const char *msg,
85 const char *file, int line);
86 public:
87 exception() {}
88 exception(const char *what_arg) {
89 what_str = std::make_shared<std::string>(what_arg);
91 static inline void throw_error(enum isl_error error, const char *msg,
92 const char *file, int line);
93 virtual const char *what() const noexcept {
94 return what_str->c_str();
97 /* Default behavior on error conditions that occur inside isl calls
98 * performed from inside the bindings.
99 * In the case exceptions are available, isl should continue
100 * without printing a warning since the warning message
101 * will be included in the exception thrown from inside the bindings.
103 static constexpr auto on_error = ISL_ON_ERROR_CONTINUE;
104 /* Wrapper for throwing an exception on NULL input.
106 static void throw_NULL_input(const char *file, int line) {
107 throw_error(isl_error_invalid, "NULL input", file, line);
109 static inline void throw_last_error(ctx ctx);
112 /* Create an exception of a type described by "what_arg", with
113 * error message "msg" in line "line" of file "file".
115 * Create a string holding the what() return value that
116 * corresponds to what isl would have printed.
117 * If no error message or no error file was set, then use "what_arg" instead.
119 exception::exception(const char *what_arg, const char *msg, const char *file,
120 int line)
122 if (!msg || !file)
123 what_str = std::make_shared<std::string>(what_arg);
124 else
125 what_str = std::make_shared<std::string>(std::string(file) +
126 ":" + std::to_string(line) + ": " + msg);
129 class exception_abort : public exception {
130 friend exception;
131 exception_abort(const char *msg, const char *file, int line) :
132 exception("execution aborted", msg, file, line) {}
135 class exception_alloc : public exception {
136 friend exception;
137 exception_alloc(const char *msg, const char *file, int line) :
138 exception("memory allocation failure", msg, file, line) {}
141 class exception_unknown : public exception {
142 friend exception;
143 exception_unknown(const char *msg, const char *file, int line) :
144 exception("unknown failure", msg, file, line) {}
147 class exception_internal : public exception {
148 friend exception;
149 exception_internal(const char *msg, const char *file, int line) :
150 exception("internal error", msg, file, line) {}
153 class exception_invalid : public exception {
154 friend exception;
155 exception_invalid(const char *msg, const char *file, int line) :
156 exception("invalid argument", msg, file, line) {}
159 class exception_quota : public exception {
160 friend exception;
161 exception_quota(const char *msg, const char *file, int line) :
162 exception("quota exceeded", msg, file, line) {}
165 class exception_unsupported : public exception {
166 friend exception;
167 exception_unsupported(const char *msg, const char *file, int line) :
168 exception("unsupported operation", msg, file, line) {}
171 /* Throw an exception of the class that corresponds to "error", with
172 * error message "msg" in line "line" of file "file".
174 * isl_error_none is treated as an invalid error type.
176 void exception::throw_error(enum isl_error error, const char *msg,
177 const char *file, int line)
179 switch (error) {
180 case isl_error_none:
181 break;
182 case isl_error_abort: throw exception_abort(msg, file, line);
183 case isl_error_alloc: throw exception_alloc(msg, file, line);
184 case isl_error_unknown: throw exception_unknown(msg, file, line);
185 case isl_error_internal: throw exception_internal(msg, file, line);
186 case isl_error_invalid: throw exception_invalid(msg, file, line);
187 case isl_error_quota: throw exception_quota(msg, file, line);
188 case isl_error_unsupported:
189 throw exception_unsupported(msg, file, line);
192 throw exception_invalid("invalid error type", file, line);
195 /* Throw an exception corresponding to the last error on "ctx" and
196 * reset the error.
198 * If "ctx" is NULL or if it is not in an error state at the start,
199 * then an invalid argument exception is thrown.
201 void exception::throw_last_error(ctx ctx)
203 enum isl_error error;
204 const char *msg, *file;
205 int line;
207 error = isl_ctx_last_error(ctx.get());
208 msg = isl_ctx_last_error_msg(ctx.get());
209 file = isl_ctx_last_error_file(ctx.get());
210 line = isl_ctx_last_error_line(ctx.get());
211 isl_ctx_reset_error(ctx.get());
213 throw_error(error, msg, file, line);
216 #else
218 #include <stdio.h>
219 #include <stdlib.h>
221 class exception {
222 public:
223 /* Default behavior on error conditions that occur inside isl calls
224 * performed from inside the bindings.
225 * In the case exceptions are not available, isl should abort.
227 static constexpr auto on_error = ISL_ON_ERROR_ABORT;
228 /* Wrapper for throwing an exception on NULL input.
229 * In the case exceptions are not available, print an error and abort.
231 static void throw_NULL_input(const char *file, int line) {
232 fprintf(stderr, "%s:%d: NULL input\n", file, line);
233 abort();
235 /* Throw an exception corresponding to the last
236 * error on "ctx".
237 * isl should already abort when an error condition occurs,
238 * so this function should never be called.
240 static void throw_last_error(ctx ctx) {
241 abort();
245 #endif
247 /* Helper class for setting the on_error and resetting the option
248 * to the original value when leaving the scope.
250 class options_scoped_set_on_error {
251 isl_ctx *ctx;
252 int saved_on_error;
253 public:
254 options_scoped_set_on_error(class ctx ctx, int on_error) {
255 this->ctx = ctx.get();
256 saved_on_error = isl_options_get_on_error(this->ctx);
257 isl_options_set_on_error(this->ctx, on_error);
259 ~options_scoped_set_on_error() {
260 isl_options_set_on_error(ctx, saved_on_error);
264 } // namespace isl
266 namespace isl {
268 // forward declarations
269 class aff;
270 class ast_build;
271 class ast_expr;
272 class ast_node;
273 class basic_map;
274 class basic_set;
275 class map;
276 class multi_aff;
277 class multi_pw_aff;
278 class multi_union_pw_aff;
279 class multi_val;
280 class point;
281 class pw_aff;
282 class pw_multi_aff;
283 class schedule;
284 class schedule_constraints;
285 class schedule_node;
286 class set;
287 class union_access_info;
288 class union_flow;
289 class union_map;
290 class union_pw_aff;
291 class union_pw_multi_aff;
292 class union_set;
293 class val;
295 // declarations for isl::aff
296 inline aff manage(__isl_take isl_aff *ptr);
297 inline aff manage_copy(__isl_keep isl_aff *ptr);
299 class aff {
300 friend inline aff manage(__isl_take isl_aff *ptr);
301 friend inline aff manage_copy(__isl_keep isl_aff *ptr);
303 isl_aff *ptr = nullptr;
305 inline explicit aff(__isl_take isl_aff *ptr);
307 public:
308 inline /* implicit */ aff();
309 inline /* implicit */ aff(const aff &obj);
310 inline explicit aff(ctx ctx, const std::string &str);
311 inline aff &operator=(aff obj);
312 inline ~aff();
313 inline __isl_give isl_aff *copy() const &;
314 inline __isl_give isl_aff *copy() && = delete;
315 inline __isl_keep isl_aff *get() const;
316 inline __isl_give isl_aff *release();
317 inline bool is_null() const;
318 inline ctx get_ctx() const;
320 inline aff add(aff aff2) const;
321 inline aff ceil() const;
322 inline aff div(aff aff2) const;
323 inline set eq_set(aff aff2) const;
324 inline aff floor() const;
325 inline set ge_set(aff aff2) const;
326 inline set gt_set(aff aff2) const;
327 inline set le_set(aff aff2) const;
328 inline set lt_set(aff aff2) const;
329 inline aff mod(val mod) const;
330 inline aff mul(aff aff2) const;
331 inline set ne_set(aff aff2) const;
332 inline aff neg() const;
333 inline aff pullback(multi_aff ma) const;
334 inline aff scale(val v) const;
335 inline aff scale_down(val v) const;
336 inline aff sub(aff aff2) const;
339 // declarations for isl::ast_build
340 inline ast_build manage(__isl_take isl_ast_build *ptr);
341 inline ast_build manage_copy(__isl_keep isl_ast_build *ptr);
343 class ast_build {
344 friend inline ast_build manage(__isl_take isl_ast_build *ptr);
345 friend inline ast_build manage_copy(__isl_keep isl_ast_build *ptr);
347 isl_ast_build *ptr = nullptr;
349 inline explicit ast_build(__isl_take isl_ast_build *ptr);
351 public:
352 inline /* implicit */ ast_build();
353 inline /* implicit */ ast_build(const ast_build &obj);
354 inline explicit ast_build(ctx ctx);
355 inline ast_build &operator=(ast_build obj);
356 inline ~ast_build();
357 inline __isl_give isl_ast_build *copy() const &;
358 inline __isl_give isl_ast_build *copy() && = delete;
359 inline __isl_keep isl_ast_build *get() const;
360 inline __isl_give isl_ast_build *release();
361 inline bool is_null() const;
362 inline ctx get_ctx() const;
364 inline ast_expr access_from(pw_multi_aff pma) const;
365 inline ast_expr access_from(multi_pw_aff mpa) const;
366 inline ast_expr call_from(pw_multi_aff pma) const;
367 inline ast_expr call_from(multi_pw_aff mpa) const;
368 inline ast_expr expr_from(set set) const;
369 inline ast_expr expr_from(pw_aff pa) const;
370 static inline ast_build from_context(set set);
371 inline ast_node node_from_schedule_map(union_map schedule) const;
374 // declarations for isl::ast_expr
375 inline ast_expr manage(__isl_take isl_ast_expr *ptr);
376 inline ast_expr manage_copy(__isl_keep isl_ast_expr *ptr);
378 class ast_expr {
379 friend inline ast_expr manage(__isl_take isl_ast_expr *ptr);
380 friend inline ast_expr manage_copy(__isl_keep isl_ast_expr *ptr);
382 isl_ast_expr *ptr = nullptr;
384 inline explicit ast_expr(__isl_take isl_ast_expr *ptr);
386 public:
387 inline /* implicit */ ast_expr();
388 inline /* implicit */ ast_expr(const ast_expr &obj);
389 inline ast_expr &operator=(ast_expr obj);
390 inline ~ast_expr();
391 inline __isl_give isl_ast_expr *copy() const &;
392 inline __isl_give isl_ast_expr *copy() && = delete;
393 inline __isl_keep isl_ast_expr *get() const;
394 inline __isl_give isl_ast_expr *release();
395 inline bool is_null() const;
396 inline ctx get_ctx() const;
398 inline std::string to_C_str() const;
401 // declarations for isl::ast_node
402 inline ast_node manage(__isl_take isl_ast_node *ptr);
403 inline ast_node manage_copy(__isl_keep isl_ast_node *ptr);
405 class ast_node {
406 friend inline ast_node manage(__isl_take isl_ast_node *ptr);
407 friend inline ast_node manage_copy(__isl_keep isl_ast_node *ptr);
409 isl_ast_node *ptr = nullptr;
411 inline explicit ast_node(__isl_take isl_ast_node *ptr);
413 public:
414 inline /* implicit */ ast_node();
415 inline /* implicit */ ast_node(const ast_node &obj);
416 inline ast_node &operator=(ast_node obj);
417 inline ~ast_node();
418 inline __isl_give isl_ast_node *copy() const &;
419 inline __isl_give isl_ast_node *copy() && = delete;
420 inline __isl_keep isl_ast_node *get() const;
421 inline __isl_give isl_ast_node *release();
422 inline bool is_null() const;
423 inline ctx get_ctx() const;
425 inline std::string to_C_str() const;
428 // declarations for isl::basic_map
429 inline basic_map manage(__isl_take isl_basic_map *ptr);
430 inline basic_map manage_copy(__isl_keep isl_basic_map *ptr);
432 class basic_map {
433 friend inline basic_map manage(__isl_take isl_basic_map *ptr);
434 friend inline basic_map manage_copy(__isl_keep isl_basic_map *ptr);
436 isl_basic_map *ptr = nullptr;
438 inline explicit basic_map(__isl_take isl_basic_map *ptr);
440 public:
441 inline /* implicit */ basic_map();
442 inline /* implicit */ basic_map(const basic_map &obj);
443 inline explicit basic_map(ctx ctx, const std::string &str);
444 inline basic_map &operator=(basic_map obj);
445 inline ~basic_map();
446 inline __isl_give isl_basic_map *copy() const &;
447 inline __isl_give isl_basic_map *copy() && = delete;
448 inline __isl_keep isl_basic_map *get() const;
449 inline __isl_give isl_basic_map *release();
450 inline bool is_null() const;
451 inline ctx get_ctx() const;
453 inline basic_map affine_hull() const;
454 inline basic_map apply_domain(basic_map bmap2) const;
455 inline basic_map apply_range(basic_map bmap2) const;
456 inline basic_set deltas() const;
457 inline basic_map detect_equalities() const;
458 inline basic_map flatten() const;
459 inline basic_map flatten_domain() const;
460 inline basic_map flatten_range() const;
461 inline basic_map gist(basic_map context) const;
462 inline basic_map intersect(basic_map bmap2) const;
463 inline basic_map intersect_domain(basic_set bset) const;
464 inline basic_map intersect_range(basic_set bset) const;
465 inline bool is_empty() const;
466 inline bool is_equal(const basic_map &bmap2) const;
467 inline bool is_subset(const basic_map &bmap2) const;
468 inline map lexmax() const;
469 inline map lexmin() const;
470 inline basic_map reverse() const;
471 inline basic_map sample() const;
472 inline map unite(basic_map bmap2) const;
475 // declarations for isl::basic_set
476 inline basic_set manage(__isl_take isl_basic_set *ptr);
477 inline basic_set manage_copy(__isl_keep isl_basic_set *ptr);
479 class basic_set {
480 friend inline basic_set manage(__isl_take isl_basic_set *ptr);
481 friend inline basic_set manage_copy(__isl_keep isl_basic_set *ptr);
483 isl_basic_set *ptr = nullptr;
485 inline explicit basic_set(__isl_take isl_basic_set *ptr);
487 public:
488 inline /* implicit */ basic_set();
489 inline /* implicit */ basic_set(const basic_set &obj);
490 inline explicit basic_set(ctx ctx, const std::string &str);
491 inline /* implicit */ basic_set(point pnt);
492 inline basic_set &operator=(basic_set obj);
493 inline ~basic_set();
494 inline __isl_give isl_basic_set *copy() const &;
495 inline __isl_give isl_basic_set *copy() && = delete;
496 inline __isl_keep isl_basic_set *get() const;
497 inline __isl_give isl_basic_set *release();
498 inline bool is_null() const;
499 inline ctx get_ctx() const;
501 inline basic_set affine_hull() const;
502 inline basic_set apply(basic_map bmap) const;
503 inline basic_set detect_equalities() const;
504 inline val dim_max_val(int pos) const;
505 inline basic_set flatten() const;
506 inline basic_set gist(basic_set context) const;
507 inline basic_set intersect(basic_set bset2) const;
508 inline basic_set intersect_params(basic_set bset2) const;
509 inline bool is_empty() const;
510 inline bool is_equal(const basic_set &bset2) const;
511 inline bool is_subset(const basic_set &bset2) const;
512 inline bool is_wrapping() const;
513 inline set lexmax() const;
514 inline set lexmin() const;
515 inline basic_set sample() const;
516 inline point sample_point() const;
517 inline set unite(basic_set bset2) const;
520 // declarations for isl::map
521 inline map manage(__isl_take isl_map *ptr);
522 inline map manage_copy(__isl_keep isl_map *ptr);
524 class map {
525 friend inline map manage(__isl_take isl_map *ptr);
526 friend inline map manage_copy(__isl_keep isl_map *ptr);
528 isl_map *ptr = nullptr;
530 inline explicit map(__isl_take isl_map *ptr);
532 public:
533 inline /* implicit */ map();
534 inline /* implicit */ map(const map &obj);
535 inline explicit map(ctx ctx, const std::string &str);
536 inline /* implicit */ map(basic_map bmap);
537 inline map &operator=(map obj);
538 inline ~map();
539 inline __isl_give isl_map *copy() const &;
540 inline __isl_give isl_map *copy() && = delete;
541 inline __isl_keep isl_map *get() const;
542 inline __isl_give isl_map *release();
543 inline bool is_null() const;
544 inline ctx get_ctx() const;
546 inline basic_map affine_hull() const;
547 inline map apply_domain(map map2) const;
548 inline map apply_range(map map2) const;
549 inline map coalesce() const;
550 inline map complement() const;
551 inline set deltas() const;
552 inline map detect_equalities() const;
553 inline map flatten() const;
554 inline map flatten_domain() const;
555 inline map flatten_range() const;
556 inline void foreach_basic_map(const std::function<void(basic_map)> &fn) const;
557 inline map gist(map context) const;
558 inline map gist_domain(set context) const;
559 inline map intersect(map map2) const;
560 inline map intersect_domain(set set) const;
561 inline map intersect_params(set params) const;
562 inline map intersect_range(set set) const;
563 inline bool is_bijective() const;
564 inline bool is_disjoint(const map &map2) const;
565 inline bool is_empty() const;
566 inline bool is_equal(const map &map2) const;
567 inline bool is_injective() const;
568 inline bool is_single_valued() const;
569 inline bool is_strict_subset(const map &map2) const;
570 inline bool is_subset(const map &map2) const;
571 inline map lexmax() const;
572 inline map lexmin() const;
573 inline basic_map polyhedral_hull() const;
574 inline map reverse() const;
575 inline basic_map sample() const;
576 inline map subtract(map map2) const;
577 inline map unite(map map2) const;
578 inline basic_map unshifted_simple_hull() const;
581 // declarations for isl::multi_aff
582 inline multi_aff manage(__isl_take isl_multi_aff *ptr);
583 inline multi_aff manage_copy(__isl_keep isl_multi_aff *ptr);
585 class multi_aff {
586 friend inline multi_aff manage(__isl_take isl_multi_aff *ptr);
587 friend inline multi_aff manage_copy(__isl_keep isl_multi_aff *ptr);
589 isl_multi_aff *ptr = nullptr;
591 inline explicit multi_aff(__isl_take isl_multi_aff *ptr);
593 public:
594 inline /* implicit */ multi_aff();
595 inline /* implicit */ multi_aff(const multi_aff &obj);
596 inline /* implicit */ multi_aff(aff aff);
597 inline explicit multi_aff(ctx ctx, const std::string &str);
598 inline multi_aff &operator=(multi_aff obj);
599 inline ~multi_aff();
600 inline __isl_give isl_multi_aff *copy() const &;
601 inline __isl_give isl_multi_aff *copy() && = delete;
602 inline __isl_keep isl_multi_aff *get() const;
603 inline __isl_give isl_multi_aff *release();
604 inline bool is_null() const;
605 inline ctx get_ctx() const;
607 inline multi_aff add(multi_aff multi2) const;
608 inline multi_aff flat_range_product(multi_aff multi2) const;
609 inline multi_aff product(multi_aff multi2) const;
610 inline multi_aff pullback(multi_aff ma2) const;
611 inline multi_aff range_product(multi_aff multi2) const;
614 // declarations for isl::multi_pw_aff
615 inline multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr);
616 inline multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr);
618 class multi_pw_aff {
619 friend inline multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr);
620 friend inline multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr);
622 isl_multi_pw_aff *ptr = nullptr;
624 inline explicit multi_pw_aff(__isl_take isl_multi_pw_aff *ptr);
626 public:
627 inline /* implicit */ multi_pw_aff();
628 inline /* implicit */ multi_pw_aff(const multi_pw_aff &obj);
629 inline /* implicit */ multi_pw_aff(multi_aff ma);
630 inline /* implicit */ multi_pw_aff(pw_aff pa);
631 inline /* implicit */ multi_pw_aff(pw_multi_aff pma);
632 inline explicit multi_pw_aff(ctx ctx, const std::string &str);
633 inline multi_pw_aff &operator=(multi_pw_aff obj);
634 inline ~multi_pw_aff();
635 inline __isl_give isl_multi_pw_aff *copy() const &;
636 inline __isl_give isl_multi_pw_aff *copy() && = delete;
637 inline __isl_keep isl_multi_pw_aff *get() const;
638 inline __isl_give isl_multi_pw_aff *release();
639 inline bool is_null() const;
640 inline ctx get_ctx() const;
642 inline multi_pw_aff add(multi_pw_aff multi2) const;
643 inline multi_pw_aff flat_range_product(multi_pw_aff multi2) const;
644 inline multi_pw_aff product(multi_pw_aff multi2) const;
645 inline multi_pw_aff pullback(multi_aff ma) const;
646 inline multi_pw_aff pullback(pw_multi_aff pma) const;
647 inline multi_pw_aff pullback(multi_pw_aff mpa2) const;
648 inline multi_pw_aff range_product(multi_pw_aff multi2) const;
651 // declarations for isl::multi_union_pw_aff
652 inline multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr);
653 inline multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr);
655 class multi_union_pw_aff {
656 friend inline multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr);
657 friend inline multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr);
659 isl_multi_union_pw_aff *ptr = nullptr;
661 inline explicit multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr);
663 public:
664 inline /* implicit */ multi_union_pw_aff();
665 inline /* implicit */ multi_union_pw_aff(const multi_union_pw_aff &obj);
666 inline /* implicit */ multi_union_pw_aff(union_pw_aff upa);
667 inline /* implicit */ multi_union_pw_aff(multi_pw_aff mpa);
668 inline explicit multi_union_pw_aff(ctx ctx, const std::string &str);
669 inline multi_union_pw_aff &operator=(multi_union_pw_aff obj);
670 inline ~multi_union_pw_aff();
671 inline __isl_give isl_multi_union_pw_aff *copy() const &;
672 inline __isl_give isl_multi_union_pw_aff *copy() && = delete;
673 inline __isl_keep isl_multi_union_pw_aff *get() const;
674 inline __isl_give isl_multi_union_pw_aff *release();
675 inline bool is_null() const;
676 inline ctx get_ctx() const;
678 inline multi_union_pw_aff add(multi_union_pw_aff multi2) const;
679 inline multi_union_pw_aff flat_range_product(multi_union_pw_aff multi2) const;
680 inline multi_union_pw_aff pullback(union_pw_multi_aff upma) const;
681 inline multi_union_pw_aff range_product(multi_union_pw_aff multi2) const;
682 inline multi_union_pw_aff union_add(multi_union_pw_aff mupa2) const;
685 // declarations for isl::multi_val
686 inline multi_val manage(__isl_take isl_multi_val *ptr);
687 inline multi_val manage_copy(__isl_keep isl_multi_val *ptr);
689 class multi_val {
690 friend inline multi_val manage(__isl_take isl_multi_val *ptr);
691 friend inline multi_val manage_copy(__isl_keep isl_multi_val *ptr);
693 isl_multi_val *ptr = nullptr;
695 inline explicit multi_val(__isl_take isl_multi_val *ptr);
697 public:
698 inline /* implicit */ multi_val();
699 inline /* implicit */ multi_val(const multi_val &obj);
700 inline multi_val &operator=(multi_val obj);
701 inline ~multi_val();
702 inline __isl_give isl_multi_val *copy() const &;
703 inline __isl_give isl_multi_val *copy() && = delete;
704 inline __isl_keep isl_multi_val *get() const;
705 inline __isl_give isl_multi_val *release();
706 inline bool is_null() const;
707 inline ctx get_ctx() const;
709 inline multi_val add(multi_val multi2) const;
710 inline multi_val flat_range_product(multi_val multi2) const;
711 inline multi_val product(multi_val multi2) const;
712 inline multi_val range_product(multi_val multi2) const;
715 // declarations for isl::point
716 inline point manage(__isl_take isl_point *ptr);
717 inline point manage_copy(__isl_keep isl_point *ptr);
719 class point {
720 friend inline point manage(__isl_take isl_point *ptr);
721 friend inline point manage_copy(__isl_keep isl_point *ptr);
723 isl_point *ptr = nullptr;
725 inline explicit point(__isl_take isl_point *ptr);
727 public:
728 inline /* implicit */ point();
729 inline /* implicit */ point(const point &obj);
730 inline point &operator=(point obj);
731 inline ~point();
732 inline __isl_give isl_point *copy() const &;
733 inline __isl_give isl_point *copy() && = delete;
734 inline __isl_keep isl_point *get() const;
735 inline __isl_give isl_point *release();
736 inline bool is_null() const;
737 inline ctx get_ctx() const;
741 // declarations for isl::pw_aff
742 inline pw_aff manage(__isl_take isl_pw_aff *ptr);
743 inline pw_aff manage_copy(__isl_keep isl_pw_aff *ptr);
745 class pw_aff {
746 friend inline pw_aff manage(__isl_take isl_pw_aff *ptr);
747 friend inline pw_aff manage_copy(__isl_keep isl_pw_aff *ptr);
749 isl_pw_aff *ptr = nullptr;
751 inline explicit pw_aff(__isl_take isl_pw_aff *ptr);
753 public:
754 inline /* implicit */ pw_aff();
755 inline /* implicit */ pw_aff(const pw_aff &obj);
756 inline /* implicit */ pw_aff(aff aff);
757 inline explicit pw_aff(ctx ctx, const std::string &str);
758 inline pw_aff &operator=(pw_aff obj);
759 inline ~pw_aff();
760 inline __isl_give isl_pw_aff *copy() const &;
761 inline __isl_give isl_pw_aff *copy() && = delete;
762 inline __isl_keep isl_pw_aff *get() const;
763 inline __isl_give isl_pw_aff *release();
764 inline bool is_null() const;
765 inline ctx get_ctx() const;
767 inline pw_aff add(pw_aff pwaff2) const;
768 inline pw_aff ceil() const;
769 inline pw_aff cond(pw_aff pwaff_true, pw_aff pwaff_false) const;
770 inline pw_aff div(pw_aff pa2) const;
771 inline set eq_set(pw_aff pwaff2) const;
772 inline pw_aff floor() const;
773 inline set ge_set(pw_aff pwaff2) const;
774 inline set gt_set(pw_aff pwaff2) const;
775 inline set le_set(pw_aff pwaff2) const;
776 inline set lt_set(pw_aff pwaff2) const;
777 inline pw_aff max(pw_aff pwaff2) const;
778 inline pw_aff min(pw_aff pwaff2) const;
779 inline pw_aff mod(val mod) const;
780 inline pw_aff mul(pw_aff pwaff2) const;
781 inline set ne_set(pw_aff pwaff2) const;
782 inline pw_aff neg() const;
783 inline pw_aff pullback(multi_aff ma) const;
784 inline pw_aff pullback(pw_multi_aff pma) const;
785 inline pw_aff pullback(multi_pw_aff mpa) const;
786 inline pw_aff scale(val v) const;
787 inline pw_aff scale_down(val f) const;
788 inline pw_aff sub(pw_aff pwaff2) const;
789 inline pw_aff tdiv_q(pw_aff pa2) const;
790 inline pw_aff tdiv_r(pw_aff pa2) const;
791 inline pw_aff union_add(pw_aff pwaff2) const;
794 // declarations for isl::pw_multi_aff
795 inline pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr);
796 inline pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr);
798 class pw_multi_aff {
799 friend inline pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr);
800 friend inline pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr);
802 isl_pw_multi_aff *ptr = nullptr;
804 inline explicit pw_multi_aff(__isl_take isl_pw_multi_aff *ptr);
806 public:
807 inline /* implicit */ pw_multi_aff();
808 inline /* implicit */ pw_multi_aff(const pw_multi_aff &obj);
809 inline /* implicit */ pw_multi_aff(multi_aff ma);
810 inline /* implicit */ pw_multi_aff(pw_aff pa);
811 inline explicit pw_multi_aff(ctx ctx, const std::string &str);
812 inline pw_multi_aff &operator=(pw_multi_aff obj);
813 inline ~pw_multi_aff();
814 inline __isl_give isl_pw_multi_aff *copy() const &;
815 inline __isl_give isl_pw_multi_aff *copy() && = delete;
816 inline __isl_keep isl_pw_multi_aff *get() const;
817 inline __isl_give isl_pw_multi_aff *release();
818 inline bool is_null() const;
819 inline ctx get_ctx() const;
821 inline pw_multi_aff add(pw_multi_aff pma2) const;
822 inline pw_multi_aff flat_range_product(pw_multi_aff pma2) const;
823 inline pw_multi_aff product(pw_multi_aff pma2) const;
824 inline pw_multi_aff pullback(multi_aff ma) const;
825 inline pw_multi_aff pullback(pw_multi_aff pma2) const;
826 inline pw_multi_aff range_product(pw_multi_aff pma2) const;
827 inline pw_multi_aff union_add(pw_multi_aff pma2) const;
830 // declarations for isl::schedule
831 inline schedule manage(__isl_take isl_schedule *ptr);
832 inline schedule manage_copy(__isl_keep isl_schedule *ptr);
834 class schedule {
835 friend inline schedule manage(__isl_take isl_schedule *ptr);
836 friend inline schedule manage_copy(__isl_keep isl_schedule *ptr);
838 isl_schedule *ptr = nullptr;
840 inline explicit schedule(__isl_take isl_schedule *ptr);
842 public:
843 inline /* implicit */ schedule();
844 inline /* implicit */ schedule(const schedule &obj);
845 inline explicit schedule(ctx ctx, const std::string &str);
846 inline schedule &operator=(schedule obj);
847 inline ~schedule();
848 inline __isl_give isl_schedule *copy() const &;
849 inline __isl_give isl_schedule *copy() && = delete;
850 inline __isl_keep isl_schedule *get() const;
851 inline __isl_give isl_schedule *release();
852 inline bool is_null() const;
853 inline ctx get_ctx() const;
855 inline union_map get_map() const;
856 inline schedule_node get_root() const;
857 inline schedule pullback(union_pw_multi_aff upma) const;
860 // declarations for isl::schedule_constraints
861 inline schedule_constraints manage(__isl_take isl_schedule_constraints *ptr);
862 inline schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr);
864 class schedule_constraints {
865 friend inline schedule_constraints manage(__isl_take isl_schedule_constraints *ptr);
866 friend inline schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr);
868 isl_schedule_constraints *ptr = nullptr;
870 inline explicit schedule_constraints(__isl_take isl_schedule_constraints *ptr);
872 public:
873 inline /* implicit */ schedule_constraints();
874 inline /* implicit */ schedule_constraints(const schedule_constraints &obj);
875 inline explicit schedule_constraints(ctx ctx, const std::string &str);
876 inline schedule_constraints &operator=(schedule_constraints obj);
877 inline ~schedule_constraints();
878 inline __isl_give isl_schedule_constraints *copy() const &;
879 inline __isl_give isl_schedule_constraints *copy() && = delete;
880 inline __isl_keep isl_schedule_constraints *get() const;
881 inline __isl_give isl_schedule_constraints *release();
882 inline bool is_null() const;
883 inline ctx get_ctx() const;
885 inline schedule compute_schedule() const;
886 inline union_map get_coincidence() const;
887 inline union_map get_conditional_validity() const;
888 inline union_map get_conditional_validity_condition() const;
889 inline set get_context() const;
890 inline union_set get_domain() const;
891 inline union_map get_proximity() const;
892 inline union_map get_validity() const;
893 static inline schedule_constraints on_domain(union_set domain);
894 inline schedule_constraints set_coincidence(union_map coincidence) const;
895 inline schedule_constraints set_conditional_validity(union_map condition, union_map validity) const;
896 inline schedule_constraints set_context(set context) const;
897 inline schedule_constraints set_proximity(union_map proximity) const;
898 inline schedule_constraints set_validity(union_map validity) const;
901 // declarations for isl::schedule_node
902 inline schedule_node manage(__isl_take isl_schedule_node *ptr);
903 inline schedule_node manage_copy(__isl_keep isl_schedule_node *ptr);
905 class schedule_node {
906 friend inline schedule_node manage(__isl_take isl_schedule_node *ptr);
907 friend inline schedule_node manage_copy(__isl_keep isl_schedule_node *ptr);
909 isl_schedule_node *ptr = nullptr;
911 inline explicit schedule_node(__isl_take isl_schedule_node *ptr);
913 public:
914 inline /* implicit */ schedule_node();
915 inline /* implicit */ schedule_node(const schedule_node &obj);
916 inline schedule_node &operator=(schedule_node obj);
917 inline ~schedule_node();
918 inline __isl_give isl_schedule_node *copy() const &;
919 inline __isl_give isl_schedule_node *copy() && = delete;
920 inline __isl_keep isl_schedule_node *get() const;
921 inline __isl_give isl_schedule_node *release();
922 inline bool is_null() const;
923 inline ctx get_ctx() const;
925 inline bool band_member_get_coincident(int pos) const;
926 inline schedule_node band_member_set_coincident(int pos, int coincident) const;
927 inline schedule_node child(int pos) const;
928 inline multi_union_pw_aff get_prefix_schedule_multi_union_pw_aff() const;
929 inline union_map get_prefix_schedule_union_map() const;
930 inline union_pw_multi_aff get_prefix_schedule_union_pw_multi_aff() const;
931 inline schedule get_schedule() const;
932 inline schedule_node parent() const;
935 // declarations for isl::set
936 inline set manage(__isl_take isl_set *ptr);
937 inline set manage_copy(__isl_keep isl_set *ptr);
939 class set {
940 friend inline set manage(__isl_take isl_set *ptr);
941 friend inline set manage_copy(__isl_keep isl_set *ptr);
943 isl_set *ptr = nullptr;
945 inline explicit set(__isl_take isl_set *ptr);
947 public:
948 inline /* implicit */ set();
949 inline /* implicit */ set(const set &obj);
950 inline explicit set(ctx ctx, const std::string &str);
951 inline /* implicit */ set(basic_set bset);
952 inline /* implicit */ set(point pnt);
953 inline set &operator=(set obj);
954 inline ~set();
955 inline __isl_give isl_set *copy() const &;
956 inline __isl_give isl_set *copy() && = delete;
957 inline __isl_keep isl_set *get() const;
958 inline __isl_give isl_set *release();
959 inline bool is_null() const;
960 inline ctx get_ctx() const;
962 inline basic_set affine_hull() const;
963 inline set apply(map map) const;
964 inline set coalesce() const;
965 inline set complement() const;
966 inline set detect_equalities() const;
967 inline set flatten() const;
968 inline void foreach_basic_set(const std::function<void(basic_set)> &fn) const;
969 inline val get_stride(int pos) const;
970 inline set gist(set context) const;
971 inline map identity() const;
972 inline set intersect(set set2) const;
973 inline set intersect_params(set params) const;
974 inline bool is_disjoint(const set &set2) const;
975 inline bool is_empty() const;
976 inline bool is_equal(const set &set2) const;
977 inline bool is_strict_subset(const set &set2) const;
978 inline bool is_subset(const set &set2) const;
979 inline bool is_wrapping() const;
980 inline set lexmax() const;
981 inline set lexmin() const;
982 inline val max_val(const aff &obj) const;
983 inline val min_val(const aff &obj) const;
984 inline basic_set polyhedral_hull() const;
985 inline basic_set sample() const;
986 inline point sample_point() const;
987 inline set subtract(set set2) const;
988 inline set unite(set set2) const;
989 inline basic_set unshifted_simple_hull() const;
992 // declarations for isl::union_access_info
993 inline union_access_info manage(__isl_take isl_union_access_info *ptr);
994 inline union_access_info manage_copy(__isl_keep isl_union_access_info *ptr);
996 class union_access_info {
997 friend inline union_access_info manage(__isl_take isl_union_access_info *ptr);
998 friend inline union_access_info manage_copy(__isl_keep isl_union_access_info *ptr);
1000 isl_union_access_info *ptr = nullptr;
1002 inline explicit union_access_info(__isl_take isl_union_access_info *ptr);
1004 public:
1005 inline /* implicit */ union_access_info();
1006 inline /* implicit */ union_access_info(const union_access_info &obj);
1007 inline explicit union_access_info(union_map sink);
1008 inline union_access_info &operator=(union_access_info obj);
1009 inline ~union_access_info();
1010 inline __isl_give isl_union_access_info *copy() const &;
1011 inline __isl_give isl_union_access_info *copy() && = delete;
1012 inline __isl_keep isl_union_access_info *get() const;
1013 inline __isl_give isl_union_access_info *release();
1014 inline bool is_null() const;
1015 inline ctx get_ctx() const;
1017 inline union_flow compute_flow() const;
1018 inline union_access_info set_kill(union_map kill) const;
1019 inline union_access_info set_may_source(union_map may_source) const;
1020 inline union_access_info set_must_source(union_map must_source) const;
1021 inline union_access_info set_schedule(schedule schedule) const;
1022 inline union_access_info set_schedule_map(union_map schedule_map) const;
1025 // declarations for isl::union_flow
1026 inline union_flow manage(__isl_take isl_union_flow *ptr);
1027 inline union_flow manage_copy(__isl_keep isl_union_flow *ptr);
1029 class union_flow {
1030 friend inline union_flow manage(__isl_take isl_union_flow *ptr);
1031 friend inline union_flow manage_copy(__isl_keep isl_union_flow *ptr);
1033 isl_union_flow *ptr = nullptr;
1035 inline explicit union_flow(__isl_take isl_union_flow *ptr);
1037 public:
1038 inline /* implicit */ union_flow();
1039 inline /* implicit */ union_flow(const union_flow &obj);
1040 inline union_flow &operator=(union_flow obj);
1041 inline ~union_flow();
1042 inline __isl_give isl_union_flow *copy() const &;
1043 inline __isl_give isl_union_flow *copy() && = delete;
1044 inline __isl_keep isl_union_flow *get() const;
1045 inline __isl_give isl_union_flow *release();
1046 inline bool is_null() const;
1047 inline ctx get_ctx() const;
1049 inline union_map get_full_may_dependence() const;
1050 inline union_map get_full_must_dependence() const;
1051 inline union_map get_may_dependence() const;
1052 inline union_map get_may_no_source() const;
1053 inline union_map get_must_dependence() const;
1054 inline union_map get_must_no_source() const;
1057 // declarations for isl::union_map
1058 inline union_map manage(__isl_take isl_union_map *ptr);
1059 inline union_map manage_copy(__isl_keep isl_union_map *ptr);
1061 class union_map {
1062 friend inline union_map manage(__isl_take isl_union_map *ptr);
1063 friend inline union_map manage_copy(__isl_keep isl_union_map *ptr);
1065 isl_union_map *ptr = nullptr;
1067 inline explicit union_map(__isl_take isl_union_map *ptr);
1069 public:
1070 inline /* implicit */ union_map();
1071 inline /* implicit */ union_map(const union_map &obj);
1072 inline /* implicit */ union_map(basic_map bmap);
1073 inline /* implicit */ union_map(map map);
1074 inline explicit union_map(ctx ctx, const std::string &str);
1075 inline union_map &operator=(union_map obj);
1076 inline ~union_map();
1077 inline __isl_give isl_union_map *copy() const &;
1078 inline __isl_give isl_union_map *copy() && = delete;
1079 inline __isl_keep isl_union_map *get() const;
1080 inline __isl_give isl_union_map *release();
1081 inline bool is_null() const;
1082 inline ctx get_ctx() const;
1084 inline union_map affine_hull() const;
1085 inline union_map apply_domain(union_map umap2) const;
1086 inline union_map apply_range(union_map umap2) const;
1087 inline union_map coalesce() const;
1088 inline union_map compute_divs() const;
1089 inline union_set deltas() const;
1090 inline union_map detect_equalities() const;
1091 inline union_set domain() const;
1092 inline union_map domain_factor_domain() const;
1093 inline union_map domain_factor_range() const;
1094 inline union_map domain_map() const;
1095 inline union_pw_multi_aff domain_map_union_pw_multi_aff() const;
1096 inline union_map domain_product(union_map umap2) const;
1097 inline union_map eq_at(multi_union_pw_aff mupa) const;
1098 inline union_map factor_domain() const;
1099 inline union_map factor_range() const;
1100 inline union_map fixed_power(val exp) const;
1101 inline void foreach_map(const std::function<void(map)> &fn) const;
1102 static inline union_map from(union_pw_multi_aff upma);
1103 static inline union_map from(multi_union_pw_aff mupa);
1104 static inline union_map from_domain(union_set uset);
1105 static inline union_map from_domain_and_range(union_set domain, union_set range);
1106 static inline union_map from_range(union_set uset);
1107 inline union_map gist(union_map context) const;
1108 inline union_map gist_domain(union_set uset) const;
1109 inline union_map gist_params(set set) const;
1110 inline union_map gist_range(union_set uset) const;
1111 inline union_map intersect(union_map umap2) const;
1112 inline union_map intersect_domain(union_set uset) const;
1113 inline union_map intersect_params(set set) const;
1114 inline union_map intersect_range(union_set uset) const;
1115 inline bool is_bijective() const;
1116 inline bool is_empty() const;
1117 inline bool is_equal(const union_map &umap2) const;
1118 inline bool is_injective() const;
1119 inline bool is_single_valued() const;
1120 inline bool is_strict_subset(const union_map &umap2) const;
1121 inline bool is_subset(const union_map &umap2) const;
1122 inline union_map lexmax() const;
1123 inline union_map lexmin() const;
1124 inline union_map polyhedral_hull() const;
1125 inline union_map product(union_map umap2) const;
1126 inline union_map project_out_all_params() const;
1127 inline union_set range() const;
1128 inline union_map range_factor_domain() const;
1129 inline union_map range_factor_range() const;
1130 inline union_map range_map() const;
1131 inline union_map range_product(union_map umap2) const;
1132 inline union_map reverse() const;
1133 inline union_map subtract(union_map umap2) const;
1134 inline union_map subtract_domain(union_set dom) const;
1135 inline union_map subtract_range(union_set dom) const;
1136 inline union_map unite(union_map umap2) const;
1137 inline union_set wrap() const;
1138 inline union_map zip() const;
1141 // declarations for isl::union_pw_aff
1142 inline union_pw_aff manage(__isl_take isl_union_pw_aff *ptr);
1143 inline union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr);
1145 class union_pw_aff {
1146 friend inline union_pw_aff manage(__isl_take isl_union_pw_aff *ptr);
1147 friend inline union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr);
1149 isl_union_pw_aff *ptr = nullptr;
1151 inline explicit union_pw_aff(__isl_take isl_union_pw_aff *ptr);
1153 public:
1154 inline /* implicit */ union_pw_aff();
1155 inline /* implicit */ union_pw_aff(const union_pw_aff &obj);
1156 inline /* implicit */ union_pw_aff(pw_aff pa);
1157 inline explicit union_pw_aff(ctx ctx, const std::string &str);
1158 inline union_pw_aff &operator=(union_pw_aff obj);
1159 inline ~union_pw_aff();
1160 inline __isl_give isl_union_pw_aff *copy() const &;
1161 inline __isl_give isl_union_pw_aff *copy() && = delete;
1162 inline __isl_keep isl_union_pw_aff *get() const;
1163 inline __isl_give isl_union_pw_aff *release();
1164 inline bool is_null() const;
1165 inline ctx get_ctx() const;
1167 inline union_pw_aff add(union_pw_aff upa2) const;
1168 inline union_pw_aff pullback(union_pw_multi_aff upma) const;
1169 inline union_pw_aff union_add(union_pw_aff upa2) const;
1172 // declarations for isl::union_pw_multi_aff
1173 inline union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr);
1174 inline union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr);
1176 class union_pw_multi_aff {
1177 friend inline union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr);
1178 friend inline union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr);
1180 isl_union_pw_multi_aff *ptr = nullptr;
1182 inline explicit union_pw_multi_aff(__isl_take isl_union_pw_multi_aff *ptr);
1184 public:
1185 inline /* implicit */ union_pw_multi_aff();
1186 inline /* implicit */ union_pw_multi_aff(const union_pw_multi_aff &obj);
1187 inline /* implicit */ union_pw_multi_aff(pw_multi_aff pma);
1188 inline explicit union_pw_multi_aff(ctx ctx, const std::string &str);
1189 inline /* implicit */ union_pw_multi_aff(union_pw_aff upa);
1190 inline union_pw_multi_aff &operator=(union_pw_multi_aff obj);
1191 inline ~union_pw_multi_aff();
1192 inline __isl_give isl_union_pw_multi_aff *copy() const &;
1193 inline __isl_give isl_union_pw_multi_aff *copy() && = delete;
1194 inline __isl_keep isl_union_pw_multi_aff *get() const;
1195 inline __isl_give isl_union_pw_multi_aff *release();
1196 inline bool is_null() const;
1197 inline ctx get_ctx() const;
1199 inline union_pw_multi_aff add(union_pw_multi_aff upma2) const;
1200 inline union_pw_multi_aff flat_range_product(union_pw_multi_aff upma2) const;
1201 inline union_pw_multi_aff pullback(union_pw_multi_aff upma2) const;
1202 inline union_pw_multi_aff union_add(union_pw_multi_aff upma2) const;
1205 // declarations for isl::union_set
1206 inline union_set manage(__isl_take isl_union_set *ptr);
1207 inline union_set manage_copy(__isl_keep isl_union_set *ptr);
1209 class union_set {
1210 friend inline union_set manage(__isl_take isl_union_set *ptr);
1211 friend inline union_set manage_copy(__isl_keep isl_union_set *ptr);
1213 isl_union_set *ptr = nullptr;
1215 inline explicit union_set(__isl_take isl_union_set *ptr);
1217 public:
1218 inline /* implicit */ union_set();
1219 inline /* implicit */ union_set(const union_set &obj);
1220 inline /* implicit */ union_set(basic_set bset);
1221 inline /* implicit */ union_set(set set);
1222 inline /* implicit */ union_set(point pnt);
1223 inline explicit union_set(ctx ctx, const std::string &str);
1224 inline union_set &operator=(union_set obj);
1225 inline ~union_set();
1226 inline __isl_give isl_union_set *copy() const &;
1227 inline __isl_give isl_union_set *copy() && = delete;
1228 inline __isl_keep isl_union_set *get() const;
1229 inline __isl_give isl_union_set *release();
1230 inline bool is_null() const;
1231 inline ctx get_ctx() const;
1233 inline union_set affine_hull() const;
1234 inline union_set apply(union_map umap) const;
1235 inline union_set coalesce() const;
1236 inline union_set compute_divs() const;
1237 inline union_set detect_equalities() const;
1238 inline void foreach_point(const std::function<void(point)> &fn) const;
1239 inline void foreach_set(const std::function<void(set)> &fn) const;
1240 inline union_set gist(union_set context) const;
1241 inline union_set gist_params(set set) const;
1242 inline union_map identity() const;
1243 inline union_set intersect(union_set uset2) const;
1244 inline union_set intersect_params(set set) const;
1245 inline bool is_empty() const;
1246 inline bool is_equal(const union_set &uset2) const;
1247 inline bool is_strict_subset(const union_set &uset2) const;
1248 inline bool is_subset(const union_set &uset2) const;
1249 inline union_set lexmax() const;
1250 inline union_set lexmin() const;
1251 inline union_set polyhedral_hull() const;
1252 inline union_set preimage(multi_aff ma) const;
1253 inline union_set preimage(pw_multi_aff pma) const;
1254 inline union_set preimage(union_pw_multi_aff upma) const;
1255 inline point sample_point() const;
1256 inline union_set subtract(union_set uset2) const;
1257 inline union_set unite(union_set uset2) const;
1258 inline union_map unwrap() const;
1261 // declarations for isl::val
1262 inline val manage(__isl_take isl_val *ptr);
1263 inline val manage_copy(__isl_keep isl_val *ptr);
1265 class val {
1266 friend inline val manage(__isl_take isl_val *ptr);
1267 friend inline val manage_copy(__isl_keep isl_val *ptr);
1269 isl_val *ptr = nullptr;
1271 inline explicit val(__isl_take isl_val *ptr);
1273 public:
1274 inline /* implicit */ val();
1275 inline /* implicit */ val(const val &obj);
1276 inline explicit val(ctx ctx, const std::string &str);
1277 inline explicit val(ctx ctx, long i);
1278 inline val &operator=(val obj);
1279 inline ~val();
1280 inline __isl_give isl_val *copy() const &;
1281 inline __isl_give isl_val *copy() && = delete;
1282 inline __isl_keep isl_val *get() const;
1283 inline __isl_give isl_val *release();
1284 inline bool is_null() const;
1285 inline ctx get_ctx() const;
1287 inline val abs() const;
1288 inline bool abs_eq(const val &v2) const;
1289 inline val add(val v2) const;
1290 inline val ceil() const;
1291 inline int cmp_si(long i) const;
1292 inline val div(val v2) const;
1293 inline bool eq(const val &v2) const;
1294 inline val floor() const;
1295 inline val gcd(val v2) const;
1296 inline bool ge(const val &v2) const;
1297 inline bool gt(const val &v2) const;
1298 static inline val infty(ctx ctx);
1299 inline val inv() const;
1300 inline bool is_divisible_by(const val &v2) const;
1301 inline bool is_infty() const;
1302 inline bool is_int() const;
1303 inline bool is_nan() const;
1304 inline bool is_neg() const;
1305 inline bool is_neginfty() const;
1306 inline bool is_negone() const;
1307 inline bool is_nonneg() const;
1308 inline bool is_nonpos() const;
1309 inline bool is_one() const;
1310 inline bool is_pos() const;
1311 inline bool is_rat() const;
1312 inline bool is_zero() const;
1313 inline bool le(const val &v2) const;
1314 inline bool lt(const val &v2) const;
1315 inline val max(val v2) const;
1316 inline val min(val v2) const;
1317 inline val mod(val v2) const;
1318 inline val mul(val v2) const;
1319 static inline val nan(ctx ctx);
1320 inline bool ne(const val &v2) const;
1321 inline val neg() const;
1322 static inline val neginfty(ctx ctx);
1323 static inline val negone(ctx ctx);
1324 static inline val one(ctx ctx);
1325 inline val pow2() const;
1326 inline int sgn() const;
1327 inline val sub(val v2) const;
1328 inline val trunc() const;
1329 static inline val zero(ctx ctx);
1332 // implementations for isl::aff
1333 aff manage(__isl_take isl_aff *ptr) {
1334 if (!ptr)
1335 exception::throw_NULL_input(__FILE__, __LINE__);
1336 return aff(ptr);
1338 aff manage_copy(__isl_keep isl_aff *ptr) {
1339 if (!ptr)
1340 exception::throw_NULL_input(__FILE__, __LINE__);
1341 auto ctx = isl_aff_get_ctx(ptr);
1342 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1343 ptr = isl_aff_copy(ptr);
1344 if (!ptr)
1345 exception::throw_last_error(ctx);
1346 return aff(ptr);
1349 aff::aff()
1350 : ptr(nullptr) {}
1352 aff::aff(const aff &obj)
1353 : ptr(nullptr)
1355 if (!obj.ptr)
1356 exception::throw_NULL_input(__FILE__, __LINE__);
1357 auto ctx = isl_aff_get_ctx(obj.ptr);
1358 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1359 ptr = obj.copy();
1360 if (!ptr)
1361 exception::throw_last_error(ctx);
1364 aff::aff(__isl_take isl_aff *ptr)
1365 : ptr(ptr) {}
1367 aff::aff(ctx ctx, const std::string &str)
1369 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1370 auto res = isl_aff_read_from_str(ctx.release(), str.c_str());
1371 if (!res)
1372 exception::throw_last_error(ctx);
1373 ptr = res;
1376 aff &aff::operator=(aff obj) {
1377 std::swap(this->ptr, obj.ptr);
1378 return *this;
1381 aff::~aff() {
1382 if (ptr)
1383 isl_aff_free(ptr);
1386 __isl_give isl_aff *aff::copy() const & {
1387 return isl_aff_copy(ptr);
1390 __isl_keep isl_aff *aff::get() const {
1391 return ptr;
1394 __isl_give isl_aff *aff::release() {
1395 isl_aff *tmp = ptr;
1396 ptr = nullptr;
1397 return tmp;
1400 bool aff::is_null() const {
1401 return ptr == nullptr;
1404 ctx aff::get_ctx() const {
1405 return ctx(isl_aff_get_ctx(ptr));
1408 aff aff::add(aff aff2) const
1410 if (!ptr || aff2.is_null())
1411 exception::throw_NULL_input(__FILE__, __LINE__);
1412 auto ctx = get_ctx();
1413 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1414 auto res = isl_aff_add(copy(), aff2.release());
1415 if (!res)
1416 exception::throw_last_error(ctx);
1417 return manage(res);
1420 aff aff::ceil() const
1422 if (!ptr)
1423 exception::throw_NULL_input(__FILE__, __LINE__);
1424 auto ctx = get_ctx();
1425 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1426 auto res = isl_aff_ceil(copy());
1427 if (!res)
1428 exception::throw_last_error(ctx);
1429 return manage(res);
1432 aff aff::div(aff aff2) const
1434 if (!ptr || aff2.is_null())
1435 exception::throw_NULL_input(__FILE__, __LINE__);
1436 auto ctx = get_ctx();
1437 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1438 auto res = isl_aff_div(copy(), aff2.release());
1439 if (!res)
1440 exception::throw_last_error(ctx);
1441 return manage(res);
1444 set aff::eq_set(aff aff2) const
1446 if (!ptr || aff2.is_null())
1447 exception::throw_NULL_input(__FILE__, __LINE__);
1448 auto ctx = get_ctx();
1449 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1450 auto res = isl_aff_eq_set(copy(), aff2.release());
1451 if (!res)
1452 exception::throw_last_error(ctx);
1453 return manage(res);
1456 aff aff::floor() const
1458 if (!ptr)
1459 exception::throw_NULL_input(__FILE__, __LINE__);
1460 auto ctx = get_ctx();
1461 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1462 auto res = isl_aff_floor(copy());
1463 if (!res)
1464 exception::throw_last_error(ctx);
1465 return manage(res);
1468 set aff::ge_set(aff aff2) const
1470 if (!ptr || aff2.is_null())
1471 exception::throw_NULL_input(__FILE__, __LINE__);
1472 auto ctx = get_ctx();
1473 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1474 auto res = isl_aff_ge_set(copy(), aff2.release());
1475 if (!res)
1476 exception::throw_last_error(ctx);
1477 return manage(res);
1480 set aff::gt_set(aff aff2) const
1482 if (!ptr || aff2.is_null())
1483 exception::throw_NULL_input(__FILE__, __LINE__);
1484 auto ctx = get_ctx();
1485 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1486 auto res = isl_aff_gt_set(copy(), aff2.release());
1487 if (!res)
1488 exception::throw_last_error(ctx);
1489 return manage(res);
1492 set aff::le_set(aff aff2) const
1494 if (!ptr || aff2.is_null())
1495 exception::throw_NULL_input(__FILE__, __LINE__);
1496 auto ctx = get_ctx();
1497 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1498 auto res = isl_aff_le_set(copy(), aff2.release());
1499 if (!res)
1500 exception::throw_last_error(ctx);
1501 return manage(res);
1504 set aff::lt_set(aff aff2) const
1506 if (!ptr || aff2.is_null())
1507 exception::throw_NULL_input(__FILE__, __LINE__);
1508 auto ctx = get_ctx();
1509 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1510 auto res = isl_aff_lt_set(copy(), aff2.release());
1511 if (!res)
1512 exception::throw_last_error(ctx);
1513 return manage(res);
1516 aff aff::mod(val mod) const
1518 if (!ptr || mod.is_null())
1519 exception::throw_NULL_input(__FILE__, __LINE__);
1520 auto ctx = get_ctx();
1521 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1522 auto res = isl_aff_mod_val(copy(), mod.release());
1523 if (!res)
1524 exception::throw_last_error(ctx);
1525 return manage(res);
1528 aff aff::mul(aff aff2) const
1530 if (!ptr || aff2.is_null())
1531 exception::throw_NULL_input(__FILE__, __LINE__);
1532 auto ctx = get_ctx();
1533 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1534 auto res = isl_aff_mul(copy(), aff2.release());
1535 if (!res)
1536 exception::throw_last_error(ctx);
1537 return manage(res);
1540 set aff::ne_set(aff aff2) const
1542 if (!ptr || aff2.is_null())
1543 exception::throw_NULL_input(__FILE__, __LINE__);
1544 auto ctx = get_ctx();
1545 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1546 auto res = isl_aff_ne_set(copy(), aff2.release());
1547 if (!res)
1548 exception::throw_last_error(ctx);
1549 return manage(res);
1552 aff aff::neg() const
1554 if (!ptr)
1555 exception::throw_NULL_input(__FILE__, __LINE__);
1556 auto ctx = get_ctx();
1557 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1558 auto res = isl_aff_neg(copy());
1559 if (!res)
1560 exception::throw_last_error(ctx);
1561 return manage(res);
1564 aff aff::pullback(multi_aff ma) const
1566 if (!ptr || ma.is_null())
1567 exception::throw_NULL_input(__FILE__, __LINE__);
1568 auto ctx = get_ctx();
1569 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1570 auto res = isl_aff_pullback_multi_aff(copy(), ma.release());
1571 if (!res)
1572 exception::throw_last_error(ctx);
1573 return manage(res);
1576 aff aff::scale(val v) const
1578 if (!ptr || v.is_null())
1579 exception::throw_NULL_input(__FILE__, __LINE__);
1580 auto ctx = get_ctx();
1581 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1582 auto res = isl_aff_scale_val(copy(), v.release());
1583 if (!res)
1584 exception::throw_last_error(ctx);
1585 return manage(res);
1588 aff aff::scale_down(val v) const
1590 if (!ptr || v.is_null())
1591 exception::throw_NULL_input(__FILE__, __LINE__);
1592 auto ctx = get_ctx();
1593 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1594 auto res = isl_aff_scale_down_val(copy(), v.release());
1595 if (!res)
1596 exception::throw_last_error(ctx);
1597 return manage(res);
1600 aff aff::sub(aff aff2) const
1602 if (!ptr || aff2.is_null())
1603 exception::throw_NULL_input(__FILE__, __LINE__);
1604 auto ctx = get_ctx();
1605 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1606 auto res = isl_aff_sub(copy(), aff2.release());
1607 if (!res)
1608 exception::throw_last_error(ctx);
1609 return manage(res);
1612 // implementations for isl::ast_build
1613 ast_build manage(__isl_take isl_ast_build *ptr) {
1614 if (!ptr)
1615 exception::throw_NULL_input(__FILE__, __LINE__);
1616 return ast_build(ptr);
1618 ast_build manage_copy(__isl_keep isl_ast_build *ptr) {
1619 if (!ptr)
1620 exception::throw_NULL_input(__FILE__, __LINE__);
1621 auto ctx = isl_ast_build_get_ctx(ptr);
1622 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1623 ptr = isl_ast_build_copy(ptr);
1624 if (!ptr)
1625 exception::throw_last_error(ctx);
1626 return ast_build(ptr);
1629 ast_build::ast_build()
1630 : ptr(nullptr) {}
1632 ast_build::ast_build(const ast_build &obj)
1633 : ptr(nullptr)
1635 if (!obj.ptr)
1636 exception::throw_NULL_input(__FILE__, __LINE__);
1637 auto ctx = isl_ast_build_get_ctx(obj.ptr);
1638 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1639 ptr = obj.copy();
1640 if (!ptr)
1641 exception::throw_last_error(ctx);
1644 ast_build::ast_build(__isl_take isl_ast_build *ptr)
1645 : ptr(ptr) {}
1647 ast_build::ast_build(ctx ctx)
1649 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1650 auto res = isl_ast_build_alloc(ctx.release());
1651 if (!res)
1652 exception::throw_last_error(ctx);
1653 ptr = res;
1656 ast_build &ast_build::operator=(ast_build obj) {
1657 std::swap(this->ptr, obj.ptr);
1658 return *this;
1661 ast_build::~ast_build() {
1662 if (ptr)
1663 isl_ast_build_free(ptr);
1666 __isl_give isl_ast_build *ast_build::copy() const & {
1667 return isl_ast_build_copy(ptr);
1670 __isl_keep isl_ast_build *ast_build::get() const {
1671 return ptr;
1674 __isl_give isl_ast_build *ast_build::release() {
1675 isl_ast_build *tmp = ptr;
1676 ptr = nullptr;
1677 return tmp;
1680 bool ast_build::is_null() const {
1681 return ptr == nullptr;
1684 ctx ast_build::get_ctx() const {
1685 return ctx(isl_ast_build_get_ctx(ptr));
1688 ast_expr ast_build::access_from(pw_multi_aff pma) const
1690 if (!ptr || pma.is_null())
1691 exception::throw_NULL_input(__FILE__, __LINE__);
1692 auto ctx = get_ctx();
1693 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1694 auto res = isl_ast_build_access_from_pw_multi_aff(get(), pma.release());
1695 if (!res)
1696 exception::throw_last_error(ctx);
1697 return manage(res);
1700 ast_expr ast_build::access_from(multi_pw_aff mpa) const
1702 if (!ptr || mpa.is_null())
1703 exception::throw_NULL_input(__FILE__, __LINE__);
1704 auto ctx = get_ctx();
1705 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1706 auto res = isl_ast_build_access_from_multi_pw_aff(get(), mpa.release());
1707 if (!res)
1708 exception::throw_last_error(ctx);
1709 return manage(res);
1712 ast_expr ast_build::call_from(pw_multi_aff pma) const
1714 if (!ptr || pma.is_null())
1715 exception::throw_NULL_input(__FILE__, __LINE__);
1716 auto ctx = get_ctx();
1717 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1718 auto res = isl_ast_build_call_from_pw_multi_aff(get(), pma.release());
1719 if (!res)
1720 exception::throw_last_error(ctx);
1721 return manage(res);
1724 ast_expr ast_build::call_from(multi_pw_aff mpa) const
1726 if (!ptr || mpa.is_null())
1727 exception::throw_NULL_input(__FILE__, __LINE__);
1728 auto ctx = get_ctx();
1729 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1730 auto res = isl_ast_build_call_from_multi_pw_aff(get(), mpa.release());
1731 if (!res)
1732 exception::throw_last_error(ctx);
1733 return manage(res);
1736 ast_expr ast_build::expr_from(set set) const
1738 if (!ptr || set.is_null())
1739 exception::throw_NULL_input(__FILE__, __LINE__);
1740 auto ctx = get_ctx();
1741 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1742 auto res = isl_ast_build_expr_from_set(get(), set.release());
1743 if (!res)
1744 exception::throw_last_error(ctx);
1745 return manage(res);
1748 ast_expr ast_build::expr_from(pw_aff pa) const
1750 if (!ptr || pa.is_null())
1751 exception::throw_NULL_input(__FILE__, __LINE__);
1752 auto ctx = get_ctx();
1753 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1754 auto res = isl_ast_build_expr_from_pw_aff(get(), pa.release());
1755 if (!res)
1756 exception::throw_last_error(ctx);
1757 return manage(res);
1760 ast_build ast_build::from_context(set set)
1762 if (set.is_null())
1763 exception::throw_NULL_input(__FILE__, __LINE__);
1764 auto ctx = set.get_ctx();
1765 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1766 auto res = isl_ast_build_from_context(set.release());
1767 if (!res)
1768 exception::throw_last_error(ctx);
1769 return manage(res);
1772 ast_node ast_build::node_from_schedule_map(union_map schedule) const
1774 if (!ptr || schedule.is_null())
1775 exception::throw_NULL_input(__FILE__, __LINE__);
1776 auto ctx = get_ctx();
1777 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1778 auto res = isl_ast_build_node_from_schedule_map(get(), schedule.release());
1779 if (!res)
1780 exception::throw_last_error(ctx);
1781 return manage(res);
1784 // implementations for isl::ast_expr
1785 ast_expr manage(__isl_take isl_ast_expr *ptr) {
1786 if (!ptr)
1787 exception::throw_NULL_input(__FILE__, __LINE__);
1788 return ast_expr(ptr);
1790 ast_expr manage_copy(__isl_keep isl_ast_expr *ptr) {
1791 if (!ptr)
1792 exception::throw_NULL_input(__FILE__, __LINE__);
1793 auto ctx = isl_ast_expr_get_ctx(ptr);
1794 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1795 ptr = isl_ast_expr_copy(ptr);
1796 if (!ptr)
1797 exception::throw_last_error(ctx);
1798 return ast_expr(ptr);
1801 ast_expr::ast_expr()
1802 : ptr(nullptr) {}
1804 ast_expr::ast_expr(const ast_expr &obj)
1805 : ptr(nullptr)
1807 if (!obj.ptr)
1808 exception::throw_NULL_input(__FILE__, __LINE__);
1809 auto ctx = isl_ast_expr_get_ctx(obj.ptr);
1810 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1811 ptr = obj.copy();
1812 if (!ptr)
1813 exception::throw_last_error(ctx);
1816 ast_expr::ast_expr(__isl_take isl_ast_expr *ptr)
1817 : ptr(ptr) {}
1820 ast_expr &ast_expr::operator=(ast_expr obj) {
1821 std::swap(this->ptr, obj.ptr);
1822 return *this;
1825 ast_expr::~ast_expr() {
1826 if (ptr)
1827 isl_ast_expr_free(ptr);
1830 __isl_give isl_ast_expr *ast_expr::copy() const & {
1831 return isl_ast_expr_copy(ptr);
1834 __isl_keep isl_ast_expr *ast_expr::get() const {
1835 return ptr;
1838 __isl_give isl_ast_expr *ast_expr::release() {
1839 isl_ast_expr *tmp = ptr;
1840 ptr = nullptr;
1841 return tmp;
1844 bool ast_expr::is_null() const {
1845 return ptr == nullptr;
1848 ctx ast_expr::get_ctx() const {
1849 return ctx(isl_ast_expr_get_ctx(ptr));
1852 std::string ast_expr::to_C_str() const
1854 if (!ptr)
1855 exception::throw_NULL_input(__FILE__, __LINE__);
1856 auto ctx = get_ctx();
1857 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1858 auto res = isl_ast_expr_to_C_str(get());
1859 std::string tmp(res);
1860 free(res);
1861 return tmp;
1864 // implementations for isl::ast_node
1865 ast_node manage(__isl_take isl_ast_node *ptr) {
1866 if (!ptr)
1867 exception::throw_NULL_input(__FILE__, __LINE__);
1868 return ast_node(ptr);
1870 ast_node manage_copy(__isl_keep isl_ast_node *ptr) {
1871 if (!ptr)
1872 exception::throw_NULL_input(__FILE__, __LINE__);
1873 auto ctx = isl_ast_node_get_ctx(ptr);
1874 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1875 ptr = isl_ast_node_copy(ptr);
1876 if (!ptr)
1877 exception::throw_last_error(ctx);
1878 return ast_node(ptr);
1881 ast_node::ast_node()
1882 : ptr(nullptr) {}
1884 ast_node::ast_node(const ast_node &obj)
1885 : ptr(nullptr)
1887 if (!obj.ptr)
1888 exception::throw_NULL_input(__FILE__, __LINE__);
1889 auto ctx = isl_ast_node_get_ctx(obj.ptr);
1890 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1891 ptr = obj.copy();
1892 if (!ptr)
1893 exception::throw_last_error(ctx);
1896 ast_node::ast_node(__isl_take isl_ast_node *ptr)
1897 : ptr(ptr) {}
1900 ast_node &ast_node::operator=(ast_node obj) {
1901 std::swap(this->ptr, obj.ptr);
1902 return *this;
1905 ast_node::~ast_node() {
1906 if (ptr)
1907 isl_ast_node_free(ptr);
1910 __isl_give isl_ast_node *ast_node::copy() const & {
1911 return isl_ast_node_copy(ptr);
1914 __isl_keep isl_ast_node *ast_node::get() const {
1915 return ptr;
1918 __isl_give isl_ast_node *ast_node::release() {
1919 isl_ast_node *tmp = ptr;
1920 ptr = nullptr;
1921 return tmp;
1924 bool ast_node::is_null() const {
1925 return ptr == nullptr;
1928 ctx ast_node::get_ctx() const {
1929 return ctx(isl_ast_node_get_ctx(ptr));
1932 std::string ast_node::to_C_str() const
1934 if (!ptr)
1935 exception::throw_NULL_input(__FILE__, __LINE__);
1936 auto ctx = get_ctx();
1937 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1938 auto res = isl_ast_node_to_C_str(get());
1939 std::string tmp(res);
1940 free(res);
1941 return tmp;
1944 // implementations for isl::basic_map
1945 basic_map manage(__isl_take isl_basic_map *ptr) {
1946 if (!ptr)
1947 exception::throw_NULL_input(__FILE__, __LINE__);
1948 return basic_map(ptr);
1950 basic_map manage_copy(__isl_keep isl_basic_map *ptr) {
1951 if (!ptr)
1952 exception::throw_NULL_input(__FILE__, __LINE__);
1953 auto ctx = isl_basic_map_get_ctx(ptr);
1954 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1955 ptr = isl_basic_map_copy(ptr);
1956 if (!ptr)
1957 exception::throw_last_error(ctx);
1958 return basic_map(ptr);
1961 basic_map::basic_map()
1962 : ptr(nullptr) {}
1964 basic_map::basic_map(const basic_map &obj)
1965 : ptr(nullptr)
1967 if (!obj.ptr)
1968 exception::throw_NULL_input(__FILE__, __LINE__);
1969 auto ctx = isl_basic_map_get_ctx(obj.ptr);
1970 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1971 ptr = obj.copy();
1972 if (!ptr)
1973 exception::throw_last_error(ctx);
1976 basic_map::basic_map(__isl_take isl_basic_map *ptr)
1977 : ptr(ptr) {}
1979 basic_map::basic_map(ctx ctx, const std::string &str)
1981 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
1982 auto res = isl_basic_map_read_from_str(ctx.release(), str.c_str());
1983 if (!res)
1984 exception::throw_last_error(ctx);
1985 ptr = res;
1988 basic_map &basic_map::operator=(basic_map obj) {
1989 std::swap(this->ptr, obj.ptr);
1990 return *this;
1993 basic_map::~basic_map() {
1994 if (ptr)
1995 isl_basic_map_free(ptr);
1998 __isl_give isl_basic_map *basic_map::copy() const & {
1999 return isl_basic_map_copy(ptr);
2002 __isl_keep isl_basic_map *basic_map::get() const {
2003 return ptr;
2006 __isl_give isl_basic_map *basic_map::release() {
2007 isl_basic_map *tmp = ptr;
2008 ptr = nullptr;
2009 return tmp;
2012 bool basic_map::is_null() const {
2013 return ptr == nullptr;
2016 ctx basic_map::get_ctx() const {
2017 return ctx(isl_basic_map_get_ctx(ptr));
2020 basic_map basic_map::affine_hull() const
2022 if (!ptr)
2023 exception::throw_NULL_input(__FILE__, __LINE__);
2024 auto ctx = get_ctx();
2025 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2026 auto res = isl_basic_map_affine_hull(copy());
2027 if (!res)
2028 exception::throw_last_error(ctx);
2029 return manage(res);
2032 basic_map basic_map::apply_domain(basic_map bmap2) const
2034 if (!ptr || bmap2.is_null())
2035 exception::throw_NULL_input(__FILE__, __LINE__);
2036 auto ctx = get_ctx();
2037 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2038 auto res = isl_basic_map_apply_domain(copy(), bmap2.release());
2039 if (!res)
2040 exception::throw_last_error(ctx);
2041 return manage(res);
2044 basic_map basic_map::apply_range(basic_map bmap2) const
2046 if (!ptr || bmap2.is_null())
2047 exception::throw_NULL_input(__FILE__, __LINE__);
2048 auto ctx = get_ctx();
2049 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2050 auto res = isl_basic_map_apply_range(copy(), bmap2.release());
2051 if (!res)
2052 exception::throw_last_error(ctx);
2053 return manage(res);
2056 basic_set basic_map::deltas() const
2058 if (!ptr)
2059 exception::throw_NULL_input(__FILE__, __LINE__);
2060 auto ctx = get_ctx();
2061 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2062 auto res = isl_basic_map_deltas(copy());
2063 if (!res)
2064 exception::throw_last_error(ctx);
2065 return manage(res);
2068 basic_map basic_map::detect_equalities() const
2070 if (!ptr)
2071 exception::throw_NULL_input(__FILE__, __LINE__);
2072 auto ctx = get_ctx();
2073 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2074 auto res = isl_basic_map_detect_equalities(copy());
2075 if (!res)
2076 exception::throw_last_error(ctx);
2077 return manage(res);
2080 basic_map basic_map::flatten() const
2082 if (!ptr)
2083 exception::throw_NULL_input(__FILE__, __LINE__);
2084 auto ctx = get_ctx();
2085 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2086 auto res = isl_basic_map_flatten(copy());
2087 if (!res)
2088 exception::throw_last_error(ctx);
2089 return manage(res);
2092 basic_map basic_map::flatten_domain() const
2094 if (!ptr)
2095 exception::throw_NULL_input(__FILE__, __LINE__);
2096 auto ctx = get_ctx();
2097 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2098 auto res = isl_basic_map_flatten_domain(copy());
2099 if (!res)
2100 exception::throw_last_error(ctx);
2101 return manage(res);
2104 basic_map basic_map::flatten_range() const
2106 if (!ptr)
2107 exception::throw_NULL_input(__FILE__, __LINE__);
2108 auto ctx = get_ctx();
2109 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2110 auto res = isl_basic_map_flatten_range(copy());
2111 if (!res)
2112 exception::throw_last_error(ctx);
2113 return manage(res);
2116 basic_map basic_map::gist(basic_map context) const
2118 if (!ptr || context.is_null())
2119 exception::throw_NULL_input(__FILE__, __LINE__);
2120 auto ctx = get_ctx();
2121 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2122 auto res = isl_basic_map_gist(copy(), context.release());
2123 if (!res)
2124 exception::throw_last_error(ctx);
2125 return manage(res);
2128 basic_map basic_map::intersect(basic_map bmap2) const
2130 if (!ptr || bmap2.is_null())
2131 exception::throw_NULL_input(__FILE__, __LINE__);
2132 auto ctx = get_ctx();
2133 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2134 auto res = isl_basic_map_intersect(copy(), bmap2.release());
2135 if (!res)
2136 exception::throw_last_error(ctx);
2137 return manage(res);
2140 basic_map basic_map::intersect_domain(basic_set bset) const
2142 if (!ptr || bset.is_null())
2143 exception::throw_NULL_input(__FILE__, __LINE__);
2144 auto ctx = get_ctx();
2145 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2146 auto res = isl_basic_map_intersect_domain(copy(), bset.release());
2147 if (!res)
2148 exception::throw_last_error(ctx);
2149 return manage(res);
2152 basic_map basic_map::intersect_range(basic_set bset) const
2154 if (!ptr || bset.is_null())
2155 exception::throw_NULL_input(__FILE__, __LINE__);
2156 auto ctx = get_ctx();
2157 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2158 auto res = isl_basic_map_intersect_range(copy(), bset.release());
2159 if (!res)
2160 exception::throw_last_error(ctx);
2161 return manage(res);
2164 bool basic_map::is_empty() const
2166 if (!ptr)
2167 exception::throw_NULL_input(__FILE__, __LINE__);
2168 auto ctx = get_ctx();
2169 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2170 auto res = isl_basic_map_is_empty(get());
2171 if (res < 0)
2172 exception::throw_last_error(ctx);
2173 return res;
2176 bool basic_map::is_equal(const basic_map &bmap2) const
2178 if (!ptr || bmap2.is_null())
2179 exception::throw_NULL_input(__FILE__, __LINE__);
2180 auto ctx = get_ctx();
2181 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2182 auto res = isl_basic_map_is_equal(get(), bmap2.get());
2183 if (res < 0)
2184 exception::throw_last_error(ctx);
2185 return res;
2188 bool basic_map::is_subset(const basic_map &bmap2) const
2190 if (!ptr || bmap2.is_null())
2191 exception::throw_NULL_input(__FILE__, __LINE__);
2192 auto ctx = get_ctx();
2193 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2194 auto res = isl_basic_map_is_subset(get(), bmap2.get());
2195 if (res < 0)
2196 exception::throw_last_error(ctx);
2197 return res;
2200 map basic_map::lexmax() const
2202 if (!ptr)
2203 exception::throw_NULL_input(__FILE__, __LINE__);
2204 auto ctx = get_ctx();
2205 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2206 auto res = isl_basic_map_lexmax(copy());
2207 if (!res)
2208 exception::throw_last_error(ctx);
2209 return manage(res);
2212 map basic_map::lexmin() const
2214 if (!ptr)
2215 exception::throw_NULL_input(__FILE__, __LINE__);
2216 auto ctx = get_ctx();
2217 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2218 auto res = isl_basic_map_lexmin(copy());
2219 if (!res)
2220 exception::throw_last_error(ctx);
2221 return manage(res);
2224 basic_map basic_map::reverse() const
2226 if (!ptr)
2227 exception::throw_NULL_input(__FILE__, __LINE__);
2228 auto ctx = get_ctx();
2229 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2230 auto res = isl_basic_map_reverse(copy());
2231 if (!res)
2232 exception::throw_last_error(ctx);
2233 return manage(res);
2236 basic_map basic_map::sample() const
2238 if (!ptr)
2239 exception::throw_NULL_input(__FILE__, __LINE__);
2240 auto ctx = get_ctx();
2241 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2242 auto res = isl_basic_map_sample(copy());
2243 if (!res)
2244 exception::throw_last_error(ctx);
2245 return manage(res);
2248 map basic_map::unite(basic_map bmap2) const
2250 if (!ptr || bmap2.is_null())
2251 exception::throw_NULL_input(__FILE__, __LINE__);
2252 auto ctx = get_ctx();
2253 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2254 auto res = isl_basic_map_union(copy(), bmap2.release());
2255 if (!res)
2256 exception::throw_last_error(ctx);
2257 return manage(res);
2260 // implementations for isl::basic_set
2261 basic_set manage(__isl_take isl_basic_set *ptr) {
2262 if (!ptr)
2263 exception::throw_NULL_input(__FILE__, __LINE__);
2264 return basic_set(ptr);
2266 basic_set manage_copy(__isl_keep isl_basic_set *ptr) {
2267 if (!ptr)
2268 exception::throw_NULL_input(__FILE__, __LINE__);
2269 auto ctx = isl_basic_set_get_ctx(ptr);
2270 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2271 ptr = isl_basic_set_copy(ptr);
2272 if (!ptr)
2273 exception::throw_last_error(ctx);
2274 return basic_set(ptr);
2277 basic_set::basic_set()
2278 : ptr(nullptr) {}
2280 basic_set::basic_set(const basic_set &obj)
2281 : ptr(nullptr)
2283 if (!obj.ptr)
2284 exception::throw_NULL_input(__FILE__, __LINE__);
2285 auto ctx = isl_basic_set_get_ctx(obj.ptr);
2286 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2287 ptr = obj.copy();
2288 if (!ptr)
2289 exception::throw_last_error(ctx);
2292 basic_set::basic_set(__isl_take isl_basic_set *ptr)
2293 : ptr(ptr) {}
2295 basic_set::basic_set(ctx ctx, const std::string &str)
2297 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2298 auto res = isl_basic_set_read_from_str(ctx.release(), str.c_str());
2299 if (!res)
2300 exception::throw_last_error(ctx);
2301 ptr = res;
2303 basic_set::basic_set(point pnt)
2305 if (pnt.is_null())
2306 exception::throw_NULL_input(__FILE__, __LINE__);
2307 auto ctx = pnt.get_ctx();
2308 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2309 auto res = isl_basic_set_from_point(pnt.release());
2310 if (!res)
2311 exception::throw_last_error(ctx);
2312 ptr = res;
2315 basic_set &basic_set::operator=(basic_set obj) {
2316 std::swap(this->ptr, obj.ptr);
2317 return *this;
2320 basic_set::~basic_set() {
2321 if (ptr)
2322 isl_basic_set_free(ptr);
2325 __isl_give isl_basic_set *basic_set::copy() const & {
2326 return isl_basic_set_copy(ptr);
2329 __isl_keep isl_basic_set *basic_set::get() const {
2330 return ptr;
2333 __isl_give isl_basic_set *basic_set::release() {
2334 isl_basic_set *tmp = ptr;
2335 ptr = nullptr;
2336 return tmp;
2339 bool basic_set::is_null() const {
2340 return ptr == nullptr;
2343 ctx basic_set::get_ctx() const {
2344 return ctx(isl_basic_set_get_ctx(ptr));
2347 basic_set basic_set::affine_hull() const
2349 if (!ptr)
2350 exception::throw_NULL_input(__FILE__, __LINE__);
2351 auto ctx = get_ctx();
2352 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2353 auto res = isl_basic_set_affine_hull(copy());
2354 if (!res)
2355 exception::throw_last_error(ctx);
2356 return manage(res);
2359 basic_set basic_set::apply(basic_map bmap) const
2361 if (!ptr || bmap.is_null())
2362 exception::throw_NULL_input(__FILE__, __LINE__);
2363 auto ctx = get_ctx();
2364 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2365 auto res = isl_basic_set_apply(copy(), bmap.release());
2366 if (!res)
2367 exception::throw_last_error(ctx);
2368 return manage(res);
2371 basic_set basic_set::detect_equalities() const
2373 if (!ptr)
2374 exception::throw_NULL_input(__FILE__, __LINE__);
2375 auto ctx = get_ctx();
2376 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2377 auto res = isl_basic_set_detect_equalities(copy());
2378 if (!res)
2379 exception::throw_last_error(ctx);
2380 return manage(res);
2383 val basic_set::dim_max_val(int pos) const
2385 if (!ptr)
2386 exception::throw_NULL_input(__FILE__, __LINE__);
2387 auto ctx = get_ctx();
2388 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2389 auto res = isl_basic_set_dim_max_val(copy(), pos);
2390 if (!res)
2391 exception::throw_last_error(ctx);
2392 return manage(res);
2395 basic_set basic_set::flatten() const
2397 if (!ptr)
2398 exception::throw_NULL_input(__FILE__, __LINE__);
2399 auto ctx = get_ctx();
2400 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2401 auto res = isl_basic_set_flatten(copy());
2402 if (!res)
2403 exception::throw_last_error(ctx);
2404 return manage(res);
2407 basic_set basic_set::gist(basic_set context) const
2409 if (!ptr || context.is_null())
2410 exception::throw_NULL_input(__FILE__, __LINE__);
2411 auto ctx = get_ctx();
2412 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2413 auto res = isl_basic_set_gist(copy(), context.release());
2414 if (!res)
2415 exception::throw_last_error(ctx);
2416 return manage(res);
2419 basic_set basic_set::intersect(basic_set bset2) const
2421 if (!ptr || bset2.is_null())
2422 exception::throw_NULL_input(__FILE__, __LINE__);
2423 auto ctx = get_ctx();
2424 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2425 auto res = isl_basic_set_intersect(copy(), bset2.release());
2426 if (!res)
2427 exception::throw_last_error(ctx);
2428 return manage(res);
2431 basic_set basic_set::intersect_params(basic_set bset2) const
2433 if (!ptr || bset2.is_null())
2434 exception::throw_NULL_input(__FILE__, __LINE__);
2435 auto ctx = get_ctx();
2436 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2437 auto res = isl_basic_set_intersect_params(copy(), bset2.release());
2438 if (!res)
2439 exception::throw_last_error(ctx);
2440 return manage(res);
2443 bool basic_set::is_empty() const
2445 if (!ptr)
2446 exception::throw_NULL_input(__FILE__, __LINE__);
2447 auto ctx = get_ctx();
2448 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2449 auto res = isl_basic_set_is_empty(get());
2450 if (res < 0)
2451 exception::throw_last_error(ctx);
2452 return res;
2455 bool basic_set::is_equal(const basic_set &bset2) const
2457 if (!ptr || bset2.is_null())
2458 exception::throw_NULL_input(__FILE__, __LINE__);
2459 auto ctx = get_ctx();
2460 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2461 auto res = isl_basic_set_is_equal(get(), bset2.get());
2462 if (res < 0)
2463 exception::throw_last_error(ctx);
2464 return res;
2467 bool basic_set::is_subset(const basic_set &bset2) const
2469 if (!ptr || bset2.is_null())
2470 exception::throw_NULL_input(__FILE__, __LINE__);
2471 auto ctx = get_ctx();
2472 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2473 auto res = isl_basic_set_is_subset(get(), bset2.get());
2474 if (res < 0)
2475 exception::throw_last_error(ctx);
2476 return res;
2479 bool basic_set::is_wrapping() const
2481 if (!ptr)
2482 exception::throw_NULL_input(__FILE__, __LINE__);
2483 auto ctx = get_ctx();
2484 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2485 auto res = isl_basic_set_is_wrapping(get());
2486 if (res < 0)
2487 exception::throw_last_error(ctx);
2488 return res;
2491 set basic_set::lexmax() const
2493 if (!ptr)
2494 exception::throw_NULL_input(__FILE__, __LINE__);
2495 auto ctx = get_ctx();
2496 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2497 auto res = isl_basic_set_lexmax(copy());
2498 if (!res)
2499 exception::throw_last_error(ctx);
2500 return manage(res);
2503 set basic_set::lexmin() const
2505 if (!ptr)
2506 exception::throw_NULL_input(__FILE__, __LINE__);
2507 auto ctx = get_ctx();
2508 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2509 auto res = isl_basic_set_lexmin(copy());
2510 if (!res)
2511 exception::throw_last_error(ctx);
2512 return manage(res);
2515 basic_set basic_set::sample() const
2517 if (!ptr)
2518 exception::throw_NULL_input(__FILE__, __LINE__);
2519 auto ctx = get_ctx();
2520 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2521 auto res = isl_basic_set_sample(copy());
2522 if (!res)
2523 exception::throw_last_error(ctx);
2524 return manage(res);
2527 point basic_set::sample_point() const
2529 if (!ptr)
2530 exception::throw_NULL_input(__FILE__, __LINE__);
2531 auto ctx = get_ctx();
2532 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2533 auto res = isl_basic_set_sample_point(copy());
2534 if (!res)
2535 exception::throw_last_error(ctx);
2536 return manage(res);
2539 set basic_set::unite(basic_set bset2) const
2541 if (!ptr || bset2.is_null())
2542 exception::throw_NULL_input(__FILE__, __LINE__);
2543 auto ctx = get_ctx();
2544 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2545 auto res = isl_basic_set_union(copy(), bset2.release());
2546 if (!res)
2547 exception::throw_last_error(ctx);
2548 return manage(res);
2551 // implementations for isl::map
2552 map manage(__isl_take isl_map *ptr) {
2553 if (!ptr)
2554 exception::throw_NULL_input(__FILE__, __LINE__);
2555 return map(ptr);
2557 map manage_copy(__isl_keep isl_map *ptr) {
2558 if (!ptr)
2559 exception::throw_NULL_input(__FILE__, __LINE__);
2560 auto ctx = isl_map_get_ctx(ptr);
2561 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2562 ptr = isl_map_copy(ptr);
2563 if (!ptr)
2564 exception::throw_last_error(ctx);
2565 return map(ptr);
2568 map::map()
2569 : ptr(nullptr) {}
2571 map::map(const map &obj)
2572 : ptr(nullptr)
2574 if (!obj.ptr)
2575 exception::throw_NULL_input(__FILE__, __LINE__);
2576 auto ctx = isl_map_get_ctx(obj.ptr);
2577 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2578 ptr = obj.copy();
2579 if (!ptr)
2580 exception::throw_last_error(ctx);
2583 map::map(__isl_take isl_map *ptr)
2584 : ptr(ptr) {}
2586 map::map(ctx ctx, const std::string &str)
2588 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2589 auto res = isl_map_read_from_str(ctx.release(), str.c_str());
2590 if (!res)
2591 exception::throw_last_error(ctx);
2592 ptr = res;
2594 map::map(basic_map bmap)
2596 if (bmap.is_null())
2597 exception::throw_NULL_input(__FILE__, __LINE__);
2598 auto ctx = bmap.get_ctx();
2599 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2600 auto res = isl_map_from_basic_map(bmap.release());
2601 if (!res)
2602 exception::throw_last_error(ctx);
2603 ptr = res;
2606 map &map::operator=(map obj) {
2607 std::swap(this->ptr, obj.ptr);
2608 return *this;
2611 map::~map() {
2612 if (ptr)
2613 isl_map_free(ptr);
2616 __isl_give isl_map *map::copy() const & {
2617 return isl_map_copy(ptr);
2620 __isl_keep isl_map *map::get() const {
2621 return ptr;
2624 __isl_give isl_map *map::release() {
2625 isl_map *tmp = ptr;
2626 ptr = nullptr;
2627 return tmp;
2630 bool map::is_null() const {
2631 return ptr == nullptr;
2634 ctx map::get_ctx() const {
2635 return ctx(isl_map_get_ctx(ptr));
2638 basic_map map::affine_hull() const
2640 if (!ptr)
2641 exception::throw_NULL_input(__FILE__, __LINE__);
2642 auto ctx = get_ctx();
2643 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2644 auto res = isl_map_affine_hull(copy());
2645 if (!res)
2646 exception::throw_last_error(ctx);
2647 return manage(res);
2650 map map::apply_domain(map map2) const
2652 if (!ptr || map2.is_null())
2653 exception::throw_NULL_input(__FILE__, __LINE__);
2654 auto ctx = get_ctx();
2655 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2656 auto res = isl_map_apply_domain(copy(), map2.release());
2657 if (!res)
2658 exception::throw_last_error(ctx);
2659 return manage(res);
2662 map map::apply_range(map map2) const
2664 if (!ptr || map2.is_null())
2665 exception::throw_NULL_input(__FILE__, __LINE__);
2666 auto ctx = get_ctx();
2667 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2668 auto res = isl_map_apply_range(copy(), map2.release());
2669 if (!res)
2670 exception::throw_last_error(ctx);
2671 return manage(res);
2674 map map::coalesce() const
2676 if (!ptr)
2677 exception::throw_NULL_input(__FILE__, __LINE__);
2678 auto ctx = get_ctx();
2679 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2680 auto res = isl_map_coalesce(copy());
2681 if (!res)
2682 exception::throw_last_error(ctx);
2683 return manage(res);
2686 map map::complement() const
2688 if (!ptr)
2689 exception::throw_NULL_input(__FILE__, __LINE__);
2690 auto ctx = get_ctx();
2691 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2692 auto res = isl_map_complement(copy());
2693 if (!res)
2694 exception::throw_last_error(ctx);
2695 return manage(res);
2698 set map::deltas() const
2700 if (!ptr)
2701 exception::throw_NULL_input(__FILE__, __LINE__);
2702 auto ctx = get_ctx();
2703 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2704 auto res = isl_map_deltas(copy());
2705 if (!res)
2706 exception::throw_last_error(ctx);
2707 return manage(res);
2710 map map::detect_equalities() const
2712 if (!ptr)
2713 exception::throw_NULL_input(__FILE__, __LINE__);
2714 auto ctx = get_ctx();
2715 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2716 auto res = isl_map_detect_equalities(copy());
2717 if (!res)
2718 exception::throw_last_error(ctx);
2719 return manage(res);
2722 map map::flatten() const
2724 if (!ptr)
2725 exception::throw_NULL_input(__FILE__, __LINE__);
2726 auto ctx = get_ctx();
2727 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2728 auto res = isl_map_flatten(copy());
2729 if (!res)
2730 exception::throw_last_error(ctx);
2731 return manage(res);
2734 map map::flatten_domain() const
2736 if (!ptr)
2737 exception::throw_NULL_input(__FILE__, __LINE__);
2738 auto ctx = get_ctx();
2739 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2740 auto res = isl_map_flatten_domain(copy());
2741 if (!res)
2742 exception::throw_last_error(ctx);
2743 return manage(res);
2746 map map::flatten_range() const
2748 if (!ptr)
2749 exception::throw_NULL_input(__FILE__, __LINE__);
2750 auto ctx = get_ctx();
2751 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2752 auto res = isl_map_flatten_range(copy());
2753 if (!res)
2754 exception::throw_last_error(ctx);
2755 return manage(res);
2758 void map::foreach_basic_map(const std::function<void(basic_map)> &fn) const
2760 if (!ptr)
2761 exception::throw_NULL_input(__FILE__, __LINE__);
2762 auto ctx = get_ctx();
2763 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2764 struct fn_data {
2765 const std::function<void(basic_map)> *func;
2766 std::exception_ptr eptr;
2767 } fn_data = { &fn };
2768 auto fn_lambda = [](isl_basic_map *arg_0, void *arg_1) -> isl_stat {
2769 auto *data = static_cast<struct fn_data *>(arg_1);
2770 ISL_CPP_TRY {
2771 (*data->func)(manage(arg_0));
2772 return isl_stat_ok;
2773 } ISL_CPP_CATCH_ALL {
2774 data->eptr = std::current_exception();
2775 return isl_stat_error;
2778 auto res = isl_map_foreach_basic_map(get(), fn_lambda, &fn_data);
2779 if (fn_data.eptr)
2780 std::rethrow_exception(fn_data.eptr);
2781 if (res < 0)
2782 exception::throw_last_error(ctx);
2783 return;
2786 map map::gist(map context) const
2788 if (!ptr || context.is_null())
2789 exception::throw_NULL_input(__FILE__, __LINE__);
2790 auto ctx = get_ctx();
2791 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2792 auto res = isl_map_gist(copy(), context.release());
2793 if (!res)
2794 exception::throw_last_error(ctx);
2795 return manage(res);
2798 map map::gist_domain(set context) const
2800 if (!ptr || context.is_null())
2801 exception::throw_NULL_input(__FILE__, __LINE__);
2802 auto ctx = get_ctx();
2803 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2804 auto res = isl_map_gist_domain(copy(), context.release());
2805 if (!res)
2806 exception::throw_last_error(ctx);
2807 return manage(res);
2810 map map::intersect(map map2) const
2812 if (!ptr || map2.is_null())
2813 exception::throw_NULL_input(__FILE__, __LINE__);
2814 auto ctx = get_ctx();
2815 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2816 auto res = isl_map_intersect(copy(), map2.release());
2817 if (!res)
2818 exception::throw_last_error(ctx);
2819 return manage(res);
2822 map map::intersect_domain(set set) const
2824 if (!ptr || set.is_null())
2825 exception::throw_NULL_input(__FILE__, __LINE__);
2826 auto ctx = get_ctx();
2827 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2828 auto res = isl_map_intersect_domain(copy(), set.release());
2829 if (!res)
2830 exception::throw_last_error(ctx);
2831 return manage(res);
2834 map map::intersect_params(set params) const
2836 if (!ptr || params.is_null())
2837 exception::throw_NULL_input(__FILE__, __LINE__);
2838 auto ctx = get_ctx();
2839 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2840 auto res = isl_map_intersect_params(copy(), params.release());
2841 if (!res)
2842 exception::throw_last_error(ctx);
2843 return manage(res);
2846 map map::intersect_range(set set) const
2848 if (!ptr || set.is_null())
2849 exception::throw_NULL_input(__FILE__, __LINE__);
2850 auto ctx = get_ctx();
2851 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2852 auto res = isl_map_intersect_range(copy(), set.release());
2853 if (!res)
2854 exception::throw_last_error(ctx);
2855 return manage(res);
2858 bool map::is_bijective() const
2860 if (!ptr)
2861 exception::throw_NULL_input(__FILE__, __LINE__);
2862 auto ctx = get_ctx();
2863 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2864 auto res = isl_map_is_bijective(get());
2865 if (res < 0)
2866 exception::throw_last_error(ctx);
2867 return res;
2870 bool map::is_disjoint(const map &map2) const
2872 if (!ptr || map2.is_null())
2873 exception::throw_NULL_input(__FILE__, __LINE__);
2874 auto ctx = get_ctx();
2875 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2876 auto res = isl_map_is_disjoint(get(), map2.get());
2877 if (res < 0)
2878 exception::throw_last_error(ctx);
2879 return res;
2882 bool map::is_empty() const
2884 if (!ptr)
2885 exception::throw_NULL_input(__FILE__, __LINE__);
2886 auto ctx = get_ctx();
2887 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2888 auto res = isl_map_is_empty(get());
2889 if (res < 0)
2890 exception::throw_last_error(ctx);
2891 return res;
2894 bool map::is_equal(const map &map2) const
2896 if (!ptr || map2.is_null())
2897 exception::throw_NULL_input(__FILE__, __LINE__);
2898 auto ctx = get_ctx();
2899 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2900 auto res = isl_map_is_equal(get(), map2.get());
2901 if (res < 0)
2902 exception::throw_last_error(ctx);
2903 return res;
2906 bool map::is_injective() const
2908 if (!ptr)
2909 exception::throw_NULL_input(__FILE__, __LINE__);
2910 auto ctx = get_ctx();
2911 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2912 auto res = isl_map_is_injective(get());
2913 if (res < 0)
2914 exception::throw_last_error(ctx);
2915 return res;
2918 bool map::is_single_valued() const
2920 if (!ptr)
2921 exception::throw_NULL_input(__FILE__, __LINE__);
2922 auto ctx = get_ctx();
2923 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2924 auto res = isl_map_is_single_valued(get());
2925 if (res < 0)
2926 exception::throw_last_error(ctx);
2927 return res;
2930 bool map::is_strict_subset(const map &map2) const
2932 if (!ptr || map2.is_null())
2933 exception::throw_NULL_input(__FILE__, __LINE__);
2934 auto ctx = get_ctx();
2935 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2936 auto res = isl_map_is_strict_subset(get(), map2.get());
2937 if (res < 0)
2938 exception::throw_last_error(ctx);
2939 return res;
2942 bool map::is_subset(const map &map2) const
2944 if (!ptr || map2.is_null())
2945 exception::throw_NULL_input(__FILE__, __LINE__);
2946 auto ctx = get_ctx();
2947 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2948 auto res = isl_map_is_subset(get(), map2.get());
2949 if (res < 0)
2950 exception::throw_last_error(ctx);
2951 return res;
2954 map map::lexmax() const
2956 if (!ptr)
2957 exception::throw_NULL_input(__FILE__, __LINE__);
2958 auto ctx = get_ctx();
2959 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2960 auto res = isl_map_lexmax(copy());
2961 if (!res)
2962 exception::throw_last_error(ctx);
2963 return manage(res);
2966 map map::lexmin() const
2968 if (!ptr)
2969 exception::throw_NULL_input(__FILE__, __LINE__);
2970 auto ctx = get_ctx();
2971 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2972 auto res = isl_map_lexmin(copy());
2973 if (!res)
2974 exception::throw_last_error(ctx);
2975 return manage(res);
2978 basic_map map::polyhedral_hull() const
2980 if (!ptr)
2981 exception::throw_NULL_input(__FILE__, __LINE__);
2982 auto ctx = get_ctx();
2983 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2984 auto res = isl_map_polyhedral_hull(copy());
2985 if (!res)
2986 exception::throw_last_error(ctx);
2987 return manage(res);
2990 map map::reverse() const
2992 if (!ptr)
2993 exception::throw_NULL_input(__FILE__, __LINE__);
2994 auto ctx = get_ctx();
2995 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
2996 auto res = isl_map_reverse(copy());
2997 if (!res)
2998 exception::throw_last_error(ctx);
2999 return manage(res);
3002 basic_map map::sample() const
3004 if (!ptr)
3005 exception::throw_NULL_input(__FILE__, __LINE__);
3006 auto ctx = get_ctx();
3007 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3008 auto res = isl_map_sample(copy());
3009 if (!res)
3010 exception::throw_last_error(ctx);
3011 return manage(res);
3014 map map::subtract(map map2) const
3016 if (!ptr || map2.is_null())
3017 exception::throw_NULL_input(__FILE__, __LINE__);
3018 auto ctx = get_ctx();
3019 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3020 auto res = isl_map_subtract(copy(), map2.release());
3021 if (!res)
3022 exception::throw_last_error(ctx);
3023 return manage(res);
3026 map map::unite(map map2) const
3028 if (!ptr || map2.is_null())
3029 exception::throw_NULL_input(__FILE__, __LINE__);
3030 auto ctx = get_ctx();
3031 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3032 auto res = isl_map_union(copy(), map2.release());
3033 if (!res)
3034 exception::throw_last_error(ctx);
3035 return manage(res);
3038 basic_map map::unshifted_simple_hull() const
3040 if (!ptr)
3041 exception::throw_NULL_input(__FILE__, __LINE__);
3042 auto ctx = get_ctx();
3043 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3044 auto res = isl_map_unshifted_simple_hull(copy());
3045 if (!res)
3046 exception::throw_last_error(ctx);
3047 return manage(res);
3050 // implementations for isl::multi_aff
3051 multi_aff manage(__isl_take isl_multi_aff *ptr) {
3052 if (!ptr)
3053 exception::throw_NULL_input(__FILE__, __LINE__);
3054 return multi_aff(ptr);
3056 multi_aff manage_copy(__isl_keep isl_multi_aff *ptr) {
3057 if (!ptr)
3058 exception::throw_NULL_input(__FILE__, __LINE__);
3059 auto ctx = isl_multi_aff_get_ctx(ptr);
3060 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3061 ptr = isl_multi_aff_copy(ptr);
3062 if (!ptr)
3063 exception::throw_last_error(ctx);
3064 return multi_aff(ptr);
3067 multi_aff::multi_aff()
3068 : ptr(nullptr) {}
3070 multi_aff::multi_aff(const multi_aff &obj)
3071 : ptr(nullptr)
3073 if (!obj.ptr)
3074 exception::throw_NULL_input(__FILE__, __LINE__);
3075 auto ctx = isl_multi_aff_get_ctx(obj.ptr);
3076 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3077 ptr = obj.copy();
3078 if (!ptr)
3079 exception::throw_last_error(ctx);
3082 multi_aff::multi_aff(__isl_take isl_multi_aff *ptr)
3083 : ptr(ptr) {}
3085 multi_aff::multi_aff(aff aff)
3087 if (aff.is_null())
3088 exception::throw_NULL_input(__FILE__, __LINE__);
3089 auto ctx = aff.get_ctx();
3090 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3091 auto res = isl_multi_aff_from_aff(aff.release());
3092 if (!res)
3093 exception::throw_last_error(ctx);
3094 ptr = res;
3096 multi_aff::multi_aff(ctx ctx, const std::string &str)
3098 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3099 auto res = isl_multi_aff_read_from_str(ctx.release(), str.c_str());
3100 if (!res)
3101 exception::throw_last_error(ctx);
3102 ptr = res;
3105 multi_aff &multi_aff::operator=(multi_aff obj) {
3106 std::swap(this->ptr, obj.ptr);
3107 return *this;
3110 multi_aff::~multi_aff() {
3111 if (ptr)
3112 isl_multi_aff_free(ptr);
3115 __isl_give isl_multi_aff *multi_aff::copy() const & {
3116 return isl_multi_aff_copy(ptr);
3119 __isl_keep isl_multi_aff *multi_aff::get() const {
3120 return ptr;
3123 __isl_give isl_multi_aff *multi_aff::release() {
3124 isl_multi_aff *tmp = ptr;
3125 ptr = nullptr;
3126 return tmp;
3129 bool multi_aff::is_null() const {
3130 return ptr == nullptr;
3133 ctx multi_aff::get_ctx() const {
3134 return ctx(isl_multi_aff_get_ctx(ptr));
3137 multi_aff multi_aff::add(multi_aff multi2) const
3139 if (!ptr || multi2.is_null())
3140 exception::throw_NULL_input(__FILE__, __LINE__);
3141 auto ctx = get_ctx();
3142 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3143 auto res = isl_multi_aff_add(copy(), multi2.release());
3144 if (!res)
3145 exception::throw_last_error(ctx);
3146 return manage(res);
3149 multi_aff multi_aff::flat_range_product(multi_aff multi2) const
3151 if (!ptr || multi2.is_null())
3152 exception::throw_NULL_input(__FILE__, __LINE__);
3153 auto ctx = get_ctx();
3154 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3155 auto res = isl_multi_aff_flat_range_product(copy(), multi2.release());
3156 if (!res)
3157 exception::throw_last_error(ctx);
3158 return manage(res);
3161 multi_aff multi_aff::product(multi_aff multi2) const
3163 if (!ptr || multi2.is_null())
3164 exception::throw_NULL_input(__FILE__, __LINE__);
3165 auto ctx = get_ctx();
3166 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3167 auto res = isl_multi_aff_product(copy(), multi2.release());
3168 if (!res)
3169 exception::throw_last_error(ctx);
3170 return manage(res);
3173 multi_aff multi_aff::pullback(multi_aff ma2) const
3175 if (!ptr || ma2.is_null())
3176 exception::throw_NULL_input(__FILE__, __LINE__);
3177 auto ctx = get_ctx();
3178 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3179 auto res = isl_multi_aff_pullback_multi_aff(copy(), ma2.release());
3180 if (!res)
3181 exception::throw_last_error(ctx);
3182 return manage(res);
3185 multi_aff multi_aff::range_product(multi_aff multi2) const
3187 if (!ptr || multi2.is_null())
3188 exception::throw_NULL_input(__FILE__, __LINE__);
3189 auto ctx = get_ctx();
3190 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3191 auto res = isl_multi_aff_range_product(copy(), multi2.release());
3192 if (!res)
3193 exception::throw_last_error(ctx);
3194 return manage(res);
3197 // implementations for isl::multi_pw_aff
3198 multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr) {
3199 if (!ptr)
3200 exception::throw_NULL_input(__FILE__, __LINE__);
3201 return multi_pw_aff(ptr);
3203 multi_pw_aff manage_copy(__isl_keep isl_multi_pw_aff *ptr) {
3204 if (!ptr)
3205 exception::throw_NULL_input(__FILE__, __LINE__);
3206 auto ctx = isl_multi_pw_aff_get_ctx(ptr);
3207 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3208 ptr = isl_multi_pw_aff_copy(ptr);
3209 if (!ptr)
3210 exception::throw_last_error(ctx);
3211 return multi_pw_aff(ptr);
3214 multi_pw_aff::multi_pw_aff()
3215 : ptr(nullptr) {}
3217 multi_pw_aff::multi_pw_aff(const multi_pw_aff &obj)
3218 : ptr(nullptr)
3220 if (!obj.ptr)
3221 exception::throw_NULL_input(__FILE__, __LINE__);
3222 auto ctx = isl_multi_pw_aff_get_ctx(obj.ptr);
3223 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3224 ptr = obj.copy();
3225 if (!ptr)
3226 exception::throw_last_error(ctx);
3229 multi_pw_aff::multi_pw_aff(__isl_take isl_multi_pw_aff *ptr)
3230 : ptr(ptr) {}
3232 multi_pw_aff::multi_pw_aff(multi_aff ma)
3234 if (ma.is_null())
3235 exception::throw_NULL_input(__FILE__, __LINE__);
3236 auto ctx = ma.get_ctx();
3237 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3238 auto res = isl_multi_pw_aff_from_multi_aff(ma.release());
3239 if (!res)
3240 exception::throw_last_error(ctx);
3241 ptr = res;
3243 multi_pw_aff::multi_pw_aff(pw_aff pa)
3245 if (pa.is_null())
3246 exception::throw_NULL_input(__FILE__, __LINE__);
3247 auto ctx = pa.get_ctx();
3248 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3249 auto res = isl_multi_pw_aff_from_pw_aff(pa.release());
3250 if (!res)
3251 exception::throw_last_error(ctx);
3252 ptr = res;
3254 multi_pw_aff::multi_pw_aff(pw_multi_aff pma)
3256 if (pma.is_null())
3257 exception::throw_NULL_input(__FILE__, __LINE__);
3258 auto ctx = pma.get_ctx();
3259 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3260 auto res = isl_multi_pw_aff_from_pw_multi_aff(pma.release());
3261 if (!res)
3262 exception::throw_last_error(ctx);
3263 ptr = res;
3265 multi_pw_aff::multi_pw_aff(ctx ctx, const std::string &str)
3267 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3268 auto res = isl_multi_pw_aff_read_from_str(ctx.release(), str.c_str());
3269 if (!res)
3270 exception::throw_last_error(ctx);
3271 ptr = res;
3274 multi_pw_aff &multi_pw_aff::operator=(multi_pw_aff obj) {
3275 std::swap(this->ptr, obj.ptr);
3276 return *this;
3279 multi_pw_aff::~multi_pw_aff() {
3280 if (ptr)
3281 isl_multi_pw_aff_free(ptr);
3284 __isl_give isl_multi_pw_aff *multi_pw_aff::copy() const & {
3285 return isl_multi_pw_aff_copy(ptr);
3288 __isl_keep isl_multi_pw_aff *multi_pw_aff::get() const {
3289 return ptr;
3292 __isl_give isl_multi_pw_aff *multi_pw_aff::release() {
3293 isl_multi_pw_aff *tmp = ptr;
3294 ptr = nullptr;
3295 return tmp;
3298 bool multi_pw_aff::is_null() const {
3299 return ptr == nullptr;
3302 ctx multi_pw_aff::get_ctx() const {
3303 return ctx(isl_multi_pw_aff_get_ctx(ptr));
3306 multi_pw_aff multi_pw_aff::add(multi_pw_aff multi2) const
3308 if (!ptr || multi2.is_null())
3309 exception::throw_NULL_input(__FILE__, __LINE__);
3310 auto ctx = get_ctx();
3311 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3312 auto res = isl_multi_pw_aff_add(copy(), multi2.release());
3313 if (!res)
3314 exception::throw_last_error(ctx);
3315 return manage(res);
3318 multi_pw_aff multi_pw_aff::flat_range_product(multi_pw_aff multi2) const
3320 if (!ptr || multi2.is_null())
3321 exception::throw_NULL_input(__FILE__, __LINE__);
3322 auto ctx = get_ctx();
3323 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3324 auto res = isl_multi_pw_aff_flat_range_product(copy(), multi2.release());
3325 if (!res)
3326 exception::throw_last_error(ctx);
3327 return manage(res);
3330 multi_pw_aff multi_pw_aff::product(multi_pw_aff multi2) const
3332 if (!ptr || multi2.is_null())
3333 exception::throw_NULL_input(__FILE__, __LINE__);
3334 auto ctx = get_ctx();
3335 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3336 auto res = isl_multi_pw_aff_product(copy(), multi2.release());
3337 if (!res)
3338 exception::throw_last_error(ctx);
3339 return manage(res);
3342 multi_pw_aff multi_pw_aff::pullback(multi_aff ma) const
3344 if (!ptr || ma.is_null())
3345 exception::throw_NULL_input(__FILE__, __LINE__);
3346 auto ctx = get_ctx();
3347 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3348 auto res = isl_multi_pw_aff_pullback_multi_aff(copy(), ma.release());
3349 if (!res)
3350 exception::throw_last_error(ctx);
3351 return manage(res);
3354 multi_pw_aff multi_pw_aff::pullback(pw_multi_aff pma) const
3356 if (!ptr || pma.is_null())
3357 exception::throw_NULL_input(__FILE__, __LINE__);
3358 auto ctx = get_ctx();
3359 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3360 auto res = isl_multi_pw_aff_pullback_pw_multi_aff(copy(), pma.release());
3361 if (!res)
3362 exception::throw_last_error(ctx);
3363 return manage(res);
3366 multi_pw_aff multi_pw_aff::pullback(multi_pw_aff mpa2) const
3368 if (!ptr || mpa2.is_null())
3369 exception::throw_NULL_input(__FILE__, __LINE__);
3370 auto ctx = get_ctx();
3371 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3372 auto res = isl_multi_pw_aff_pullback_multi_pw_aff(copy(), mpa2.release());
3373 if (!res)
3374 exception::throw_last_error(ctx);
3375 return manage(res);
3378 multi_pw_aff multi_pw_aff::range_product(multi_pw_aff multi2) const
3380 if (!ptr || multi2.is_null())
3381 exception::throw_NULL_input(__FILE__, __LINE__);
3382 auto ctx = get_ctx();
3383 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3384 auto res = isl_multi_pw_aff_range_product(copy(), multi2.release());
3385 if (!res)
3386 exception::throw_last_error(ctx);
3387 return manage(res);
3390 // implementations for isl::multi_union_pw_aff
3391 multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr) {
3392 if (!ptr)
3393 exception::throw_NULL_input(__FILE__, __LINE__);
3394 return multi_union_pw_aff(ptr);
3396 multi_union_pw_aff manage_copy(__isl_keep isl_multi_union_pw_aff *ptr) {
3397 if (!ptr)
3398 exception::throw_NULL_input(__FILE__, __LINE__);
3399 auto ctx = isl_multi_union_pw_aff_get_ctx(ptr);
3400 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3401 ptr = isl_multi_union_pw_aff_copy(ptr);
3402 if (!ptr)
3403 exception::throw_last_error(ctx);
3404 return multi_union_pw_aff(ptr);
3407 multi_union_pw_aff::multi_union_pw_aff()
3408 : ptr(nullptr) {}
3410 multi_union_pw_aff::multi_union_pw_aff(const multi_union_pw_aff &obj)
3411 : ptr(nullptr)
3413 if (!obj.ptr)
3414 exception::throw_NULL_input(__FILE__, __LINE__);
3415 auto ctx = isl_multi_union_pw_aff_get_ctx(obj.ptr);
3416 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3417 ptr = obj.copy();
3418 if (!ptr)
3419 exception::throw_last_error(ctx);
3422 multi_union_pw_aff::multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr)
3423 : ptr(ptr) {}
3425 multi_union_pw_aff::multi_union_pw_aff(union_pw_aff upa)
3427 if (upa.is_null())
3428 exception::throw_NULL_input(__FILE__, __LINE__);
3429 auto ctx = upa.get_ctx();
3430 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3431 auto res = isl_multi_union_pw_aff_from_union_pw_aff(upa.release());
3432 if (!res)
3433 exception::throw_last_error(ctx);
3434 ptr = res;
3436 multi_union_pw_aff::multi_union_pw_aff(multi_pw_aff mpa)
3438 if (mpa.is_null())
3439 exception::throw_NULL_input(__FILE__, __LINE__);
3440 auto ctx = mpa.get_ctx();
3441 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3442 auto res = isl_multi_union_pw_aff_from_multi_pw_aff(mpa.release());
3443 if (!res)
3444 exception::throw_last_error(ctx);
3445 ptr = res;
3447 multi_union_pw_aff::multi_union_pw_aff(ctx ctx, const std::string &str)
3449 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3450 auto res = isl_multi_union_pw_aff_read_from_str(ctx.release(), str.c_str());
3451 if (!res)
3452 exception::throw_last_error(ctx);
3453 ptr = res;
3456 multi_union_pw_aff &multi_union_pw_aff::operator=(multi_union_pw_aff obj) {
3457 std::swap(this->ptr, obj.ptr);
3458 return *this;
3461 multi_union_pw_aff::~multi_union_pw_aff() {
3462 if (ptr)
3463 isl_multi_union_pw_aff_free(ptr);
3466 __isl_give isl_multi_union_pw_aff *multi_union_pw_aff::copy() const & {
3467 return isl_multi_union_pw_aff_copy(ptr);
3470 __isl_keep isl_multi_union_pw_aff *multi_union_pw_aff::get() const {
3471 return ptr;
3474 __isl_give isl_multi_union_pw_aff *multi_union_pw_aff::release() {
3475 isl_multi_union_pw_aff *tmp = ptr;
3476 ptr = nullptr;
3477 return tmp;
3480 bool multi_union_pw_aff::is_null() const {
3481 return ptr == nullptr;
3484 ctx multi_union_pw_aff::get_ctx() const {
3485 return ctx(isl_multi_union_pw_aff_get_ctx(ptr));
3488 multi_union_pw_aff multi_union_pw_aff::add(multi_union_pw_aff multi2) const
3490 if (!ptr || multi2.is_null())
3491 exception::throw_NULL_input(__FILE__, __LINE__);
3492 auto ctx = get_ctx();
3493 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3494 auto res = isl_multi_union_pw_aff_add(copy(), multi2.release());
3495 if (!res)
3496 exception::throw_last_error(ctx);
3497 return manage(res);
3500 multi_union_pw_aff multi_union_pw_aff::flat_range_product(multi_union_pw_aff multi2) const
3502 if (!ptr || multi2.is_null())
3503 exception::throw_NULL_input(__FILE__, __LINE__);
3504 auto ctx = get_ctx();
3505 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3506 auto res = isl_multi_union_pw_aff_flat_range_product(copy(), multi2.release());
3507 if (!res)
3508 exception::throw_last_error(ctx);
3509 return manage(res);
3512 multi_union_pw_aff multi_union_pw_aff::pullback(union_pw_multi_aff upma) const
3514 if (!ptr || upma.is_null())
3515 exception::throw_NULL_input(__FILE__, __LINE__);
3516 auto ctx = get_ctx();
3517 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3518 auto res = isl_multi_union_pw_aff_pullback_union_pw_multi_aff(copy(), upma.release());
3519 if (!res)
3520 exception::throw_last_error(ctx);
3521 return manage(res);
3524 multi_union_pw_aff multi_union_pw_aff::range_product(multi_union_pw_aff multi2) const
3526 if (!ptr || multi2.is_null())
3527 exception::throw_NULL_input(__FILE__, __LINE__);
3528 auto ctx = get_ctx();
3529 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3530 auto res = isl_multi_union_pw_aff_range_product(copy(), multi2.release());
3531 if (!res)
3532 exception::throw_last_error(ctx);
3533 return manage(res);
3536 multi_union_pw_aff multi_union_pw_aff::union_add(multi_union_pw_aff mupa2) const
3538 if (!ptr || mupa2.is_null())
3539 exception::throw_NULL_input(__FILE__, __LINE__);
3540 auto ctx = get_ctx();
3541 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3542 auto res = isl_multi_union_pw_aff_union_add(copy(), mupa2.release());
3543 if (!res)
3544 exception::throw_last_error(ctx);
3545 return manage(res);
3548 // implementations for isl::multi_val
3549 multi_val manage(__isl_take isl_multi_val *ptr) {
3550 if (!ptr)
3551 exception::throw_NULL_input(__FILE__, __LINE__);
3552 return multi_val(ptr);
3554 multi_val manage_copy(__isl_keep isl_multi_val *ptr) {
3555 if (!ptr)
3556 exception::throw_NULL_input(__FILE__, __LINE__);
3557 auto ctx = isl_multi_val_get_ctx(ptr);
3558 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3559 ptr = isl_multi_val_copy(ptr);
3560 if (!ptr)
3561 exception::throw_last_error(ctx);
3562 return multi_val(ptr);
3565 multi_val::multi_val()
3566 : ptr(nullptr) {}
3568 multi_val::multi_val(const multi_val &obj)
3569 : ptr(nullptr)
3571 if (!obj.ptr)
3572 exception::throw_NULL_input(__FILE__, __LINE__);
3573 auto ctx = isl_multi_val_get_ctx(obj.ptr);
3574 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3575 ptr = obj.copy();
3576 if (!ptr)
3577 exception::throw_last_error(ctx);
3580 multi_val::multi_val(__isl_take isl_multi_val *ptr)
3581 : ptr(ptr) {}
3584 multi_val &multi_val::operator=(multi_val obj) {
3585 std::swap(this->ptr, obj.ptr);
3586 return *this;
3589 multi_val::~multi_val() {
3590 if (ptr)
3591 isl_multi_val_free(ptr);
3594 __isl_give isl_multi_val *multi_val::copy() const & {
3595 return isl_multi_val_copy(ptr);
3598 __isl_keep isl_multi_val *multi_val::get() const {
3599 return ptr;
3602 __isl_give isl_multi_val *multi_val::release() {
3603 isl_multi_val *tmp = ptr;
3604 ptr = nullptr;
3605 return tmp;
3608 bool multi_val::is_null() const {
3609 return ptr == nullptr;
3612 ctx multi_val::get_ctx() const {
3613 return ctx(isl_multi_val_get_ctx(ptr));
3616 multi_val multi_val::add(multi_val multi2) const
3618 if (!ptr || multi2.is_null())
3619 exception::throw_NULL_input(__FILE__, __LINE__);
3620 auto ctx = get_ctx();
3621 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3622 auto res = isl_multi_val_add(copy(), multi2.release());
3623 if (!res)
3624 exception::throw_last_error(ctx);
3625 return manage(res);
3628 multi_val multi_val::flat_range_product(multi_val multi2) const
3630 if (!ptr || multi2.is_null())
3631 exception::throw_NULL_input(__FILE__, __LINE__);
3632 auto ctx = get_ctx();
3633 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3634 auto res = isl_multi_val_flat_range_product(copy(), multi2.release());
3635 if (!res)
3636 exception::throw_last_error(ctx);
3637 return manage(res);
3640 multi_val multi_val::product(multi_val multi2) const
3642 if (!ptr || multi2.is_null())
3643 exception::throw_NULL_input(__FILE__, __LINE__);
3644 auto ctx = get_ctx();
3645 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3646 auto res = isl_multi_val_product(copy(), multi2.release());
3647 if (!res)
3648 exception::throw_last_error(ctx);
3649 return manage(res);
3652 multi_val multi_val::range_product(multi_val multi2) const
3654 if (!ptr || multi2.is_null())
3655 exception::throw_NULL_input(__FILE__, __LINE__);
3656 auto ctx = get_ctx();
3657 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3658 auto res = isl_multi_val_range_product(copy(), multi2.release());
3659 if (!res)
3660 exception::throw_last_error(ctx);
3661 return manage(res);
3664 // implementations for isl::point
3665 point manage(__isl_take isl_point *ptr) {
3666 if (!ptr)
3667 exception::throw_NULL_input(__FILE__, __LINE__);
3668 return point(ptr);
3670 point manage_copy(__isl_keep isl_point *ptr) {
3671 if (!ptr)
3672 exception::throw_NULL_input(__FILE__, __LINE__);
3673 auto ctx = isl_point_get_ctx(ptr);
3674 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3675 ptr = isl_point_copy(ptr);
3676 if (!ptr)
3677 exception::throw_last_error(ctx);
3678 return point(ptr);
3681 point::point()
3682 : ptr(nullptr) {}
3684 point::point(const point &obj)
3685 : ptr(nullptr)
3687 if (!obj.ptr)
3688 exception::throw_NULL_input(__FILE__, __LINE__);
3689 auto ctx = isl_point_get_ctx(obj.ptr);
3690 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3691 ptr = obj.copy();
3692 if (!ptr)
3693 exception::throw_last_error(ctx);
3696 point::point(__isl_take isl_point *ptr)
3697 : ptr(ptr) {}
3700 point &point::operator=(point obj) {
3701 std::swap(this->ptr, obj.ptr);
3702 return *this;
3705 point::~point() {
3706 if (ptr)
3707 isl_point_free(ptr);
3710 __isl_give isl_point *point::copy() const & {
3711 return isl_point_copy(ptr);
3714 __isl_keep isl_point *point::get() const {
3715 return ptr;
3718 __isl_give isl_point *point::release() {
3719 isl_point *tmp = ptr;
3720 ptr = nullptr;
3721 return tmp;
3724 bool point::is_null() const {
3725 return ptr == nullptr;
3728 ctx point::get_ctx() const {
3729 return ctx(isl_point_get_ctx(ptr));
3733 // implementations for isl::pw_aff
3734 pw_aff manage(__isl_take isl_pw_aff *ptr) {
3735 if (!ptr)
3736 exception::throw_NULL_input(__FILE__, __LINE__);
3737 return pw_aff(ptr);
3739 pw_aff manage_copy(__isl_keep isl_pw_aff *ptr) {
3740 if (!ptr)
3741 exception::throw_NULL_input(__FILE__, __LINE__);
3742 auto ctx = isl_pw_aff_get_ctx(ptr);
3743 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3744 ptr = isl_pw_aff_copy(ptr);
3745 if (!ptr)
3746 exception::throw_last_error(ctx);
3747 return pw_aff(ptr);
3750 pw_aff::pw_aff()
3751 : ptr(nullptr) {}
3753 pw_aff::pw_aff(const pw_aff &obj)
3754 : ptr(nullptr)
3756 if (!obj.ptr)
3757 exception::throw_NULL_input(__FILE__, __LINE__);
3758 auto ctx = isl_pw_aff_get_ctx(obj.ptr);
3759 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3760 ptr = obj.copy();
3761 if (!ptr)
3762 exception::throw_last_error(ctx);
3765 pw_aff::pw_aff(__isl_take isl_pw_aff *ptr)
3766 : ptr(ptr) {}
3768 pw_aff::pw_aff(aff aff)
3770 if (aff.is_null())
3771 exception::throw_NULL_input(__FILE__, __LINE__);
3772 auto ctx = aff.get_ctx();
3773 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3774 auto res = isl_pw_aff_from_aff(aff.release());
3775 if (!res)
3776 exception::throw_last_error(ctx);
3777 ptr = res;
3779 pw_aff::pw_aff(ctx ctx, const std::string &str)
3781 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3782 auto res = isl_pw_aff_read_from_str(ctx.release(), str.c_str());
3783 if (!res)
3784 exception::throw_last_error(ctx);
3785 ptr = res;
3788 pw_aff &pw_aff::operator=(pw_aff obj) {
3789 std::swap(this->ptr, obj.ptr);
3790 return *this;
3793 pw_aff::~pw_aff() {
3794 if (ptr)
3795 isl_pw_aff_free(ptr);
3798 __isl_give isl_pw_aff *pw_aff::copy() const & {
3799 return isl_pw_aff_copy(ptr);
3802 __isl_keep isl_pw_aff *pw_aff::get() const {
3803 return ptr;
3806 __isl_give isl_pw_aff *pw_aff::release() {
3807 isl_pw_aff *tmp = ptr;
3808 ptr = nullptr;
3809 return tmp;
3812 bool pw_aff::is_null() const {
3813 return ptr == nullptr;
3816 ctx pw_aff::get_ctx() const {
3817 return ctx(isl_pw_aff_get_ctx(ptr));
3820 pw_aff pw_aff::add(pw_aff pwaff2) const
3822 if (!ptr || pwaff2.is_null())
3823 exception::throw_NULL_input(__FILE__, __LINE__);
3824 auto ctx = get_ctx();
3825 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3826 auto res = isl_pw_aff_add(copy(), pwaff2.release());
3827 if (!res)
3828 exception::throw_last_error(ctx);
3829 return manage(res);
3832 pw_aff pw_aff::ceil() const
3834 if (!ptr)
3835 exception::throw_NULL_input(__FILE__, __LINE__);
3836 auto ctx = get_ctx();
3837 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3838 auto res = isl_pw_aff_ceil(copy());
3839 if (!res)
3840 exception::throw_last_error(ctx);
3841 return manage(res);
3844 pw_aff pw_aff::cond(pw_aff pwaff_true, pw_aff pwaff_false) const
3846 if (!ptr || pwaff_true.is_null() || pwaff_false.is_null())
3847 exception::throw_NULL_input(__FILE__, __LINE__);
3848 auto ctx = get_ctx();
3849 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3850 auto res = isl_pw_aff_cond(copy(), pwaff_true.release(), pwaff_false.release());
3851 if (!res)
3852 exception::throw_last_error(ctx);
3853 return manage(res);
3856 pw_aff pw_aff::div(pw_aff pa2) const
3858 if (!ptr || pa2.is_null())
3859 exception::throw_NULL_input(__FILE__, __LINE__);
3860 auto ctx = get_ctx();
3861 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3862 auto res = isl_pw_aff_div(copy(), pa2.release());
3863 if (!res)
3864 exception::throw_last_error(ctx);
3865 return manage(res);
3868 set pw_aff::eq_set(pw_aff pwaff2) const
3870 if (!ptr || pwaff2.is_null())
3871 exception::throw_NULL_input(__FILE__, __LINE__);
3872 auto ctx = get_ctx();
3873 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3874 auto res = isl_pw_aff_eq_set(copy(), pwaff2.release());
3875 if (!res)
3876 exception::throw_last_error(ctx);
3877 return manage(res);
3880 pw_aff pw_aff::floor() const
3882 if (!ptr)
3883 exception::throw_NULL_input(__FILE__, __LINE__);
3884 auto ctx = get_ctx();
3885 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3886 auto res = isl_pw_aff_floor(copy());
3887 if (!res)
3888 exception::throw_last_error(ctx);
3889 return manage(res);
3892 set pw_aff::ge_set(pw_aff pwaff2) const
3894 if (!ptr || pwaff2.is_null())
3895 exception::throw_NULL_input(__FILE__, __LINE__);
3896 auto ctx = get_ctx();
3897 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3898 auto res = isl_pw_aff_ge_set(copy(), pwaff2.release());
3899 if (!res)
3900 exception::throw_last_error(ctx);
3901 return manage(res);
3904 set pw_aff::gt_set(pw_aff pwaff2) const
3906 if (!ptr || pwaff2.is_null())
3907 exception::throw_NULL_input(__FILE__, __LINE__);
3908 auto ctx = get_ctx();
3909 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3910 auto res = isl_pw_aff_gt_set(copy(), pwaff2.release());
3911 if (!res)
3912 exception::throw_last_error(ctx);
3913 return manage(res);
3916 set pw_aff::le_set(pw_aff pwaff2) const
3918 if (!ptr || pwaff2.is_null())
3919 exception::throw_NULL_input(__FILE__, __LINE__);
3920 auto ctx = get_ctx();
3921 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3922 auto res = isl_pw_aff_le_set(copy(), pwaff2.release());
3923 if (!res)
3924 exception::throw_last_error(ctx);
3925 return manage(res);
3928 set pw_aff::lt_set(pw_aff pwaff2) const
3930 if (!ptr || pwaff2.is_null())
3931 exception::throw_NULL_input(__FILE__, __LINE__);
3932 auto ctx = get_ctx();
3933 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3934 auto res = isl_pw_aff_lt_set(copy(), pwaff2.release());
3935 if (!res)
3936 exception::throw_last_error(ctx);
3937 return manage(res);
3940 pw_aff pw_aff::max(pw_aff pwaff2) const
3942 if (!ptr || pwaff2.is_null())
3943 exception::throw_NULL_input(__FILE__, __LINE__);
3944 auto ctx = get_ctx();
3945 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3946 auto res = isl_pw_aff_max(copy(), pwaff2.release());
3947 if (!res)
3948 exception::throw_last_error(ctx);
3949 return manage(res);
3952 pw_aff pw_aff::min(pw_aff pwaff2) const
3954 if (!ptr || pwaff2.is_null())
3955 exception::throw_NULL_input(__FILE__, __LINE__);
3956 auto ctx = get_ctx();
3957 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3958 auto res = isl_pw_aff_min(copy(), pwaff2.release());
3959 if (!res)
3960 exception::throw_last_error(ctx);
3961 return manage(res);
3964 pw_aff pw_aff::mod(val mod) const
3966 if (!ptr || mod.is_null())
3967 exception::throw_NULL_input(__FILE__, __LINE__);
3968 auto ctx = get_ctx();
3969 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3970 auto res = isl_pw_aff_mod_val(copy(), mod.release());
3971 if (!res)
3972 exception::throw_last_error(ctx);
3973 return manage(res);
3976 pw_aff pw_aff::mul(pw_aff pwaff2) const
3978 if (!ptr || pwaff2.is_null())
3979 exception::throw_NULL_input(__FILE__, __LINE__);
3980 auto ctx = get_ctx();
3981 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3982 auto res = isl_pw_aff_mul(copy(), pwaff2.release());
3983 if (!res)
3984 exception::throw_last_error(ctx);
3985 return manage(res);
3988 set pw_aff::ne_set(pw_aff pwaff2) const
3990 if (!ptr || pwaff2.is_null())
3991 exception::throw_NULL_input(__FILE__, __LINE__);
3992 auto ctx = get_ctx();
3993 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
3994 auto res = isl_pw_aff_ne_set(copy(), pwaff2.release());
3995 if (!res)
3996 exception::throw_last_error(ctx);
3997 return manage(res);
4000 pw_aff pw_aff::neg() const
4002 if (!ptr)
4003 exception::throw_NULL_input(__FILE__, __LINE__);
4004 auto ctx = get_ctx();
4005 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4006 auto res = isl_pw_aff_neg(copy());
4007 if (!res)
4008 exception::throw_last_error(ctx);
4009 return manage(res);
4012 pw_aff pw_aff::pullback(multi_aff ma) const
4014 if (!ptr || ma.is_null())
4015 exception::throw_NULL_input(__FILE__, __LINE__);
4016 auto ctx = get_ctx();
4017 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4018 auto res = isl_pw_aff_pullback_multi_aff(copy(), ma.release());
4019 if (!res)
4020 exception::throw_last_error(ctx);
4021 return manage(res);
4024 pw_aff pw_aff::pullback(pw_multi_aff pma) const
4026 if (!ptr || pma.is_null())
4027 exception::throw_NULL_input(__FILE__, __LINE__);
4028 auto ctx = get_ctx();
4029 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4030 auto res = isl_pw_aff_pullback_pw_multi_aff(copy(), pma.release());
4031 if (!res)
4032 exception::throw_last_error(ctx);
4033 return manage(res);
4036 pw_aff pw_aff::pullback(multi_pw_aff mpa) const
4038 if (!ptr || mpa.is_null())
4039 exception::throw_NULL_input(__FILE__, __LINE__);
4040 auto ctx = get_ctx();
4041 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4042 auto res = isl_pw_aff_pullback_multi_pw_aff(copy(), mpa.release());
4043 if (!res)
4044 exception::throw_last_error(ctx);
4045 return manage(res);
4048 pw_aff pw_aff::scale(val v) const
4050 if (!ptr || v.is_null())
4051 exception::throw_NULL_input(__FILE__, __LINE__);
4052 auto ctx = get_ctx();
4053 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4054 auto res = isl_pw_aff_scale_val(copy(), v.release());
4055 if (!res)
4056 exception::throw_last_error(ctx);
4057 return manage(res);
4060 pw_aff pw_aff::scale_down(val f) const
4062 if (!ptr || f.is_null())
4063 exception::throw_NULL_input(__FILE__, __LINE__);
4064 auto ctx = get_ctx();
4065 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4066 auto res = isl_pw_aff_scale_down_val(copy(), f.release());
4067 if (!res)
4068 exception::throw_last_error(ctx);
4069 return manage(res);
4072 pw_aff pw_aff::sub(pw_aff pwaff2) const
4074 if (!ptr || pwaff2.is_null())
4075 exception::throw_NULL_input(__FILE__, __LINE__);
4076 auto ctx = get_ctx();
4077 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4078 auto res = isl_pw_aff_sub(copy(), pwaff2.release());
4079 if (!res)
4080 exception::throw_last_error(ctx);
4081 return manage(res);
4084 pw_aff pw_aff::tdiv_q(pw_aff pa2) const
4086 if (!ptr || pa2.is_null())
4087 exception::throw_NULL_input(__FILE__, __LINE__);
4088 auto ctx = get_ctx();
4089 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4090 auto res = isl_pw_aff_tdiv_q(copy(), pa2.release());
4091 if (!res)
4092 exception::throw_last_error(ctx);
4093 return manage(res);
4096 pw_aff pw_aff::tdiv_r(pw_aff pa2) const
4098 if (!ptr || pa2.is_null())
4099 exception::throw_NULL_input(__FILE__, __LINE__);
4100 auto ctx = get_ctx();
4101 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4102 auto res = isl_pw_aff_tdiv_r(copy(), pa2.release());
4103 if (!res)
4104 exception::throw_last_error(ctx);
4105 return manage(res);
4108 pw_aff pw_aff::union_add(pw_aff pwaff2) const
4110 if (!ptr || pwaff2.is_null())
4111 exception::throw_NULL_input(__FILE__, __LINE__);
4112 auto ctx = get_ctx();
4113 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4114 auto res = isl_pw_aff_union_add(copy(), pwaff2.release());
4115 if (!res)
4116 exception::throw_last_error(ctx);
4117 return manage(res);
4120 // implementations for isl::pw_multi_aff
4121 pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr) {
4122 if (!ptr)
4123 exception::throw_NULL_input(__FILE__, __LINE__);
4124 return pw_multi_aff(ptr);
4126 pw_multi_aff manage_copy(__isl_keep isl_pw_multi_aff *ptr) {
4127 if (!ptr)
4128 exception::throw_NULL_input(__FILE__, __LINE__);
4129 auto ctx = isl_pw_multi_aff_get_ctx(ptr);
4130 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4131 ptr = isl_pw_multi_aff_copy(ptr);
4132 if (!ptr)
4133 exception::throw_last_error(ctx);
4134 return pw_multi_aff(ptr);
4137 pw_multi_aff::pw_multi_aff()
4138 : ptr(nullptr) {}
4140 pw_multi_aff::pw_multi_aff(const pw_multi_aff &obj)
4141 : ptr(nullptr)
4143 if (!obj.ptr)
4144 exception::throw_NULL_input(__FILE__, __LINE__);
4145 auto ctx = isl_pw_multi_aff_get_ctx(obj.ptr);
4146 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4147 ptr = obj.copy();
4148 if (!ptr)
4149 exception::throw_last_error(ctx);
4152 pw_multi_aff::pw_multi_aff(__isl_take isl_pw_multi_aff *ptr)
4153 : ptr(ptr) {}
4155 pw_multi_aff::pw_multi_aff(multi_aff ma)
4157 if (ma.is_null())
4158 exception::throw_NULL_input(__FILE__, __LINE__);
4159 auto ctx = ma.get_ctx();
4160 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4161 auto res = isl_pw_multi_aff_from_multi_aff(ma.release());
4162 if (!res)
4163 exception::throw_last_error(ctx);
4164 ptr = res;
4166 pw_multi_aff::pw_multi_aff(pw_aff pa)
4168 if (pa.is_null())
4169 exception::throw_NULL_input(__FILE__, __LINE__);
4170 auto ctx = pa.get_ctx();
4171 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4172 auto res = isl_pw_multi_aff_from_pw_aff(pa.release());
4173 if (!res)
4174 exception::throw_last_error(ctx);
4175 ptr = res;
4177 pw_multi_aff::pw_multi_aff(ctx ctx, const std::string &str)
4179 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4180 auto res = isl_pw_multi_aff_read_from_str(ctx.release(), str.c_str());
4181 if (!res)
4182 exception::throw_last_error(ctx);
4183 ptr = res;
4186 pw_multi_aff &pw_multi_aff::operator=(pw_multi_aff obj) {
4187 std::swap(this->ptr, obj.ptr);
4188 return *this;
4191 pw_multi_aff::~pw_multi_aff() {
4192 if (ptr)
4193 isl_pw_multi_aff_free(ptr);
4196 __isl_give isl_pw_multi_aff *pw_multi_aff::copy() const & {
4197 return isl_pw_multi_aff_copy(ptr);
4200 __isl_keep isl_pw_multi_aff *pw_multi_aff::get() const {
4201 return ptr;
4204 __isl_give isl_pw_multi_aff *pw_multi_aff::release() {
4205 isl_pw_multi_aff *tmp = ptr;
4206 ptr = nullptr;
4207 return tmp;
4210 bool pw_multi_aff::is_null() const {
4211 return ptr == nullptr;
4214 ctx pw_multi_aff::get_ctx() const {
4215 return ctx(isl_pw_multi_aff_get_ctx(ptr));
4218 pw_multi_aff pw_multi_aff::add(pw_multi_aff pma2) const
4220 if (!ptr || pma2.is_null())
4221 exception::throw_NULL_input(__FILE__, __LINE__);
4222 auto ctx = get_ctx();
4223 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4224 auto res = isl_pw_multi_aff_add(copy(), pma2.release());
4225 if (!res)
4226 exception::throw_last_error(ctx);
4227 return manage(res);
4230 pw_multi_aff pw_multi_aff::flat_range_product(pw_multi_aff pma2) const
4232 if (!ptr || pma2.is_null())
4233 exception::throw_NULL_input(__FILE__, __LINE__);
4234 auto ctx = get_ctx();
4235 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4236 auto res = isl_pw_multi_aff_flat_range_product(copy(), pma2.release());
4237 if (!res)
4238 exception::throw_last_error(ctx);
4239 return manage(res);
4242 pw_multi_aff pw_multi_aff::product(pw_multi_aff pma2) const
4244 if (!ptr || pma2.is_null())
4245 exception::throw_NULL_input(__FILE__, __LINE__);
4246 auto ctx = get_ctx();
4247 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4248 auto res = isl_pw_multi_aff_product(copy(), pma2.release());
4249 if (!res)
4250 exception::throw_last_error(ctx);
4251 return manage(res);
4254 pw_multi_aff pw_multi_aff::pullback(multi_aff ma) const
4256 if (!ptr || ma.is_null())
4257 exception::throw_NULL_input(__FILE__, __LINE__);
4258 auto ctx = get_ctx();
4259 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4260 auto res = isl_pw_multi_aff_pullback_multi_aff(copy(), ma.release());
4261 if (!res)
4262 exception::throw_last_error(ctx);
4263 return manage(res);
4266 pw_multi_aff pw_multi_aff::pullback(pw_multi_aff pma2) const
4268 if (!ptr || pma2.is_null())
4269 exception::throw_NULL_input(__FILE__, __LINE__);
4270 auto ctx = get_ctx();
4271 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4272 auto res = isl_pw_multi_aff_pullback_pw_multi_aff(copy(), pma2.release());
4273 if (!res)
4274 exception::throw_last_error(ctx);
4275 return manage(res);
4278 pw_multi_aff pw_multi_aff::range_product(pw_multi_aff pma2) const
4280 if (!ptr || pma2.is_null())
4281 exception::throw_NULL_input(__FILE__, __LINE__);
4282 auto ctx = get_ctx();
4283 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4284 auto res = isl_pw_multi_aff_range_product(copy(), pma2.release());
4285 if (!res)
4286 exception::throw_last_error(ctx);
4287 return manage(res);
4290 pw_multi_aff pw_multi_aff::union_add(pw_multi_aff pma2) const
4292 if (!ptr || pma2.is_null())
4293 exception::throw_NULL_input(__FILE__, __LINE__);
4294 auto ctx = get_ctx();
4295 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4296 auto res = isl_pw_multi_aff_union_add(copy(), pma2.release());
4297 if (!res)
4298 exception::throw_last_error(ctx);
4299 return manage(res);
4302 // implementations for isl::schedule
4303 schedule manage(__isl_take isl_schedule *ptr) {
4304 if (!ptr)
4305 exception::throw_NULL_input(__FILE__, __LINE__);
4306 return schedule(ptr);
4308 schedule manage_copy(__isl_keep isl_schedule *ptr) {
4309 if (!ptr)
4310 exception::throw_NULL_input(__FILE__, __LINE__);
4311 auto ctx = isl_schedule_get_ctx(ptr);
4312 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4313 ptr = isl_schedule_copy(ptr);
4314 if (!ptr)
4315 exception::throw_last_error(ctx);
4316 return schedule(ptr);
4319 schedule::schedule()
4320 : ptr(nullptr) {}
4322 schedule::schedule(const schedule &obj)
4323 : ptr(nullptr)
4325 if (!obj.ptr)
4326 exception::throw_NULL_input(__FILE__, __LINE__);
4327 auto ctx = isl_schedule_get_ctx(obj.ptr);
4328 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4329 ptr = obj.copy();
4330 if (!ptr)
4331 exception::throw_last_error(ctx);
4334 schedule::schedule(__isl_take isl_schedule *ptr)
4335 : ptr(ptr) {}
4337 schedule::schedule(ctx ctx, const std::string &str)
4339 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4340 auto res = isl_schedule_read_from_str(ctx.release(), str.c_str());
4341 if (!res)
4342 exception::throw_last_error(ctx);
4343 ptr = res;
4346 schedule &schedule::operator=(schedule obj) {
4347 std::swap(this->ptr, obj.ptr);
4348 return *this;
4351 schedule::~schedule() {
4352 if (ptr)
4353 isl_schedule_free(ptr);
4356 __isl_give isl_schedule *schedule::copy() const & {
4357 return isl_schedule_copy(ptr);
4360 __isl_keep isl_schedule *schedule::get() const {
4361 return ptr;
4364 __isl_give isl_schedule *schedule::release() {
4365 isl_schedule *tmp = ptr;
4366 ptr = nullptr;
4367 return tmp;
4370 bool schedule::is_null() const {
4371 return ptr == nullptr;
4374 ctx schedule::get_ctx() const {
4375 return ctx(isl_schedule_get_ctx(ptr));
4378 union_map schedule::get_map() const
4380 if (!ptr)
4381 exception::throw_NULL_input(__FILE__, __LINE__);
4382 auto ctx = get_ctx();
4383 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4384 auto res = isl_schedule_get_map(get());
4385 if (!res)
4386 exception::throw_last_error(ctx);
4387 return manage(res);
4390 schedule_node schedule::get_root() const
4392 if (!ptr)
4393 exception::throw_NULL_input(__FILE__, __LINE__);
4394 auto ctx = get_ctx();
4395 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4396 auto res = isl_schedule_get_root(get());
4397 if (!res)
4398 exception::throw_last_error(ctx);
4399 return manage(res);
4402 schedule schedule::pullback(union_pw_multi_aff upma) const
4404 if (!ptr || upma.is_null())
4405 exception::throw_NULL_input(__FILE__, __LINE__);
4406 auto ctx = get_ctx();
4407 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4408 auto res = isl_schedule_pullback_union_pw_multi_aff(copy(), upma.release());
4409 if (!res)
4410 exception::throw_last_error(ctx);
4411 return manage(res);
4414 // implementations for isl::schedule_constraints
4415 schedule_constraints manage(__isl_take isl_schedule_constraints *ptr) {
4416 if (!ptr)
4417 exception::throw_NULL_input(__FILE__, __LINE__);
4418 return schedule_constraints(ptr);
4420 schedule_constraints manage_copy(__isl_keep isl_schedule_constraints *ptr) {
4421 if (!ptr)
4422 exception::throw_NULL_input(__FILE__, __LINE__);
4423 auto ctx = isl_schedule_constraints_get_ctx(ptr);
4424 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4425 ptr = isl_schedule_constraints_copy(ptr);
4426 if (!ptr)
4427 exception::throw_last_error(ctx);
4428 return schedule_constraints(ptr);
4431 schedule_constraints::schedule_constraints()
4432 : ptr(nullptr) {}
4434 schedule_constraints::schedule_constraints(const schedule_constraints &obj)
4435 : ptr(nullptr)
4437 if (!obj.ptr)
4438 exception::throw_NULL_input(__FILE__, __LINE__);
4439 auto ctx = isl_schedule_constraints_get_ctx(obj.ptr);
4440 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4441 ptr = obj.copy();
4442 if (!ptr)
4443 exception::throw_last_error(ctx);
4446 schedule_constraints::schedule_constraints(__isl_take isl_schedule_constraints *ptr)
4447 : ptr(ptr) {}
4449 schedule_constraints::schedule_constraints(ctx ctx, const std::string &str)
4451 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4452 auto res = isl_schedule_constraints_read_from_str(ctx.release(), str.c_str());
4453 if (!res)
4454 exception::throw_last_error(ctx);
4455 ptr = res;
4458 schedule_constraints &schedule_constraints::operator=(schedule_constraints obj) {
4459 std::swap(this->ptr, obj.ptr);
4460 return *this;
4463 schedule_constraints::~schedule_constraints() {
4464 if (ptr)
4465 isl_schedule_constraints_free(ptr);
4468 __isl_give isl_schedule_constraints *schedule_constraints::copy() const & {
4469 return isl_schedule_constraints_copy(ptr);
4472 __isl_keep isl_schedule_constraints *schedule_constraints::get() const {
4473 return ptr;
4476 __isl_give isl_schedule_constraints *schedule_constraints::release() {
4477 isl_schedule_constraints *tmp = ptr;
4478 ptr = nullptr;
4479 return tmp;
4482 bool schedule_constraints::is_null() const {
4483 return ptr == nullptr;
4486 ctx schedule_constraints::get_ctx() const {
4487 return ctx(isl_schedule_constraints_get_ctx(ptr));
4490 schedule schedule_constraints::compute_schedule() const
4492 if (!ptr)
4493 exception::throw_NULL_input(__FILE__, __LINE__);
4494 auto ctx = get_ctx();
4495 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4496 auto res = isl_schedule_constraints_compute_schedule(copy());
4497 if (!res)
4498 exception::throw_last_error(ctx);
4499 return manage(res);
4502 union_map schedule_constraints::get_coincidence() const
4504 if (!ptr)
4505 exception::throw_NULL_input(__FILE__, __LINE__);
4506 auto ctx = get_ctx();
4507 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4508 auto res = isl_schedule_constraints_get_coincidence(get());
4509 if (!res)
4510 exception::throw_last_error(ctx);
4511 return manage(res);
4514 union_map schedule_constraints::get_conditional_validity() const
4516 if (!ptr)
4517 exception::throw_NULL_input(__FILE__, __LINE__);
4518 auto ctx = get_ctx();
4519 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4520 auto res = isl_schedule_constraints_get_conditional_validity(get());
4521 if (!res)
4522 exception::throw_last_error(ctx);
4523 return manage(res);
4526 union_map schedule_constraints::get_conditional_validity_condition() const
4528 if (!ptr)
4529 exception::throw_NULL_input(__FILE__, __LINE__);
4530 auto ctx = get_ctx();
4531 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4532 auto res = isl_schedule_constraints_get_conditional_validity_condition(get());
4533 if (!res)
4534 exception::throw_last_error(ctx);
4535 return manage(res);
4538 set schedule_constraints::get_context() const
4540 if (!ptr)
4541 exception::throw_NULL_input(__FILE__, __LINE__);
4542 auto ctx = get_ctx();
4543 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4544 auto res = isl_schedule_constraints_get_context(get());
4545 if (!res)
4546 exception::throw_last_error(ctx);
4547 return manage(res);
4550 union_set schedule_constraints::get_domain() const
4552 if (!ptr)
4553 exception::throw_NULL_input(__FILE__, __LINE__);
4554 auto ctx = get_ctx();
4555 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4556 auto res = isl_schedule_constraints_get_domain(get());
4557 if (!res)
4558 exception::throw_last_error(ctx);
4559 return manage(res);
4562 union_map schedule_constraints::get_proximity() const
4564 if (!ptr)
4565 exception::throw_NULL_input(__FILE__, __LINE__);
4566 auto ctx = get_ctx();
4567 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4568 auto res = isl_schedule_constraints_get_proximity(get());
4569 if (!res)
4570 exception::throw_last_error(ctx);
4571 return manage(res);
4574 union_map schedule_constraints::get_validity() const
4576 if (!ptr)
4577 exception::throw_NULL_input(__FILE__, __LINE__);
4578 auto ctx = get_ctx();
4579 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4580 auto res = isl_schedule_constraints_get_validity(get());
4581 if (!res)
4582 exception::throw_last_error(ctx);
4583 return manage(res);
4586 schedule_constraints schedule_constraints::on_domain(union_set domain)
4588 if (domain.is_null())
4589 exception::throw_NULL_input(__FILE__, __LINE__);
4590 auto ctx = domain.get_ctx();
4591 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4592 auto res = isl_schedule_constraints_on_domain(domain.release());
4593 if (!res)
4594 exception::throw_last_error(ctx);
4595 return manage(res);
4598 schedule_constraints schedule_constraints::set_coincidence(union_map coincidence) const
4600 if (!ptr || coincidence.is_null())
4601 exception::throw_NULL_input(__FILE__, __LINE__);
4602 auto ctx = get_ctx();
4603 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4604 auto res = isl_schedule_constraints_set_coincidence(copy(), coincidence.release());
4605 if (!res)
4606 exception::throw_last_error(ctx);
4607 return manage(res);
4610 schedule_constraints schedule_constraints::set_conditional_validity(union_map condition, union_map validity) const
4612 if (!ptr || condition.is_null() || validity.is_null())
4613 exception::throw_NULL_input(__FILE__, __LINE__);
4614 auto ctx = get_ctx();
4615 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4616 auto res = isl_schedule_constraints_set_conditional_validity(copy(), condition.release(), validity.release());
4617 if (!res)
4618 exception::throw_last_error(ctx);
4619 return manage(res);
4622 schedule_constraints schedule_constraints::set_context(set context) const
4624 if (!ptr || context.is_null())
4625 exception::throw_NULL_input(__FILE__, __LINE__);
4626 auto ctx = get_ctx();
4627 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4628 auto res = isl_schedule_constraints_set_context(copy(), context.release());
4629 if (!res)
4630 exception::throw_last_error(ctx);
4631 return manage(res);
4634 schedule_constraints schedule_constraints::set_proximity(union_map proximity) const
4636 if (!ptr || proximity.is_null())
4637 exception::throw_NULL_input(__FILE__, __LINE__);
4638 auto ctx = get_ctx();
4639 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4640 auto res = isl_schedule_constraints_set_proximity(copy(), proximity.release());
4641 if (!res)
4642 exception::throw_last_error(ctx);
4643 return manage(res);
4646 schedule_constraints schedule_constraints::set_validity(union_map validity) const
4648 if (!ptr || validity.is_null())
4649 exception::throw_NULL_input(__FILE__, __LINE__);
4650 auto ctx = get_ctx();
4651 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4652 auto res = isl_schedule_constraints_set_validity(copy(), validity.release());
4653 if (!res)
4654 exception::throw_last_error(ctx);
4655 return manage(res);
4658 // implementations for isl::schedule_node
4659 schedule_node manage(__isl_take isl_schedule_node *ptr) {
4660 if (!ptr)
4661 exception::throw_NULL_input(__FILE__, __LINE__);
4662 return schedule_node(ptr);
4664 schedule_node manage_copy(__isl_keep isl_schedule_node *ptr) {
4665 if (!ptr)
4666 exception::throw_NULL_input(__FILE__, __LINE__);
4667 auto ctx = isl_schedule_node_get_ctx(ptr);
4668 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4669 ptr = isl_schedule_node_copy(ptr);
4670 if (!ptr)
4671 exception::throw_last_error(ctx);
4672 return schedule_node(ptr);
4675 schedule_node::schedule_node()
4676 : ptr(nullptr) {}
4678 schedule_node::schedule_node(const schedule_node &obj)
4679 : ptr(nullptr)
4681 if (!obj.ptr)
4682 exception::throw_NULL_input(__FILE__, __LINE__);
4683 auto ctx = isl_schedule_node_get_ctx(obj.ptr);
4684 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4685 ptr = obj.copy();
4686 if (!ptr)
4687 exception::throw_last_error(ctx);
4690 schedule_node::schedule_node(__isl_take isl_schedule_node *ptr)
4691 : ptr(ptr) {}
4694 schedule_node &schedule_node::operator=(schedule_node obj) {
4695 std::swap(this->ptr, obj.ptr);
4696 return *this;
4699 schedule_node::~schedule_node() {
4700 if (ptr)
4701 isl_schedule_node_free(ptr);
4704 __isl_give isl_schedule_node *schedule_node::copy() const & {
4705 return isl_schedule_node_copy(ptr);
4708 __isl_keep isl_schedule_node *schedule_node::get() const {
4709 return ptr;
4712 __isl_give isl_schedule_node *schedule_node::release() {
4713 isl_schedule_node *tmp = ptr;
4714 ptr = nullptr;
4715 return tmp;
4718 bool schedule_node::is_null() const {
4719 return ptr == nullptr;
4722 ctx schedule_node::get_ctx() const {
4723 return ctx(isl_schedule_node_get_ctx(ptr));
4726 bool schedule_node::band_member_get_coincident(int pos) const
4728 if (!ptr)
4729 exception::throw_NULL_input(__FILE__, __LINE__);
4730 auto ctx = get_ctx();
4731 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4732 auto res = isl_schedule_node_band_member_get_coincident(get(), pos);
4733 if (res < 0)
4734 exception::throw_last_error(ctx);
4735 return res;
4738 schedule_node schedule_node::band_member_set_coincident(int pos, int coincident) const
4740 if (!ptr)
4741 exception::throw_NULL_input(__FILE__, __LINE__);
4742 auto ctx = get_ctx();
4743 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4744 auto res = isl_schedule_node_band_member_set_coincident(copy(), pos, coincident);
4745 if (!res)
4746 exception::throw_last_error(ctx);
4747 return manage(res);
4750 schedule_node schedule_node::child(int pos) const
4752 if (!ptr)
4753 exception::throw_NULL_input(__FILE__, __LINE__);
4754 auto ctx = get_ctx();
4755 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4756 auto res = isl_schedule_node_child(copy(), pos);
4757 if (!res)
4758 exception::throw_last_error(ctx);
4759 return manage(res);
4762 multi_union_pw_aff schedule_node::get_prefix_schedule_multi_union_pw_aff() const
4764 if (!ptr)
4765 exception::throw_NULL_input(__FILE__, __LINE__);
4766 auto ctx = get_ctx();
4767 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4768 auto res = isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(get());
4769 if (!res)
4770 exception::throw_last_error(ctx);
4771 return manage(res);
4774 union_map schedule_node::get_prefix_schedule_union_map() const
4776 if (!ptr)
4777 exception::throw_NULL_input(__FILE__, __LINE__);
4778 auto ctx = get_ctx();
4779 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4780 auto res = isl_schedule_node_get_prefix_schedule_union_map(get());
4781 if (!res)
4782 exception::throw_last_error(ctx);
4783 return manage(res);
4786 union_pw_multi_aff schedule_node::get_prefix_schedule_union_pw_multi_aff() const
4788 if (!ptr)
4789 exception::throw_NULL_input(__FILE__, __LINE__);
4790 auto ctx = get_ctx();
4791 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4792 auto res = isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(get());
4793 if (!res)
4794 exception::throw_last_error(ctx);
4795 return manage(res);
4798 schedule schedule_node::get_schedule() const
4800 if (!ptr)
4801 exception::throw_NULL_input(__FILE__, __LINE__);
4802 auto ctx = get_ctx();
4803 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4804 auto res = isl_schedule_node_get_schedule(get());
4805 if (!res)
4806 exception::throw_last_error(ctx);
4807 return manage(res);
4810 schedule_node schedule_node::parent() const
4812 if (!ptr)
4813 exception::throw_NULL_input(__FILE__, __LINE__);
4814 auto ctx = get_ctx();
4815 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4816 auto res = isl_schedule_node_parent(copy());
4817 if (!res)
4818 exception::throw_last_error(ctx);
4819 return manage(res);
4822 // implementations for isl::set
4823 set manage(__isl_take isl_set *ptr) {
4824 if (!ptr)
4825 exception::throw_NULL_input(__FILE__, __LINE__);
4826 return set(ptr);
4828 set manage_copy(__isl_keep isl_set *ptr) {
4829 if (!ptr)
4830 exception::throw_NULL_input(__FILE__, __LINE__);
4831 auto ctx = isl_set_get_ctx(ptr);
4832 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4833 ptr = isl_set_copy(ptr);
4834 if (!ptr)
4835 exception::throw_last_error(ctx);
4836 return set(ptr);
4839 set::set()
4840 : ptr(nullptr) {}
4842 set::set(const set &obj)
4843 : ptr(nullptr)
4845 if (!obj.ptr)
4846 exception::throw_NULL_input(__FILE__, __LINE__);
4847 auto ctx = isl_set_get_ctx(obj.ptr);
4848 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4849 ptr = obj.copy();
4850 if (!ptr)
4851 exception::throw_last_error(ctx);
4854 set::set(__isl_take isl_set *ptr)
4855 : ptr(ptr) {}
4857 set::set(ctx ctx, const std::string &str)
4859 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4860 auto res = isl_set_read_from_str(ctx.release(), str.c_str());
4861 if (!res)
4862 exception::throw_last_error(ctx);
4863 ptr = res;
4865 set::set(basic_set bset)
4867 if (bset.is_null())
4868 exception::throw_NULL_input(__FILE__, __LINE__);
4869 auto ctx = bset.get_ctx();
4870 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4871 auto res = isl_set_from_basic_set(bset.release());
4872 if (!res)
4873 exception::throw_last_error(ctx);
4874 ptr = res;
4876 set::set(point pnt)
4878 if (pnt.is_null())
4879 exception::throw_NULL_input(__FILE__, __LINE__);
4880 auto ctx = pnt.get_ctx();
4881 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4882 auto res = isl_set_from_point(pnt.release());
4883 if (!res)
4884 exception::throw_last_error(ctx);
4885 ptr = res;
4888 set &set::operator=(set obj) {
4889 std::swap(this->ptr, obj.ptr);
4890 return *this;
4893 set::~set() {
4894 if (ptr)
4895 isl_set_free(ptr);
4898 __isl_give isl_set *set::copy() const & {
4899 return isl_set_copy(ptr);
4902 __isl_keep isl_set *set::get() const {
4903 return ptr;
4906 __isl_give isl_set *set::release() {
4907 isl_set *tmp = ptr;
4908 ptr = nullptr;
4909 return tmp;
4912 bool set::is_null() const {
4913 return ptr == nullptr;
4916 ctx set::get_ctx() const {
4917 return ctx(isl_set_get_ctx(ptr));
4920 basic_set set::affine_hull() const
4922 if (!ptr)
4923 exception::throw_NULL_input(__FILE__, __LINE__);
4924 auto ctx = get_ctx();
4925 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4926 auto res = isl_set_affine_hull(copy());
4927 if (!res)
4928 exception::throw_last_error(ctx);
4929 return manage(res);
4932 set set::apply(map map) const
4934 if (!ptr || map.is_null())
4935 exception::throw_NULL_input(__FILE__, __LINE__);
4936 auto ctx = get_ctx();
4937 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4938 auto res = isl_set_apply(copy(), map.release());
4939 if (!res)
4940 exception::throw_last_error(ctx);
4941 return manage(res);
4944 set set::coalesce() const
4946 if (!ptr)
4947 exception::throw_NULL_input(__FILE__, __LINE__);
4948 auto ctx = get_ctx();
4949 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4950 auto res = isl_set_coalesce(copy());
4951 if (!res)
4952 exception::throw_last_error(ctx);
4953 return manage(res);
4956 set set::complement() const
4958 if (!ptr)
4959 exception::throw_NULL_input(__FILE__, __LINE__);
4960 auto ctx = get_ctx();
4961 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4962 auto res = isl_set_complement(copy());
4963 if (!res)
4964 exception::throw_last_error(ctx);
4965 return manage(res);
4968 set set::detect_equalities() const
4970 if (!ptr)
4971 exception::throw_NULL_input(__FILE__, __LINE__);
4972 auto ctx = get_ctx();
4973 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4974 auto res = isl_set_detect_equalities(copy());
4975 if (!res)
4976 exception::throw_last_error(ctx);
4977 return manage(res);
4980 set set::flatten() const
4982 if (!ptr)
4983 exception::throw_NULL_input(__FILE__, __LINE__);
4984 auto ctx = get_ctx();
4985 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4986 auto res = isl_set_flatten(copy());
4987 if (!res)
4988 exception::throw_last_error(ctx);
4989 return manage(res);
4992 void set::foreach_basic_set(const std::function<void(basic_set)> &fn) const
4994 if (!ptr)
4995 exception::throw_NULL_input(__FILE__, __LINE__);
4996 auto ctx = get_ctx();
4997 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
4998 struct fn_data {
4999 const std::function<void(basic_set)> *func;
5000 std::exception_ptr eptr;
5001 } fn_data = { &fn };
5002 auto fn_lambda = [](isl_basic_set *arg_0, void *arg_1) -> isl_stat {
5003 auto *data = static_cast<struct fn_data *>(arg_1);
5004 ISL_CPP_TRY {
5005 (*data->func)(manage(arg_0));
5006 return isl_stat_ok;
5007 } ISL_CPP_CATCH_ALL {
5008 data->eptr = std::current_exception();
5009 return isl_stat_error;
5012 auto res = isl_set_foreach_basic_set(get(), fn_lambda, &fn_data);
5013 if (fn_data.eptr)
5014 std::rethrow_exception(fn_data.eptr);
5015 if (res < 0)
5016 exception::throw_last_error(ctx);
5017 return;
5020 val set::get_stride(int pos) const
5022 if (!ptr)
5023 exception::throw_NULL_input(__FILE__, __LINE__);
5024 auto ctx = get_ctx();
5025 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5026 auto res = isl_set_get_stride(get(), pos);
5027 if (!res)
5028 exception::throw_last_error(ctx);
5029 return manage(res);
5032 set set::gist(set context) const
5034 if (!ptr || context.is_null())
5035 exception::throw_NULL_input(__FILE__, __LINE__);
5036 auto ctx = get_ctx();
5037 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5038 auto res = isl_set_gist(copy(), context.release());
5039 if (!res)
5040 exception::throw_last_error(ctx);
5041 return manage(res);
5044 map set::identity() const
5046 if (!ptr)
5047 exception::throw_NULL_input(__FILE__, __LINE__);
5048 auto ctx = get_ctx();
5049 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5050 auto res = isl_set_identity(copy());
5051 if (!res)
5052 exception::throw_last_error(ctx);
5053 return manage(res);
5056 set set::intersect(set set2) const
5058 if (!ptr || set2.is_null())
5059 exception::throw_NULL_input(__FILE__, __LINE__);
5060 auto ctx = get_ctx();
5061 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5062 auto res = isl_set_intersect(copy(), set2.release());
5063 if (!res)
5064 exception::throw_last_error(ctx);
5065 return manage(res);
5068 set set::intersect_params(set params) const
5070 if (!ptr || params.is_null())
5071 exception::throw_NULL_input(__FILE__, __LINE__);
5072 auto ctx = get_ctx();
5073 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5074 auto res = isl_set_intersect_params(copy(), params.release());
5075 if (!res)
5076 exception::throw_last_error(ctx);
5077 return manage(res);
5080 bool set::is_disjoint(const set &set2) const
5082 if (!ptr || set2.is_null())
5083 exception::throw_NULL_input(__FILE__, __LINE__);
5084 auto ctx = get_ctx();
5085 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5086 auto res = isl_set_is_disjoint(get(), set2.get());
5087 if (res < 0)
5088 exception::throw_last_error(ctx);
5089 return res;
5092 bool set::is_empty() const
5094 if (!ptr)
5095 exception::throw_NULL_input(__FILE__, __LINE__);
5096 auto ctx = get_ctx();
5097 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5098 auto res = isl_set_is_empty(get());
5099 if (res < 0)
5100 exception::throw_last_error(ctx);
5101 return res;
5104 bool set::is_equal(const set &set2) const
5106 if (!ptr || set2.is_null())
5107 exception::throw_NULL_input(__FILE__, __LINE__);
5108 auto ctx = get_ctx();
5109 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5110 auto res = isl_set_is_equal(get(), set2.get());
5111 if (res < 0)
5112 exception::throw_last_error(ctx);
5113 return res;
5116 bool set::is_strict_subset(const set &set2) const
5118 if (!ptr || set2.is_null())
5119 exception::throw_NULL_input(__FILE__, __LINE__);
5120 auto ctx = get_ctx();
5121 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5122 auto res = isl_set_is_strict_subset(get(), set2.get());
5123 if (res < 0)
5124 exception::throw_last_error(ctx);
5125 return res;
5128 bool set::is_subset(const set &set2) const
5130 if (!ptr || set2.is_null())
5131 exception::throw_NULL_input(__FILE__, __LINE__);
5132 auto ctx = get_ctx();
5133 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5134 auto res = isl_set_is_subset(get(), set2.get());
5135 if (res < 0)
5136 exception::throw_last_error(ctx);
5137 return res;
5140 bool set::is_wrapping() const
5142 if (!ptr)
5143 exception::throw_NULL_input(__FILE__, __LINE__);
5144 auto ctx = get_ctx();
5145 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5146 auto res = isl_set_is_wrapping(get());
5147 if (res < 0)
5148 exception::throw_last_error(ctx);
5149 return res;
5152 set set::lexmax() const
5154 if (!ptr)
5155 exception::throw_NULL_input(__FILE__, __LINE__);
5156 auto ctx = get_ctx();
5157 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5158 auto res = isl_set_lexmax(copy());
5159 if (!res)
5160 exception::throw_last_error(ctx);
5161 return manage(res);
5164 set set::lexmin() const
5166 if (!ptr)
5167 exception::throw_NULL_input(__FILE__, __LINE__);
5168 auto ctx = get_ctx();
5169 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5170 auto res = isl_set_lexmin(copy());
5171 if (!res)
5172 exception::throw_last_error(ctx);
5173 return manage(res);
5176 val set::max_val(const aff &obj) const
5178 if (!ptr || obj.is_null())
5179 exception::throw_NULL_input(__FILE__, __LINE__);
5180 auto ctx = get_ctx();
5181 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5182 auto res = isl_set_max_val(get(), obj.get());
5183 if (!res)
5184 exception::throw_last_error(ctx);
5185 return manage(res);
5188 val set::min_val(const aff &obj) const
5190 if (!ptr || obj.is_null())
5191 exception::throw_NULL_input(__FILE__, __LINE__);
5192 auto ctx = get_ctx();
5193 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5194 auto res = isl_set_min_val(get(), obj.get());
5195 if (!res)
5196 exception::throw_last_error(ctx);
5197 return manage(res);
5200 basic_set set::polyhedral_hull() const
5202 if (!ptr)
5203 exception::throw_NULL_input(__FILE__, __LINE__);
5204 auto ctx = get_ctx();
5205 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5206 auto res = isl_set_polyhedral_hull(copy());
5207 if (!res)
5208 exception::throw_last_error(ctx);
5209 return manage(res);
5212 basic_set set::sample() const
5214 if (!ptr)
5215 exception::throw_NULL_input(__FILE__, __LINE__);
5216 auto ctx = get_ctx();
5217 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5218 auto res = isl_set_sample(copy());
5219 if (!res)
5220 exception::throw_last_error(ctx);
5221 return manage(res);
5224 point set::sample_point() const
5226 if (!ptr)
5227 exception::throw_NULL_input(__FILE__, __LINE__);
5228 auto ctx = get_ctx();
5229 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5230 auto res = isl_set_sample_point(copy());
5231 if (!res)
5232 exception::throw_last_error(ctx);
5233 return manage(res);
5236 set set::subtract(set set2) const
5238 if (!ptr || set2.is_null())
5239 exception::throw_NULL_input(__FILE__, __LINE__);
5240 auto ctx = get_ctx();
5241 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5242 auto res = isl_set_subtract(copy(), set2.release());
5243 if (!res)
5244 exception::throw_last_error(ctx);
5245 return manage(res);
5248 set set::unite(set set2) const
5250 if (!ptr || set2.is_null())
5251 exception::throw_NULL_input(__FILE__, __LINE__);
5252 auto ctx = get_ctx();
5253 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5254 auto res = isl_set_union(copy(), set2.release());
5255 if (!res)
5256 exception::throw_last_error(ctx);
5257 return manage(res);
5260 basic_set set::unshifted_simple_hull() const
5262 if (!ptr)
5263 exception::throw_NULL_input(__FILE__, __LINE__);
5264 auto ctx = get_ctx();
5265 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5266 auto res = isl_set_unshifted_simple_hull(copy());
5267 if (!res)
5268 exception::throw_last_error(ctx);
5269 return manage(res);
5272 // implementations for isl::union_access_info
5273 union_access_info manage(__isl_take isl_union_access_info *ptr) {
5274 if (!ptr)
5275 exception::throw_NULL_input(__FILE__, __LINE__);
5276 return union_access_info(ptr);
5278 union_access_info manage_copy(__isl_keep isl_union_access_info *ptr) {
5279 if (!ptr)
5280 exception::throw_NULL_input(__FILE__, __LINE__);
5281 auto ctx = isl_union_access_info_get_ctx(ptr);
5282 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5283 ptr = isl_union_access_info_copy(ptr);
5284 if (!ptr)
5285 exception::throw_last_error(ctx);
5286 return union_access_info(ptr);
5289 union_access_info::union_access_info()
5290 : ptr(nullptr) {}
5292 union_access_info::union_access_info(const union_access_info &obj)
5293 : ptr(nullptr)
5295 if (!obj.ptr)
5296 exception::throw_NULL_input(__FILE__, __LINE__);
5297 auto ctx = isl_union_access_info_get_ctx(obj.ptr);
5298 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5299 ptr = obj.copy();
5300 if (!ptr)
5301 exception::throw_last_error(ctx);
5304 union_access_info::union_access_info(__isl_take isl_union_access_info *ptr)
5305 : ptr(ptr) {}
5307 union_access_info::union_access_info(union_map sink)
5309 if (sink.is_null())
5310 exception::throw_NULL_input(__FILE__, __LINE__);
5311 auto ctx = sink.get_ctx();
5312 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5313 auto res = isl_union_access_info_from_sink(sink.release());
5314 if (!res)
5315 exception::throw_last_error(ctx);
5316 ptr = res;
5319 union_access_info &union_access_info::operator=(union_access_info obj) {
5320 std::swap(this->ptr, obj.ptr);
5321 return *this;
5324 union_access_info::~union_access_info() {
5325 if (ptr)
5326 isl_union_access_info_free(ptr);
5329 __isl_give isl_union_access_info *union_access_info::copy() const & {
5330 return isl_union_access_info_copy(ptr);
5333 __isl_keep isl_union_access_info *union_access_info::get() const {
5334 return ptr;
5337 __isl_give isl_union_access_info *union_access_info::release() {
5338 isl_union_access_info *tmp = ptr;
5339 ptr = nullptr;
5340 return tmp;
5343 bool union_access_info::is_null() const {
5344 return ptr == nullptr;
5347 ctx union_access_info::get_ctx() const {
5348 return ctx(isl_union_access_info_get_ctx(ptr));
5351 union_flow union_access_info::compute_flow() const
5353 if (!ptr)
5354 exception::throw_NULL_input(__FILE__, __LINE__);
5355 auto ctx = get_ctx();
5356 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5357 auto res = isl_union_access_info_compute_flow(copy());
5358 if (!res)
5359 exception::throw_last_error(ctx);
5360 return manage(res);
5363 union_access_info union_access_info::set_kill(union_map kill) const
5365 if (!ptr || kill.is_null())
5366 exception::throw_NULL_input(__FILE__, __LINE__);
5367 auto ctx = get_ctx();
5368 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5369 auto res = isl_union_access_info_set_kill(copy(), kill.release());
5370 if (!res)
5371 exception::throw_last_error(ctx);
5372 return manage(res);
5375 union_access_info union_access_info::set_may_source(union_map may_source) const
5377 if (!ptr || may_source.is_null())
5378 exception::throw_NULL_input(__FILE__, __LINE__);
5379 auto ctx = get_ctx();
5380 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5381 auto res = isl_union_access_info_set_may_source(copy(), may_source.release());
5382 if (!res)
5383 exception::throw_last_error(ctx);
5384 return manage(res);
5387 union_access_info union_access_info::set_must_source(union_map must_source) const
5389 if (!ptr || must_source.is_null())
5390 exception::throw_NULL_input(__FILE__, __LINE__);
5391 auto ctx = get_ctx();
5392 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5393 auto res = isl_union_access_info_set_must_source(copy(), must_source.release());
5394 if (!res)
5395 exception::throw_last_error(ctx);
5396 return manage(res);
5399 union_access_info union_access_info::set_schedule(schedule schedule) const
5401 if (!ptr || schedule.is_null())
5402 exception::throw_NULL_input(__FILE__, __LINE__);
5403 auto ctx = get_ctx();
5404 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5405 auto res = isl_union_access_info_set_schedule(copy(), schedule.release());
5406 if (!res)
5407 exception::throw_last_error(ctx);
5408 return manage(res);
5411 union_access_info union_access_info::set_schedule_map(union_map schedule_map) const
5413 if (!ptr || schedule_map.is_null())
5414 exception::throw_NULL_input(__FILE__, __LINE__);
5415 auto ctx = get_ctx();
5416 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5417 auto res = isl_union_access_info_set_schedule_map(copy(), schedule_map.release());
5418 if (!res)
5419 exception::throw_last_error(ctx);
5420 return manage(res);
5423 // implementations for isl::union_flow
5424 union_flow manage(__isl_take isl_union_flow *ptr) {
5425 if (!ptr)
5426 exception::throw_NULL_input(__FILE__, __LINE__);
5427 return union_flow(ptr);
5429 union_flow manage_copy(__isl_keep isl_union_flow *ptr) {
5430 if (!ptr)
5431 exception::throw_NULL_input(__FILE__, __LINE__);
5432 auto ctx = isl_union_flow_get_ctx(ptr);
5433 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5434 ptr = isl_union_flow_copy(ptr);
5435 if (!ptr)
5436 exception::throw_last_error(ctx);
5437 return union_flow(ptr);
5440 union_flow::union_flow()
5441 : ptr(nullptr) {}
5443 union_flow::union_flow(const union_flow &obj)
5444 : ptr(nullptr)
5446 if (!obj.ptr)
5447 exception::throw_NULL_input(__FILE__, __LINE__);
5448 auto ctx = isl_union_flow_get_ctx(obj.ptr);
5449 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5450 ptr = obj.copy();
5451 if (!ptr)
5452 exception::throw_last_error(ctx);
5455 union_flow::union_flow(__isl_take isl_union_flow *ptr)
5456 : ptr(ptr) {}
5459 union_flow &union_flow::operator=(union_flow obj) {
5460 std::swap(this->ptr, obj.ptr);
5461 return *this;
5464 union_flow::~union_flow() {
5465 if (ptr)
5466 isl_union_flow_free(ptr);
5469 __isl_give isl_union_flow *union_flow::copy() const & {
5470 return isl_union_flow_copy(ptr);
5473 __isl_keep isl_union_flow *union_flow::get() const {
5474 return ptr;
5477 __isl_give isl_union_flow *union_flow::release() {
5478 isl_union_flow *tmp = ptr;
5479 ptr = nullptr;
5480 return tmp;
5483 bool union_flow::is_null() const {
5484 return ptr == nullptr;
5487 ctx union_flow::get_ctx() const {
5488 return ctx(isl_union_flow_get_ctx(ptr));
5491 union_map union_flow::get_full_may_dependence() const
5493 if (!ptr)
5494 exception::throw_NULL_input(__FILE__, __LINE__);
5495 auto ctx = get_ctx();
5496 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5497 auto res = isl_union_flow_get_full_may_dependence(get());
5498 if (!res)
5499 exception::throw_last_error(ctx);
5500 return manage(res);
5503 union_map union_flow::get_full_must_dependence() const
5505 if (!ptr)
5506 exception::throw_NULL_input(__FILE__, __LINE__);
5507 auto ctx = get_ctx();
5508 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5509 auto res = isl_union_flow_get_full_must_dependence(get());
5510 if (!res)
5511 exception::throw_last_error(ctx);
5512 return manage(res);
5515 union_map union_flow::get_may_dependence() const
5517 if (!ptr)
5518 exception::throw_NULL_input(__FILE__, __LINE__);
5519 auto ctx = get_ctx();
5520 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5521 auto res = isl_union_flow_get_may_dependence(get());
5522 if (!res)
5523 exception::throw_last_error(ctx);
5524 return manage(res);
5527 union_map union_flow::get_may_no_source() const
5529 if (!ptr)
5530 exception::throw_NULL_input(__FILE__, __LINE__);
5531 auto ctx = get_ctx();
5532 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5533 auto res = isl_union_flow_get_may_no_source(get());
5534 if (!res)
5535 exception::throw_last_error(ctx);
5536 return manage(res);
5539 union_map union_flow::get_must_dependence() const
5541 if (!ptr)
5542 exception::throw_NULL_input(__FILE__, __LINE__);
5543 auto ctx = get_ctx();
5544 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5545 auto res = isl_union_flow_get_must_dependence(get());
5546 if (!res)
5547 exception::throw_last_error(ctx);
5548 return manage(res);
5551 union_map union_flow::get_must_no_source() const
5553 if (!ptr)
5554 exception::throw_NULL_input(__FILE__, __LINE__);
5555 auto ctx = get_ctx();
5556 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5557 auto res = isl_union_flow_get_must_no_source(get());
5558 if (!res)
5559 exception::throw_last_error(ctx);
5560 return manage(res);
5563 // implementations for isl::union_map
5564 union_map manage(__isl_take isl_union_map *ptr) {
5565 if (!ptr)
5566 exception::throw_NULL_input(__FILE__, __LINE__);
5567 return union_map(ptr);
5569 union_map manage_copy(__isl_keep isl_union_map *ptr) {
5570 if (!ptr)
5571 exception::throw_NULL_input(__FILE__, __LINE__);
5572 auto ctx = isl_union_map_get_ctx(ptr);
5573 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5574 ptr = isl_union_map_copy(ptr);
5575 if (!ptr)
5576 exception::throw_last_error(ctx);
5577 return union_map(ptr);
5580 union_map::union_map()
5581 : ptr(nullptr) {}
5583 union_map::union_map(const union_map &obj)
5584 : ptr(nullptr)
5586 if (!obj.ptr)
5587 exception::throw_NULL_input(__FILE__, __LINE__);
5588 auto ctx = isl_union_map_get_ctx(obj.ptr);
5589 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5590 ptr = obj.copy();
5591 if (!ptr)
5592 exception::throw_last_error(ctx);
5595 union_map::union_map(__isl_take isl_union_map *ptr)
5596 : ptr(ptr) {}
5598 union_map::union_map(basic_map bmap)
5600 if (bmap.is_null())
5601 exception::throw_NULL_input(__FILE__, __LINE__);
5602 auto ctx = bmap.get_ctx();
5603 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5604 auto res = isl_union_map_from_basic_map(bmap.release());
5605 if (!res)
5606 exception::throw_last_error(ctx);
5607 ptr = res;
5609 union_map::union_map(map map)
5611 if (map.is_null())
5612 exception::throw_NULL_input(__FILE__, __LINE__);
5613 auto ctx = map.get_ctx();
5614 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5615 auto res = isl_union_map_from_map(map.release());
5616 if (!res)
5617 exception::throw_last_error(ctx);
5618 ptr = res;
5620 union_map::union_map(ctx ctx, const std::string &str)
5622 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5623 auto res = isl_union_map_read_from_str(ctx.release(), str.c_str());
5624 if (!res)
5625 exception::throw_last_error(ctx);
5626 ptr = res;
5629 union_map &union_map::operator=(union_map obj) {
5630 std::swap(this->ptr, obj.ptr);
5631 return *this;
5634 union_map::~union_map() {
5635 if (ptr)
5636 isl_union_map_free(ptr);
5639 __isl_give isl_union_map *union_map::copy() const & {
5640 return isl_union_map_copy(ptr);
5643 __isl_keep isl_union_map *union_map::get() const {
5644 return ptr;
5647 __isl_give isl_union_map *union_map::release() {
5648 isl_union_map *tmp = ptr;
5649 ptr = nullptr;
5650 return tmp;
5653 bool union_map::is_null() const {
5654 return ptr == nullptr;
5657 ctx union_map::get_ctx() const {
5658 return ctx(isl_union_map_get_ctx(ptr));
5661 union_map union_map::affine_hull() const
5663 if (!ptr)
5664 exception::throw_NULL_input(__FILE__, __LINE__);
5665 auto ctx = get_ctx();
5666 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5667 auto res = isl_union_map_affine_hull(copy());
5668 if (!res)
5669 exception::throw_last_error(ctx);
5670 return manage(res);
5673 union_map union_map::apply_domain(union_map umap2) const
5675 if (!ptr || umap2.is_null())
5676 exception::throw_NULL_input(__FILE__, __LINE__);
5677 auto ctx = get_ctx();
5678 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5679 auto res = isl_union_map_apply_domain(copy(), umap2.release());
5680 if (!res)
5681 exception::throw_last_error(ctx);
5682 return manage(res);
5685 union_map union_map::apply_range(union_map umap2) const
5687 if (!ptr || umap2.is_null())
5688 exception::throw_NULL_input(__FILE__, __LINE__);
5689 auto ctx = get_ctx();
5690 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5691 auto res = isl_union_map_apply_range(copy(), umap2.release());
5692 if (!res)
5693 exception::throw_last_error(ctx);
5694 return manage(res);
5697 union_map union_map::coalesce() const
5699 if (!ptr)
5700 exception::throw_NULL_input(__FILE__, __LINE__);
5701 auto ctx = get_ctx();
5702 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5703 auto res = isl_union_map_coalesce(copy());
5704 if (!res)
5705 exception::throw_last_error(ctx);
5706 return manage(res);
5709 union_map union_map::compute_divs() const
5711 if (!ptr)
5712 exception::throw_NULL_input(__FILE__, __LINE__);
5713 auto ctx = get_ctx();
5714 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5715 auto res = isl_union_map_compute_divs(copy());
5716 if (!res)
5717 exception::throw_last_error(ctx);
5718 return manage(res);
5721 union_set union_map::deltas() const
5723 if (!ptr)
5724 exception::throw_NULL_input(__FILE__, __LINE__);
5725 auto ctx = get_ctx();
5726 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5727 auto res = isl_union_map_deltas(copy());
5728 if (!res)
5729 exception::throw_last_error(ctx);
5730 return manage(res);
5733 union_map union_map::detect_equalities() const
5735 if (!ptr)
5736 exception::throw_NULL_input(__FILE__, __LINE__);
5737 auto ctx = get_ctx();
5738 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5739 auto res = isl_union_map_detect_equalities(copy());
5740 if (!res)
5741 exception::throw_last_error(ctx);
5742 return manage(res);
5745 union_set union_map::domain() const
5747 if (!ptr)
5748 exception::throw_NULL_input(__FILE__, __LINE__);
5749 auto ctx = get_ctx();
5750 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5751 auto res = isl_union_map_domain(copy());
5752 if (!res)
5753 exception::throw_last_error(ctx);
5754 return manage(res);
5757 union_map union_map::domain_factor_domain() const
5759 if (!ptr)
5760 exception::throw_NULL_input(__FILE__, __LINE__);
5761 auto ctx = get_ctx();
5762 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5763 auto res = isl_union_map_domain_factor_domain(copy());
5764 if (!res)
5765 exception::throw_last_error(ctx);
5766 return manage(res);
5769 union_map union_map::domain_factor_range() const
5771 if (!ptr)
5772 exception::throw_NULL_input(__FILE__, __LINE__);
5773 auto ctx = get_ctx();
5774 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5775 auto res = isl_union_map_domain_factor_range(copy());
5776 if (!res)
5777 exception::throw_last_error(ctx);
5778 return manage(res);
5781 union_map union_map::domain_map() const
5783 if (!ptr)
5784 exception::throw_NULL_input(__FILE__, __LINE__);
5785 auto ctx = get_ctx();
5786 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5787 auto res = isl_union_map_domain_map(copy());
5788 if (!res)
5789 exception::throw_last_error(ctx);
5790 return manage(res);
5793 union_pw_multi_aff union_map::domain_map_union_pw_multi_aff() const
5795 if (!ptr)
5796 exception::throw_NULL_input(__FILE__, __LINE__);
5797 auto ctx = get_ctx();
5798 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5799 auto res = isl_union_map_domain_map_union_pw_multi_aff(copy());
5800 if (!res)
5801 exception::throw_last_error(ctx);
5802 return manage(res);
5805 union_map union_map::domain_product(union_map umap2) const
5807 if (!ptr || umap2.is_null())
5808 exception::throw_NULL_input(__FILE__, __LINE__);
5809 auto ctx = get_ctx();
5810 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5811 auto res = isl_union_map_domain_product(copy(), umap2.release());
5812 if (!res)
5813 exception::throw_last_error(ctx);
5814 return manage(res);
5817 union_map union_map::eq_at(multi_union_pw_aff mupa) const
5819 if (!ptr || mupa.is_null())
5820 exception::throw_NULL_input(__FILE__, __LINE__);
5821 auto ctx = get_ctx();
5822 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5823 auto res = isl_union_map_eq_at_multi_union_pw_aff(copy(), mupa.release());
5824 if (!res)
5825 exception::throw_last_error(ctx);
5826 return manage(res);
5829 union_map union_map::factor_domain() const
5831 if (!ptr)
5832 exception::throw_NULL_input(__FILE__, __LINE__);
5833 auto ctx = get_ctx();
5834 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5835 auto res = isl_union_map_factor_domain(copy());
5836 if (!res)
5837 exception::throw_last_error(ctx);
5838 return manage(res);
5841 union_map union_map::factor_range() const
5843 if (!ptr)
5844 exception::throw_NULL_input(__FILE__, __LINE__);
5845 auto ctx = get_ctx();
5846 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5847 auto res = isl_union_map_factor_range(copy());
5848 if (!res)
5849 exception::throw_last_error(ctx);
5850 return manage(res);
5853 union_map union_map::fixed_power(val exp) const
5855 if (!ptr || exp.is_null())
5856 exception::throw_NULL_input(__FILE__, __LINE__);
5857 auto ctx = get_ctx();
5858 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5859 auto res = isl_union_map_fixed_power_val(copy(), exp.release());
5860 if (!res)
5861 exception::throw_last_error(ctx);
5862 return manage(res);
5865 void union_map::foreach_map(const std::function<void(map)> &fn) const
5867 if (!ptr)
5868 exception::throw_NULL_input(__FILE__, __LINE__);
5869 auto ctx = get_ctx();
5870 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5871 struct fn_data {
5872 const std::function<void(map)> *func;
5873 std::exception_ptr eptr;
5874 } fn_data = { &fn };
5875 auto fn_lambda = [](isl_map *arg_0, void *arg_1) -> isl_stat {
5876 auto *data = static_cast<struct fn_data *>(arg_1);
5877 ISL_CPP_TRY {
5878 (*data->func)(manage(arg_0));
5879 return isl_stat_ok;
5880 } ISL_CPP_CATCH_ALL {
5881 data->eptr = std::current_exception();
5882 return isl_stat_error;
5885 auto res = isl_union_map_foreach_map(get(), fn_lambda, &fn_data);
5886 if (fn_data.eptr)
5887 std::rethrow_exception(fn_data.eptr);
5888 if (res < 0)
5889 exception::throw_last_error(ctx);
5890 return;
5893 union_map union_map::from(union_pw_multi_aff upma)
5895 if (upma.is_null())
5896 exception::throw_NULL_input(__FILE__, __LINE__);
5897 auto ctx = upma.get_ctx();
5898 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5899 auto res = isl_union_map_from_union_pw_multi_aff(upma.release());
5900 if (!res)
5901 exception::throw_last_error(ctx);
5902 return manage(res);
5905 union_map union_map::from(multi_union_pw_aff mupa)
5907 if (mupa.is_null())
5908 exception::throw_NULL_input(__FILE__, __LINE__);
5909 auto ctx = mupa.get_ctx();
5910 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5911 auto res = isl_union_map_from_multi_union_pw_aff(mupa.release());
5912 if (!res)
5913 exception::throw_last_error(ctx);
5914 return manage(res);
5917 union_map union_map::from_domain(union_set uset)
5919 if (uset.is_null())
5920 exception::throw_NULL_input(__FILE__, __LINE__);
5921 auto ctx = uset.get_ctx();
5922 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5923 auto res = isl_union_map_from_domain(uset.release());
5924 if (!res)
5925 exception::throw_last_error(ctx);
5926 return manage(res);
5929 union_map union_map::from_domain_and_range(union_set domain, union_set range)
5931 if (domain.is_null() || range.is_null())
5932 exception::throw_NULL_input(__FILE__, __LINE__);
5933 auto ctx = domain.get_ctx();
5934 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5935 auto res = isl_union_map_from_domain_and_range(domain.release(), range.release());
5936 if (!res)
5937 exception::throw_last_error(ctx);
5938 return manage(res);
5941 union_map union_map::from_range(union_set uset)
5943 if (uset.is_null())
5944 exception::throw_NULL_input(__FILE__, __LINE__);
5945 auto ctx = uset.get_ctx();
5946 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5947 auto res = isl_union_map_from_range(uset.release());
5948 if (!res)
5949 exception::throw_last_error(ctx);
5950 return manage(res);
5953 union_map union_map::gist(union_map context) const
5955 if (!ptr || context.is_null())
5956 exception::throw_NULL_input(__FILE__, __LINE__);
5957 auto ctx = get_ctx();
5958 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5959 auto res = isl_union_map_gist(copy(), context.release());
5960 if (!res)
5961 exception::throw_last_error(ctx);
5962 return manage(res);
5965 union_map union_map::gist_domain(union_set uset) const
5967 if (!ptr || uset.is_null())
5968 exception::throw_NULL_input(__FILE__, __LINE__);
5969 auto ctx = get_ctx();
5970 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5971 auto res = isl_union_map_gist_domain(copy(), uset.release());
5972 if (!res)
5973 exception::throw_last_error(ctx);
5974 return manage(res);
5977 union_map union_map::gist_params(set set) const
5979 if (!ptr || set.is_null())
5980 exception::throw_NULL_input(__FILE__, __LINE__);
5981 auto ctx = get_ctx();
5982 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5983 auto res = isl_union_map_gist_params(copy(), set.release());
5984 if (!res)
5985 exception::throw_last_error(ctx);
5986 return manage(res);
5989 union_map union_map::gist_range(union_set uset) const
5991 if (!ptr || uset.is_null())
5992 exception::throw_NULL_input(__FILE__, __LINE__);
5993 auto ctx = get_ctx();
5994 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
5995 auto res = isl_union_map_gist_range(copy(), uset.release());
5996 if (!res)
5997 exception::throw_last_error(ctx);
5998 return manage(res);
6001 union_map union_map::intersect(union_map umap2) const
6003 if (!ptr || umap2.is_null())
6004 exception::throw_NULL_input(__FILE__, __LINE__);
6005 auto ctx = get_ctx();
6006 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6007 auto res = isl_union_map_intersect(copy(), umap2.release());
6008 if (!res)
6009 exception::throw_last_error(ctx);
6010 return manage(res);
6013 union_map union_map::intersect_domain(union_set uset) const
6015 if (!ptr || uset.is_null())
6016 exception::throw_NULL_input(__FILE__, __LINE__);
6017 auto ctx = get_ctx();
6018 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6019 auto res = isl_union_map_intersect_domain(copy(), uset.release());
6020 if (!res)
6021 exception::throw_last_error(ctx);
6022 return manage(res);
6025 union_map union_map::intersect_params(set set) const
6027 if (!ptr || set.is_null())
6028 exception::throw_NULL_input(__FILE__, __LINE__);
6029 auto ctx = get_ctx();
6030 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6031 auto res = isl_union_map_intersect_params(copy(), set.release());
6032 if (!res)
6033 exception::throw_last_error(ctx);
6034 return manage(res);
6037 union_map union_map::intersect_range(union_set uset) const
6039 if (!ptr || uset.is_null())
6040 exception::throw_NULL_input(__FILE__, __LINE__);
6041 auto ctx = get_ctx();
6042 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6043 auto res = isl_union_map_intersect_range(copy(), uset.release());
6044 if (!res)
6045 exception::throw_last_error(ctx);
6046 return manage(res);
6049 bool union_map::is_bijective() const
6051 if (!ptr)
6052 exception::throw_NULL_input(__FILE__, __LINE__);
6053 auto ctx = get_ctx();
6054 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6055 auto res = isl_union_map_is_bijective(get());
6056 if (res < 0)
6057 exception::throw_last_error(ctx);
6058 return res;
6061 bool union_map::is_empty() const
6063 if (!ptr)
6064 exception::throw_NULL_input(__FILE__, __LINE__);
6065 auto ctx = get_ctx();
6066 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6067 auto res = isl_union_map_is_empty(get());
6068 if (res < 0)
6069 exception::throw_last_error(ctx);
6070 return res;
6073 bool union_map::is_equal(const union_map &umap2) const
6075 if (!ptr || umap2.is_null())
6076 exception::throw_NULL_input(__FILE__, __LINE__);
6077 auto ctx = get_ctx();
6078 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6079 auto res = isl_union_map_is_equal(get(), umap2.get());
6080 if (res < 0)
6081 exception::throw_last_error(ctx);
6082 return res;
6085 bool union_map::is_injective() const
6087 if (!ptr)
6088 exception::throw_NULL_input(__FILE__, __LINE__);
6089 auto ctx = get_ctx();
6090 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6091 auto res = isl_union_map_is_injective(get());
6092 if (res < 0)
6093 exception::throw_last_error(ctx);
6094 return res;
6097 bool union_map::is_single_valued() const
6099 if (!ptr)
6100 exception::throw_NULL_input(__FILE__, __LINE__);
6101 auto ctx = get_ctx();
6102 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6103 auto res = isl_union_map_is_single_valued(get());
6104 if (res < 0)
6105 exception::throw_last_error(ctx);
6106 return res;
6109 bool union_map::is_strict_subset(const union_map &umap2) const
6111 if (!ptr || umap2.is_null())
6112 exception::throw_NULL_input(__FILE__, __LINE__);
6113 auto ctx = get_ctx();
6114 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6115 auto res = isl_union_map_is_strict_subset(get(), umap2.get());
6116 if (res < 0)
6117 exception::throw_last_error(ctx);
6118 return res;
6121 bool union_map::is_subset(const union_map &umap2) const
6123 if (!ptr || umap2.is_null())
6124 exception::throw_NULL_input(__FILE__, __LINE__);
6125 auto ctx = get_ctx();
6126 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6127 auto res = isl_union_map_is_subset(get(), umap2.get());
6128 if (res < 0)
6129 exception::throw_last_error(ctx);
6130 return res;
6133 union_map union_map::lexmax() const
6135 if (!ptr)
6136 exception::throw_NULL_input(__FILE__, __LINE__);
6137 auto ctx = get_ctx();
6138 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6139 auto res = isl_union_map_lexmax(copy());
6140 if (!res)
6141 exception::throw_last_error(ctx);
6142 return manage(res);
6145 union_map union_map::lexmin() const
6147 if (!ptr)
6148 exception::throw_NULL_input(__FILE__, __LINE__);
6149 auto ctx = get_ctx();
6150 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6151 auto res = isl_union_map_lexmin(copy());
6152 if (!res)
6153 exception::throw_last_error(ctx);
6154 return manage(res);
6157 union_map union_map::polyhedral_hull() const
6159 if (!ptr)
6160 exception::throw_NULL_input(__FILE__, __LINE__);
6161 auto ctx = get_ctx();
6162 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6163 auto res = isl_union_map_polyhedral_hull(copy());
6164 if (!res)
6165 exception::throw_last_error(ctx);
6166 return manage(res);
6169 union_map union_map::product(union_map umap2) const
6171 if (!ptr || umap2.is_null())
6172 exception::throw_NULL_input(__FILE__, __LINE__);
6173 auto ctx = get_ctx();
6174 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6175 auto res = isl_union_map_product(copy(), umap2.release());
6176 if (!res)
6177 exception::throw_last_error(ctx);
6178 return manage(res);
6181 union_map union_map::project_out_all_params() const
6183 if (!ptr)
6184 exception::throw_NULL_input(__FILE__, __LINE__);
6185 auto ctx = get_ctx();
6186 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6187 auto res = isl_union_map_project_out_all_params(copy());
6188 if (!res)
6189 exception::throw_last_error(ctx);
6190 return manage(res);
6193 union_set union_map::range() const
6195 if (!ptr)
6196 exception::throw_NULL_input(__FILE__, __LINE__);
6197 auto ctx = get_ctx();
6198 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6199 auto res = isl_union_map_range(copy());
6200 if (!res)
6201 exception::throw_last_error(ctx);
6202 return manage(res);
6205 union_map union_map::range_factor_domain() const
6207 if (!ptr)
6208 exception::throw_NULL_input(__FILE__, __LINE__);
6209 auto ctx = get_ctx();
6210 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6211 auto res = isl_union_map_range_factor_domain(copy());
6212 if (!res)
6213 exception::throw_last_error(ctx);
6214 return manage(res);
6217 union_map union_map::range_factor_range() const
6219 if (!ptr)
6220 exception::throw_NULL_input(__FILE__, __LINE__);
6221 auto ctx = get_ctx();
6222 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6223 auto res = isl_union_map_range_factor_range(copy());
6224 if (!res)
6225 exception::throw_last_error(ctx);
6226 return manage(res);
6229 union_map union_map::range_map() const
6231 if (!ptr)
6232 exception::throw_NULL_input(__FILE__, __LINE__);
6233 auto ctx = get_ctx();
6234 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6235 auto res = isl_union_map_range_map(copy());
6236 if (!res)
6237 exception::throw_last_error(ctx);
6238 return manage(res);
6241 union_map union_map::range_product(union_map umap2) const
6243 if (!ptr || umap2.is_null())
6244 exception::throw_NULL_input(__FILE__, __LINE__);
6245 auto ctx = get_ctx();
6246 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6247 auto res = isl_union_map_range_product(copy(), umap2.release());
6248 if (!res)
6249 exception::throw_last_error(ctx);
6250 return manage(res);
6253 union_map union_map::reverse() const
6255 if (!ptr)
6256 exception::throw_NULL_input(__FILE__, __LINE__);
6257 auto ctx = get_ctx();
6258 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6259 auto res = isl_union_map_reverse(copy());
6260 if (!res)
6261 exception::throw_last_error(ctx);
6262 return manage(res);
6265 union_map union_map::subtract(union_map umap2) const
6267 if (!ptr || umap2.is_null())
6268 exception::throw_NULL_input(__FILE__, __LINE__);
6269 auto ctx = get_ctx();
6270 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6271 auto res = isl_union_map_subtract(copy(), umap2.release());
6272 if (!res)
6273 exception::throw_last_error(ctx);
6274 return manage(res);
6277 union_map union_map::subtract_domain(union_set dom) const
6279 if (!ptr || dom.is_null())
6280 exception::throw_NULL_input(__FILE__, __LINE__);
6281 auto ctx = get_ctx();
6282 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6283 auto res = isl_union_map_subtract_domain(copy(), dom.release());
6284 if (!res)
6285 exception::throw_last_error(ctx);
6286 return manage(res);
6289 union_map union_map::subtract_range(union_set dom) const
6291 if (!ptr || dom.is_null())
6292 exception::throw_NULL_input(__FILE__, __LINE__);
6293 auto ctx = get_ctx();
6294 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6295 auto res = isl_union_map_subtract_range(copy(), dom.release());
6296 if (!res)
6297 exception::throw_last_error(ctx);
6298 return manage(res);
6301 union_map union_map::unite(union_map umap2) const
6303 if (!ptr || umap2.is_null())
6304 exception::throw_NULL_input(__FILE__, __LINE__);
6305 auto ctx = get_ctx();
6306 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6307 auto res = isl_union_map_union(copy(), umap2.release());
6308 if (!res)
6309 exception::throw_last_error(ctx);
6310 return manage(res);
6313 union_set union_map::wrap() const
6315 if (!ptr)
6316 exception::throw_NULL_input(__FILE__, __LINE__);
6317 auto ctx = get_ctx();
6318 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6319 auto res = isl_union_map_wrap(copy());
6320 if (!res)
6321 exception::throw_last_error(ctx);
6322 return manage(res);
6325 union_map union_map::zip() const
6327 if (!ptr)
6328 exception::throw_NULL_input(__FILE__, __LINE__);
6329 auto ctx = get_ctx();
6330 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6331 auto res = isl_union_map_zip(copy());
6332 if (!res)
6333 exception::throw_last_error(ctx);
6334 return manage(res);
6337 // implementations for isl::union_pw_aff
6338 union_pw_aff manage(__isl_take isl_union_pw_aff *ptr) {
6339 if (!ptr)
6340 exception::throw_NULL_input(__FILE__, __LINE__);
6341 return union_pw_aff(ptr);
6343 union_pw_aff manage_copy(__isl_keep isl_union_pw_aff *ptr) {
6344 if (!ptr)
6345 exception::throw_NULL_input(__FILE__, __LINE__);
6346 auto ctx = isl_union_pw_aff_get_ctx(ptr);
6347 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6348 ptr = isl_union_pw_aff_copy(ptr);
6349 if (!ptr)
6350 exception::throw_last_error(ctx);
6351 return union_pw_aff(ptr);
6354 union_pw_aff::union_pw_aff()
6355 : ptr(nullptr) {}
6357 union_pw_aff::union_pw_aff(const union_pw_aff &obj)
6358 : ptr(nullptr)
6360 if (!obj.ptr)
6361 exception::throw_NULL_input(__FILE__, __LINE__);
6362 auto ctx = isl_union_pw_aff_get_ctx(obj.ptr);
6363 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6364 ptr = obj.copy();
6365 if (!ptr)
6366 exception::throw_last_error(ctx);
6369 union_pw_aff::union_pw_aff(__isl_take isl_union_pw_aff *ptr)
6370 : ptr(ptr) {}
6372 union_pw_aff::union_pw_aff(pw_aff pa)
6374 if (pa.is_null())
6375 exception::throw_NULL_input(__FILE__, __LINE__);
6376 auto ctx = pa.get_ctx();
6377 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6378 auto res = isl_union_pw_aff_from_pw_aff(pa.release());
6379 if (!res)
6380 exception::throw_last_error(ctx);
6381 ptr = res;
6383 union_pw_aff::union_pw_aff(ctx ctx, const std::string &str)
6385 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6386 auto res = isl_union_pw_aff_read_from_str(ctx.release(), str.c_str());
6387 if (!res)
6388 exception::throw_last_error(ctx);
6389 ptr = res;
6392 union_pw_aff &union_pw_aff::operator=(union_pw_aff obj) {
6393 std::swap(this->ptr, obj.ptr);
6394 return *this;
6397 union_pw_aff::~union_pw_aff() {
6398 if (ptr)
6399 isl_union_pw_aff_free(ptr);
6402 __isl_give isl_union_pw_aff *union_pw_aff::copy() const & {
6403 return isl_union_pw_aff_copy(ptr);
6406 __isl_keep isl_union_pw_aff *union_pw_aff::get() const {
6407 return ptr;
6410 __isl_give isl_union_pw_aff *union_pw_aff::release() {
6411 isl_union_pw_aff *tmp = ptr;
6412 ptr = nullptr;
6413 return tmp;
6416 bool union_pw_aff::is_null() const {
6417 return ptr == nullptr;
6420 ctx union_pw_aff::get_ctx() const {
6421 return ctx(isl_union_pw_aff_get_ctx(ptr));
6424 union_pw_aff union_pw_aff::add(union_pw_aff upa2) const
6426 if (!ptr || upa2.is_null())
6427 exception::throw_NULL_input(__FILE__, __LINE__);
6428 auto ctx = get_ctx();
6429 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6430 auto res = isl_union_pw_aff_add(copy(), upa2.release());
6431 if (!res)
6432 exception::throw_last_error(ctx);
6433 return manage(res);
6436 union_pw_aff union_pw_aff::pullback(union_pw_multi_aff upma) const
6438 if (!ptr || upma.is_null())
6439 exception::throw_NULL_input(__FILE__, __LINE__);
6440 auto ctx = get_ctx();
6441 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6442 auto res = isl_union_pw_aff_pullback_union_pw_multi_aff(copy(), upma.release());
6443 if (!res)
6444 exception::throw_last_error(ctx);
6445 return manage(res);
6448 union_pw_aff union_pw_aff::union_add(union_pw_aff upa2) const
6450 if (!ptr || upa2.is_null())
6451 exception::throw_NULL_input(__FILE__, __LINE__);
6452 auto ctx = get_ctx();
6453 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6454 auto res = isl_union_pw_aff_union_add(copy(), upa2.release());
6455 if (!res)
6456 exception::throw_last_error(ctx);
6457 return manage(res);
6460 // implementations for isl::union_pw_multi_aff
6461 union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr) {
6462 if (!ptr)
6463 exception::throw_NULL_input(__FILE__, __LINE__);
6464 return union_pw_multi_aff(ptr);
6466 union_pw_multi_aff manage_copy(__isl_keep isl_union_pw_multi_aff *ptr) {
6467 if (!ptr)
6468 exception::throw_NULL_input(__FILE__, __LINE__);
6469 auto ctx = isl_union_pw_multi_aff_get_ctx(ptr);
6470 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6471 ptr = isl_union_pw_multi_aff_copy(ptr);
6472 if (!ptr)
6473 exception::throw_last_error(ctx);
6474 return union_pw_multi_aff(ptr);
6477 union_pw_multi_aff::union_pw_multi_aff()
6478 : ptr(nullptr) {}
6480 union_pw_multi_aff::union_pw_multi_aff(const union_pw_multi_aff &obj)
6481 : ptr(nullptr)
6483 if (!obj.ptr)
6484 exception::throw_NULL_input(__FILE__, __LINE__);
6485 auto ctx = isl_union_pw_multi_aff_get_ctx(obj.ptr);
6486 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6487 ptr = obj.copy();
6488 if (!ptr)
6489 exception::throw_last_error(ctx);
6492 union_pw_multi_aff::union_pw_multi_aff(__isl_take isl_union_pw_multi_aff *ptr)
6493 : ptr(ptr) {}
6495 union_pw_multi_aff::union_pw_multi_aff(pw_multi_aff pma)
6497 if (pma.is_null())
6498 exception::throw_NULL_input(__FILE__, __LINE__);
6499 auto ctx = pma.get_ctx();
6500 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6501 auto res = isl_union_pw_multi_aff_from_pw_multi_aff(pma.release());
6502 if (!res)
6503 exception::throw_last_error(ctx);
6504 ptr = res;
6506 union_pw_multi_aff::union_pw_multi_aff(ctx ctx, const std::string &str)
6508 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6509 auto res = isl_union_pw_multi_aff_read_from_str(ctx.release(), str.c_str());
6510 if (!res)
6511 exception::throw_last_error(ctx);
6512 ptr = res;
6514 union_pw_multi_aff::union_pw_multi_aff(union_pw_aff upa)
6516 if (upa.is_null())
6517 exception::throw_NULL_input(__FILE__, __LINE__);
6518 auto ctx = upa.get_ctx();
6519 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6520 auto res = isl_union_pw_multi_aff_from_union_pw_aff(upa.release());
6521 if (!res)
6522 exception::throw_last_error(ctx);
6523 ptr = res;
6526 union_pw_multi_aff &union_pw_multi_aff::operator=(union_pw_multi_aff obj) {
6527 std::swap(this->ptr, obj.ptr);
6528 return *this;
6531 union_pw_multi_aff::~union_pw_multi_aff() {
6532 if (ptr)
6533 isl_union_pw_multi_aff_free(ptr);
6536 __isl_give isl_union_pw_multi_aff *union_pw_multi_aff::copy() const & {
6537 return isl_union_pw_multi_aff_copy(ptr);
6540 __isl_keep isl_union_pw_multi_aff *union_pw_multi_aff::get() const {
6541 return ptr;
6544 __isl_give isl_union_pw_multi_aff *union_pw_multi_aff::release() {
6545 isl_union_pw_multi_aff *tmp = ptr;
6546 ptr = nullptr;
6547 return tmp;
6550 bool union_pw_multi_aff::is_null() const {
6551 return ptr == nullptr;
6554 ctx union_pw_multi_aff::get_ctx() const {
6555 return ctx(isl_union_pw_multi_aff_get_ctx(ptr));
6558 union_pw_multi_aff union_pw_multi_aff::add(union_pw_multi_aff upma2) const
6560 if (!ptr || upma2.is_null())
6561 exception::throw_NULL_input(__FILE__, __LINE__);
6562 auto ctx = get_ctx();
6563 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6564 auto res = isl_union_pw_multi_aff_add(copy(), upma2.release());
6565 if (!res)
6566 exception::throw_last_error(ctx);
6567 return manage(res);
6570 union_pw_multi_aff union_pw_multi_aff::flat_range_product(union_pw_multi_aff upma2) const
6572 if (!ptr || upma2.is_null())
6573 exception::throw_NULL_input(__FILE__, __LINE__);
6574 auto ctx = get_ctx();
6575 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6576 auto res = isl_union_pw_multi_aff_flat_range_product(copy(), upma2.release());
6577 if (!res)
6578 exception::throw_last_error(ctx);
6579 return manage(res);
6582 union_pw_multi_aff union_pw_multi_aff::pullback(union_pw_multi_aff upma2) const
6584 if (!ptr || upma2.is_null())
6585 exception::throw_NULL_input(__FILE__, __LINE__);
6586 auto ctx = get_ctx();
6587 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6588 auto res = isl_union_pw_multi_aff_pullback_union_pw_multi_aff(copy(), upma2.release());
6589 if (!res)
6590 exception::throw_last_error(ctx);
6591 return manage(res);
6594 union_pw_multi_aff union_pw_multi_aff::union_add(union_pw_multi_aff upma2) const
6596 if (!ptr || upma2.is_null())
6597 exception::throw_NULL_input(__FILE__, __LINE__);
6598 auto ctx = get_ctx();
6599 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6600 auto res = isl_union_pw_multi_aff_union_add(copy(), upma2.release());
6601 if (!res)
6602 exception::throw_last_error(ctx);
6603 return manage(res);
6606 // implementations for isl::union_set
6607 union_set manage(__isl_take isl_union_set *ptr) {
6608 if (!ptr)
6609 exception::throw_NULL_input(__FILE__, __LINE__);
6610 return union_set(ptr);
6612 union_set manage_copy(__isl_keep isl_union_set *ptr) {
6613 if (!ptr)
6614 exception::throw_NULL_input(__FILE__, __LINE__);
6615 auto ctx = isl_union_set_get_ctx(ptr);
6616 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6617 ptr = isl_union_set_copy(ptr);
6618 if (!ptr)
6619 exception::throw_last_error(ctx);
6620 return union_set(ptr);
6623 union_set::union_set()
6624 : ptr(nullptr) {}
6626 union_set::union_set(const union_set &obj)
6627 : ptr(nullptr)
6629 if (!obj.ptr)
6630 exception::throw_NULL_input(__FILE__, __LINE__);
6631 auto ctx = isl_union_set_get_ctx(obj.ptr);
6632 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6633 ptr = obj.copy();
6634 if (!ptr)
6635 exception::throw_last_error(ctx);
6638 union_set::union_set(__isl_take isl_union_set *ptr)
6639 : ptr(ptr) {}
6641 union_set::union_set(basic_set bset)
6643 if (bset.is_null())
6644 exception::throw_NULL_input(__FILE__, __LINE__);
6645 auto ctx = bset.get_ctx();
6646 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6647 auto res = isl_union_set_from_basic_set(bset.release());
6648 if (!res)
6649 exception::throw_last_error(ctx);
6650 ptr = res;
6652 union_set::union_set(set set)
6654 if (set.is_null())
6655 exception::throw_NULL_input(__FILE__, __LINE__);
6656 auto ctx = set.get_ctx();
6657 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6658 auto res = isl_union_set_from_set(set.release());
6659 if (!res)
6660 exception::throw_last_error(ctx);
6661 ptr = res;
6663 union_set::union_set(point pnt)
6665 if (pnt.is_null())
6666 exception::throw_NULL_input(__FILE__, __LINE__);
6667 auto ctx = pnt.get_ctx();
6668 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6669 auto res = isl_union_set_from_point(pnt.release());
6670 if (!res)
6671 exception::throw_last_error(ctx);
6672 ptr = res;
6674 union_set::union_set(ctx ctx, const std::string &str)
6676 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6677 auto res = isl_union_set_read_from_str(ctx.release(), str.c_str());
6678 if (!res)
6679 exception::throw_last_error(ctx);
6680 ptr = res;
6683 union_set &union_set::operator=(union_set obj) {
6684 std::swap(this->ptr, obj.ptr);
6685 return *this;
6688 union_set::~union_set() {
6689 if (ptr)
6690 isl_union_set_free(ptr);
6693 __isl_give isl_union_set *union_set::copy() const & {
6694 return isl_union_set_copy(ptr);
6697 __isl_keep isl_union_set *union_set::get() const {
6698 return ptr;
6701 __isl_give isl_union_set *union_set::release() {
6702 isl_union_set *tmp = ptr;
6703 ptr = nullptr;
6704 return tmp;
6707 bool union_set::is_null() const {
6708 return ptr == nullptr;
6711 ctx union_set::get_ctx() const {
6712 return ctx(isl_union_set_get_ctx(ptr));
6715 union_set union_set::affine_hull() const
6717 if (!ptr)
6718 exception::throw_NULL_input(__FILE__, __LINE__);
6719 auto ctx = get_ctx();
6720 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6721 auto res = isl_union_set_affine_hull(copy());
6722 if (!res)
6723 exception::throw_last_error(ctx);
6724 return manage(res);
6727 union_set union_set::apply(union_map umap) const
6729 if (!ptr || umap.is_null())
6730 exception::throw_NULL_input(__FILE__, __LINE__);
6731 auto ctx = get_ctx();
6732 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6733 auto res = isl_union_set_apply(copy(), umap.release());
6734 if (!res)
6735 exception::throw_last_error(ctx);
6736 return manage(res);
6739 union_set union_set::coalesce() const
6741 if (!ptr)
6742 exception::throw_NULL_input(__FILE__, __LINE__);
6743 auto ctx = get_ctx();
6744 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6745 auto res = isl_union_set_coalesce(copy());
6746 if (!res)
6747 exception::throw_last_error(ctx);
6748 return manage(res);
6751 union_set union_set::compute_divs() const
6753 if (!ptr)
6754 exception::throw_NULL_input(__FILE__, __LINE__);
6755 auto ctx = get_ctx();
6756 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6757 auto res = isl_union_set_compute_divs(copy());
6758 if (!res)
6759 exception::throw_last_error(ctx);
6760 return manage(res);
6763 union_set union_set::detect_equalities() const
6765 if (!ptr)
6766 exception::throw_NULL_input(__FILE__, __LINE__);
6767 auto ctx = get_ctx();
6768 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6769 auto res = isl_union_set_detect_equalities(copy());
6770 if (!res)
6771 exception::throw_last_error(ctx);
6772 return manage(res);
6775 void union_set::foreach_point(const std::function<void(point)> &fn) const
6777 if (!ptr)
6778 exception::throw_NULL_input(__FILE__, __LINE__);
6779 auto ctx = get_ctx();
6780 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6781 struct fn_data {
6782 const std::function<void(point)> *func;
6783 std::exception_ptr eptr;
6784 } fn_data = { &fn };
6785 auto fn_lambda = [](isl_point *arg_0, void *arg_1) -> isl_stat {
6786 auto *data = static_cast<struct fn_data *>(arg_1);
6787 ISL_CPP_TRY {
6788 (*data->func)(manage(arg_0));
6789 return isl_stat_ok;
6790 } ISL_CPP_CATCH_ALL {
6791 data->eptr = std::current_exception();
6792 return isl_stat_error;
6795 auto res = isl_union_set_foreach_point(get(), fn_lambda, &fn_data);
6796 if (fn_data.eptr)
6797 std::rethrow_exception(fn_data.eptr);
6798 if (res < 0)
6799 exception::throw_last_error(ctx);
6800 return;
6803 void union_set::foreach_set(const std::function<void(set)> &fn) const
6805 if (!ptr)
6806 exception::throw_NULL_input(__FILE__, __LINE__);
6807 auto ctx = get_ctx();
6808 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6809 struct fn_data {
6810 const std::function<void(set)> *func;
6811 std::exception_ptr eptr;
6812 } fn_data = { &fn };
6813 auto fn_lambda = [](isl_set *arg_0, void *arg_1) -> isl_stat {
6814 auto *data = static_cast<struct fn_data *>(arg_1);
6815 ISL_CPP_TRY {
6816 (*data->func)(manage(arg_0));
6817 return isl_stat_ok;
6818 } ISL_CPP_CATCH_ALL {
6819 data->eptr = std::current_exception();
6820 return isl_stat_error;
6823 auto res = isl_union_set_foreach_set(get(), fn_lambda, &fn_data);
6824 if (fn_data.eptr)
6825 std::rethrow_exception(fn_data.eptr);
6826 if (res < 0)
6827 exception::throw_last_error(ctx);
6828 return;
6831 union_set union_set::gist(union_set context) const
6833 if (!ptr || context.is_null())
6834 exception::throw_NULL_input(__FILE__, __LINE__);
6835 auto ctx = get_ctx();
6836 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6837 auto res = isl_union_set_gist(copy(), context.release());
6838 if (!res)
6839 exception::throw_last_error(ctx);
6840 return manage(res);
6843 union_set union_set::gist_params(set set) const
6845 if (!ptr || set.is_null())
6846 exception::throw_NULL_input(__FILE__, __LINE__);
6847 auto ctx = get_ctx();
6848 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6849 auto res = isl_union_set_gist_params(copy(), set.release());
6850 if (!res)
6851 exception::throw_last_error(ctx);
6852 return manage(res);
6855 union_map union_set::identity() const
6857 if (!ptr)
6858 exception::throw_NULL_input(__FILE__, __LINE__);
6859 auto ctx = get_ctx();
6860 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6861 auto res = isl_union_set_identity(copy());
6862 if (!res)
6863 exception::throw_last_error(ctx);
6864 return manage(res);
6867 union_set union_set::intersect(union_set uset2) const
6869 if (!ptr || uset2.is_null())
6870 exception::throw_NULL_input(__FILE__, __LINE__);
6871 auto ctx = get_ctx();
6872 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6873 auto res = isl_union_set_intersect(copy(), uset2.release());
6874 if (!res)
6875 exception::throw_last_error(ctx);
6876 return manage(res);
6879 union_set union_set::intersect_params(set set) const
6881 if (!ptr || set.is_null())
6882 exception::throw_NULL_input(__FILE__, __LINE__);
6883 auto ctx = get_ctx();
6884 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6885 auto res = isl_union_set_intersect_params(copy(), set.release());
6886 if (!res)
6887 exception::throw_last_error(ctx);
6888 return manage(res);
6891 bool union_set::is_empty() const
6893 if (!ptr)
6894 exception::throw_NULL_input(__FILE__, __LINE__);
6895 auto ctx = get_ctx();
6896 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6897 auto res = isl_union_set_is_empty(get());
6898 if (res < 0)
6899 exception::throw_last_error(ctx);
6900 return res;
6903 bool union_set::is_equal(const union_set &uset2) const
6905 if (!ptr || uset2.is_null())
6906 exception::throw_NULL_input(__FILE__, __LINE__);
6907 auto ctx = get_ctx();
6908 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6909 auto res = isl_union_set_is_equal(get(), uset2.get());
6910 if (res < 0)
6911 exception::throw_last_error(ctx);
6912 return res;
6915 bool union_set::is_strict_subset(const union_set &uset2) const
6917 if (!ptr || uset2.is_null())
6918 exception::throw_NULL_input(__FILE__, __LINE__);
6919 auto ctx = get_ctx();
6920 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6921 auto res = isl_union_set_is_strict_subset(get(), uset2.get());
6922 if (res < 0)
6923 exception::throw_last_error(ctx);
6924 return res;
6927 bool union_set::is_subset(const union_set &uset2) const
6929 if (!ptr || uset2.is_null())
6930 exception::throw_NULL_input(__FILE__, __LINE__);
6931 auto ctx = get_ctx();
6932 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6933 auto res = isl_union_set_is_subset(get(), uset2.get());
6934 if (res < 0)
6935 exception::throw_last_error(ctx);
6936 return res;
6939 union_set union_set::lexmax() const
6941 if (!ptr)
6942 exception::throw_NULL_input(__FILE__, __LINE__);
6943 auto ctx = get_ctx();
6944 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6945 auto res = isl_union_set_lexmax(copy());
6946 if (!res)
6947 exception::throw_last_error(ctx);
6948 return manage(res);
6951 union_set union_set::lexmin() const
6953 if (!ptr)
6954 exception::throw_NULL_input(__FILE__, __LINE__);
6955 auto ctx = get_ctx();
6956 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6957 auto res = isl_union_set_lexmin(copy());
6958 if (!res)
6959 exception::throw_last_error(ctx);
6960 return manage(res);
6963 union_set union_set::polyhedral_hull() const
6965 if (!ptr)
6966 exception::throw_NULL_input(__FILE__, __LINE__);
6967 auto ctx = get_ctx();
6968 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6969 auto res = isl_union_set_polyhedral_hull(copy());
6970 if (!res)
6971 exception::throw_last_error(ctx);
6972 return manage(res);
6975 union_set union_set::preimage(multi_aff ma) const
6977 if (!ptr || ma.is_null())
6978 exception::throw_NULL_input(__FILE__, __LINE__);
6979 auto ctx = get_ctx();
6980 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6981 auto res = isl_union_set_preimage_multi_aff(copy(), ma.release());
6982 if (!res)
6983 exception::throw_last_error(ctx);
6984 return manage(res);
6987 union_set union_set::preimage(pw_multi_aff pma) const
6989 if (!ptr || pma.is_null())
6990 exception::throw_NULL_input(__FILE__, __LINE__);
6991 auto ctx = get_ctx();
6992 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
6993 auto res = isl_union_set_preimage_pw_multi_aff(copy(), pma.release());
6994 if (!res)
6995 exception::throw_last_error(ctx);
6996 return manage(res);
6999 union_set union_set::preimage(union_pw_multi_aff upma) const
7001 if (!ptr || upma.is_null())
7002 exception::throw_NULL_input(__FILE__, __LINE__);
7003 auto ctx = get_ctx();
7004 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7005 auto res = isl_union_set_preimage_union_pw_multi_aff(copy(), upma.release());
7006 if (!res)
7007 exception::throw_last_error(ctx);
7008 return manage(res);
7011 point union_set::sample_point() const
7013 if (!ptr)
7014 exception::throw_NULL_input(__FILE__, __LINE__);
7015 auto ctx = get_ctx();
7016 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7017 auto res = isl_union_set_sample_point(copy());
7018 if (!res)
7019 exception::throw_last_error(ctx);
7020 return manage(res);
7023 union_set union_set::subtract(union_set uset2) const
7025 if (!ptr || uset2.is_null())
7026 exception::throw_NULL_input(__FILE__, __LINE__);
7027 auto ctx = get_ctx();
7028 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7029 auto res = isl_union_set_subtract(copy(), uset2.release());
7030 if (!res)
7031 exception::throw_last_error(ctx);
7032 return manage(res);
7035 union_set union_set::unite(union_set uset2) const
7037 if (!ptr || uset2.is_null())
7038 exception::throw_NULL_input(__FILE__, __LINE__);
7039 auto ctx = get_ctx();
7040 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7041 auto res = isl_union_set_union(copy(), uset2.release());
7042 if (!res)
7043 exception::throw_last_error(ctx);
7044 return manage(res);
7047 union_map union_set::unwrap() const
7049 if (!ptr)
7050 exception::throw_NULL_input(__FILE__, __LINE__);
7051 auto ctx = get_ctx();
7052 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7053 auto res = isl_union_set_unwrap(copy());
7054 if (!res)
7055 exception::throw_last_error(ctx);
7056 return manage(res);
7059 // implementations for isl::val
7060 val manage(__isl_take isl_val *ptr) {
7061 if (!ptr)
7062 exception::throw_NULL_input(__FILE__, __LINE__);
7063 return val(ptr);
7065 val manage_copy(__isl_keep isl_val *ptr) {
7066 if (!ptr)
7067 exception::throw_NULL_input(__FILE__, __LINE__);
7068 auto ctx = isl_val_get_ctx(ptr);
7069 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7070 ptr = isl_val_copy(ptr);
7071 if (!ptr)
7072 exception::throw_last_error(ctx);
7073 return val(ptr);
7076 val::val()
7077 : ptr(nullptr) {}
7079 val::val(const val &obj)
7080 : ptr(nullptr)
7082 if (!obj.ptr)
7083 exception::throw_NULL_input(__FILE__, __LINE__);
7084 auto ctx = isl_val_get_ctx(obj.ptr);
7085 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7086 ptr = obj.copy();
7087 if (!ptr)
7088 exception::throw_last_error(ctx);
7091 val::val(__isl_take isl_val *ptr)
7092 : ptr(ptr) {}
7094 val::val(ctx ctx, const std::string &str)
7096 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7097 auto res = isl_val_read_from_str(ctx.release(), str.c_str());
7098 if (!res)
7099 exception::throw_last_error(ctx);
7100 ptr = res;
7102 val::val(ctx ctx, long i)
7104 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7105 auto res = isl_val_int_from_si(ctx.release(), i);
7106 if (!res)
7107 exception::throw_last_error(ctx);
7108 ptr = res;
7111 val &val::operator=(val obj) {
7112 std::swap(this->ptr, obj.ptr);
7113 return *this;
7116 val::~val() {
7117 if (ptr)
7118 isl_val_free(ptr);
7121 __isl_give isl_val *val::copy() const & {
7122 return isl_val_copy(ptr);
7125 __isl_keep isl_val *val::get() const {
7126 return ptr;
7129 __isl_give isl_val *val::release() {
7130 isl_val *tmp = ptr;
7131 ptr = nullptr;
7132 return tmp;
7135 bool val::is_null() const {
7136 return ptr == nullptr;
7139 ctx val::get_ctx() const {
7140 return ctx(isl_val_get_ctx(ptr));
7143 val val::abs() const
7145 if (!ptr)
7146 exception::throw_NULL_input(__FILE__, __LINE__);
7147 auto ctx = get_ctx();
7148 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7149 auto res = isl_val_abs(copy());
7150 if (!res)
7151 exception::throw_last_error(ctx);
7152 return manage(res);
7155 bool val::abs_eq(const val &v2) const
7157 if (!ptr || v2.is_null())
7158 exception::throw_NULL_input(__FILE__, __LINE__);
7159 auto ctx = get_ctx();
7160 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7161 auto res = isl_val_abs_eq(get(), v2.get());
7162 if (res < 0)
7163 exception::throw_last_error(ctx);
7164 return res;
7167 val val::add(val v2) const
7169 if (!ptr || v2.is_null())
7170 exception::throw_NULL_input(__FILE__, __LINE__);
7171 auto ctx = get_ctx();
7172 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7173 auto res = isl_val_add(copy(), v2.release());
7174 if (!res)
7175 exception::throw_last_error(ctx);
7176 return manage(res);
7179 val val::ceil() const
7181 if (!ptr)
7182 exception::throw_NULL_input(__FILE__, __LINE__);
7183 auto ctx = get_ctx();
7184 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7185 auto res = isl_val_ceil(copy());
7186 if (!res)
7187 exception::throw_last_error(ctx);
7188 return manage(res);
7191 int val::cmp_si(long i) const
7193 if (!ptr)
7194 exception::throw_NULL_input(__FILE__, __LINE__);
7195 auto ctx = get_ctx();
7196 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7197 auto res = isl_val_cmp_si(get(), i);
7198 return res;
7201 val val::div(val v2) const
7203 if (!ptr || v2.is_null())
7204 exception::throw_NULL_input(__FILE__, __LINE__);
7205 auto ctx = get_ctx();
7206 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7207 auto res = isl_val_div(copy(), v2.release());
7208 if (!res)
7209 exception::throw_last_error(ctx);
7210 return manage(res);
7213 bool val::eq(const val &v2) const
7215 if (!ptr || v2.is_null())
7216 exception::throw_NULL_input(__FILE__, __LINE__);
7217 auto ctx = get_ctx();
7218 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7219 auto res = isl_val_eq(get(), v2.get());
7220 if (res < 0)
7221 exception::throw_last_error(ctx);
7222 return res;
7225 val val::floor() const
7227 if (!ptr)
7228 exception::throw_NULL_input(__FILE__, __LINE__);
7229 auto ctx = get_ctx();
7230 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7231 auto res = isl_val_floor(copy());
7232 if (!res)
7233 exception::throw_last_error(ctx);
7234 return manage(res);
7237 val val::gcd(val v2) const
7239 if (!ptr || v2.is_null())
7240 exception::throw_NULL_input(__FILE__, __LINE__);
7241 auto ctx = get_ctx();
7242 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7243 auto res = isl_val_gcd(copy(), v2.release());
7244 if (!res)
7245 exception::throw_last_error(ctx);
7246 return manage(res);
7249 bool val::ge(const val &v2) const
7251 if (!ptr || v2.is_null())
7252 exception::throw_NULL_input(__FILE__, __LINE__);
7253 auto ctx = get_ctx();
7254 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7255 auto res = isl_val_ge(get(), v2.get());
7256 if (res < 0)
7257 exception::throw_last_error(ctx);
7258 return res;
7261 bool val::gt(const val &v2) const
7263 if (!ptr || v2.is_null())
7264 exception::throw_NULL_input(__FILE__, __LINE__);
7265 auto ctx = get_ctx();
7266 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7267 auto res = isl_val_gt(get(), v2.get());
7268 if (res < 0)
7269 exception::throw_last_error(ctx);
7270 return res;
7273 val val::infty(ctx ctx)
7275 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7276 auto res = isl_val_infty(ctx.release());
7277 if (!res)
7278 exception::throw_last_error(ctx);
7279 return manage(res);
7282 val val::inv() const
7284 if (!ptr)
7285 exception::throw_NULL_input(__FILE__, __LINE__);
7286 auto ctx = get_ctx();
7287 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7288 auto res = isl_val_inv(copy());
7289 if (!res)
7290 exception::throw_last_error(ctx);
7291 return manage(res);
7294 bool val::is_divisible_by(const val &v2) const
7296 if (!ptr || v2.is_null())
7297 exception::throw_NULL_input(__FILE__, __LINE__);
7298 auto ctx = get_ctx();
7299 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7300 auto res = isl_val_is_divisible_by(get(), v2.get());
7301 if (res < 0)
7302 exception::throw_last_error(ctx);
7303 return res;
7306 bool val::is_infty() const
7308 if (!ptr)
7309 exception::throw_NULL_input(__FILE__, __LINE__);
7310 auto ctx = get_ctx();
7311 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7312 auto res = isl_val_is_infty(get());
7313 if (res < 0)
7314 exception::throw_last_error(ctx);
7315 return res;
7318 bool val::is_int() const
7320 if (!ptr)
7321 exception::throw_NULL_input(__FILE__, __LINE__);
7322 auto ctx = get_ctx();
7323 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7324 auto res = isl_val_is_int(get());
7325 if (res < 0)
7326 exception::throw_last_error(ctx);
7327 return res;
7330 bool val::is_nan() const
7332 if (!ptr)
7333 exception::throw_NULL_input(__FILE__, __LINE__);
7334 auto ctx = get_ctx();
7335 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7336 auto res = isl_val_is_nan(get());
7337 if (res < 0)
7338 exception::throw_last_error(ctx);
7339 return res;
7342 bool val::is_neg() const
7344 if (!ptr)
7345 exception::throw_NULL_input(__FILE__, __LINE__);
7346 auto ctx = get_ctx();
7347 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7348 auto res = isl_val_is_neg(get());
7349 if (res < 0)
7350 exception::throw_last_error(ctx);
7351 return res;
7354 bool val::is_neginfty() const
7356 if (!ptr)
7357 exception::throw_NULL_input(__FILE__, __LINE__);
7358 auto ctx = get_ctx();
7359 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7360 auto res = isl_val_is_neginfty(get());
7361 if (res < 0)
7362 exception::throw_last_error(ctx);
7363 return res;
7366 bool val::is_negone() const
7368 if (!ptr)
7369 exception::throw_NULL_input(__FILE__, __LINE__);
7370 auto ctx = get_ctx();
7371 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7372 auto res = isl_val_is_negone(get());
7373 if (res < 0)
7374 exception::throw_last_error(ctx);
7375 return res;
7378 bool val::is_nonneg() const
7380 if (!ptr)
7381 exception::throw_NULL_input(__FILE__, __LINE__);
7382 auto ctx = get_ctx();
7383 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7384 auto res = isl_val_is_nonneg(get());
7385 if (res < 0)
7386 exception::throw_last_error(ctx);
7387 return res;
7390 bool val::is_nonpos() const
7392 if (!ptr)
7393 exception::throw_NULL_input(__FILE__, __LINE__);
7394 auto ctx = get_ctx();
7395 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7396 auto res = isl_val_is_nonpos(get());
7397 if (res < 0)
7398 exception::throw_last_error(ctx);
7399 return res;
7402 bool val::is_one() const
7404 if (!ptr)
7405 exception::throw_NULL_input(__FILE__, __LINE__);
7406 auto ctx = get_ctx();
7407 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7408 auto res = isl_val_is_one(get());
7409 if (res < 0)
7410 exception::throw_last_error(ctx);
7411 return res;
7414 bool val::is_pos() const
7416 if (!ptr)
7417 exception::throw_NULL_input(__FILE__, __LINE__);
7418 auto ctx = get_ctx();
7419 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7420 auto res = isl_val_is_pos(get());
7421 if (res < 0)
7422 exception::throw_last_error(ctx);
7423 return res;
7426 bool val::is_rat() const
7428 if (!ptr)
7429 exception::throw_NULL_input(__FILE__, __LINE__);
7430 auto ctx = get_ctx();
7431 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7432 auto res = isl_val_is_rat(get());
7433 if (res < 0)
7434 exception::throw_last_error(ctx);
7435 return res;
7438 bool val::is_zero() const
7440 if (!ptr)
7441 exception::throw_NULL_input(__FILE__, __LINE__);
7442 auto ctx = get_ctx();
7443 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7444 auto res = isl_val_is_zero(get());
7445 if (res < 0)
7446 exception::throw_last_error(ctx);
7447 return res;
7450 bool val::le(const val &v2) const
7452 if (!ptr || v2.is_null())
7453 exception::throw_NULL_input(__FILE__, __LINE__);
7454 auto ctx = get_ctx();
7455 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7456 auto res = isl_val_le(get(), v2.get());
7457 if (res < 0)
7458 exception::throw_last_error(ctx);
7459 return res;
7462 bool val::lt(const val &v2) const
7464 if (!ptr || v2.is_null())
7465 exception::throw_NULL_input(__FILE__, __LINE__);
7466 auto ctx = get_ctx();
7467 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7468 auto res = isl_val_lt(get(), v2.get());
7469 if (res < 0)
7470 exception::throw_last_error(ctx);
7471 return res;
7474 val val::max(val v2) const
7476 if (!ptr || v2.is_null())
7477 exception::throw_NULL_input(__FILE__, __LINE__);
7478 auto ctx = get_ctx();
7479 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7480 auto res = isl_val_max(copy(), v2.release());
7481 if (!res)
7482 exception::throw_last_error(ctx);
7483 return manage(res);
7486 val val::min(val v2) const
7488 if (!ptr || v2.is_null())
7489 exception::throw_NULL_input(__FILE__, __LINE__);
7490 auto ctx = get_ctx();
7491 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7492 auto res = isl_val_min(copy(), v2.release());
7493 if (!res)
7494 exception::throw_last_error(ctx);
7495 return manage(res);
7498 val val::mod(val v2) const
7500 if (!ptr || v2.is_null())
7501 exception::throw_NULL_input(__FILE__, __LINE__);
7502 auto ctx = get_ctx();
7503 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7504 auto res = isl_val_mod(copy(), v2.release());
7505 if (!res)
7506 exception::throw_last_error(ctx);
7507 return manage(res);
7510 val val::mul(val v2) const
7512 if (!ptr || v2.is_null())
7513 exception::throw_NULL_input(__FILE__, __LINE__);
7514 auto ctx = get_ctx();
7515 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7516 auto res = isl_val_mul(copy(), v2.release());
7517 if (!res)
7518 exception::throw_last_error(ctx);
7519 return manage(res);
7522 val val::nan(ctx ctx)
7524 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7525 auto res = isl_val_nan(ctx.release());
7526 if (!res)
7527 exception::throw_last_error(ctx);
7528 return manage(res);
7531 bool val::ne(const val &v2) const
7533 if (!ptr || v2.is_null())
7534 exception::throw_NULL_input(__FILE__, __LINE__);
7535 auto ctx = get_ctx();
7536 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7537 auto res = isl_val_ne(get(), v2.get());
7538 if (res < 0)
7539 exception::throw_last_error(ctx);
7540 return res;
7543 val val::neg() const
7545 if (!ptr)
7546 exception::throw_NULL_input(__FILE__, __LINE__);
7547 auto ctx = get_ctx();
7548 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7549 auto res = isl_val_neg(copy());
7550 if (!res)
7551 exception::throw_last_error(ctx);
7552 return manage(res);
7555 val val::neginfty(ctx ctx)
7557 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7558 auto res = isl_val_neginfty(ctx.release());
7559 if (!res)
7560 exception::throw_last_error(ctx);
7561 return manage(res);
7564 val val::negone(ctx ctx)
7566 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7567 auto res = isl_val_negone(ctx.release());
7568 if (!res)
7569 exception::throw_last_error(ctx);
7570 return manage(res);
7573 val val::one(ctx ctx)
7575 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7576 auto res = isl_val_one(ctx.release());
7577 if (!res)
7578 exception::throw_last_error(ctx);
7579 return manage(res);
7582 val val::pow2() const
7584 if (!ptr)
7585 exception::throw_NULL_input(__FILE__, __LINE__);
7586 auto ctx = get_ctx();
7587 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7588 auto res = isl_val_pow2(copy());
7589 if (!res)
7590 exception::throw_last_error(ctx);
7591 return manage(res);
7594 int val::sgn() const
7596 if (!ptr)
7597 exception::throw_NULL_input(__FILE__, __LINE__);
7598 auto ctx = get_ctx();
7599 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7600 auto res = isl_val_sgn(get());
7601 return res;
7604 val val::sub(val v2) const
7606 if (!ptr || v2.is_null())
7607 exception::throw_NULL_input(__FILE__, __LINE__);
7608 auto ctx = get_ctx();
7609 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7610 auto res = isl_val_sub(copy(), v2.release());
7611 if (!res)
7612 exception::throw_last_error(ctx);
7613 return manage(res);
7616 val val::trunc() const
7618 if (!ptr)
7619 exception::throw_NULL_input(__FILE__, __LINE__);
7620 auto ctx = get_ctx();
7621 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7622 auto res = isl_val_trunc(copy());
7623 if (!res)
7624 exception::throw_last_error(ctx);
7625 return manage(res);
7628 val val::zero(ctx ctx)
7630 options_scoped_set_on_error saved_on_error(ctx, exception::on_error);
7631 auto res = isl_val_zero(ctx.release());
7632 if (!res)
7633 exception::throw_last_error(ctx);
7634 return manage(res);
7636 } // namespace isl
7638 #endif /* ISL_CPP */