3 C<isl> is a thread-safe C library for manipulating
4 sets and relations of integer points bounded by affine constraints.
5 The descriptions of the sets and relations may involve
6 both parameters and existentially quantified variables.
7 All computations are performed in exact integer arithmetic
8 using C<GMP> or C<imath>.
9 The C<isl> library offers functionality that is similar
10 to that offered by the C<Omega> and C<Omega+> libraries,
11 but the underlying algorithms are in most cases completely different.
13 The library is by no means complete and some fairly basic
14 functionality is still missing.
15 Still, even in its current form, the library has been successfully
16 used as a backend polyhedral library for the polyhedral
17 scanner C<CLooG> and as part of an equivalence checker of
18 static affine programs.
19 For bug reports, feature requests and questions,
20 visit the discussion group at
21 L<http://groups.google.com/group/isl-development>.
23 =head2 Backward Incompatible Changes
25 =head3 Changes since isl-0.02
29 =item * The old printing functions have been deprecated
30 and replaced by C<isl_printer> functions, see L<Input and Output>.
32 =item * Most functions related to dependence analysis have acquired
33 an extra C<must> argument. To obtain the old behavior, this argument
34 should be given the value 1. See L<Dependence Analysis>.
38 =head3 Changes since isl-0.03
42 =item * The function C<isl_pw_qpolynomial_fold_add> has been
43 renamed to C<isl_pw_qpolynomial_fold_fold>.
44 Similarly, C<isl_union_pw_qpolynomial_fold_add> has been
45 renamed to C<isl_union_pw_qpolynomial_fold_fold>.
49 =head3 Changes since isl-0.04
53 =item * All header files have been renamed from C<isl_header.h>
58 =head3 Changes since isl-0.05
62 =item * The functions C<isl_printer_print_basic_set> and
63 C<isl_printer_print_basic_map> no longer print a newline.
65 =item * The functions C<isl_flow_get_no_source>
66 and C<isl_union_map_compute_flow> now return
67 the accesses for which no source could be found instead of
68 the iterations where those accesses occur.
70 =item * The functions C<isl_basic_map_identity> and
71 C<isl_map_identity> now take a B<map> space as input. An old call
72 C<isl_map_identity(space)> can be rewritten to
73 C<isl_map_identity(isl_space_map_from_set(space))>.
75 =item * The function C<isl_map_power> no longer takes
76 a parameter position as input. Instead, the exponent
77 is now expressed as the domain of the resulting relation.
81 =head3 Changes since isl-0.06
85 =item * The format of C<isl_printer_print_qpolynomial>'s
86 C<ISL_FORMAT_ISL> output has changed.
87 Use C<ISL_FORMAT_C> to obtain the old output.
89 =item * The C<*_fast_*> functions have been renamed to C<*_plain_*>.
90 Some of the old names have been kept for backward compatibility,
91 but they will be removed in the future.
95 =head3 Changes since isl-0.07
99 =item * The function C<isl_pw_aff_max> has been renamed to
100 C<isl_pw_aff_union_max>.
101 Similarly, the function C<isl_pw_aff_add> has been renamed to
102 C<isl_pw_aff_union_add>.
104 =item * The C<isl_dim> type has been renamed to C<isl_space>
105 along with the associated functions.
106 Some of the old names have been kept for backward compatibility,
107 but they will be removed in the future.
109 =item * Spaces of maps, sets and parameter domains are now
110 treated differently. The distinction between map spaces and set spaces
111 has always been made on a conceptual level, but proper use of such spaces
112 was never checked. Furthermore, up until isl-0.07 there was no way
113 of explicitly creating a parameter space. These can now be created
114 directly using C<isl_space_params_alloc> or from other spaces using
117 =item * The space in which C<isl_aff>, C<isl_pw_aff>, C<isl_qpolynomial>,
118 C<isl_pw_qpolynomial>, C<isl_qpolynomial_fold> and C<isl_pw_qpolynomial_fold>
119 objects live is now a map space
120 instead of a set space. This means, for example, that the dimensions
121 of the domain of an C<isl_aff> are now considered to be of type
122 C<isl_dim_in> instead of C<isl_dim_set>. Extra functions have been
123 added to obtain the domain space. Some of the constructors still
124 take a domain space and have therefore been renamed.
126 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
127 now take an C<isl_local_space> instead of an C<isl_space>.
128 An C<isl_local_space> can be created from an C<isl_space>
129 using C<isl_local_space_from_space>.
131 =item * The C<isl_div> type has been removed. Functions that used
132 to return an C<isl_div> now return an C<isl_aff>.
133 Note that the space of an C<isl_aff> is that of relation.
134 When replacing a call to C<isl_div_get_coefficient> by a call to
135 C<isl_aff_get_coefficient> any C<isl_dim_set> argument needs
136 to be replaced by C<isl_dim_in>.
137 A call to C<isl_aff_from_div> can be replaced by a call
139 A call to C<isl_qpolynomial_div(div)> call be replaced by
142 isl_qpolynomial_from_aff(isl_aff_floor(div))
144 The function C<isl_constraint_div> has also been renamed
145 to C<isl_constraint_get_div>.
147 =item * The C<nparam> argument has been removed from
148 C<isl_map_read_from_str> and similar functions.
149 When reading input in the original PolyLib format,
150 the result will have no parameters.
151 If parameters are expected, the caller may want to perform
152 dimension manipulation on the result.
156 =head3 Changes since isl-0.09
160 =item * The C<schedule_split_parallel> option has been replaced
161 by the C<schedule_split_scaled> option.
163 =item * The first argument of C<isl_pw_aff_cond> is now
164 an C<isl_pw_aff> instead of an C<isl_set>.
165 A call C<isl_pw_aff_cond(a, b, c)> can be replaced by
167 isl_pw_aff_cond(isl_set_indicator_function(a), b, c)
171 =head3 Changes since isl-0.10
175 =item * The functions C<isl_set_dim_has_lower_bound> and
176 C<isl_set_dim_has_upper_bound> have been renamed to
177 C<isl_set_dim_has_any_lower_bound> and
178 C<isl_set_dim_has_any_upper_bound>.
179 The new C<isl_set_dim_has_lower_bound> and
180 C<isl_set_dim_has_upper_bound> have slightly different meanings.
184 =head3 Changes since isl-0.12
188 =item * C<isl_int> has been replaced by C<isl_val>.
189 Some of the old functions are still available in C<isl/deprecated/*.h>
190 but they will be removed in the future.
192 =item * The functions C<isl_pw_qpolynomial_eval>,
193 C<isl_union_pw_qpolynomial_eval>, C<isl_pw_qpolynomial_fold_eval>
194 and C<isl_union_pw_qpolynomial_fold_eval> have been changed to return
195 an C<isl_val> instead of an C<isl_qpolynomial>.
197 =item * The function C<isl_band_member_is_zero_distance>
198 has been removed. Essentially the same functionality is available
199 through C<isl_band_member_is_coincident>, except that is requires
200 setting up coincidence constraints.
201 The option C<schedule_outer_zero_distance> has accordingly been
202 replaced by the option C<schedule_outer_coincidence>.
204 =item * The function C<isl_vertex_get_expr> has been changed
205 to return an C<isl_multi_aff> instead of a rational C<isl_basic_set>.
206 The function C<isl_vertex_get_domain> has been changed to return
207 a regular basic set, rather than a rational basic set.
211 =head3 Changes since isl-0.14
215 =item * Objects of type C<isl_union_pw_multi_aff> can no longer contain
216 two or more C<isl_pw_multi_aff> objects with the same domain space.
218 =item * The function C<isl_union_pw_multi_aff_add> now consistently
219 computes the sum on the shared definition domain.
220 The function C<isl_union_pw_multi_aff_union_add> has been added
221 to compute the sum on the union of definition domains.
222 The original behavior of C<isl_union_pw_multi_aff_add> was
223 confused and is no longer available.
229 C<isl> is released under the MIT license.
233 Permission is hereby granted, free of charge, to any person obtaining a copy of
234 this software and associated documentation files (the "Software"), to deal in
235 the Software without restriction, including without limitation the rights to
236 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
237 of the Software, and to permit persons to whom the Software is furnished to do
238 so, subject to the following conditions:
240 The above copyright notice and this permission notice shall be included in all
241 copies or substantial portions of the Software.
243 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
244 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
245 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
246 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
247 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
248 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
253 Note that by default C<isl> requires C<GMP>, which is released
254 under the GNU Lesser General Public License (LGPL). This means
255 that code linked against C<isl> is also linked against LGPL code.
257 When configuring with C<--with-int=imath>, C<isl> will link against C<imath>, a
258 library for exact integer arithmetic released under the MIT license.
262 The source of C<isl> can be obtained either as a tarball
263 or from the git repository. Both are available from
264 L<http://freshmeat.net/projects/isl/>.
265 The installation process depends on how you obtained
268 =head2 Installation from the git repository
272 =item 1 Clone or update the repository
274 The first time the source is obtained, you need to clone
277 git clone git://repo.or.cz/isl.git
279 To obtain updates, you need to pull in the latest changes
283 =item 2 Optionally get C<imath> submodule
285 To build C<isl> with C<imath>, you need to obtain the C<imath>
286 submodule by running in the git source tree of C<isl>
291 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
293 =item 2 Generate C<configure>
299 After performing the above steps, continue
300 with the L<Common installation instructions>.
302 =head2 Common installation instructions
306 =item 1 Obtain C<GMP>
308 By default, building C<isl> requires C<GMP>, including its headers files.
309 Your distribution may not provide these header files by default
310 and you may need to install a package called C<gmp-devel> or something
311 similar. Alternatively, C<GMP> can be built from
312 source, available from L<http://gmplib.org/>.
313 C<GMP> is not needed if you build C<isl> with C<imath>.
317 C<isl> uses the standard C<autoconf> C<configure> script.
322 optionally followed by some configure options.
323 A complete list of options can be obtained by running
327 Below we discuss some of the more common options.
333 Installation prefix for C<isl>
335 =item C<--with-int=[gmp|imath]>
337 Select the integer library to be used by C<isl>, the default is C<gmp>.
338 Note that C<isl> may run significantly slower if you use C<imath>.
340 =item C<--with-gmp-prefix>
342 Installation prefix for C<GMP> (architecture-independent files).
344 =item C<--with-gmp-exec-prefix>
346 Installation prefix for C<GMP> (architecture-dependent files).
354 =item 4 Install (optional)
360 =head1 Integer Set Library
362 =head2 Memory Management
364 Since a high-level operation on isl objects usually involves
365 several substeps and since the user is usually not interested in
366 the intermediate results, most functions that return a new object
367 will also release all the objects passed as arguments.
368 If the user still wants to use one or more of these arguments
369 after the function call, she should pass along a copy of the
370 object rather than the object itself.
371 The user is then responsible for making sure that the original
372 object gets used somewhere else or is explicitly freed.
374 The arguments and return values of all documented functions are
375 annotated to make clear which arguments are released and which
376 arguments are preserved. In particular, the following annotations
383 C<__isl_give> means that a new object is returned.
384 The user should make sure that the returned pointer is
385 used exactly once as a value for an C<__isl_take> argument.
386 In between, it can be used as a value for as many
387 C<__isl_keep> arguments as the user likes.
388 There is one exception, and that is the case where the
389 pointer returned is C<NULL>. Is this case, the user
390 is free to use it as an C<__isl_take> argument or not.
391 When applied to a C<char *>, the returned pointer needs to be
396 C<__isl_null> means that a C<NULL> value is returned.
400 C<__isl_take> means that the object the argument points to
401 is taken over by the function and may no longer be used
402 by the user as an argument to any other function.
403 The pointer value must be one returned by a function
404 returning an C<__isl_give> pointer.
405 If the user passes in a C<NULL> value, then this will
406 be treated as an error in the sense that the function will
407 not perform its usual operation. However, it will still
408 make sure that all the other C<__isl_take> arguments
413 C<__isl_keep> means that the function will only use the object
414 temporarily. After the function has finished, the user
415 can still use it as an argument to other functions.
416 A C<NULL> value will be treated in the same way as
417 a C<NULL> value for an C<__isl_take> argument.
418 This annotation may also be used on return values of
419 type C<const char *>, in which case the returned pointer should
420 not be freed by the user and is only valid until the object
421 from which it was derived is updated or freed.
425 =head2 Initialization
427 All manipulations of integer sets and relations occur within
428 the context of an C<isl_ctx>.
429 A given C<isl_ctx> can only be used within a single thread.
430 All arguments of a function are required to have been allocated
431 within the same context.
432 There are currently no functions available for moving an object
433 from one C<isl_ctx> to another C<isl_ctx>. This means that
434 there is currently no way of safely moving an object from one
435 thread to another, unless the whole C<isl_ctx> is moved.
437 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
438 freed using C<isl_ctx_free>.
439 All objects allocated within an C<isl_ctx> should be freed
440 before the C<isl_ctx> itself is freed.
442 isl_ctx *isl_ctx_alloc();
443 void isl_ctx_free(isl_ctx *ctx);
445 The user can impose a bound on the number of low-level I<operations>
446 that can be performed by an C<isl_ctx>. This bound can be set and
447 retrieved using the following functions. A bound of zero means that
448 no bound is imposed. The number of operations performed can be
449 reset using C<isl_ctx_reset_operations>. Note that the number
450 of low-level operations needed to perform a high-level computation
451 may differ significantly across different versions
452 of C<isl>, but it should be the same across different platforms
453 for the same version of C<isl>.
455 Warning: This feature is experimental. C<isl> has good support to abort and
456 bail out during the computation, but this feature may exercise error code paths
457 that are normally not used that much. Consequently, it is not unlikely that
458 hidden bugs will be exposed.
460 void isl_ctx_set_max_operations(isl_ctx *ctx,
461 unsigned long max_operations);
462 unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
463 void isl_ctx_reset_operations(isl_ctx *ctx);
465 In order to be able to create an object in the same context
466 as another object, most object types (described later in
467 this document) provide a function to obtain the context
468 in which the object was created.
471 isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
472 isl_ctx *isl_multi_val_get_ctx(
473 __isl_keep isl_multi_val *mv);
476 isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
478 #include <isl/local_space.h>
479 isl_ctx *isl_local_space_get_ctx(
480 __isl_keep isl_local_space *ls);
483 isl_ctx *isl_set_list_get_ctx(
484 __isl_keep isl_set_list *list);
487 isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
488 isl_ctx *isl_multi_aff_get_ctx(
489 __isl_keep isl_multi_aff *maff);
490 isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
491 isl_ctx *isl_pw_multi_aff_get_ctx(
492 __isl_keep isl_pw_multi_aff *pma);
493 isl_ctx *isl_multi_pw_aff_get_ctx(
494 __isl_keep isl_multi_pw_aff *mpa);
495 isl_ctx *isl_union_pw_multi_aff_get_ctx(
496 __isl_keep isl_union_pw_multi_aff *upma);
498 #include <isl/id_to_ast_expr.h>
499 isl_ctx *isl_id_to_ast_expr_get_ctx(
500 __isl_keep id_to_ast_expr *id2expr);
502 #include <isl/point.h>
503 isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
506 isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
509 isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
511 #include <isl/vertices.h>
512 isl_ctx *isl_vertices_get_ctx(
513 __isl_keep isl_vertices *vertices);
514 isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
515 isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
517 #include <isl/flow.h>
518 isl_ctx *isl_restriction_get_ctx(
519 __isl_keep isl_restriction *restr);
521 #include <isl/schedule.h>
522 isl_ctx *isl_schedule_constraints_get_ctx(
523 __isl_keep isl_schedule_constraints *sc);
525 #include <isl/band.h>
526 isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
528 #include <isl/ast_build.h>
529 isl_ctx *isl_ast_build_get_ctx(
530 __isl_keep isl_ast_build *build);
533 isl_ctx *isl_ast_expr_get_ctx(
534 __isl_keep isl_ast_expr *expr);
535 isl_ctx *isl_ast_node_get_ctx(
536 __isl_keep isl_ast_node *node);
540 An C<isl_val> represents an integer value, a rational value
541 or one of three special values, infinity, negative infinity and NaN.
542 Some predefined values can be created using the following functions.
545 __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
546 __isl_give isl_val *isl_val_one(isl_ctx *ctx);
547 __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
548 __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
549 __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
550 __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
552 Specific integer values can be created using the following functions.
555 __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
557 __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
559 __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
560 size_t n, size_t size, const void *chunks);
562 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
563 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
564 The least significant digit is assumed to be stored first.
566 Value objects can be copied and freed using the following functions.
569 __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
570 __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
572 They can be inspected using the following functions.
575 long isl_val_get_num_si(__isl_keep isl_val *v);
576 long isl_val_get_den_si(__isl_keep isl_val *v);
577 double isl_val_get_d(__isl_keep isl_val *v);
578 size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
580 int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
581 size_t size, void *chunks);
583 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
584 of C<size> bytes needed to store the absolute value of the
586 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
587 which is assumed to have been preallocated by the caller.
588 The least significant digit is stored first.
589 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
590 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
591 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
593 An C<isl_val> can be modified using the following function.
596 __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
599 The following unary properties are defined on C<isl_val>s.
602 int isl_val_sgn(__isl_keep isl_val *v);
603 int isl_val_is_zero(__isl_keep isl_val *v);
604 int isl_val_is_one(__isl_keep isl_val *v);
605 int isl_val_is_negone(__isl_keep isl_val *v);
606 int isl_val_is_nonneg(__isl_keep isl_val *v);
607 int isl_val_is_nonpos(__isl_keep isl_val *v);
608 int isl_val_is_pos(__isl_keep isl_val *v);
609 int isl_val_is_neg(__isl_keep isl_val *v);
610 int isl_val_is_int(__isl_keep isl_val *v);
611 int isl_val_is_rat(__isl_keep isl_val *v);
612 int isl_val_is_nan(__isl_keep isl_val *v);
613 int isl_val_is_infty(__isl_keep isl_val *v);
614 int isl_val_is_neginfty(__isl_keep isl_val *v);
616 Note that the sign of NaN is undefined.
618 The following binary properties are defined on pairs of C<isl_val>s.
621 int isl_val_lt(__isl_keep isl_val *v1,
622 __isl_keep isl_val *v2);
623 int isl_val_le(__isl_keep isl_val *v1,
624 __isl_keep isl_val *v2);
625 int isl_val_gt(__isl_keep isl_val *v1,
626 __isl_keep isl_val *v2);
627 int isl_val_ge(__isl_keep isl_val *v1,
628 __isl_keep isl_val *v2);
629 int isl_val_eq(__isl_keep isl_val *v1,
630 __isl_keep isl_val *v2);
631 int isl_val_ne(__isl_keep isl_val *v1,
632 __isl_keep isl_val *v2);
633 int isl_val_abs_eq(__isl_keep isl_val *v1,
634 __isl_keep isl_val *v2);
636 The function C<isl_val_abs_eq> checks whether its two arguments
637 are equal in absolute value.
639 For integer C<isl_val>s we additionally have the following binary property.
642 int isl_val_is_divisible_by(__isl_keep isl_val *v1,
643 __isl_keep isl_val *v2);
645 An C<isl_val> can also be compared to an integer using the following
646 function. The result is undefined for NaN.
649 int isl_val_cmp_si(__isl_keep isl_val *v, long i);
651 The following unary operations are available on C<isl_val>s.
654 __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
655 __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
656 __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
657 __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
658 __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
659 __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
660 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
662 The following binary operations are available on C<isl_val>s.
665 __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
666 __isl_take isl_val *v2);
667 __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
668 __isl_take isl_val *v2);
669 __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
670 __isl_take isl_val *v2);
671 __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
673 __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
674 __isl_take isl_val *v2);
675 __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
677 __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
678 __isl_take isl_val *v2);
679 __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
681 __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
682 __isl_take isl_val *v2);
684 On integer values, we additionally have the following operations.
687 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
688 __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
689 __isl_take isl_val *v2);
690 __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
691 __isl_take isl_val *v2);
692 __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
693 __isl_take isl_val *v2, __isl_give isl_val **x,
694 __isl_give isl_val **y);
696 The function C<isl_val_gcdext> returns the greatest common divisor g
697 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
698 that C<*x> * C<v1> + C<*y> * C<v2> = g.
700 =head3 GMP specific functions
702 These functions are only available if C<isl> has been compiled with C<GMP>
705 Specific integer and rational values can be created from C<GMP> values using
706 the following functions.
708 #include <isl/val_gmp.h>
709 __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
711 __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
712 const mpz_t n, const mpz_t d);
714 The numerator and denominator of a rational value can be extracted as
715 C<GMP> values using the following functions.
717 #include <isl/val_gmp.h>
718 int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
719 int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
721 =head2 Sets and Relations
723 C<isl> uses six types of objects for representing sets and relations,
724 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
725 C<isl_union_set> and C<isl_union_map>.
726 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
727 can be described as a conjunction of affine constraints, while
728 C<isl_set> and C<isl_map> represent unions of
729 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
730 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
731 to live in the same space. C<isl_union_set>s and C<isl_union_map>s
732 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
733 where spaces are considered different if they have a different number
734 of dimensions and/or different names (see L<"Spaces">).
735 The difference between sets and relations (maps) is that sets have
736 one set of variables, while relations have two sets of variables,
737 input variables and output variables.
739 =head2 Error Handling
741 C<isl> supports different ways to react in case a runtime error is triggered.
742 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
743 with two maps that have incompatible spaces. There are three possible ways
744 to react on error: to warn, to continue or to abort.
746 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
747 the last error in the corresponding C<isl_ctx> and the function in which the
748 error was triggered returns C<NULL>. An error does not corrupt internal state,
749 such that isl can continue to be used. C<isl> also provides functions to
750 read the last error and to reset the memory that stores the last error. The
751 last error is only stored for information purposes. Its presence does not
752 change the behavior of C<isl>. Hence, resetting an error is not required to
753 continue to use isl, but only to observe new errors.
756 enum isl_error isl_ctx_last_error(isl_ctx *ctx);
757 void isl_ctx_reset_error(isl_ctx *ctx);
759 Another option is to continue on error. This is similar to warn on error mode,
760 except that C<isl> does not print any warning. This allows a program to
761 implement its own error reporting.
763 The last option is to directly abort the execution of the program from within
764 the isl library. This makes it obviously impossible to recover from an error,
765 but it allows to directly spot the error location. By aborting on error,
766 debuggers break at the location the error occurred and can provide a stack
767 trace. Other tools that automatically provide stack traces on abort or that do
768 not want to continue execution after an error was triggered may also prefer to
771 The on error behavior of isl can be specified by calling
772 C<isl_options_set_on_error> or by setting the command line option
773 C<--isl-on-error>. Valid arguments for the function call are
774 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
775 choices for the command line option are C<warn>, C<continue> and C<abort>.
776 It is also possible to query the current error mode.
778 #include <isl/options.h>
779 int isl_options_set_on_error(isl_ctx *ctx, int val);
780 int isl_options_get_on_error(isl_ctx *ctx);
784 Identifiers are used to identify both individual dimensions
785 and tuples of dimensions. They consist of an optional name and an optional
786 user pointer. The name and the user pointer cannot both be C<NULL>, however.
787 Identifiers with the same name but different pointer values
788 are considered to be distinct.
789 Similarly, identifiers with different names but the same pointer value
790 are also considered to be distinct.
791 Equal identifiers are represented using the same object.
792 Pairs of identifiers can therefore be tested for equality using the
794 Identifiers can be constructed, copied, freed, inspected and printed
795 using the following functions.
798 __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
799 __isl_keep const char *name, void *user);
800 __isl_give isl_id *isl_id_set_free_user(
801 __isl_take isl_id *id,
802 __isl_give void (*free_user)(void *user));
803 __isl_give isl_id *isl_id_copy(isl_id *id);
804 __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
806 void *isl_id_get_user(__isl_keep isl_id *id);
807 __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
809 __isl_give isl_printer *isl_printer_print_id(
810 __isl_take isl_printer *p, __isl_keep isl_id *id);
812 The callback set by C<isl_id_set_free_user> is called on the user
813 pointer when the last reference to the C<isl_id> is freed.
814 Note that C<isl_id_get_name> returns a pointer to some internal
815 data structure, so the result can only be used while the
816 corresponding C<isl_id> is alive.
820 Whenever a new set, relation or similar object is created from scratch,
821 the space in which it lives needs to be specified using an C<isl_space>.
822 Each space involves zero or more parameters and zero, one or two
823 tuples of set or input/output dimensions. The parameters and dimensions
824 are identified by an C<isl_dim_type> and a position.
825 The type C<isl_dim_param> refers to parameters,
826 the type C<isl_dim_set> refers to set dimensions (for spaces
827 with a single tuple of dimensions) and the types C<isl_dim_in>
828 and C<isl_dim_out> refer to input and output dimensions
829 (for spaces with two tuples of dimensions).
830 Local spaces (see L</"Local Spaces">) also contain dimensions
831 of type C<isl_dim_div>.
832 Note that parameters are only identified by their position within
833 a given object. Across different objects, parameters are (usually)
834 identified by their names or identifiers. Only unnamed parameters
835 are identified by their positions across objects. The use of unnamed
836 parameters is discouraged.
838 #include <isl/space.h>
839 __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
840 unsigned nparam, unsigned n_in, unsigned n_out);
841 __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
843 __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
844 unsigned nparam, unsigned dim);
845 __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
846 __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
848 The space used for creating a parameter domain
849 needs to be created using C<isl_space_params_alloc>.
850 For other sets, the space
851 needs to be created using C<isl_space_set_alloc>, while
852 for a relation, the space
853 needs to be created using C<isl_space_alloc>.
855 To check whether a given space is that of a set or a map
856 or whether it is a parameter space, use these functions:
858 #include <isl/space.h>
859 int isl_space_is_params(__isl_keep isl_space *space);
860 int isl_space_is_set(__isl_keep isl_space *space);
861 int isl_space_is_map(__isl_keep isl_space *space);
863 Spaces can be compared using the following functions:
865 #include <isl/space.h>
866 int isl_space_is_equal(__isl_keep isl_space *space1,
867 __isl_keep isl_space *space2);
868 int isl_space_is_domain(__isl_keep isl_space *space1,
869 __isl_keep isl_space *space2);
870 int isl_space_is_range(__isl_keep isl_space *space1,
871 __isl_keep isl_space *space2);
872 int isl_space_tuple_is_equal(
873 __isl_keep isl_space *space1,
874 enum isl_dim_type type1,
875 __isl_keep isl_space *space2,
876 enum isl_dim_type type2);
878 C<isl_space_is_domain> checks whether the first argument is equal
879 to the domain of the second argument. This requires in particular that
880 the first argument is a set space and that the second argument
881 is a map space. C<isl_space_tuple_is_equal> checks whether the given
882 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
883 spaces are the same. That is, it checks if they have the same
884 identifier (if any), the same dimension and the same internal structure
887 It is often useful to create objects that live in the
888 same space as some other object. This can be accomplished
889 by creating the new objects
890 (see L</"Creating New Sets and Relations"> or
891 L</"Functions">) based on the space
892 of the original object.
895 __isl_give isl_space *isl_basic_set_get_space(
896 __isl_keep isl_basic_set *bset);
897 __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
899 #include <isl/union_set.h>
900 __isl_give isl_space *isl_union_set_get_space(
901 __isl_keep isl_union_set *uset);
904 __isl_give isl_space *isl_basic_map_get_space(
905 __isl_keep isl_basic_map *bmap);
906 __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
908 #include <isl/union_map.h>
909 __isl_give isl_space *isl_union_map_get_space(
910 __isl_keep isl_union_map *umap);
912 #include <isl/constraint.h>
913 __isl_give isl_space *isl_constraint_get_space(
914 __isl_keep isl_constraint *constraint);
916 #include <isl/polynomial.h>
917 __isl_give isl_space *isl_qpolynomial_get_domain_space(
918 __isl_keep isl_qpolynomial *qp);
919 __isl_give isl_space *isl_qpolynomial_get_space(
920 __isl_keep isl_qpolynomial *qp);
921 __isl_give isl_space *isl_qpolynomial_fold_get_space(
922 __isl_keep isl_qpolynomial_fold *fold);
923 __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
924 __isl_keep isl_pw_qpolynomial *pwqp);
925 __isl_give isl_space *isl_pw_qpolynomial_get_space(
926 __isl_keep isl_pw_qpolynomial *pwqp);
927 __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
928 __isl_keep isl_pw_qpolynomial_fold *pwf);
929 __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
930 __isl_keep isl_pw_qpolynomial_fold *pwf);
931 __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
932 __isl_keep isl_union_pw_qpolynomial *upwqp);
933 __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
934 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
937 __isl_give isl_space *isl_multi_val_get_space(
938 __isl_keep isl_multi_val *mv);
941 __isl_give isl_space *isl_aff_get_domain_space(
942 __isl_keep isl_aff *aff);
943 __isl_give isl_space *isl_aff_get_space(
944 __isl_keep isl_aff *aff);
945 __isl_give isl_space *isl_pw_aff_get_domain_space(
946 __isl_keep isl_pw_aff *pwaff);
947 __isl_give isl_space *isl_pw_aff_get_space(
948 __isl_keep isl_pw_aff *pwaff);
949 __isl_give isl_space *isl_multi_aff_get_domain_space(
950 __isl_keep isl_multi_aff *maff);
951 __isl_give isl_space *isl_multi_aff_get_space(
952 __isl_keep isl_multi_aff *maff);
953 __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
954 __isl_keep isl_pw_multi_aff *pma);
955 __isl_give isl_space *isl_pw_multi_aff_get_space(
956 __isl_keep isl_pw_multi_aff *pma);
957 __isl_give isl_space *isl_union_pw_multi_aff_get_space(
958 __isl_keep isl_union_pw_multi_aff *upma);
959 __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
960 __isl_keep isl_multi_pw_aff *mpa);
961 __isl_give isl_space *isl_multi_pw_aff_get_space(
962 __isl_keep isl_multi_pw_aff *mpa);
964 #include <isl/point.h>
965 __isl_give isl_space *isl_point_get_space(
966 __isl_keep isl_point *pnt);
968 The number of dimensions of a given type of space
969 may be read off from a space or an object that lives
970 in a space using the following functions.
971 In case of C<isl_space_dim>, type may be
972 C<isl_dim_param>, C<isl_dim_in> (only for relations),
973 C<isl_dim_out> (only for relations), C<isl_dim_set>
974 (only for sets) or C<isl_dim_all>.
976 #include <isl/space.h>
977 unsigned isl_space_dim(__isl_keep isl_space *space,
978 enum isl_dim_type type);
980 #include <isl/local_space.h>
981 int isl_local_space_dim(__isl_keep isl_local_space *ls,
982 enum isl_dim_type type);
985 unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
986 enum isl_dim_type type);
987 unsigned isl_set_dim(__isl_keep isl_set *set,
988 enum isl_dim_type type);
990 #include <isl/union_set.h>
991 unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
992 enum isl_dim_type type);
995 unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
996 enum isl_dim_type type);
997 unsigned isl_map_dim(__isl_keep isl_map *map,
998 enum isl_dim_type type);
1000 #include <isl/union_map.h>
1001 unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1002 enum isl_dim_type type);
1004 #include <isl/val.h>
1005 unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1006 enum isl_dim_type type);
1008 #include <isl/aff.h>
1009 int isl_aff_dim(__isl_keep isl_aff *aff,
1010 enum isl_dim_type type);
1011 unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1012 enum isl_dim_type type);
1013 unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1014 enum isl_dim_type type);
1015 unsigned isl_pw_multi_aff_dim(
1016 __isl_keep isl_pw_multi_aff *pma,
1017 enum isl_dim_type type);
1018 unsigned isl_multi_pw_aff_dim(
1019 __isl_keep isl_multi_pw_aff *mpa,
1020 enum isl_dim_type type);
1021 unsigned isl_union_pw_multi_aff_dim(
1022 __isl_keep isl_union_pw_multi_aff *upma,
1023 enum isl_dim_type type);
1025 #include <isl/polynomial.h>
1026 unsigned isl_union_pw_qpolynomial_dim(
1027 __isl_keep isl_union_pw_qpolynomial *upwqp,
1028 enum isl_dim_type type);
1029 unsigned isl_union_pw_qpolynomial_fold_dim(
1030 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1031 enum isl_dim_type type);
1033 Note that an C<isl_union_set>, an C<isl_union_map>,
1034 an C<isl_union_pw_multi_aff>,
1035 an C<isl_union_pw_qpolynomial> and
1036 an C<isl_union_pw_qpolynomial_fold>
1037 only have parameters.
1039 The identifiers or names of the individual dimensions of spaces
1040 may be set or read off using the following functions on spaces
1041 or objects that live in spaces.
1042 These functions are mostly useful to obtain the identifiers, positions
1043 or names of the parameters. Identifiers of individual dimensions are
1044 essentially only useful for printing. They are ignored by all other
1045 operations and may not be preserved across those operations.
1047 #include <isl/space.h>
1048 __isl_give isl_space *isl_space_set_dim_id(
1049 __isl_take isl_space *space,
1050 enum isl_dim_type type, unsigned pos,
1051 __isl_take isl_id *id);
1052 int isl_space_has_dim_id(__isl_keep isl_space *space,
1053 enum isl_dim_type type, unsigned pos);
1054 __isl_give isl_id *isl_space_get_dim_id(
1055 __isl_keep isl_space *space,
1056 enum isl_dim_type type, unsigned pos);
1057 __isl_give isl_space *isl_space_set_dim_name(
1058 __isl_take isl_space *space,
1059 enum isl_dim_type type, unsigned pos,
1060 __isl_keep const char *name);
1061 int isl_space_has_dim_name(__isl_keep isl_space *space,
1062 enum isl_dim_type type, unsigned pos);
1063 __isl_keep const char *isl_space_get_dim_name(
1064 __isl_keep isl_space *space,
1065 enum isl_dim_type type, unsigned pos);
1067 #include <isl/local_space.h>
1068 __isl_give isl_local_space *isl_local_space_set_dim_id(
1069 __isl_take isl_local_space *ls,
1070 enum isl_dim_type type, unsigned pos,
1071 __isl_take isl_id *id);
1072 int isl_local_space_has_dim_id(
1073 __isl_keep isl_local_space *ls,
1074 enum isl_dim_type type, unsigned pos);
1075 __isl_give isl_id *isl_local_space_get_dim_id(
1076 __isl_keep isl_local_space *ls,
1077 enum isl_dim_type type, unsigned pos);
1078 __isl_give isl_local_space *isl_local_space_set_dim_name(
1079 __isl_take isl_local_space *ls,
1080 enum isl_dim_type type, unsigned pos, const char *s);
1081 int isl_local_space_has_dim_name(
1082 __isl_keep isl_local_space *ls,
1083 enum isl_dim_type type, unsigned pos)
1084 const char *isl_local_space_get_dim_name(
1085 __isl_keep isl_local_space *ls,
1086 enum isl_dim_type type, unsigned pos);
1088 #include <isl/constraint.h>
1089 const char *isl_constraint_get_dim_name(
1090 __isl_keep isl_constraint *constraint,
1091 enum isl_dim_type type, unsigned pos);
1093 #include <isl/set.h>
1094 __isl_give isl_id *isl_basic_set_get_dim_id(
1095 __isl_keep isl_basic_set *bset,
1096 enum isl_dim_type type, unsigned pos);
1097 __isl_give isl_set *isl_set_set_dim_id(
1098 __isl_take isl_set *set, enum isl_dim_type type,
1099 unsigned pos, __isl_take isl_id *id);
1100 int isl_set_has_dim_id(__isl_keep isl_set *set,
1101 enum isl_dim_type type, unsigned pos);
1102 __isl_give isl_id *isl_set_get_dim_id(
1103 __isl_keep isl_set *set, enum isl_dim_type type,
1105 const char *isl_basic_set_get_dim_name(
1106 __isl_keep isl_basic_set *bset,
1107 enum isl_dim_type type, unsigned pos);
1108 int isl_set_has_dim_name(__isl_keep isl_set *set,
1109 enum isl_dim_type type, unsigned pos);
1110 const char *isl_set_get_dim_name(
1111 __isl_keep isl_set *set,
1112 enum isl_dim_type type, unsigned pos);
1114 #include <isl/map.h>
1115 __isl_give isl_map *isl_map_set_dim_id(
1116 __isl_take isl_map *map, enum isl_dim_type type,
1117 unsigned pos, __isl_take isl_id *id);
1118 int isl_basic_map_has_dim_id(
1119 __isl_keep isl_basic_map *bmap,
1120 enum isl_dim_type type, unsigned pos);
1121 int isl_map_has_dim_id(__isl_keep isl_map *map,
1122 enum isl_dim_type type, unsigned pos);
1123 __isl_give isl_id *isl_map_get_dim_id(
1124 __isl_keep isl_map *map, enum isl_dim_type type,
1126 __isl_give isl_id *isl_union_map_get_dim_id(
1127 __isl_keep isl_union_map *umap,
1128 enum isl_dim_type type, unsigned pos);
1129 const char *isl_basic_map_get_dim_name(
1130 __isl_keep isl_basic_map *bmap,
1131 enum isl_dim_type type, unsigned pos);
1132 int isl_map_has_dim_name(__isl_keep isl_map *map,
1133 enum isl_dim_type type, unsigned pos);
1134 const char *isl_map_get_dim_name(
1135 __isl_keep isl_map *map,
1136 enum isl_dim_type type, unsigned pos);
1138 #include <isl/val.h>
1139 __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1140 __isl_take isl_multi_val *mv,
1141 enum isl_dim_type type, unsigned pos,
1142 __isl_take isl_id *id);
1143 __isl_give isl_id *isl_multi_val_get_dim_id(
1144 __isl_keep isl_multi_val *mv,
1145 enum isl_dim_type type, unsigned pos);
1146 __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1147 __isl_take isl_multi_val *mv,
1148 enum isl_dim_type type, unsigned pos, const char *s);
1150 #include <isl/aff.h>
1151 __isl_give isl_aff *isl_aff_set_dim_id(
1152 __isl_take isl_aff *aff, enum isl_dim_type type,
1153 unsigned pos, __isl_take isl_id *id);
1154 __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1155 __isl_take isl_multi_aff *maff,
1156 enum isl_dim_type type, unsigned pos,
1157 __isl_take isl_id *id);
1158 __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1159 __isl_take isl_pw_aff *pma,
1160 enum isl_dim_type type, unsigned pos,
1161 __isl_take isl_id *id);
1162 __isl_give isl_multi_pw_aff *
1163 isl_multi_pw_aff_set_dim_id(
1164 __isl_take isl_multi_pw_aff *mpa,
1165 enum isl_dim_type type, unsigned pos,
1166 __isl_take isl_id *id);
1167 __isl_give isl_id *isl_multi_aff_get_dim_id(
1168 __isl_keep isl_multi_aff *ma,
1169 enum isl_dim_type type, unsigned pos);
1170 int isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1171 enum isl_dim_type type, unsigned pos);
1172 __isl_give isl_id *isl_pw_aff_get_dim_id(
1173 __isl_keep isl_pw_aff *pa,
1174 enum isl_dim_type type, unsigned pos);
1175 __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1176 __isl_keep isl_pw_multi_aff *pma,
1177 enum isl_dim_type type, unsigned pos);
1178 __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1179 __isl_keep isl_multi_pw_aff *mpa,
1180 enum isl_dim_type type, unsigned pos);
1181 __isl_give isl_aff *isl_aff_set_dim_name(
1182 __isl_take isl_aff *aff, enum isl_dim_type type,
1183 unsigned pos, const char *s);
1184 __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1185 __isl_take isl_multi_aff *maff,
1186 enum isl_dim_type type, unsigned pos, const char *s);
1187 __isl_give isl_multi_pw_aff *
1188 isl_multi_pw_aff_set_dim_name(
1189 __isl_take isl_multi_pw_aff *mpa,
1190 enum isl_dim_type type, unsigned pos, const char *s);
1191 const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1192 enum isl_dim_type type, unsigned pos);
1193 const char *isl_pw_aff_get_dim_name(
1194 __isl_keep isl_pw_aff *pa,
1195 enum isl_dim_type type, unsigned pos);
1196 const char *isl_pw_multi_aff_get_dim_name(
1197 __isl_keep isl_pw_multi_aff *pma,
1198 enum isl_dim_type type, unsigned pos);
1200 #include <isl/polynomial.h>
1201 __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1202 __isl_take isl_qpolynomial *qp,
1203 enum isl_dim_type type, unsigned pos,
1205 __isl_give isl_pw_qpolynomial *
1206 isl_pw_qpolynomial_set_dim_name(
1207 __isl_take isl_pw_qpolynomial *pwqp,
1208 enum isl_dim_type type, unsigned pos,
1210 __isl_give isl_pw_qpolynomial_fold *
1211 isl_pw_qpolynomial_fold_set_dim_name(
1212 __isl_take isl_pw_qpolynomial_fold *pwf,
1213 enum isl_dim_type type, unsigned pos,
1216 Note that C<isl_space_get_name> returns a pointer to some internal
1217 data structure, so the result can only be used while the
1218 corresponding C<isl_space> is alive.
1219 Also note that every function that operates on two sets or relations
1220 requires that both arguments have the same parameters. This also
1221 means that if one of the arguments has named parameters, then the
1222 other needs to have named parameters too and the names need to match.
1223 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1224 arguments may have different parameters (as long as they are named),
1225 in which case the result will have as parameters the union of the parameters of
1228 Given the identifier or name of a dimension (typically a parameter),
1229 its position can be obtained from the following functions.
1231 #include <isl/space.h>
1232 int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1233 enum isl_dim_type type, __isl_keep isl_id *id);
1234 int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1235 enum isl_dim_type type, const char *name);
1237 #include <isl/local_space.h>
1238 int isl_local_space_find_dim_by_name(
1239 __isl_keep isl_local_space *ls,
1240 enum isl_dim_type type, const char *name);
1242 #include <isl/val.h>
1243 int isl_multi_val_find_dim_by_id(
1244 __isl_keep isl_multi_val *mv,
1245 enum isl_dim_type type, __isl_keep isl_id *id);
1246 int isl_multi_val_find_dim_by_name(
1247 __isl_keep isl_multi_val *mv,
1248 enum isl_dim_type type, const char *name);
1250 #include <isl/set.h>
1251 int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1252 enum isl_dim_type type, __isl_keep isl_id *id);
1253 int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1254 enum isl_dim_type type, const char *name);
1256 #include <isl/map.h>
1257 int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1258 enum isl_dim_type type, __isl_keep isl_id *id);
1259 int isl_basic_map_find_dim_by_name(
1260 __isl_keep isl_basic_map *bmap,
1261 enum isl_dim_type type, const char *name);
1262 int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1263 enum isl_dim_type type, const char *name);
1264 int isl_union_map_find_dim_by_name(
1265 __isl_keep isl_union_map *umap,
1266 enum isl_dim_type type, const char *name);
1268 #include <isl/aff.h>
1269 int isl_multi_aff_find_dim_by_id(
1270 __isl_keep isl_multi_aff *ma,
1271 enum isl_dim_type type, __isl_keep isl_id *id);
1272 int isl_multi_pw_aff_find_dim_by_id(
1273 __isl_keep isl_multi_pw_aff *mpa,
1274 enum isl_dim_type type, __isl_keep isl_id *id);
1275 int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1276 enum isl_dim_type type, const char *name);
1277 int isl_multi_aff_find_dim_by_name(
1278 __isl_keep isl_multi_aff *ma,
1279 enum isl_dim_type type, const char *name);
1280 int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1281 enum isl_dim_type type, const char *name);
1282 int isl_multi_pw_aff_find_dim_by_name(
1283 __isl_keep isl_multi_pw_aff *mpa,
1284 enum isl_dim_type type, const char *name);
1285 int isl_pw_multi_aff_find_dim_by_name(
1286 __isl_keep isl_pw_multi_aff *pma,
1287 enum isl_dim_type type, const char *name);
1289 #include <isl/polynomial.h>
1290 int isl_pw_qpolynomial_find_dim_by_name(
1291 __isl_keep isl_pw_qpolynomial *pwqp,
1292 enum isl_dim_type type, const char *name);
1293 int isl_pw_qpolynomial_fold_find_dim_by_name(
1294 __isl_keep isl_pw_qpolynomial_fold *pwf,
1295 enum isl_dim_type type, const char *name);
1297 The identifiers or names of entire spaces may be set or read off
1298 using the following functions.
1300 #include <isl/space.h>
1301 __isl_give isl_space *isl_space_set_tuple_id(
1302 __isl_take isl_space *space,
1303 enum isl_dim_type type, __isl_take isl_id *id);
1304 __isl_give isl_space *isl_space_reset_tuple_id(
1305 __isl_take isl_space *space, enum isl_dim_type type);
1306 int isl_space_has_tuple_id(__isl_keep isl_space *space,
1307 enum isl_dim_type type);
1308 __isl_give isl_id *isl_space_get_tuple_id(
1309 __isl_keep isl_space *space, enum isl_dim_type type);
1310 __isl_give isl_space *isl_space_set_tuple_name(
1311 __isl_take isl_space *space,
1312 enum isl_dim_type type, const char *s);
1313 int isl_space_has_tuple_name(__isl_keep isl_space *space,
1314 enum isl_dim_type type);
1315 const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1316 enum isl_dim_type type);
1318 #include <isl/local_space.h>
1319 __isl_give isl_local_space *isl_local_space_set_tuple_id(
1320 __isl_take isl_local_space *ls,
1321 enum isl_dim_type type, __isl_take isl_id *id);
1323 #include <isl/set.h>
1324 __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1325 __isl_take isl_basic_set *bset,
1326 __isl_take isl_id *id);
1327 __isl_give isl_set *isl_set_set_tuple_id(
1328 __isl_take isl_set *set, __isl_take isl_id *id);
1329 __isl_give isl_set *isl_set_reset_tuple_id(
1330 __isl_take isl_set *set);
1331 int isl_set_has_tuple_id(__isl_keep isl_set *set);
1332 __isl_give isl_id *isl_set_get_tuple_id(
1333 __isl_keep isl_set *set);
1334 __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1335 __isl_take isl_basic_set *set, const char *s);
1336 __isl_give isl_set *isl_set_set_tuple_name(
1337 __isl_take isl_set *set, const char *s);
1338 const char *isl_basic_set_get_tuple_name(
1339 __isl_keep isl_basic_set *bset);
1340 int isl_set_has_tuple_name(__isl_keep isl_set *set);
1341 const char *isl_set_get_tuple_name(
1342 __isl_keep isl_set *set);
1344 #include <isl/map.h>
1345 __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1346 __isl_take isl_basic_map *bmap,
1347 enum isl_dim_type type, __isl_take isl_id *id);
1348 __isl_give isl_map *isl_map_set_tuple_id(
1349 __isl_take isl_map *map, enum isl_dim_type type,
1350 __isl_take isl_id *id);
1351 __isl_give isl_map *isl_map_reset_tuple_id(
1352 __isl_take isl_map *map, enum isl_dim_type type);
1353 int isl_map_has_tuple_id(__isl_keep isl_map *map,
1354 enum isl_dim_type type);
1355 __isl_give isl_id *isl_map_get_tuple_id(
1356 __isl_keep isl_map *map, enum isl_dim_type type);
1357 __isl_give isl_map *isl_map_set_tuple_name(
1358 __isl_take isl_map *map,
1359 enum isl_dim_type type, const char *s);
1360 const char *isl_basic_map_get_tuple_name(
1361 __isl_keep isl_basic_map *bmap,
1362 enum isl_dim_type type);
1363 __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1364 __isl_take isl_basic_map *bmap,
1365 enum isl_dim_type type, const char *s);
1366 int isl_map_has_tuple_name(__isl_keep isl_map *map,
1367 enum isl_dim_type type);
1368 const char *isl_map_get_tuple_name(
1369 __isl_keep isl_map *map,
1370 enum isl_dim_type type);
1372 #include <isl/val.h>
1373 __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1374 __isl_take isl_multi_val *mv,
1375 enum isl_dim_type type, __isl_take isl_id *id);
1376 __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1377 __isl_take isl_multi_val *mv,
1378 enum isl_dim_type type);
1379 int isl_multi_val_has_tuple_id(__isl_keep isl_multi_val *mv,
1380 enum isl_dim_type type);
1381 __isl_give isl_id *isl_multi_val_get_tuple_id(
1382 __isl_keep isl_multi_val *mv,
1383 enum isl_dim_type type);
1384 __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1385 __isl_take isl_multi_val *mv,
1386 enum isl_dim_type type, const char *s);
1387 const char *isl_multi_val_get_tuple_name(
1388 __isl_keep isl_multi_val *mv,
1389 enum isl_dim_type type);
1391 #include <isl/aff.h>
1392 __isl_give isl_aff *isl_aff_set_tuple_id(
1393 __isl_take isl_aff *aff,
1394 enum isl_dim_type type, __isl_take isl_id *id);
1395 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1396 __isl_take isl_multi_aff *maff,
1397 enum isl_dim_type type, __isl_take isl_id *id);
1398 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1399 __isl_take isl_pw_aff *pwaff,
1400 enum isl_dim_type type, __isl_take isl_id *id);
1401 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1402 __isl_take isl_pw_multi_aff *pma,
1403 enum isl_dim_type type, __isl_take isl_id *id);
1404 __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1405 __isl_take isl_multi_aff *ma,
1406 enum isl_dim_type type);
1407 __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1408 __isl_take isl_pw_aff *pa,
1409 enum isl_dim_type type);
1410 __isl_give isl_multi_pw_aff *
1411 isl_multi_pw_aff_reset_tuple_id(
1412 __isl_take isl_multi_pw_aff *mpa,
1413 enum isl_dim_type type);
1414 __isl_give isl_pw_multi_aff *
1415 isl_pw_multi_aff_reset_tuple_id(
1416 __isl_take isl_pw_multi_aff *pma,
1417 enum isl_dim_type type);
1418 int isl_multi_aff_has_tuple_id(__isl_keep isl_multi_aff *ma,
1419 enum isl_dim_type type);
1420 __isl_give isl_id *isl_multi_aff_get_tuple_id(
1421 __isl_keep isl_multi_aff *ma,
1422 enum isl_dim_type type);
1423 int isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1424 enum isl_dim_type type);
1425 __isl_give isl_id *isl_pw_aff_get_tuple_id(
1426 __isl_keep isl_pw_aff *pa,
1427 enum isl_dim_type type);
1428 int isl_pw_multi_aff_has_tuple_id(
1429 __isl_keep isl_pw_multi_aff *pma,
1430 enum isl_dim_type type);
1431 __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1432 __isl_keep isl_pw_multi_aff *pma,
1433 enum isl_dim_type type);
1434 int isl_multi_pw_aff_has_tuple_id(
1435 __isl_keep isl_multi_pw_aff *mpa,
1436 enum isl_dim_type type);
1437 __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1438 __isl_keep isl_multi_pw_aff *mpa,
1439 enum isl_dim_type type);
1440 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1441 __isl_take isl_multi_aff *maff,
1442 enum isl_dim_type type, const char *s);
1443 __isl_give isl_multi_pw_aff *
1444 isl_multi_pw_aff_set_tuple_name(
1445 __isl_take isl_multi_pw_aff *mpa,
1446 enum isl_dim_type type, const char *s);
1447 const char *isl_multi_aff_get_tuple_name(
1448 __isl_keep isl_multi_aff *multi,
1449 enum isl_dim_type type);
1450 int isl_pw_multi_aff_has_tuple_name(
1451 __isl_keep isl_pw_multi_aff *pma,
1452 enum isl_dim_type type);
1453 const char *isl_pw_multi_aff_get_tuple_name(
1454 __isl_keep isl_pw_multi_aff *pma,
1455 enum isl_dim_type type);
1457 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1458 or C<isl_dim_set>. As with C<isl_space_get_name>,
1459 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1461 Binary operations require the corresponding spaces of their arguments
1462 to have the same name.
1464 To keep the names of all parameters and tuples, but reset the user pointers
1465 of all the corresponding identifiers, use the following function.
1467 #include <isl/space.h>
1468 __isl_give isl_space *isl_space_reset_user(
1469 __isl_take isl_space *space);
1471 #include <isl/set.h>
1472 __isl_give isl_set *isl_set_reset_user(
1473 __isl_take isl_set *set);
1475 #include <isl/map.h>
1476 __isl_give isl_map *isl_map_reset_user(
1477 __isl_take isl_map *map);
1479 #include <isl/union_set.h>
1480 __isl_give isl_union_set *isl_union_set_reset_user(
1481 __isl_take isl_union_set *uset);
1483 #include <isl/union_map.h>
1484 __isl_give isl_union_map *isl_union_map_reset_user(
1485 __isl_take isl_union_map *umap);
1487 #include <isl/val.h>
1488 __isl_give isl_multi_val *isl_multi_val_reset_user(
1489 __isl_take isl_multi_val *mv);
1491 #include <isl/aff.h>
1492 __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1493 __isl_take isl_multi_aff *ma);
1494 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1495 __isl_take isl_multi_pw_aff *mpa);
1497 Spaces can be nested. In particular, the domain of a set or
1498 the domain or range of a relation can be a nested relation.
1499 This process is also called I<wrapping>.
1500 The functions for detecting, constructing and deconstructing
1501 such nested spaces can be found in the wrapping properties
1502 of L</"Unary Properties">, the wrapping operations
1503 of L</"Unary Operations"> and the Cartesian product operations
1504 of L</"Basic Operations">.
1506 Spaces can be created from other spaces
1507 using the functions described in L</"Unary Operations">
1508 and L</"Binary Operations">.
1512 A local space is essentially a space with
1513 zero or more existentially quantified variables.
1514 The local space of various objects can be obtained
1515 using the following functions.
1517 #include <isl/constraint.h>
1518 __isl_give isl_local_space *isl_constraint_get_local_space(
1519 __isl_keep isl_constraint *constraint);
1521 #include <isl/set.h>
1522 __isl_give isl_local_space *isl_basic_set_get_local_space(
1523 __isl_keep isl_basic_set *bset);
1525 #include <isl/map.h>
1526 __isl_give isl_local_space *isl_basic_map_get_local_space(
1527 __isl_keep isl_basic_map *bmap);
1529 #include <isl/aff.h>
1530 __isl_give isl_local_space *isl_aff_get_domain_local_space(
1531 __isl_keep isl_aff *aff);
1532 __isl_give isl_local_space *isl_aff_get_local_space(
1533 __isl_keep isl_aff *aff);
1535 A new local space can be created from a space using
1537 #include <isl/local_space.h>
1538 __isl_give isl_local_space *isl_local_space_from_space(
1539 __isl_take isl_space *space);
1541 They can be inspected, modified, copied and freed using the following functions.
1543 #include <isl/local_space.h>
1544 int isl_local_space_is_params(
1545 __isl_keep isl_local_space *ls);
1546 int isl_local_space_is_set(__isl_keep isl_local_space *ls);
1547 __isl_give isl_space *isl_local_space_get_space(
1548 __isl_keep isl_local_space *ls);
1549 __isl_give isl_aff *isl_local_space_get_div(
1550 __isl_keep isl_local_space *ls, int pos);
1551 __isl_give isl_local_space *isl_local_space_copy(
1552 __isl_keep isl_local_space *ls);
1553 __isl_null isl_local_space *isl_local_space_free(
1554 __isl_take isl_local_space *ls);
1556 Note that C<isl_local_space_get_div> can only be used on local spaces
1559 Two local spaces can be compared using
1561 int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
1562 __isl_keep isl_local_space *ls2);
1564 Local spaces can be created from other local spaces
1565 using the functions described in L</"Unary Operations">
1566 and L</"Binary Operations">.
1568 =head2 Creating New Sets and Relations
1570 C<isl> has functions for creating some standard sets and relations.
1574 =item * Empty sets and relations
1576 __isl_give isl_basic_set *isl_basic_set_empty(
1577 __isl_take isl_space *space);
1578 __isl_give isl_basic_map *isl_basic_map_empty(
1579 __isl_take isl_space *space);
1580 __isl_give isl_set *isl_set_empty(
1581 __isl_take isl_space *space);
1582 __isl_give isl_map *isl_map_empty(
1583 __isl_take isl_space *space);
1584 __isl_give isl_union_set *isl_union_set_empty(
1585 __isl_take isl_space *space);
1586 __isl_give isl_union_map *isl_union_map_empty(
1587 __isl_take isl_space *space);
1589 For C<isl_union_set>s and C<isl_union_map>s, the space
1590 is only used to specify the parameters.
1592 =item * Universe sets and relations
1594 __isl_give isl_basic_set *isl_basic_set_universe(
1595 __isl_take isl_space *space);
1596 __isl_give isl_basic_map *isl_basic_map_universe(
1597 __isl_take isl_space *space);
1598 __isl_give isl_set *isl_set_universe(
1599 __isl_take isl_space *space);
1600 __isl_give isl_map *isl_map_universe(
1601 __isl_take isl_space *space);
1602 __isl_give isl_union_set *isl_union_set_universe(
1603 __isl_take isl_union_set *uset);
1604 __isl_give isl_union_map *isl_union_map_universe(
1605 __isl_take isl_union_map *umap);
1607 The sets and relations constructed by the functions above
1608 contain all integer values, while those constructed by the
1609 functions below only contain non-negative values.
1611 __isl_give isl_basic_set *isl_basic_set_nat_universe(
1612 __isl_take isl_space *space);
1613 __isl_give isl_basic_map *isl_basic_map_nat_universe(
1614 __isl_take isl_space *space);
1615 __isl_give isl_set *isl_set_nat_universe(
1616 __isl_take isl_space *space);
1617 __isl_give isl_map *isl_map_nat_universe(
1618 __isl_take isl_space *space);
1620 =item * Identity relations
1622 __isl_give isl_basic_map *isl_basic_map_identity(
1623 __isl_take isl_space *space);
1624 __isl_give isl_map *isl_map_identity(
1625 __isl_take isl_space *space);
1627 The number of input and output dimensions in C<space> needs
1630 =item * Lexicographic order
1632 __isl_give isl_map *isl_map_lex_lt(
1633 __isl_take isl_space *set_space);
1634 __isl_give isl_map *isl_map_lex_le(
1635 __isl_take isl_space *set_space);
1636 __isl_give isl_map *isl_map_lex_gt(
1637 __isl_take isl_space *set_space);
1638 __isl_give isl_map *isl_map_lex_ge(
1639 __isl_take isl_space *set_space);
1640 __isl_give isl_map *isl_map_lex_lt_first(
1641 __isl_take isl_space *space, unsigned n);
1642 __isl_give isl_map *isl_map_lex_le_first(
1643 __isl_take isl_space *space, unsigned n);
1644 __isl_give isl_map *isl_map_lex_gt_first(
1645 __isl_take isl_space *space, unsigned n);
1646 __isl_give isl_map *isl_map_lex_ge_first(
1647 __isl_take isl_space *space, unsigned n);
1649 The first four functions take a space for a B<set>
1650 and return relations that express that the elements in the domain
1651 are lexicographically less
1652 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1653 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1654 than the elements in the range.
1655 The last four functions take a space for a map
1656 and return relations that express that the first C<n> dimensions
1657 in the domain are lexicographically less
1658 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1659 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1660 than the first C<n> dimensions in the range.
1664 A basic set or relation can be converted to a set or relation
1665 using the following functions.
1667 __isl_give isl_set *isl_set_from_basic_set(
1668 __isl_take isl_basic_set *bset);
1669 __isl_give isl_map *isl_map_from_basic_map(
1670 __isl_take isl_basic_map *bmap);
1672 Sets and relations can be converted to union sets and relations
1673 using the following functions.
1675 __isl_give isl_union_set *isl_union_set_from_basic_set(
1676 __isl_take isl_basic_set *bset);
1677 __isl_give isl_union_map *isl_union_map_from_basic_map(
1678 __isl_take isl_basic_map *bmap);
1679 __isl_give isl_union_set *isl_union_set_from_set(
1680 __isl_take isl_set *set);
1681 __isl_give isl_union_map *isl_union_map_from_map(
1682 __isl_take isl_map *map);
1684 The inverse conversions below can only be used if the input
1685 union set or relation is known to contain elements in exactly one
1688 __isl_give isl_set *isl_set_from_union_set(
1689 __isl_take isl_union_set *uset);
1690 __isl_give isl_map *isl_map_from_union_map(
1691 __isl_take isl_union_map *umap);
1693 Sets and relations can be copied and freed again using the following
1696 __isl_give isl_basic_set *isl_basic_set_copy(
1697 __isl_keep isl_basic_set *bset);
1698 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1699 __isl_give isl_union_set *isl_union_set_copy(
1700 __isl_keep isl_union_set *uset);
1701 __isl_give isl_basic_map *isl_basic_map_copy(
1702 __isl_keep isl_basic_map *bmap);
1703 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1704 __isl_give isl_union_map *isl_union_map_copy(
1705 __isl_keep isl_union_map *umap);
1706 __isl_null isl_basic_set *isl_basic_set_free(
1707 __isl_take isl_basic_set *bset);
1708 __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1709 __isl_null isl_union_set *isl_union_set_free(
1710 __isl_take isl_union_set *uset);
1711 __isl_null isl_basic_map *isl_basic_map_free(
1712 __isl_take isl_basic_map *bmap);
1713 __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1714 __isl_null isl_union_map *isl_union_map_free(
1715 __isl_take isl_union_map *umap);
1717 Other sets and relations can be constructed by starting
1718 from a universe set or relation, adding equality and/or
1719 inequality constraints and then projecting out the
1720 existentially quantified variables, if any.
1721 Constraints can be constructed, manipulated and
1722 added to (or removed from) (basic) sets and relations
1723 using the following functions.
1725 #include <isl/constraint.h>
1726 __isl_give isl_constraint *isl_equality_alloc(
1727 __isl_take isl_local_space *ls);
1728 __isl_give isl_constraint *isl_inequality_alloc(
1729 __isl_take isl_local_space *ls);
1730 __isl_give isl_constraint *isl_constraint_set_constant_si(
1731 __isl_take isl_constraint *constraint, int v);
1732 __isl_give isl_constraint *isl_constraint_set_constant_val(
1733 __isl_take isl_constraint *constraint,
1734 __isl_take isl_val *v);
1735 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1736 __isl_take isl_constraint *constraint,
1737 enum isl_dim_type type, int pos, int v);
1738 __isl_give isl_constraint *
1739 isl_constraint_set_coefficient_val(
1740 __isl_take isl_constraint *constraint,
1741 enum isl_dim_type type, int pos,
1742 __isl_take isl_val *v);
1743 __isl_give isl_basic_map *isl_basic_map_add_constraint(
1744 __isl_take isl_basic_map *bmap,
1745 __isl_take isl_constraint *constraint);
1746 __isl_give isl_basic_set *isl_basic_set_add_constraint(
1747 __isl_take isl_basic_set *bset,
1748 __isl_take isl_constraint *constraint);
1749 __isl_give isl_map *isl_map_add_constraint(
1750 __isl_take isl_map *map,
1751 __isl_take isl_constraint *constraint);
1752 __isl_give isl_set *isl_set_add_constraint(
1753 __isl_take isl_set *set,
1754 __isl_take isl_constraint *constraint);
1755 __isl_give isl_basic_set *isl_basic_set_drop_constraint(
1756 __isl_take isl_basic_set *bset,
1757 __isl_take isl_constraint *constraint);
1759 For example, to create a set containing the even integers
1760 between 10 and 42, you would use the following code.
1763 isl_local_space *ls;
1765 isl_basic_set *bset;
1767 space = isl_space_set_alloc(ctx, 0, 2);
1768 bset = isl_basic_set_universe(isl_space_copy(space));
1769 ls = isl_local_space_from_space(space);
1771 c = isl_equality_alloc(isl_local_space_copy(ls));
1772 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1773 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1774 bset = isl_basic_set_add_constraint(bset, c);
1776 c = isl_inequality_alloc(isl_local_space_copy(ls));
1777 c = isl_constraint_set_constant_si(c, -10);
1778 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1779 bset = isl_basic_set_add_constraint(bset, c);
1781 c = isl_inequality_alloc(ls);
1782 c = isl_constraint_set_constant_si(c, 42);
1783 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1784 bset = isl_basic_set_add_constraint(bset, c);
1786 bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1790 isl_basic_set *bset;
1791 bset = isl_basic_set_read_from_str(ctx,
1792 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1794 A basic set or relation can also be constructed from two matrices
1795 describing the equalities and the inequalities.
1797 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1798 __isl_take isl_space *space,
1799 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1800 enum isl_dim_type c1,
1801 enum isl_dim_type c2, enum isl_dim_type c3,
1802 enum isl_dim_type c4);
1803 __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1804 __isl_take isl_space *space,
1805 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1806 enum isl_dim_type c1,
1807 enum isl_dim_type c2, enum isl_dim_type c3,
1808 enum isl_dim_type c4, enum isl_dim_type c5);
1810 The C<isl_dim_type> arguments indicate the order in which
1811 different kinds of variables appear in the input matrices
1812 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1813 C<isl_dim_set> and C<isl_dim_div> for sets and
1814 of C<isl_dim_cst>, C<isl_dim_param>,
1815 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1817 A (basic or union) set or relation can also be constructed from a
1818 (union) (piecewise) (multiple) affine expression
1819 or a list of affine expressions
1820 (See L</"Functions">).
1822 __isl_give isl_basic_map *isl_basic_map_from_aff(
1823 __isl_take isl_aff *aff);
1824 __isl_give isl_map *isl_map_from_aff(
1825 __isl_take isl_aff *aff);
1826 __isl_give isl_set *isl_set_from_pw_aff(
1827 __isl_take isl_pw_aff *pwaff);
1828 __isl_give isl_map *isl_map_from_pw_aff(
1829 __isl_take isl_pw_aff *pwaff);
1830 __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1831 __isl_take isl_space *domain_space,
1832 __isl_take isl_aff_list *list);
1833 __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
1834 __isl_take isl_multi_aff *maff)
1835 __isl_give isl_map *isl_map_from_multi_aff(
1836 __isl_take isl_multi_aff *maff)
1837 __isl_give isl_set *isl_set_from_pw_multi_aff(
1838 __isl_take isl_pw_multi_aff *pma);
1839 __isl_give isl_map *isl_map_from_pw_multi_aff(
1840 __isl_take isl_pw_multi_aff *pma);
1841 __isl_give isl_set *isl_set_from_multi_pw_aff(
1842 __isl_take isl_multi_pw_aff *mpa);
1843 __isl_give isl_map *isl_map_from_multi_pw_aff(
1844 __isl_take isl_multi_pw_aff *mpa);
1845 __isl_give isl_union_map *
1846 isl_union_map_from_union_pw_multi_aff(
1847 __isl_take isl_union_pw_multi_aff *upma);
1849 The C<domain_space> argument describes the domain of the resulting
1850 basic relation. It is required because the C<list> may consist
1851 of zero affine expressions.
1853 =head2 Inspecting Sets and Relations
1855 Usually, the user should not have to care about the actual constraints
1856 of the sets and maps, but should instead apply the abstract operations
1857 explained in the following sections.
1858 Occasionally, however, it may be required to inspect the individual
1859 coefficients of the constraints. This section explains how to do so.
1860 In these cases, it may also be useful to have C<isl> compute
1861 an explicit representation of the existentially quantified variables.
1863 __isl_give isl_set *isl_set_compute_divs(
1864 __isl_take isl_set *set);
1865 __isl_give isl_map *isl_map_compute_divs(
1866 __isl_take isl_map *map);
1867 __isl_give isl_union_set *isl_union_set_compute_divs(
1868 __isl_take isl_union_set *uset);
1869 __isl_give isl_union_map *isl_union_map_compute_divs(
1870 __isl_take isl_union_map *umap);
1872 This explicit representation defines the existentially quantified
1873 variables as integer divisions of the other variables, possibly
1874 including earlier existentially quantified variables.
1875 An explicitly represented existentially quantified variable therefore
1876 has a unique value when the values of the other variables are known.
1877 If, furthermore, the same existentials, i.e., existentials
1878 with the same explicit representations, should appear in the
1879 same order in each of the disjuncts of a set or map, then the user should call
1880 either of the following functions.
1882 __isl_give isl_set *isl_set_align_divs(
1883 __isl_take isl_set *set);
1884 __isl_give isl_map *isl_map_align_divs(
1885 __isl_take isl_map *map);
1887 Alternatively, the existentially quantified variables can be removed
1888 using the following functions, which compute an overapproximation.
1890 __isl_give isl_basic_set *isl_basic_set_remove_divs(
1891 __isl_take isl_basic_set *bset);
1892 __isl_give isl_basic_map *isl_basic_map_remove_divs(
1893 __isl_take isl_basic_map *bmap);
1894 __isl_give isl_set *isl_set_remove_divs(
1895 __isl_take isl_set *set);
1896 __isl_give isl_map *isl_map_remove_divs(
1897 __isl_take isl_map *map);
1899 It is also possible to only remove those divs that are defined
1900 in terms of a given range of dimensions or only those for which
1901 no explicit representation is known.
1903 __isl_give isl_basic_set *
1904 isl_basic_set_remove_divs_involving_dims(
1905 __isl_take isl_basic_set *bset,
1906 enum isl_dim_type type,
1907 unsigned first, unsigned n);
1908 __isl_give isl_basic_map *
1909 isl_basic_map_remove_divs_involving_dims(
1910 __isl_take isl_basic_map *bmap,
1911 enum isl_dim_type type,
1912 unsigned first, unsigned n);
1913 __isl_give isl_set *isl_set_remove_divs_involving_dims(
1914 __isl_take isl_set *set, enum isl_dim_type type,
1915 unsigned first, unsigned n);
1916 __isl_give isl_map *isl_map_remove_divs_involving_dims(
1917 __isl_take isl_map *map, enum isl_dim_type type,
1918 unsigned first, unsigned n);
1920 __isl_give isl_basic_set *
1921 isl_basic_set_remove_unknown_divs(
1922 __isl_take isl_basic_set *bset);
1923 __isl_give isl_set *isl_set_remove_unknown_divs(
1924 __isl_take isl_set *set);
1925 __isl_give isl_map *isl_map_remove_unknown_divs(
1926 __isl_take isl_map *map);
1928 To iterate over all the sets or maps in a union set or map, use
1930 int isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
1931 int (*fn)(__isl_take isl_set *set, void *user),
1933 int isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
1934 int (*fn)(__isl_take isl_map *map, void *user),
1937 The number of sets or maps in a union set or map can be obtained
1940 int isl_union_set_n_set(__isl_keep isl_union_set *uset);
1941 int isl_union_map_n_map(__isl_keep isl_union_map *umap);
1943 To extract the set or map in a given space from a union, use
1945 __isl_give isl_set *isl_union_set_extract_set(
1946 __isl_keep isl_union_set *uset,
1947 __isl_take isl_space *space);
1948 __isl_give isl_map *isl_union_map_extract_map(
1949 __isl_keep isl_union_map *umap,
1950 __isl_take isl_space *space);
1952 To iterate over all the basic sets or maps in a set or map, use
1954 int isl_set_foreach_basic_set(__isl_keep isl_set *set,
1955 int (*fn)(__isl_take isl_basic_set *bset, void *user),
1957 int isl_map_foreach_basic_map(__isl_keep isl_map *map,
1958 int (*fn)(__isl_take isl_basic_map *bmap, void *user),
1961 The callback function C<fn> should return 0 if successful and
1962 -1 if an error occurs. In the latter case, or if any other error
1963 occurs, the above functions will return -1.
1965 It should be noted that C<isl> does not guarantee that
1966 the basic sets or maps passed to C<fn> are disjoint.
1967 If this is required, then the user should call one of
1968 the following functions first.
1970 __isl_give isl_set *isl_set_make_disjoint(
1971 __isl_take isl_set *set);
1972 __isl_give isl_map *isl_map_make_disjoint(
1973 __isl_take isl_map *map);
1975 The number of basic sets in a set can be obtained
1976 or the number of basic maps in a map can be obtained
1979 #include <isl/set.h>
1980 int isl_set_n_basic_set(__isl_keep isl_set *set);
1982 #include <isl/map.h>
1983 int isl_map_n_basic_map(__isl_keep isl_map *map);
1985 To iterate over the constraints of a basic set or map, use
1987 #include <isl/constraint.h>
1989 int isl_basic_set_n_constraint(
1990 __isl_keep isl_basic_set *bset);
1991 int isl_basic_set_foreach_constraint(
1992 __isl_keep isl_basic_set *bset,
1993 int (*fn)(__isl_take isl_constraint *c, void *user),
1995 int isl_basic_map_n_constraint(
1996 __isl_keep isl_basic_map *bmap);
1997 int isl_basic_map_foreach_constraint(
1998 __isl_keep isl_basic_map *bmap,
1999 int (*fn)(__isl_take isl_constraint *c, void *user),
2001 __isl_null isl_constraint *isl_constraint_free(
2002 __isl_take isl_constraint *c);
2004 Again, the callback function C<fn> should return 0 if successful and
2005 -1 if an error occurs. In the latter case, or if any other error
2006 occurs, the above functions will return -1.
2007 The constraint C<c> represents either an equality or an inequality.
2008 Use the following function to find out whether a constraint
2009 represents an equality. If not, it represents an inequality.
2011 int isl_constraint_is_equality(
2012 __isl_keep isl_constraint *constraint);
2014 It is also possible to obtain a list of constraints from a basic
2017 #include <isl/constraint.h>
2018 __isl_give isl_constraint_list *
2019 isl_basic_map_get_constraint_list(
2020 __isl_keep isl_basic_map *bmap);
2021 __isl_give isl_constraint_list *
2022 isl_basic_set_get_constraint_list(
2023 __isl_keep isl_basic_set *bset);
2025 These functions require that all existentially quantified variables
2026 have an explicit representation.
2027 The returned list can be manipulated using the functions in L<"Lists">.
2029 The coefficients of the constraints can be inspected using
2030 the following functions.
2032 int isl_constraint_is_lower_bound(
2033 __isl_keep isl_constraint *constraint,
2034 enum isl_dim_type type, unsigned pos);
2035 int isl_constraint_is_upper_bound(
2036 __isl_keep isl_constraint *constraint,
2037 enum isl_dim_type type, unsigned pos);
2038 __isl_give isl_val *isl_constraint_get_constant_val(
2039 __isl_keep isl_constraint *constraint);
2040 __isl_give isl_val *isl_constraint_get_coefficient_val(
2041 __isl_keep isl_constraint *constraint,
2042 enum isl_dim_type type, int pos);
2044 The explicit representations of the existentially quantified
2045 variables can be inspected using the following function.
2046 Note that the user is only allowed to use this function
2047 if the inspected set or map is the result of a call
2048 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2049 The existentially quantified variable is equal to the floor
2050 of the returned affine expression. The affine expression
2051 itself can be inspected using the functions in
2054 __isl_give isl_aff *isl_constraint_get_div(
2055 __isl_keep isl_constraint *constraint, int pos);
2057 To obtain the constraints of a basic set or map in matrix
2058 form, use the following functions.
2060 __isl_give isl_mat *isl_basic_set_equalities_matrix(
2061 __isl_keep isl_basic_set *bset,
2062 enum isl_dim_type c1, enum isl_dim_type c2,
2063 enum isl_dim_type c3, enum isl_dim_type c4);
2064 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2065 __isl_keep isl_basic_set *bset,
2066 enum isl_dim_type c1, enum isl_dim_type c2,
2067 enum isl_dim_type c3, enum isl_dim_type c4);
2068 __isl_give isl_mat *isl_basic_map_equalities_matrix(
2069 __isl_keep isl_basic_map *bmap,
2070 enum isl_dim_type c1,
2071 enum isl_dim_type c2, enum isl_dim_type c3,
2072 enum isl_dim_type c4, enum isl_dim_type c5);
2073 __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2074 __isl_keep isl_basic_map *bmap,
2075 enum isl_dim_type c1,
2076 enum isl_dim_type c2, enum isl_dim_type c3,
2077 enum isl_dim_type c4, enum isl_dim_type c5);
2079 The C<isl_dim_type> arguments dictate the order in which
2080 different kinds of variables appear in the resulting matrix.
2081 For set inputs, they should be a permutation of
2082 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2083 For map inputs, they should be a permutation of
2084 C<isl_dim_cst>, C<isl_dim_param>,
2085 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2089 Points are elements of a set. They can be used to construct
2090 simple sets (boxes) or they can be used to represent the
2091 individual elements of a set.
2092 The zero point (the origin) can be created using
2094 __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2096 The coordinates of a point can be inspected, set and changed
2099 __isl_give isl_val *isl_point_get_coordinate_val(
2100 __isl_keep isl_point *pnt,
2101 enum isl_dim_type type, int pos);
2102 __isl_give isl_point *isl_point_set_coordinate_val(
2103 __isl_take isl_point *pnt,
2104 enum isl_dim_type type, int pos,
2105 __isl_take isl_val *v);
2107 __isl_give isl_point *isl_point_add_ui(
2108 __isl_take isl_point *pnt,
2109 enum isl_dim_type type, int pos, unsigned val);
2110 __isl_give isl_point *isl_point_sub_ui(
2111 __isl_take isl_point *pnt,
2112 enum isl_dim_type type, int pos, unsigned val);
2114 Points can be copied or freed using
2116 __isl_give isl_point *isl_point_copy(
2117 __isl_keep isl_point *pnt);
2118 void isl_point_free(__isl_take isl_point *pnt);
2120 A singleton set can be created from a point using
2122 __isl_give isl_basic_set *isl_basic_set_from_point(
2123 __isl_take isl_point *pnt);
2124 __isl_give isl_set *isl_set_from_point(
2125 __isl_take isl_point *pnt);
2127 and a box can be created from two opposite extremal points using
2129 __isl_give isl_basic_set *isl_basic_set_box_from_points(
2130 __isl_take isl_point *pnt1,
2131 __isl_take isl_point *pnt2);
2132 __isl_give isl_set *isl_set_box_from_points(
2133 __isl_take isl_point *pnt1,
2134 __isl_take isl_point *pnt2);
2136 All elements of a B<bounded> (union) set can be enumerated using
2137 the following functions.
2139 int isl_set_foreach_point(__isl_keep isl_set *set,
2140 int (*fn)(__isl_take isl_point *pnt, void *user),
2142 int isl_union_set_foreach_point(__isl_keep isl_union_set *uset,
2143 int (*fn)(__isl_take isl_point *pnt, void *user),
2146 The function C<fn> is called for each integer point in
2147 C<set> with as second argument the last argument of
2148 the C<isl_set_foreach_point> call. The function C<fn>
2149 should return C<0> on success and C<-1> on failure.
2150 In the latter case, C<isl_set_foreach_point> will stop
2151 enumerating and return C<-1> as well.
2152 If the enumeration is performed successfully and to completion,
2153 then C<isl_set_foreach_point> returns C<0>.
2155 To obtain a single point of a (basic) set, use
2157 __isl_give isl_point *isl_basic_set_sample_point(
2158 __isl_take isl_basic_set *bset);
2159 __isl_give isl_point *isl_set_sample_point(
2160 __isl_take isl_set *set);
2162 If C<set> does not contain any (integer) points, then the
2163 resulting point will be ``void'', a property that can be
2166 int isl_point_is_void(__isl_keep isl_point *pnt);
2170 Besides sets and relation, C<isl> also supports various types of functions.
2171 Each of these types is derived from the value type (see L</"Values">)
2172 or from one of two primitive function types
2173 through the application of zero or more type constructors.
2174 We first describe the primitive type and then we describe
2175 the types derived from these primitive types.
2177 =head3 Primitive Functions
2179 C<isl> support two primitive function types, quasi-affine
2180 expressions and quasipolynomials.
2181 A quasi-affine expression is defined either over a parameter
2182 space or over a set and is composed of integer constants,
2183 parameters and set variables, addition, subtraction and
2184 integer division by an integer constant.
2185 For example, the quasi-affine expression
2187 [n] -> { [x] -> [2*floor((4 n + x)/9] }
2189 maps C<x> to C<2*floor((4 n + x)/9>.
2190 A quasipolynomial is a polynomial expression in quasi-affine
2191 expression. That is, it additionally allows for multiplication.
2192 Note, though, that it is not allowed to construct an integer
2193 division of an expression involving multiplications.
2194 Here is an example of a quasipolynomial that is not
2195 quasi-affine expression
2197 [n] -> { [x] -> (n*floor((4 n + x)/9) }
2199 Note that the external representations of quasi-affine expressions
2200 and quasipolynomials are different. Quasi-affine expressions
2201 use a notation with square brackets just like binary relations,
2202 while quasipolynomials do not. This might change at some point.
2204 If a primitive function is defined over a parameter space,
2205 then the space of the function itself is that of a set.
2206 If it is defined over a set, then the space of the function
2207 is that of a relation. In both cases, the set space (or
2208 the output space) is single-dimensional, anonymous and unstructured.
2209 To create functions with multiple dimensions or with other kinds
2210 of set or output spaces, use multiple expressions
2211 (see L</"Multiple Expressions">).
2215 =item * Quasi-affine Expressions
2217 Besides the expressions described above, a quasi-affine
2218 expression can also be set to NaN. Such expressions
2219 typically represent a failure to represent a result
2220 as a quasi-affine expression.
2222 The zero quasi affine expression or the quasi affine expression
2223 that is equal to a given value or
2224 a specified dimension on a given domain can be created using
2226 #include <isl/aff.h>
2227 __isl_give isl_aff *isl_aff_zero_on_domain(
2228 __isl_take isl_local_space *ls);
2229 __isl_give isl_aff *isl_aff_val_on_domain(
2230 __isl_take isl_local_space *ls,
2231 __isl_take isl_val *val);
2232 __isl_give isl_aff *isl_aff_var_on_domain(
2233 __isl_take isl_local_space *ls,
2234 enum isl_dim_type type, unsigned pos);
2235 __isl_give isl_aff *isl_aff_nan_on_domain(
2236 __isl_take isl_local_space *ls);
2238 Quasi affine expressions can be copied and freed using
2240 #include <isl/aff.h>
2241 __isl_give isl_aff *isl_aff_copy(
2242 __isl_keep isl_aff *aff);
2243 __isl_null isl_aff *isl_aff_free(
2244 __isl_take isl_aff *aff);
2246 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2247 using the following function. The constraint is required to have
2248 a non-zero coefficient for the specified dimension.
2250 #include <isl/constraint.h>
2251 __isl_give isl_aff *isl_constraint_get_bound(
2252 __isl_keep isl_constraint *constraint,
2253 enum isl_dim_type type, int pos);
2255 The entire affine expression of the constraint can also be extracted
2256 using the following function.
2258 #include <isl/constraint.h>
2259 __isl_give isl_aff *isl_constraint_get_aff(
2260 __isl_keep isl_constraint *constraint);
2262 Conversely, an equality constraint equating
2263 the affine expression to zero or an inequality constraint enforcing
2264 the affine expression to be non-negative, can be constructed using
2266 __isl_give isl_constraint *isl_equality_from_aff(
2267 __isl_take isl_aff *aff);
2268 __isl_give isl_constraint *isl_inequality_from_aff(
2269 __isl_take isl_aff *aff);
2271 The coefficients and the integer divisions of an affine expression
2272 can be inspected using the following functions.
2274 #include <isl/aff.h>
2275 __isl_give isl_val *isl_aff_get_constant_val(
2276 __isl_keep isl_aff *aff);
2277 __isl_give isl_val *isl_aff_get_coefficient_val(
2278 __isl_keep isl_aff *aff,
2279 enum isl_dim_type type, int pos);
2280 int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2281 enum isl_dim_type type, int pos);
2282 __isl_give isl_val *isl_aff_get_denominator_val(
2283 __isl_keep isl_aff *aff);
2284 __isl_give isl_aff *isl_aff_get_div(
2285 __isl_keep isl_aff *aff, int pos);
2287 They can be modified using the following functions.
2289 #include <isl/aff.h>
2290 __isl_give isl_aff *isl_aff_set_constant_si(
2291 __isl_take isl_aff *aff, int v);
2292 __isl_give isl_aff *isl_aff_set_constant_val(
2293 __isl_take isl_aff *aff, __isl_take isl_val *v);
2294 __isl_give isl_aff *isl_aff_set_coefficient_si(
2295 __isl_take isl_aff *aff,
2296 enum isl_dim_type type, int pos, int v);
2297 __isl_give isl_aff *isl_aff_set_coefficient_val(
2298 __isl_take isl_aff *aff,
2299 enum isl_dim_type type, int pos,
2300 __isl_take isl_val *v);
2302 __isl_give isl_aff *isl_aff_add_constant_si(
2303 __isl_take isl_aff *aff, int v);
2304 __isl_give isl_aff *isl_aff_add_constant_val(
2305 __isl_take isl_aff *aff, __isl_take isl_val *v);
2306 __isl_give isl_aff *isl_aff_add_constant_num_si(
2307 __isl_take isl_aff *aff, int v);
2308 __isl_give isl_aff *isl_aff_add_coefficient_si(
2309 __isl_take isl_aff *aff,
2310 enum isl_dim_type type, int pos, int v);
2311 __isl_give isl_aff *isl_aff_add_coefficient_val(
2312 __isl_take isl_aff *aff,
2313 enum isl_dim_type type, int pos,
2314 __isl_take isl_val *v);
2316 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2317 set the I<numerator> of the constant or coefficient, while
2318 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2319 the constant or coefficient as a whole.
2320 The C<add_constant> and C<add_coefficient> functions add an integer
2321 or rational value to
2322 the possibly rational constant or coefficient.
2323 The C<add_constant_num> functions add an integer value to
2326 =item * Quasipolynomials
2328 Some simple quasipolynomials can be created using the following functions.
2330 #include <isl/polynomial.h>
2331 __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2332 __isl_take isl_space *domain);
2333 __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2334 __isl_take isl_space *domain);
2335 __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2336 __isl_take isl_space *domain);
2337 __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2338 __isl_take isl_space *domain);
2339 __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2340 __isl_take isl_space *domain);
2341 __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2342 __isl_take isl_space *domain,
2343 __isl_take isl_val *val);
2344 __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2345 __isl_take isl_space *domain,
2346 enum isl_dim_type type, unsigned pos);
2347 __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2348 __isl_take isl_aff *aff);
2350 Recall that the space in which a quasipolynomial lives is a map space
2351 with a one-dimensional range. The C<domain> argument in some of
2352 the functions above corresponds to the domain of this map space.
2354 Quasipolynomials can be copied and freed again using the following
2357 #include <isl/polynomial.h>
2358 __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2359 __isl_keep isl_qpolynomial *qp);
2360 __isl_null isl_qpolynomial *isl_qpolynomial_free(
2361 __isl_take isl_qpolynomial *qp);
2363 The constant term of a quasipolynomial can be extracted using
2365 __isl_give isl_val *isl_qpolynomial_get_constant_val(
2366 __isl_keep isl_qpolynomial *qp);
2368 To iterate over all terms in a quasipolynomial,
2371 int isl_qpolynomial_foreach_term(
2372 __isl_keep isl_qpolynomial *qp,
2373 int (*fn)(__isl_take isl_term *term,
2374 void *user), void *user);
2376 The terms themselves can be inspected and freed using
2379 unsigned isl_term_dim(__isl_keep isl_term *term,
2380 enum isl_dim_type type);
2381 __isl_give isl_val *isl_term_get_coefficient_val(
2382 __isl_keep isl_term *term);
2383 int isl_term_get_exp(__isl_keep isl_term *term,
2384 enum isl_dim_type type, unsigned pos);
2385 __isl_give isl_aff *isl_term_get_div(
2386 __isl_keep isl_term *term, unsigned pos);
2387 void isl_term_free(__isl_take isl_term *term);
2389 Each term is a product of parameters, set variables and
2390 integer divisions. The function C<isl_term_get_exp>
2391 returns the exponent of a given dimensions in the given term.
2397 A reduction represents a maximum or a minimum of its
2399 The only reduction type defined by C<isl> is
2400 C<isl_qpolynomial_fold>.
2402 There are currently no functions to directly create such
2403 objects, but they do appear in the piecewise quasipolynomial
2404 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2406 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2408 Reductions can be copied and freed using
2409 the following functions.
2411 #include <isl/polynomial.h>
2412 __isl_give isl_qpolynomial_fold *
2413 isl_qpolynomial_fold_copy(
2414 __isl_keep isl_qpolynomial_fold *fold);
2415 void isl_qpolynomial_fold_free(
2416 __isl_take isl_qpolynomial_fold *fold);
2418 To iterate over all quasipolynomials in a reduction, use
2420 int isl_qpolynomial_fold_foreach_qpolynomial(
2421 __isl_keep isl_qpolynomial_fold *fold,
2422 int (*fn)(__isl_take isl_qpolynomial *qp,
2423 void *user), void *user);
2425 =head3 Multiple Expressions
2427 A multiple expression represents a sequence of zero or
2428 more base expressions, all defined on the same domain space.
2429 The domain space of the multiple expression is the same
2430 as that of the base expressions, but the range space
2431 can be any space. In case the base expressions have
2432 a set space, the corresponding multiple expression
2433 also has a set space.
2434 Objects of the value type do not have an associated space.
2435 The space of a multiple value is therefore always a set space.
2437 The multiple expression types defined by C<isl>
2438 are C<isl_multi_val>, C<isl_multi_aff> and C<isl_multi_pw_aff>.
2440 A multiple expression with the value zero for
2441 each output (or set) dimension can be created
2442 using the following functions.
2444 #include <isl/val.h>
2445 __isl_give isl_multi_val *isl_multi_val_zero(
2446 __isl_take isl_space *space);
2448 #include <isl/aff.h>
2449 __isl_give isl_multi_aff *isl_multi_aff_zero(
2450 __isl_take isl_space *space);
2451 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2452 __isl_take isl_space *space);
2454 An identity function can be created using the following
2455 functions. The space needs to be that of a relation
2456 with the same number of input and output dimensions.
2458 #include <isl/aff.h>
2459 __isl_give isl_multi_aff *isl_multi_aff_identity(
2460 __isl_take isl_space *space);
2461 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2462 __isl_take isl_space *space);
2464 A function that performs a projection on a universe
2465 relation or set can be created using the following functions.
2466 See also the corresponding
2467 projection operations in L</"Unary Operations">.
2469 #include <isl/aff.h>
2470 __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2471 __isl_take isl_space *space);
2472 __isl_give isl_multi_aff *isl_multi_aff_range_map(
2473 __isl_take isl_space *space);
2474 __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2475 __isl_take isl_space *space,
2476 enum isl_dim_type type,
2477 unsigned first, unsigned n);
2479 A multiple expression can be created from a single
2480 base expression using the following functions.
2481 The space of the created multiple expression is the same
2482 as that of the base expression.
2484 #include <isl/aff.h>
2485 __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2486 __isl_take isl_aff *aff);
2487 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2488 __isl_take isl_pw_aff *pa);
2490 A multiple expression can be created from a list
2491 of base expression in a specified space.
2492 The domain of this space needs to be the same
2493 as the domains of the base expressions in the list.
2494 If the base expressions have a set space (or no associated space),
2495 then this space also needs to be a set space.
2497 #include <isl/val.h>
2498 __isl_give isl_multi_val *isl_multi_val_from_val_list(
2499 __isl_take isl_space *space,
2500 __isl_take isl_val_list *list);
2502 #include <isl/aff.h>
2503 __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2504 __isl_take isl_space *space,
2505 __isl_take isl_aff_list *list);
2507 As a convenience, a multiple piecewise expression can
2508 also be created from a multiple expression.
2509 Each piecewise expression in the result has a single
2512 #include <isl/aff.h>
2513 __isl_give isl_multi_pw_aff *
2514 isl_multi_pw_aff_from_multi_aff(
2515 __isl_take isl_multi_aff *ma);
2517 A multiple quasi-affine expression can be created from
2518 a multiple value with a given domain space using the following
2521 #include <isl/aff.h>
2522 __isl_give isl_multi_aff *
2523 isl_multi_aff_multi_val_on_space(
2524 __isl_take isl_space *space,
2525 __isl_take isl_multi_val *mv);
2527 Multiple expressions can be copied and freed using
2528 the following functions.
2530 #include <isl/val.h>
2531 __isl_give isl_multi_val *isl_multi_val_copy(
2532 __isl_keep isl_multi_val *mv);
2533 __isl_null isl_multi_val *isl_multi_val_free(
2534 __isl_take isl_multi_val *mv);
2536 #include <isl/aff.h>
2537 __isl_give isl_multi_aff *isl_multi_aff_copy(
2538 __isl_keep isl_multi_aff *maff);
2539 __isl_null isl_multi_aff *isl_multi_aff_free(
2540 __isl_take isl_multi_aff *maff);
2541 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2542 __isl_keep isl_multi_pw_aff *mpa);
2543 __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2544 __isl_take isl_multi_pw_aff *mpa);
2546 The base expression at a given position of a multiple
2547 expression can be extracted using the following functions.
2549 #include <isl/val.h>
2550 __isl_give isl_val *isl_multi_val_get_val(
2551 __isl_keep isl_multi_val *mv, int pos);
2553 #include <isl/aff.h>
2554 __isl_give isl_aff *isl_multi_aff_get_aff(
2555 __isl_keep isl_multi_aff *multi, int pos);
2556 __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2557 __isl_keep isl_multi_pw_aff *mpa, int pos);
2559 It can be replaced using the following functions.
2561 #include <isl/val.h>
2562 __isl_give isl_multi_val *isl_multi_val_set_val(
2563 __isl_take isl_multi_val *mv, int pos,
2564 __isl_take isl_val *val);
2566 #include <isl/aff.h>
2567 __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2568 __isl_take isl_multi_aff *multi, int pos,
2569 __isl_take isl_aff *aff);
2571 =head3 Piecewise Expressions
2573 A piecewise expression is an expression that is described
2574 using zero or more base expression defined over the same
2575 number of cells in the domain space of the base expressions.
2576 All base expressions are defined over the same
2577 domain space and the cells are disjoint.
2578 The space of a piecewise expression is the same as
2579 that of the base expressions.
2580 If the union of the cells is a strict subset of the domain
2581 space, then the value of the piecewise expression outside
2582 this union is different for types derived from quasi-affine
2583 expressions and those derived from quasipolynomials.
2584 Piecewise expressions derived from quasi-affine expressions
2585 are considered to be undefined outside the union of their cells.
2586 Piecewise expressions derived from quasipolynomials
2587 are considered to be zero outside the union of their cells.
2589 Piecewise quasipolynomials are mainly used by the C<barvinok>
2590 library for representing the number of elements in a parametric set or map.
2591 For example, the piecewise quasipolynomial
2593 [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2595 represents the number of points in the map
2597 [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2599 The piecewise expression types defined by C<isl>
2600 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2601 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2603 A piecewise expression with no cells can be created using
2604 the following functions.
2606 #include <isl/aff.h>
2607 __isl_give isl_pw_aff *isl_pw_aff_empty(
2608 __isl_take isl_space *space);
2609 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2610 __isl_take isl_space *space);
2612 A piecewise expression with a single universe cell can be
2613 created using the following functions.
2615 #include <isl/aff.h>
2616 __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2617 __isl_take isl_aff *aff);
2618 __isl_give isl_pw_multi_aff *
2619 isl_pw_multi_aff_from_multi_aff(
2620 __isl_take isl_multi_aff *ma);
2622 #include <isl/polynomial.h>
2623 __isl_give isl_pw_qpolynomial *
2624 isl_pw_qpolynomial_from_qpolynomial(
2625 __isl_take isl_qpolynomial *qp);
2627 A piecewise expression with a single specified cell can be
2628 created using the following functions.
2630 #include <isl/aff.h>
2631 __isl_give isl_pw_aff *isl_pw_aff_alloc(
2632 __isl_take isl_set *set, __isl_take isl_aff *aff);
2633 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2634 __isl_take isl_set *set,
2635 __isl_take isl_multi_aff *maff);
2637 #include <isl/polynomial.h>
2638 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2639 __isl_take isl_set *set,
2640 __isl_take isl_qpolynomial *qp);
2642 The following convenience functions first create a base expression and
2643 then create a piecewise expression over a universe domain.
2645 #include <isl/aff.h>
2646 __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2647 __isl_take isl_local_space *ls);
2648 __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2649 __isl_take isl_local_space *ls,
2650 enum isl_dim_type type, unsigned pos);
2651 __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2652 __isl_take isl_local_space *ls);
2653 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2654 __isl_take isl_space *space);
2655 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2656 __isl_take isl_space *space);
2657 __isl_give isl_pw_multi_aff *
2658 isl_pw_multi_aff_project_out_map(
2659 __isl_take isl_space *space,
2660 enum isl_dim_type type,
2661 unsigned first, unsigned n);
2663 #include <isl/polynomial.h>
2664 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2665 __isl_take isl_space *space);
2667 The following convenience functions first create a base expression and
2668 then create a piecewise expression over a given domain.
2670 #include <isl/aff.h>
2671 __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2672 __isl_take isl_set *domain,
2673 __isl_take isl_val *v);
2674 __isl_give isl_pw_multi_aff *
2675 isl_pw_multi_aff_multi_val_on_domain(
2676 __isl_take isl_set *domain,
2677 __isl_take isl_multi_val *mv);
2679 As a convenience, a piecewise multiple expression can
2680 also be created from a piecewise expression.
2681 Each multiple expression in the result is derived
2682 from the corresponding base expression.
2684 #include <isl/aff.h>
2685 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2686 __isl_take isl_pw_aff *pa);
2688 Similarly, a piecewise quasipolynomial can be
2689 created from a piecewise quasi-affine expression using
2690 the following function.
2692 #include <isl/polynomial.h>
2693 __isl_give isl_pw_qpolynomial *
2694 isl_pw_qpolynomial_from_pw_aff(
2695 __isl_take isl_pw_aff *pwaff);
2697 Piecewise expressions can be copied and freed using the following functions.
2699 #include <isl/aff.h>
2700 __isl_give isl_pw_aff *isl_pw_aff_copy(
2701 __isl_keep isl_pw_aff *pwaff);
2702 __isl_null isl_pw_aff *isl_pw_aff_free(
2703 __isl_take isl_pw_aff *pwaff);
2704 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
2705 __isl_keep isl_pw_multi_aff *pma);
2706 __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
2707 __isl_take isl_pw_multi_aff *pma);
2709 #include <isl/polynomial.h>
2710 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
2711 __isl_keep isl_pw_qpolynomial *pwqp);
2712 __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
2713 __isl_take isl_pw_qpolynomial *pwqp);
2714 __isl_give isl_pw_qpolynomial_fold *
2715 isl_pw_qpolynomial_fold_copy(
2716 __isl_keep isl_pw_qpolynomial_fold *pwf);
2717 __isl_null isl_pw_qpolynomial_fold *
2718 isl_pw_qpolynomial_fold_free(
2719 __isl_take isl_pw_qpolynomial_fold *pwf);
2721 To iterate over the different cells of a piecewise expression,
2722 use the following functions.
2724 #include <isl/aff.h>
2725 int isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
2726 int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
2727 int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
2728 int (*fn)(__isl_take isl_set *set,
2729 __isl_take isl_aff *aff,
2730 void *user), void *user);
2731 int isl_pw_multi_aff_foreach_piece(
2732 __isl_keep isl_pw_multi_aff *pma,
2733 int (*fn)(__isl_take isl_set *set,
2734 __isl_take isl_multi_aff *maff,
2735 void *user), void *user);
2737 #include <isl/polynomial.h>
2738 int isl_pw_qpolynomial_foreach_piece(
2739 __isl_keep isl_pw_qpolynomial *pwqp,
2740 int (*fn)(__isl_take isl_set *set,
2741 __isl_take isl_qpolynomial *qp,
2742 void *user), void *user);
2743 int isl_pw_qpolynomial_foreach_lifted_piece(
2744 __isl_keep isl_pw_qpolynomial *pwqp,
2745 int (*fn)(__isl_take isl_set *set,
2746 __isl_take isl_qpolynomial *qp,
2747 void *user), void *user);
2748 int isl_pw_qpolynomial_fold_foreach_piece(
2749 __isl_keep isl_pw_qpolynomial_fold *pwf,
2750 int (*fn)(__isl_take isl_set *set,
2751 __isl_take isl_qpolynomial_fold *fold,
2752 void *user), void *user);
2753 int isl_pw_qpolynomial_fold_foreach_lifted_piece(
2754 __isl_keep isl_pw_qpolynomial_fold *pwf,
2755 int (*fn)(__isl_take isl_set *set,
2756 __isl_take isl_qpolynomial_fold *fold,
2757 void *user), void *user);
2759 As usual, the function C<fn> should return C<0> on success
2760 and C<-1> on failure. The difference between
2761 C<isl_pw_qpolynomial_foreach_piece> and
2762 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
2763 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
2764 compute unique representations for all existentially quantified
2765 variables and then turn these existentially quantified variables
2766 into extra set variables, adapting the associated quasipolynomial
2767 accordingly. This means that the C<set> passed to C<fn>
2768 will not have any existentially quantified variables, but that
2769 the dimensions of the sets may be different for different
2770 invocations of C<fn>.
2771 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
2772 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
2774 A piecewise expression consisting of the expressions at a given
2775 position of a piecewise multiple expression can be extracted
2776 using the following function.
2778 #include <isl/aff.h>
2779 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
2780 __isl_keep isl_pw_multi_aff *pma, int pos);
2782 These expressions can be replaced using the following function.
2784 #include <isl/aff.h>
2785 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
2786 __isl_take isl_pw_multi_aff *pma, unsigned pos,
2787 __isl_take isl_pw_aff *pa);
2789 Note that there is a difference between C<isl_multi_pw_aff> and
2790 C<isl_pw_multi_aff> objects. The first is a sequence of piecewise
2791 affine expressions, while the second is a piecewise sequence
2792 of affine expressions. In particular, each of the piecewise
2793 affine expressions in an C<isl_multi_pw_aff> may have a different
2794 domain, while all multiple expressions associated to a cell
2795 in an C<isl_pw_multi_aff> have the same domain.
2796 It is possible to convert between the two, but when converting
2797 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
2798 of the result is the intersection of the domains of the input.
2799 The reverse conversion is exact.
2801 #include <isl/aff.h>
2802 __isl_give isl_pw_multi_aff *
2803 isl_pw_multi_aff_from_multi_pw_aff(
2804 __isl_take isl_multi_pw_aff *mpa);
2805 __isl_give isl_multi_pw_aff *
2806 isl_multi_pw_aff_from_pw_multi_aff(
2807 __isl_take isl_pw_multi_aff *pma);
2809 =head3 Union Expressions
2811 A union expression collects base expressions defined
2812 over different domains. The space of a union expression
2813 is that of the shared parameter space.
2815 The union expression types defined by C<isl>
2816 are C<isl_union_pw_multi_aff>, C<isl_union_pw_qpolynomial> and
2817 C<isl_union_pw_qpolynomial_fold>.
2819 An empty union expression can be created using the following functions.
2821 #include <isl/aff.h>
2822 __isl_give isl_union_pw_multi_aff *
2823 isl_union_pw_multi_aff_empty(
2824 __isl_take isl_space *space);
2826 #include <isl/polynomial.h>
2827 __isl_give isl_union_pw_qpolynomial *
2828 isl_union_pw_qpolynomial_zero(
2829 __isl_take isl_space *space);
2831 A union expression containing a single base expression
2832 can be created using the following functions.
2834 #include <isl/aff.h>
2835 __isl_give isl_union_pw_multi_aff *
2836 isl_union_pw_multi_aff_from_pw_multi_aff(
2837 __isl_take isl_pw_multi_aff *pma);
2839 #include <isl/polynomial.h>
2840 __isl_give isl_union_pw_qpolynomial *
2841 isl_union_pw_qpolynomial_from_pw_qpolynomial(
2842 __isl_take isl_pw_qpolynomial *pwqp);
2844 The following function creates a base expression on each
2845 of the sets in the union set and collects the results.
2847 #include <isl/aff.h>
2848 __isl_give isl_union_pw_multi_aff *
2849 isl_union_pw_multi_aff_multi_val_on_domain(
2850 __isl_take isl_union_set *domain,
2851 __isl_take isl_multi_val *mv);
2853 A base expression can be added to a union expression using
2854 the following functions.
2856 #include <isl/aff.h>
2857 __isl_give isl_union_pw_multi_aff *
2858 isl_union_pw_multi_aff_add_pw_multi_aff(
2859 __isl_take isl_union_pw_multi_aff *upma,
2860 __isl_take isl_pw_multi_aff *pma);
2862 #include <isl/polynomial.h>
2863 __isl_give isl_union_pw_qpolynomial *
2864 isl_union_pw_qpolynomial_add_pw_qpolynomial(
2865 __isl_take isl_union_pw_qpolynomial *upwqp,
2866 __isl_take isl_pw_qpolynomial *pwqp);
2868 Union expressions can be copied and freed using
2869 the following functions.
2871 #include <isl/aff.h>
2872 __isl_give isl_union_pw_multi_aff *
2873 isl_union_pw_multi_aff_copy(
2874 __isl_keep isl_union_pw_multi_aff *upma);
2875 __isl_null isl_union_pw_multi_aff *
2876 isl_union_pw_multi_aff_free(
2877 __isl_take isl_union_pw_multi_aff *upma);
2879 #include <isl/polynomial.h>
2880 __isl_give isl_union_pw_qpolynomial *
2881 isl_union_pw_qpolynomial_copy(
2882 __isl_keep isl_union_pw_qpolynomial *upwqp);
2883 __isl_null isl_union_pw_qpolynomial *
2884 isl_union_pw_qpolynomial_free(
2885 __isl_take isl_union_pw_qpolynomial *upwqp);
2886 __isl_give isl_union_pw_qpolynomial_fold *
2887 isl_union_pw_qpolynomial_fold_copy(
2888 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
2889 __isl_null isl_union_pw_qpolynomial_fold *
2890 isl_union_pw_qpolynomial_fold_free(
2891 __isl_take isl_union_pw_qpolynomial_fold *upwf);
2893 To iterate over the base expressions in a union expression,
2894 use the following functions.
2896 #include <isl/aff.h>
2897 int isl_union_pw_multi_aff_foreach_pw_multi_aff(
2898 __isl_keep isl_union_pw_multi_aff *upma,
2899 int (*fn)(__isl_take isl_pw_multi_aff *pma,
2900 void *user), void *user);
2902 #include <isl/polynomial.h>
2903 int isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
2904 __isl_keep isl_union_pw_qpolynomial *upwqp,
2905 int (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
2906 void *user), void *user);
2907 int isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
2908 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
2909 int (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
2910 void *user), void *user);
2912 To extract the base expression in a given space from a union, use
2913 the following functions.
2915 #include <isl/aff.h>
2916 __isl_give isl_pw_multi_aff *
2917 isl_union_pw_multi_aff_extract_pw_multi_aff(
2918 __isl_keep isl_union_pw_multi_aff *upma,
2919 __isl_take isl_space *space);
2921 #include <isl/polynomial.h>
2922 __isl_give isl_pw_qpolynomial *
2923 isl_union_pw_qpolynomial_extract_pw_qpolynomial(
2924 __isl_keep isl_union_pw_qpolynomial *upwqp,
2925 __isl_take isl_space *space);
2927 =head2 Input and Output
2929 For set and relation,
2930 C<isl> supports its own input/output format, which is similar
2931 to the C<Omega> format, but also supports the C<PolyLib> format
2933 For other object types, typically only an C<isl> format is supported.
2935 =head3 C<isl> format
2937 The C<isl> format is similar to that of C<Omega>, but has a different
2938 syntax for describing the parameters and allows for the definition
2939 of an existentially quantified variable as the integer division
2940 of an affine expression.
2941 For example, the set of integers C<i> between C<0> and C<n>
2942 such that C<i % 10 <= 6> can be described as
2944 [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
2947 A set or relation can have several disjuncts, separated
2948 by the keyword C<or>. Each disjunct is either a conjunction
2949 of constraints or a projection (C<exists>) of a conjunction
2950 of constraints. The constraints are separated by the keyword
2953 =head3 C<PolyLib> format
2955 If the represented set is a union, then the first line
2956 contains a single number representing the number of disjuncts.
2957 Otherwise, a line containing the number C<1> is optional.
2959 Each disjunct is represented by a matrix of constraints.
2960 The first line contains two numbers representing
2961 the number of rows and columns,
2962 where the number of rows is equal to the number of constraints
2963 and the number of columns is equal to two plus the number of variables.
2964 The following lines contain the actual rows of the constraint matrix.
2965 In each row, the first column indicates whether the constraint
2966 is an equality (C<0>) or inequality (C<1>). The final column
2967 corresponds to the constant term.
2969 If the set is parametric, then the coefficients of the parameters
2970 appear in the last columns before the constant column.
2971 The coefficients of any existentially quantified variables appear
2972 between those of the set variables and those of the parameters.
2974 =head3 Extended C<PolyLib> format
2976 The extended C<PolyLib> format is nearly identical to the
2977 C<PolyLib> format. The only difference is that the line
2978 containing the number of rows and columns of a constraint matrix
2979 also contains four additional numbers:
2980 the number of output dimensions, the number of input dimensions,
2981 the number of local dimensions (i.e., the number of existentially
2982 quantified variables) and the number of parameters.
2983 For sets, the number of ``output'' dimensions is equal
2984 to the number of set dimensions, while the number of ``input''
2989 Objects can be read from input using the following functions.
2991 #include <isl/val.h>
2992 __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
2995 #include <isl/set.h>
2996 __isl_give isl_basic_set *isl_basic_set_read_from_file(
2997 isl_ctx *ctx, FILE *input);
2998 __isl_give isl_basic_set *isl_basic_set_read_from_str(
2999 isl_ctx *ctx, const char *str);
3000 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3002 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3005 #include <isl/map.h>
3006 __isl_give isl_basic_map *isl_basic_map_read_from_file(
3007 isl_ctx *ctx, FILE *input);
3008 __isl_give isl_basic_map *isl_basic_map_read_from_str(
3009 isl_ctx *ctx, const char *str);
3010 __isl_give isl_map *isl_map_read_from_file(
3011 isl_ctx *ctx, FILE *input);
3012 __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3015 #include <isl/union_set.h>
3016 __isl_give isl_union_set *isl_union_set_read_from_file(
3017 isl_ctx *ctx, FILE *input);
3018 __isl_give isl_union_set *isl_union_set_read_from_str(
3019 isl_ctx *ctx, const char *str);
3021 #include <isl/union_map.h>
3022 __isl_give isl_union_map *isl_union_map_read_from_file(
3023 isl_ctx *ctx, FILE *input);
3024 __isl_give isl_union_map *isl_union_map_read_from_str(
3025 isl_ctx *ctx, const char *str);
3027 #include <isl/aff.h>
3028 __isl_give isl_aff *isl_aff_read_from_str(
3029 isl_ctx *ctx, const char *str);
3030 __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3031 isl_ctx *ctx, const char *str);
3032 __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3033 isl_ctx *ctx, const char *str);
3034 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3035 isl_ctx *ctx, const char *str);
3036 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3037 isl_ctx *ctx, const char *str);
3038 __isl_give isl_union_pw_multi_aff *
3039 isl_union_pw_multi_aff_read_from_str(
3040 isl_ctx *ctx, const char *str);
3042 #include <isl/polynomial.h>
3043 __isl_give isl_union_pw_qpolynomial *
3044 isl_union_pw_qpolynomial_read_from_str(
3045 isl_ctx *ctx, const char *str);
3047 For sets and relations,
3048 the input format is autodetected and may be either the C<PolyLib> format
3049 or the C<isl> format.
3053 Before anything can be printed, an C<isl_printer> needs to
3056 __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3058 __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3059 __isl_null isl_printer *isl_printer_free(
3060 __isl_take isl_printer *printer);
3061 __isl_give char *isl_printer_get_str(
3062 __isl_keep isl_printer *printer);
3064 The printer can be inspected using the following functions.
3066 FILE *isl_printer_get_file(
3067 __isl_keep isl_printer *printer);
3068 int isl_printer_get_output_format(
3069 __isl_keep isl_printer *p);
3071 The behavior of the printer can be modified in various ways
3073 __isl_give isl_printer *isl_printer_set_output_format(
3074 __isl_take isl_printer *p, int output_format);
3075 __isl_give isl_printer *isl_printer_set_indent(
3076 __isl_take isl_printer *p, int indent);
3077 __isl_give isl_printer *isl_printer_set_indent_prefix(
3078 __isl_take isl_printer *p, const char *prefix);
3079 __isl_give isl_printer *isl_printer_indent(
3080 __isl_take isl_printer *p, int indent);
3081 __isl_give isl_printer *isl_printer_set_prefix(
3082 __isl_take isl_printer *p, const char *prefix);
3083 __isl_give isl_printer *isl_printer_set_suffix(
3084 __isl_take isl_printer *p, const char *suffix);
3086 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3087 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3088 and defaults to C<ISL_FORMAT_ISL>.
3089 Each line in the output is prefixed by C<indent_prefix>,
3090 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3091 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3092 In the C<PolyLib> format output,
3093 the coefficients of the existentially quantified variables
3094 appear between those of the set variables and those
3096 The function C<isl_printer_indent> increases the indentation
3097 by the specified amount (which may be negative).
3099 To actually print something, use
3101 #include <isl/printer.h>
3102 __isl_give isl_printer *isl_printer_print_double(
3103 __isl_take isl_printer *p, double d);
3105 #include <isl/val.h>
3106 __isl_give isl_printer *isl_printer_print_val(
3107 __isl_take isl_printer *p, __isl_keep isl_val *v);
3109 #include <isl/set.h>
3110 __isl_give isl_printer *isl_printer_print_basic_set(
3111 __isl_take isl_printer *printer,
3112 __isl_keep isl_basic_set *bset);
3113 __isl_give isl_printer *isl_printer_print_set(
3114 __isl_take isl_printer *printer,
3115 __isl_keep isl_set *set);
3117 #include <isl/map.h>
3118 __isl_give isl_printer *isl_printer_print_basic_map(
3119 __isl_take isl_printer *printer,
3120 __isl_keep isl_basic_map *bmap);
3121 __isl_give isl_printer *isl_printer_print_map(
3122 __isl_take isl_printer *printer,
3123 __isl_keep isl_map *map);
3125 #include <isl/union_set.h>
3126 __isl_give isl_printer *isl_printer_print_union_set(
3127 __isl_take isl_printer *p,
3128 __isl_keep isl_union_set *uset);
3130 #include <isl/union_map.h>
3131 __isl_give isl_printer *isl_printer_print_union_map(
3132 __isl_take isl_printer *p,
3133 __isl_keep isl_union_map *umap);
3135 #include <isl/val.h>
3136 __isl_give isl_printer *isl_printer_print_multi_val(
3137 __isl_take isl_printer *p,
3138 __isl_keep isl_multi_val *mv);
3140 #include <isl/aff.h>
3141 __isl_give isl_printer *isl_printer_print_aff(
3142 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3143 __isl_give isl_printer *isl_printer_print_multi_aff(
3144 __isl_take isl_printer *p,
3145 __isl_keep isl_multi_aff *maff);
3146 __isl_give isl_printer *isl_printer_print_pw_aff(
3147 __isl_take isl_printer *p,
3148 __isl_keep isl_pw_aff *pwaff);
3149 __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3150 __isl_take isl_printer *p,
3151 __isl_keep isl_pw_multi_aff *pma);
3152 __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3153 __isl_take isl_printer *p,
3154 __isl_keep isl_multi_pw_aff *mpa);
3155 __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3156 __isl_take isl_printer *p,
3157 __isl_keep isl_union_pw_multi_aff *upma);
3159 #include <isl/polynomial.h>
3160 __isl_give isl_printer *isl_printer_print_qpolynomial(
3161 __isl_take isl_printer *p,
3162 __isl_keep isl_qpolynomial *qp);
3163 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3164 __isl_take isl_printer *p,
3165 __isl_keep isl_pw_qpolynomial *pwqp);
3166 __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3167 __isl_take isl_printer *p,
3168 __isl_keep isl_union_pw_qpolynomial *upwqp);
3170 __isl_give isl_printer *
3171 isl_printer_print_pw_qpolynomial_fold(
3172 __isl_take isl_printer *p,
3173 __isl_keep isl_pw_qpolynomial_fold *pwf);
3174 __isl_give isl_printer *
3175 isl_printer_print_union_pw_qpolynomial_fold(
3176 __isl_take isl_printer *p,
3177 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3179 For C<isl_printer_print_qpolynomial>,
3180 C<isl_printer_print_pw_qpolynomial> and
3181 C<isl_printer_print_pw_qpolynomial_fold>,
3182 the output format of the printer
3183 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3184 For C<isl_printer_print_union_pw_qpolynomial> and
3185 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3187 In case of printing in C<ISL_FORMAT_C>, the user may want
3188 to set the names of all dimensions first.
3190 When called on a file printer, the following function flushes
3191 the file. When called on a string printer, the buffer is cleared.
3193 __isl_give isl_printer *isl_printer_flush(
3194 __isl_take isl_printer *p);
3196 Alternatively, a string representation can be obtained
3197 directly using the following functions, which always print
3200 #include <isl/space.h>
3201 __isl_give char *isl_space_to_str(
3202 __isl_keep isl_space *space);
3204 #include <isl/val.h>
3205 __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3206 __isl_give char *isl_multi_val_to_str(
3207 __isl_keep isl_multi_val *mv);
3209 #include <isl/set.h>
3210 __isl_give char *isl_set_to_str(
3211 __isl_keep isl_set *set);
3213 #include <isl/union_set.h>
3214 __isl_give char *isl_union_set_to_str(
3215 __isl_keep isl_union_set *uset);
3217 #include <isl/map.h>
3218 __isl_give char *isl_map_to_str(
3219 __isl_keep isl_map *map);
3221 #include <isl/union_map.h>
3222 __isl_give char *isl_union_map_to_str(
3223 __isl_keep isl_union_map *umap);
3225 #include <isl/aff.h>
3226 __isl_give char *isl_multi_aff_to_str(
3227 __isl_keep isl_multi_aff *aff);
3228 __isl_give char *isl_union_pw_multi_aff_to_str(
3229 __isl_keep isl_union_pw_multi_aff *upma);
3233 =head3 Unary Properties
3239 The following functions test whether the given set or relation
3240 contains any integer points. The ``plain'' variants do not perform
3241 any computations, but simply check if the given set or relation
3242 is already known to be empty.
3244 int isl_basic_set_plain_is_empty(__isl_keep isl_basic_set *bset);
3245 int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
3246 int isl_set_plain_is_empty(__isl_keep isl_set *set);
3247 int isl_set_is_empty(__isl_keep isl_set *set);
3248 int isl_union_set_is_empty(__isl_keep isl_union_set *uset);
3249 int isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
3250 int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
3251 int isl_map_plain_is_empty(__isl_keep isl_map *map);
3252 int isl_map_is_empty(__isl_keep isl_map *map);
3253 int isl_union_map_is_empty(__isl_keep isl_union_map *umap);
3255 =item * Universality
3257 int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
3258 int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
3259 int isl_set_plain_is_universe(__isl_keep isl_set *set);
3261 =item * Single-valuedness
3263 #include <isl/set.h>
3264 int isl_set_is_singleton(__isl_keep isl_set *set);
3266 #include <isl/map.h>
3267 int isl_basic_map_is_single_valued(
3268 __isl_keep isl_basic_map *bmap);
3269 int isl_map_plain_is_single_valued(
3270 __isl_keep isl_map *map);
3271 int isl_map_is_single_valued(__isl_keep isl_map *map);
3273 #include <isl/union_map.h>
3274 int isl_union_map_is_single_valued(__isl_keep isl_union_map *umap);
3278 int isl_map_plain_is_injective(__isl_keep isl_map *map);
3279 int isl_map_is_injective(__isl_keep isl_map *map);
3280 int isl_union_map_plain_is_injective(
3281 __isl_keep isl_union_map *umap);
3282 int isl_union_map_is_injective(
3283 __isl_keep isl_union_map *umap);
3287 int isl_map_is_bijective(__isl_keep isl_map *map);
3288 int isl_union_map_is_bijective(__isl_keep isl_union_map *umap);
3292 __isl_give isl_val *
3293 isl_basic_map_plain_get_val_if_fixed(
3294 __isl_keep isl_basic_map *bmap,
3295 enum isl_dim_type type, unsigned pos);
3296 __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3297 __isl_keep isl_set *set,
3298 enum isl_dim_type type, unsigned pos);
3299 __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3300 __isl_keep isl_map *map,
3301 enum isl_dim_type type, unsigned pos);
3303 If the set or relation obviously lies on a hyperplane where the given dimension
3304 has a fixed value, then return that value.
3305 Otherwise return NaN.
3309 int isl_set_dim_residue_class_val(
3310 __isl_keep isl_set *set,
3311 int pos, __isl_give isl_val **modulo,
3312 __isl_give isl_val **residue);
3314 Check if the values of the given set dimension are equal to a fixed
3315 value modulo some integer value. If so, assign the modulo to C<*modulo>
3316 and the fixed value to C<*residue>. If the given dimension attains only
3317 a single value, then assign C<0> to C<*modulo> and the fixed value to
3319 If the dimension does not attain only a single value and if no modulo
3320 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3324 To check whether the description of a set, relation or function depends
3325 on one or more given dimensions,
3326 the following functions can be used.
3328 #include <isl/constraint.h>
3329 int isl_constraint_involves_dims(
3330 __isl_keep isl_constraint *constraint,
3331 enum isl_dim_type type, unsigned first, unsigned n);
3333 #include <isl/set.h>
3334 int isl_basic_set_involves_dims(
3335 __isl_keep isl_basic_set *bset,
3336 enum isl_dim_type type, unsigned first, unsigned n);
3337 int isl_set_involves_dims(__isl_keep isl_set *set,
3338 enum isl_dim_type type, unsigned first, unsigned n);
3340 #include <isl/map.h>
3341 int isl_basic_map_involves_dims(
3342 __isl_keep isl_basic_map *bmap,
3343 enum isl_dim_type type, unsigned first, unsigned n);
3344 int isl_map_involves_dims(__isl_keep isl_map *map,
3345 enum isl_dim_type type, unsigned first, unsigned n);
3347 #include <isl/aff.h>
3348 int isl_aff_involves_dims(__isl_keep isl_aff *aff,
3349 enum isl_dim_type type, unsigned first, unsigned n);
3350 int isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff,
3351 enum isl_dim_type type, unsigned first, unsigned n);
3352 int isl_multi_aff_involves_dims(
3353 __isl_keep isl_multi_aff *ma,
3354 enum isl_dim_type type, unsigned first, unsigned n);
3355 int isl_multi_pw_aff_involves_dims(
3356 __isl_keep isl_multi_pw_aff *mpa,
3357 enum isl_dim_type type, unsigned first, unsigned n);
3359 Similarly, the following functions can be used to check whether
3360 a given dimension is involved in any lower or upper bound.
3362 #include <isl/set.h>
3363 int isl_set_dim_has_any_lower_bound(__isl_keep isl_set *set,
3364 enum isl_dim_type type, unsigned pos);
3365 int isl_set_dim_has_any_upper_bound(__isl_keep isl_set *set,
3366 enum isl_dim_type type, unsigned pos);
3368 Note that these functions return true even if there is a bound on
3369 the dimension on only some of the basic sets of C<set>.
3370 To check if they have a bound for all of the basic sets in C<set>,
3371 use the following functions instead.
3373 #include <isl/set.h>
3374 int isl_set_dim_has_lower_bound(__isl_keep isl_set *set,
3375 enum isl_dim_type type, unsigned pos);
3376 int isl_set_dim_has_upper_bound(__isl_keep isl_set *set,
3377 enum isl_dim_type type, unsigned pos);
3381 To check whether a set is a parameter domain, use this function:
3383 int isl_set_is_params(__isl_keep isl_set *set);
3384 int isl_union_set_is_params(
3385 __isl_keep isl_union_set *uset);
3389 The following functions check whether the space of the given
3390 (basic) set or relation range is a wrapped relation.
3392 #include <isl/space.h>
3393 int isl_space_is_wrapping(
3394 __isl_keep isl_space *space);
3395 int isl_space_domain_is_wrapping(
3396 __isl_keep isl_space *space);
3397 int isl_space_range_is_wrapping(
3398 __isl_keep isl_space *space);
3400 #include <isl/set.h>
3401 int isl_basic_set_is_wrapping(
3402 __isl_keep isl_basic_set *bset);
3403 int isl_set_is_wrapping(__isl_keep isl_set *set);
3405 #include <isl/map.h>
3406 int isl_map_domain_is_wrapping(
3407 __isl_keep isl_map *map);
3408 int isl_map_range_is_wrapping(
3409 __isl_keep isl_map *map);
3411 #include <isl/val.h>
3412 int isl_multi_val_range_is_wrapping(
3413 __isl_keep isl_multi_val *mv);
3415 #include <isl/aff.h>
3416 int isl_multi_aff_range_is_wrapping(
3417 __isl_keep isl_multi_aff *ma);
3418 int isl_multi_pw_aff_range_is_wrapping(
3419 __isl_keep isl_multi_pw_aff *mpa);
3421 The input to C<isl_space_is_wrapping> should
3422 be the space of a set, while that of
3423 C<isl_space_domain_is_wrapping> and
3424 C<isl_space_range_is_wrapping> should be the space of a relation.
3426 =item * Internal Product
3428 int isl_basic_map_can_zip(
3429 __isl_keep isl_basic_map *bmap);
3430 int isl_map_can_zip(__isl_keep isl_map *map);
3432 Check whether the product of domain and range of the given relation
3434 i.e., whether both domain and range are nested relations.
3438 int isl_basic_map_can_curry(
3439 __isl_keep isl_basic_map *bmap);
3440 int isl_map_can_curry(__isl_keep isl_map *map);
3442 Check whether the domain of the (basic) relation is a wrapped relation.
3444 int isl_basic_map_can_uncurry(
3445 __isl_keep isl_basic_map *bmap);
3446 int isl_map_can_uncurry(__isl_keep isl_map *map);
3448 Check whether the range of the (basic) relation is a wrapped relation.
3450 =item * Special Values
3452 #include <isl/aff.h>
3453 int isl_aff_is_cst(__isl_keep isl_aff *aff);
3454 int isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3456 Check whether the given expression is a constant.
3458 #include <isl/aff.h>
3459 int isl_aff_is_nan(__isl_keep isl_aff *aff);
3460 int isl_pw_aff_involves_nan(__isl_keep isl_pw_aff *pa);
3462 Check whether the given expression is equal to or involves NaN.
3464 #include <isl/aff.h>
3465 int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
3467 Check whether the affine expression is obviously zero.
3471 =head3 Binary Properties
3477 The following functions check whether two objects
3478 represent the same set, relation or function.
3479 The C<plain> variants only return true if the objects
3480 are obviously the same. That is, they may return false
3481 even if the objects are the same, but they will never
3482 return true if the objects are not the same.
3484 #include <isl/set.h>
3485 int isl_basic_set_plain_is_equal(
3486 __isl_keep isl_basic_set *bset1,
3487 __isl_keep isl_basic_set *bset2);
3488 int isl_set_plain_is_equal(__isl_keep isl_set *set1,
3489 __isl_keep isl_set *set2);
3490 int isl_set_is_equal(__isl_keep isl_set *set1,
3491 __isl_keep isl_set *set2);
3493 #include <isl/map.h>
3494 int isl_basic_map_is_equal(
3495 __isl_keep isl_basic_map *bmap1,
3496 __isl_keep isl_basic_map *bmap2);
3497 int isl_map_is_equal(__isl_keep isl_map *map1,
3498 __isl_keep isl_map *map2);
3499 int isl_map_plain_is_equal(__isl_keep isl_map *map1,
3500 __isl_keep isl_map *map2);
3502 #include <isl/union_set.h>
3503 int isl_union_set_is_equal(
3504 __isl_keep isl_union_set *uset1,
3505 __isl_keep isl_union_set *uset2);
3507 #include <isl/union_map.h>
3508 int isl_union_map_is_equal(
3509 __isl_keep isl_union_map *umap1,
3510 __isl_keep isl_union_map *umap2);
3512 #include <isl/aff.h>
3513 int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1,
3514 __isl_keep isl_aff *aff2);
3515 int isl_multi_aff_plain_is_equal(
3516 __isl_keep isl_multi_aff *maff1,
3517 __isl_keep isl_multi_aff *maff2);
3518 int isl_pw_aff_plain_is_equal(
3519 __isl_keep isl_pw_aff *pwaff1,
3520 __isl_keep isl_pw_aff *pwaff2);
3521 int isl_pw_multi_aff_plain_is_equal(
3522 __isl_keep isl_pw_multi_aff *pma1,
3523 __isl_keep isl_pw_multi_aff *pma2);
3524 int isl_multi_pw_aff_plain_is_equal(
3525 __isl_keep isl_multi_pw_aff *mpa1,
3526 __isl_keep isl_multi_pw_aff *mpa2);
3527 int isl_multi_pw_aff_is_equal(
3528 __isl_keep isl_multi_pw_aff *mpa1,
3529 __isl_keep isl_multi_pw_aff *mpa2);
3530 int isl_union_pw_multi_aff_plain_is_equal(
3531 __isl_keep isl_union_pw_multi_aff *upma1,
3532 __isl_keep isl_union_pw_multi_aff *upma2);
3534 #include <isl/polynomial.h>
3535 int isl_union_pw_qpolynomial_plain_is_equal(
3536 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3537 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3538 int isl_union_pw_qpolynomial_fold_plain_is_equal(
3539 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3540 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3542 =item * Disjointness
3544 int isl_basic_set_is_disjoint(
3545 __isl_keep isl_basic_set *bset1,
3546 __isl_keep isl_basic_set *bset2);
3547 int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
3548 __isl_keep isl_set *set2);
3549 int isl_set_is_disjoint(__isl_keep isl_set *set1,
3550 __isl_keep isl_set *set2);
3551 int isl_basic_map_is_disjoint(
3552 __isl_keep isl_basic_map *bmap1,
3553 __isl_keep isl_basic_map *bmap2);
3554 int isl_map_is_disjoint(__isl_keep isl_map *map1,
3555 __isl_keep isl_map *map2);
3559 int isl_basic_set_is_subset(
3560 __isl_keep isl_basic_set *bset1,
3561 __isl_keep isl_basic_set *bset2);
3562 int isl_set_is_subset(__isl_keep isl_set *set1,
3563 __isl_keep isl_set *set2);
3564 int isl_set_is_strict_subset(
3565 __isl_keep isl_set *set1,
3566 __isl_keep isl_set *set2);
3567 int isl_union_set_is_subset(
3568 __isl_keep isl_union_set *uset1,
3569 __isl_keep isl_union_set *uset2);
3570 int isl_union_set_is_strict_subset(
3571 __isl_keep isl_union_set *uset1,
3572 __isl_keep isl_union_set *uset2);
3573 int isl_basic_map_is_subset(
3574 __isl_keep isl_basic_map *bmap1,
3575 __isl_keep isl_basic_map *bmap2);
3576 int isl_basic_map_is_strict_subset(
3577 __isl_keep isl_basic_map *bmap1,
3578 __isl_keep isl_basic_map *bmap2);
3579 int isl_map_is_subset(
3580 __isl_keep isl_map *map1,
3581 __isl_keep isl_map *map2);
3582 int isl_map_is_strict_subset(
3583 __isl_keep isl_map *map1,
3584 __isl_keep isl_map *map2);
3585 int isl_union_map_is_subset(
3586 __isl_keep isl_union_map *umap1,
3587 __isl_keep isl_union_map *umap2);
3588 int isl_union_map_is_strict_subset(
3589 __isl_keep isl_union_map *umap1,
3590 __isl_keep isl_union_map *umap2);
3592 Check whether the first argument is a (strict) subset of the
3597 Every comparison function returns a negative value if the first
3598 argument is considered smaller than the second, a positive value
3599 if the first argument is considered greater and zero if the two
3600 constraints are considered the same by the comparison criterion.
3602 #include <isl/constraint.h>
3603 int isl_constraint_plain_cmp(
3604 __isl_keep isl_constraint *c1,
3605 __isl_keep isl_constraint *c2);
3607 This function is useful for sorting C<isl_constraint>s.
3608 The order depends on the internal representation of the inputs.
3609 The order is fixed over different calls to the function (assuming
3610 the internal representation of the inputs has not changed), but may
3611 change over different versions of C<isl>.
3613 #include <isl/constraint.h>
3614 int isl_constraint_cmp_last_non_zero(
3615 __isl_keep isl_constraint *c1,
3616 __isl_keep isl_constraint *c2);
3618 This function can be used to sort constraints that live in the same
3619 local space. Constraints that involve ``earlier'' dimensions or
3620 that have a smaller coefficient for the shared latest dimension
3621 are considered smaller than other constraints.
3622 This function only defines a B<partial> order.
3624 #include <isl/set.h>
3625 int isl_set_plain_cmp(__isl_keep isl_set *set1,
3626 __isl_keep isl_set *set2);
3628 This function is useful for sorting C<isl_set>s.
3629 The order depends on the internal representation of the inputs.
3630 The order is fixed over different calls to the function (assuming
3631 the internal representation of the inputs has not changed), but may
3632 change over different versions of C<isl>.
3634 #include <isl/aff.h>
3635 int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
3636 __isl_keep isl_pw_aff *pa2);
3638 The function C<isl_pw_aff_plain_cmp> can be used to sort
3639 C<isl_pw_aff>s. The order is not strictly defined.
3640 The current order sorts expressions that only involve
3641 earlier dimensions before those that involve later dimensions.
3645 =head2 Unary Operations
3651 __isl_give isl_set *isl_set_complement(
3652 __isl_take isl_set *set);
3653 __isl_give isl_map *isl_map_complement(
3654 __isl_take isl_map *map);
3658 #include <isl/space.h>
3659 __isl_give isl_space *isl_space_reverse(
3660 __isl_take isl_space *space);
3662 #include <isl/map.h>
3663 __isl_give isl_basic_map *isl_basic_map_reverse(
3664 __isl_take isl_basic_map *bmap);
3665 __isl_give isl_map *isl_map_reverse(
3666 __isl_take isl_map *map);
3668 #include <isl/union_map.h>
3669 __isl_give isl_union_map *isl_union_map_reverse(
3670 __isl_take isl_union_map *umap);
3674 #include <isl/space.h>
3675 __isl_give isl_space *isl_space_domain(
3676 __isl_take isl_space *space);
3677 __isl_give isl_space *isl_space_range(
3678 __isl_take isl_space *space);
3679 __isl_give isl_space *isl_space_params(
3680 __isl_take isl_space *space);
3682 #include <isl/local_space.h>
3683 __isl_give isl_local_space *isl_local_space_domain(
3684 __isl_take isl_local_space *ls);
3685 __isl_give isl_local_space *isl_local_space_range(
3686 __isl_take isl_local_space *ls);
3688 #include <isl/set.h>
3689 __isl_give isl_basic_set *isl_basic_set_project_out(
3690 __isl_take isl_basic_set *bset,
3691 enum isl_dim_type type, unsigned first, unsigned n);
3692 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
3693 enum isl_dim_type type, unsigned first, unsigned n);
3694 __isl_give isl_basic_set *isl_basic_set_params(
3695 __isl_take isl_basic_set *bset);
3696 __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
3698 #include <isl/map.h>
3699 __isl_give isl_basic_map *isl_basic_map_project_out(
3700 __isl_take isl_basic_map *bmap,
3701 enum isl_dim_type type, unsigned first, unsigned n);
3702 __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
3703 enum isl_dim_type type, unsigned first, unsigned n);
3704 __isl_give isl_basic_set *isl_basic_map_domain(
3705 __isl_take isl_basic_map *bmap);
3706 __isl_give isl_basic_set *isl_basic_map_range(
3707 __isl_take isl_basic_map *bmap);
3708 __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
3709 __isl_give isl_set *isl_map_domain(
3710 __isl_take isl_map *bmap);
3711 __isl_give isl_set *isl_map_range(
3712 __isl_take isl_map *map);
3714 #include <isl/union_set.h>
3715 __isl_give isl_set *isl_union_set_params(
3716 __isl_take isl_union_set *uset);
3718 #include <isl/union_map.h>
3719 __isl_give isl_union_map *isl_union_map_project_out(
3720 __isl_take isl_union_map *umap,
3721 enum isl_dim_type type, unsigned first, unsigned n);
3722 __isl_give isl_set *isl_union_map_params(
3723 __isl_take isl_union_map *umap);
3724 __isl_give isl_union_set *isl_union_map_domain(
3725 __isl_take isl_union_map *umap);
3726 __isl_give isl_union_set *isl_union_map_range(
3727 __isl_take isl_union_map *umap);
3729 The function C<isl_union_map_project_out> can only project out
3732 #include <isl/aff.h>
3733 __isl_give isl_aff *isl_aff_project_domain_on_params(
3734 __isl_take isl_aff *aff);
3735 __isl_give isl_pw_multi_aff *
3736 isl_pw_multi_aff_project_domain_on_params(
3737 __isl_take isl_pw_multi_aff *pma);
3738 __isl_give isl_set *isl_pw_aff_domain(
3739 __isl_take isl_pw_aff *pwaff);
3740 __isl_give isl_set *isl_pw_multi_aff_domain(
3741 __isl_take isl_pw_multi_aff *pma);
3742 __isl_give isl_set *isl_multi_pw_aff_domain(
3743 __isl_take isl_multi_pw_aff *mpa);
3744 __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
3745 __isl_take isl_union_pw_multi_aff *upma);
3746 __isl_give isl_set *isl_pw_aff_params(
3747 __isl_take isl_pw_aff *pwa);
3749 #include <isl/polynomial.h>
3750 __isl_give isl_qpolynomial *
3751 isl_qpolynomial_project_domain_on_params(
3752 __isl_take isl_qpolynomial *qp);
3753 __isl_give isl_pw_qpolynomial *
3754 isl_pw_qpolynomial_project_domain_on_params(
3755 __isl_take isl_pw_qpolynomial *pwqp);
3756 __isl_give isl_pw_qpolynomial_fold *
3757 isl_pw_qpolynomial_fold_project_domain_on_params(
3758 __isl_take isl_pw_qpolynomial_fold *pwf);
3759 __isl_give isl_set *isl_pw_qpolynomial_domain(
3760 __isl_take isl_pw_qpolynomial *pwqp);
3761 __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
3762 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3763 __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
3764 __isl_take isl_union_pw_qpolynomial *upwqp);
3766 #include <isl/space.h>
3767 __isl_give isl_space *isl_space_domain_map(
3768 __isl_take isl_space *space);
3769 __isl_give isl_space *isl_space_range_map(
3770 __isl_take isl_space *space);
3772 #include <isl/map.h>
3773 __isl_give isl_basic_map *isl_basic_map_domain_map(
3774 __isl_take isl_basic_map *bmap);
3775 __isl_give isl_basic_map *isl_basic_map_range_map(
3776 __isl_take isl_basic_map *bmap);
3777 __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
3778 __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
3780 #include <isl/union_map.h>
3781 __isl_give isl_union_map *isl_union_map_domain_map(
3782 __isl_take isl_union_map *umap);
3783 __isl_give isl_union_map *isl_union_map_range_map(
3784 __isl_take isl_union_map *umap);
3786 The functions above construct a (basic, regular or union) relation
3787 that maps (a wrapped version of) the input relation to its domain or range.
3791 __isl_give isl_basic_set *isl_basic_set_eliminate(
3792 __isl_take isl_basic_set *bset,
3793 enum isl_dim_type type,
3794 unsigned first, unsigned n);
3795 __isl_give isl_set *isl_set_eliminate(
3796 __isl_take isl_set *set, enum isl_dim_type type,
3797 unsigned first, unsigned n);
3798 __isl_give isl_basic_map *isl_basic_map_eliminate(
3799 __isl_take isl_basic_map *bmap,
3800 enum isl_dim_type type,
3801 unsigned first, unsigned n);
3802 __isl_give isl_map *isl_map_eliminate(
3803 __isl_take isl_map *map, enum isl_dim_type type,
3804 unsigned first, unsigned n);
3806 Eliminate the coefficients for the given dimensions from the constraints,
3807 without removing the dimensions.
3809 =item * Constructing a set from a parameter domain
3811 A zero-dimensional space or (basic) set can be constructed
3812 on a given parameter domain using the following functions.
3814 #include <isl/space.h>
3815 __isl_give isl_space *isl_space_set_from_params(
3816 __isl_take isl_space *space);
3818 #include <isl/set.h>
3819 __isl_give isl_basic_set *isl_basic_set_from_params(
3820 __isl_take isl_basic_set *bset);
3821 __isl_give isl_set *isl_set_from_params(
3822 __isl_take isl_set *set);
3824 =item * Constructing a relation from a set
3826 Create a relation with the given set as domain or range.
3827 The range or domain of the created relation is a zero-dimensional
3828 flat anonymous space.
3830 #include <isl/space.h>
3831 __isl_give isl_space *isl_space_from_domain(
3832 __isl_take isl_space *space);
3833 __isl_give isl_space *isl_space_from_range(
3834 __isl_take isl_space *space);
3835 __isl_give isl_space *isl_space_map_from_set(
3836 __isl_take isl_space *space);
3837 __isl_give isl_space *isl_space_map_from_domain_and_range(
3838 __isl_take isl_space *domain,
3839 __isl_take isl_space *range);
3841 #include <isl/local_space.h>
3842 __isl_give isl_local_space *isl_local_space_from_domain(
3843 __isl_take isl_local_space *ls);
3845 #include <isl/map.h>
3846 __isl_give isl_map *isl_map_from_domain(
3847 __isl_take isl_set *set);
3848 __isl_give isl_map *isl_map_from_range(
3849 __isl_take isl_set *set);
3851 #include <isl/val.h>
3852 __isl_give isl_multi_val *isl_multi_val_from_range(
3853 __isl_take isl_multi_val *mv);
3855 #include <isl/aff.h>
3856 __isl_give isl_multi_aff *isl_multi_aff_from_range(
3857 __isl_take isl_multi_aff *ma);
3858 __isl_give isl_pw_aff *isl_pw_aff_from_range(
3859 __isl_take isl_pw_aff *pwa);
3860 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
3861 __isl_take isl_multi_pw_aff *mpa);
3862 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
3863 __isl_take isl_set *set);
3864 __isl_give isl_union_pw_multi_aff *
3865 isl_union_pw_multi_aff_from_domain(
3866 __isl_take isl_union_set *uset);
3870 #include <isl/set.h>
3871 __isl_give isl_basic_set *isl_basic_set_fix_si(
3872 __isl_take isl_basic_set *bset,
3873 enum isl_dim_type type, unsigned pos, int value);
3874 __isl_give isl_basic_set *isl_basic_set_fix_val(
3875 __isl_take isl_basic_set *bset,
3876 enum isl_dim_type type, unsigned pos,
3877 __isl_take isl_val *v);
3878 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
3879 enum isl_dim_type type, unsigned pos, int value);
3880 __isl_give isl_set *isl_set_fix_val(
3881 __isl_take isl_set *set,
3882 enum isl_dim_type type, unsigned pos,
3883 __isl_take isl_val *v);
3885 #include <isl/map.h>
3886 __isl_give isl_basic_map *isl_basic_map_fix_si(
3887 __isl_take isl_basic_map *bmap,
3888 enum isl_dim_type type, unsigned pos, int value);
3889 __isl_give isl_basic_map *isl_basic_map_fix_val(
3890 __isl_take isl_basic_map *bmap,
3891 enum isl_dim_type type, unsigned pos,
3892 __isl_take isl_val *v);
3893 __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
3894 enum isl_dim_type type, unsigned pos, int value);
3895 __isl_give isl_map *isl_map_fix_val(
3896 __isl_take isl_map *map,
3897 enum isl_dim_type type, unsigned pos,
3898 __isl_take isl_val *v);
3900 #include <isl/aff.h>
3901 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
3902 __isl_take isl_pw_multi_aff *pma,
3903 enum isl_dim_type type, unsigned pos, int value);
3905 #include <isl/polynomial.h>
3906 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
3907 __isl_take isl_pw_qpolynomial *pwqp,
3908 enum isl_dim_type type, unsigned n,
3909 __isl_take isl_val *v);
3911 Intersect the set, relation or function domain
3912 with the hyperplane where the given
3913 dimension has the fixed given value.
3915 __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
3916 __isl_take isl_basic_map *bmap,
3917 enum isl_dim_type type, unsigned pos, int value);
3918 __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
3919 __isl_take isl_basic_map *bmap,
3920 enum isl_dim_type type, unsigned pos, int value);
3921 __isl_give isl_set *isl_set_lower_bound_si(
3922 __isl_take isl_set *set,
3923 enum isl_dim_type type, unsigned pos, int value);
3924 __isl_give isl_set *isl_set_lower_bound_val(
3925 __isl_take isl_set *set,
3926 enum isl_dim_type type, unsigned pos,
3927 __isl_take isl_val *value);
3928 __isl_give isl_map *isl_map_lower_bound_si(
3929 __isl_take isl_map *map,
3930 enum isl_dim_type type, unsigned pos, int value);
3931 __isl_give isl_set *isl_set_upper_bound_si(
3932 __isl_take isl_set *set,
3933 enum isl_dim_type type, unsigned pos, int value);
3934 __isl_give isl_set *isl_set_upper_bound_val(
3935 __isl_take isl_set *set,
3936 enum isl_dim_type type, unsigned pos,
3937 __isl_take isl_val *value);
3938 __isl_give isl_map *isl_map_upper_bound_si(
3939 __isl_take isl_map *map,
3940 enum isl_dim_type type, unsigned pos, int value);
3942 Intersect the set or relation with the half-space where the given
3943 dimension has a value bounded by the fixed given integer value.
3945 __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
3946 enum isl_dim_type type1, int pos1,
3947 enum isl_dim_type type2, int pos2);
3948 __isl_give isl_basic_map *isl_basic_map_equate(
3949 __isl_take isl_basic_map *bmap,
3950 enum isl_dim_type type1, int pos1,
3951 enum isl_dim_type type2, int pos2);
3952 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
3953 enum isl_dim_type type1, int pos1,
3954 enum isl_dim_type type2, int pos2);
3956 Intersect the set or relation with the hyperplane where the given
3957 dimensions are equal to each other.
3959 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
3960 enum isl_dim_type type1, int pos1,
3961 enum isl_dim_type type2, int pos2);
3963 Intersect the relation with the hyperplane where the given
3964 dimensions have opposite values.
3966 __isl_give isl_map *isl_map_order_le(
3967 __isl_take isl_map *map,
3968 enum isl_dim_type type1, int pos1,
3969 enum isl_dim_type type2, int pos2);
3970 __isl_give isl_basic_map *isl_basic_map_order_ge(
3971 __isl_take isl_basic_map *bmap,
3972 enum isl_dim_type type1, int pos1,
3973 enum isl_dim_type type2, int pos2);
3974 __isl_give isl_map *isl_map_order_ge(
3975 __isl_take isl_map *map,
3976 enum isl_dim_type type1, int pos1,
3977 enum isl_dim_type type2, int pos2);
3978 __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
3979 enum isl_dim_type type1, int pos1,
3980 enum isl_dim_type type2, int pos2);
3981 __isl_give isl_basic_map *isl_basic_map_order_gt(
3982 __isl_take isl_basic_map *bmap,
3983 enum isl_dim_type type1, int pos1,
3984 enum isl_dim_type type2, int pos2);
3985 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
3986 enum isl_dim_type type1, int pos1,
3987 enum isl_dim_type type2, int pos2);
3989 Intersect the relation with the half-space where the given
3990 dimensions satisfy the given ordering.
3994 #include <isl/aff.h>
3995 __isl_give isl_basic_set *isl_aff_zero_basic_set(
3996 __isl_take isl_aff *aff);
3997 __isl_give isl_basic_set *isl_aff_neg_basic_set(
3998 __isl_take isl_aff *aff);
3999 __isl_give isl_set *isl_pw_aff_nonneg_set(
4000 __isl_take isl_pw_aff *pwaff);
4001 __isl_give isl_set *isl_pw_aff_zero_set(
4002 __isl_take isl_pw_aff *pwaff);
4003 __isl_give isl_set *isl_pw_aff_non_zero_set(
4004 __isl_take isl_pw_aff *pwaff);
4006 The function C<isl_aff_neg_basic_set> returns a basic set
4007 containing those elements in the domain space
4008 of C<aff> where C<aff> is negative.
4009 The function C<isl_pw_aff_nonneg_set> returns a set
4010 containing those elements in the domain
4011 of C<pwaff> where C<pwaff> is non-negative.
4015 __isl_give isl_map *isl_set_identity(
4016 __isl_take isl_set *set);
4017 __isl_give isl_union_map *isl_union_set_identity(
4018 __isl_take isl_union_set *uset);
4020 Construct an identity relation on the given (union) set.
4022 =item * Function Extraction
4024 A piecewise quasi affine expression that is equal to 1 on a set
4025 and 0 outside the set can be created using the following function.
4027 #include <isl/aff.h>
4028 __isl_give isl_pw_aff *isl_set_indicator_function(
4029 __isl_take isl_set *set);
4031 A piecewise multiple quasi affine expression can be extracted
4032 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4033 and the C<isl_map> is single-valued.
4034 In case of a conversion from an C<isl_union_map>
4035 to an C<isl_union_pw_multi_aff>, these properties need to hold
4036 in each domain space.
4038 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4039 __isl_take isl_set *set);
4040 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4041 __isl_take isl_map *map);
4043 __isl_give isl_union_pw_multi_aff *
4044 isl_union_pw_multi_aff_from_union_set(
4045 __isl_take isl_union_set *uset);
4046 __isl_give isl_union_pw_multi_aff *
4047 isl_union_pw_multi_aff_from_union_map(
4048 __isl_take isl_union_map *umap);
4052 __isl_give isl_basic_set *isl_basic_map_deltas(
4053 __isl_take isl_basic_map *bmap);
4054 __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4055 __isl_give isl_union_set *isl_union_map_deltas(
4056 __isl_take isl_union_map *umap);
4058 These functions return a (basic) set containing the differences
4059 between image elements and corresponding domain elements in the input.
4061 __isl_give isl_basic_map *isl_basic_map_deltas_map(
4062 __isl_take isl_basic_map *bmap);
4063 __isl_give isl_map *isl_map_deltas_map(
4064 __isl_take isl_map *map);
4065 __isl_give isl_union_map *isl_union_map_deltas_map(
4066 __isl_take isl_union_map *umap);
4068 The functions above construct a (basic, regular or union) relation
4069 that maps (a wrapped version of) the input relation to its delta set.
4073 Simplify the representation of a set, relation or functions by trying
4074 to combine pairs of basic sets or relations into a single
4075 basic set or relation.
4077 #include <isl/set.h>
4078 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4080 #include <isl/map.h>
4081 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4083 #include <isl/union_set.h>
4084 __isl_give isl_union_set *isl_union_set_coalesce(
4085 __isl_take isl_union_set *uset);
4087 #include <isl/union_map.h>
4088 __isl_give isl_union_map *isl_union_map_coalesce(
4089 __isl_take isl_union_map *umap);
4091 #include <isl/aff.h>
4092 __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4093 __isl_take isl_pw_aff *pwqp);
4094 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4095 __isl_take isl_pw_multi_aff *pma);
4096 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4097 __isl_take isl_multi_pw_aff *mpa);
4098 __isl_give isl_union_pw_multi_aff *
4099 isl_union_pw_multi_aff_coalesce(
4100 __isl_take isl_union_pw_multi_aff *upma);
4102 #include <isl/polynomial.h>
4103 __isl_give isl_pw_qpolynomial_fold *
4104 isl_pw_qpolynomial_fold_coalesce(
4105 __isl_take isl_pw_qpolynomial_fold *pwf);
4106 __isl_give isl_union_pw_qpolynomial *
4107 isl_union_pw_qpolynomial_coalesce(
4108 __isl_take isl_union_pw_qpolynomial *upwqp);
4109 __isl_give isl_union_pw_qpolynomial_fold *
4110 isl_union_pw_qpolynomial_fold_coalesce(
4111 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4113 One of the methods for combining pairs of basic sets or relations
4114 can result in coefficients that are much larger than those that appear
4115 in the constraints of the input. By default, the coefficients are
4116 not allowed to grow larger, but this can be changed by unsetting
4117 the following option.
4119 int isl_options_set_coalesce_bounded_wrapping(
4120 isl_ctx *ctx, int val);
4121 int isl_options_get_coalesce_bounded_wrapping(
4124 =item * Detecting equalities
4126 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4127 __isl_take isl_basic_set *bset);
4128 __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4129 __isl_take isl_basic_map *bmap);
4130 __isl_give isl_set *isl_set_detect_equalities(
4131 __isl_take isl_set *set);
4132 __isl_give isl_map *isl_map_detect_equalities(
4133 __isl_take isl_map *map);
4134 __isl_give isl_union_set *isl_union_set_detect_equalities(
4135 __isl_take isl_union_set *uset);
4136 __isl_give isl_union_map *isl_union_map_detect_equalities(
4137 __isl_take isl_union_map *umap);
4139 Simplify the representation of a set or relation by detecting implicit
4142 =item * Removing redundant constraints
4144 __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4145 __isl_take isl_basic_set *bset);
4146 __isl_give isl_set *isl_set_remove_redundancies(
4147 __isl_take isl_set *set);
4148 __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4149 __isl_take isl_basic_map *bmap);
4150 __isl_give isl_map *isl_map_remove_redundancies(
4151 __isl_take isl_map *map);
4155 __isl_give isl_basic_set *isl_set_convex_hull(
4156 __isl_take isl_set *set);
4157 __isl_give isl_basic_map *isl_map_convex_hull(
4158 __isl_take isl_map *map);
4160 If the input set or relation has any existentially quantified
4161 variables, then the result of these operations is currently undefined.
4165 #include <isl/set.h>
4166 __isl_give isl_basic_set *
4167 isl_set_unshifted_simple_hull(
4168 __isl_take isl_set *set);
4169 __isl_give isl_basic_set *isl_set_simple_hull(
4170 __isl_take isl_set *set);
4171 __isl_give isl_basic_set *
4172 isl_set_unshifted_simple_hull_from_set_list(
4173 __isl_take isl_set *set,
4174 __isl_take isl_set_list *list);
4176 #include <isl/map.h>
4177 __isl_give isl_basic_map *
4178 isl_map_unshifted_simple_hull(
4179 __isl_take isl_map *map);
4180 __isl_give isl_basic_map *isl_map_simple_hull(
4181 __isl_take isl_map *map);
4183 #include <isl/union_map.h>
4184 __isl_give isl_union_map *isl_union_map_simple_hull(
4185 __isl_take isl_union_map *umap);
4187 These functions compute a single basic set or relation
4188 that contains the whole input set or relation.
4189 In particular, the output is described by translates
4190 of the constraints describing the basic sets or relations in the input.
4191 In case of C<isl_set_unshifted_simple_hull>, only the original
4192 constraints are used, without any translation.
4193 In case of C<isl_set_unshifted_simple_hull_from_set_list>, the
4194 constraints are taken from the elements of the second argument.
4198 (See \autoref{s:simple hull}.)
4204 __isl_give isl_basic_set *isl_basic_set_affine_hull(
4205 __isl_take isl_basic_set *bset);
4206 __isl_give isl_basic_set *isl_set_affine_hull(
4207 __isl_take isl_set *set);
4208 __isl_give isl_union_set *isl_union_set_affine_hull(
4209 __isl_take isl_union_set *uset);
4210 __isl_give isl_basic_map *isl_basic_map_affine_hull(
4211 __isl_take isl_basic_map *bmap);
4212 __isl_give isl_basic_map *isl_map_affine_hull(
4213 __isl_take isl_map *map);
4214 __isl_give isl_union_map *isl_union_map_affine_hull(
4215 __isl_take isl_union_map *umap);
4217 In case of union sets and relations, the affine hull is computed
4220 =item * Polyhedral hull
4222 __isl_give isl_basic_set *isl_set_polyhedral_hull(
4223 __isl_take isl_set *set);
4224 __isl_give isl_basic_map *isl_map_polyhedral_hull(
4225 __isl_take isl_map *map);
4226 __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4227 __isl_take isl_union_set *uset);
4228 __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4229 __isl_take isl_union_map *umap);
4231 These functions compute a single basic set or relation
4232 not involving any existentially quantified variables
4233 that contains the whole input set or relation.
4234 In case of union sets and relations, the polyhedral hull is computed
4237 =item * Other approximations
4239 #include <isl/set.h>
4240 __isl_give isl_basic_set *
4241 isl_basic_set_drop_constraints_involving_dims(
4242 __isl_take isl_basic_set *bset,
4243 enum isl_dim_type type,
4244 unsigned first, unsigned n);
4245 __isl_give isl_basic_set *
4246 isl_basic_set_drop_constraints_not_involving_dims(
4247 __isl_take isl_basic_set *bset,
4248 enum isl_dim_type type,
4249 unsigned first, unsigned n);
4250 __isl_give isl_set *
4251 isl_set_drop_constraints_involving_dims(
4252 __isl_take isl_set *set,
4253 enum isl_dim_type type,
4254 unsigned first, unsigned n);
4256 #include <isl/map.h>
4257 __isl_give isl_basic_map *
4258 isl_basic_map_drop_constraints_involving_dims(
4259 __isl_take isl_basic_map *bmap,
4260 enum isl_dim_type type,
4261 unsigned first, unsigned n);
4262 __isl_give isl_map *
4263 isl_map_drop_constraints_involving_dims(
4264 __isl_take isl_map *map,
4265 enum isl_dim_type type,
4266 unsigned first, unsigned n);
4268 These functions drop any constraints (not) involving the specified dimensions.
4269 Note that the result depends on the representation of the input.
4271 #include <isl/polynomial.h>
4272 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4273 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4274 __isl_give isl_union_pw_qpolynomial *
4275 isl_union_pw_qpolynomial_to_polynomial(
4276 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4278 Approximate each quasipolynomial by a polynomial. If C<sign> is positive,
4279 the polynomial will be an overapproximation. If C<sign> is negative,
4280 it will be an underapproximation. If C<sign> is zero, the approximation
4281 will lie somewhere in between.
4285 __isl_give isl_basic_set *isl_basic_set_sample(
4286 __isl_take isl_basic_set *bset);
4287 __isl_give isl_basic_set *isl_set_sample(
4288 __isl_take isl_set *set);
4289 __isl_give isl_basic_map *isl_basic_map_sample(
4290 __isl_take isl_basic_map *bmap);
4291 __isl_give isl_basic_map *isl_map_sample(
4292 __isl_take isl_map *map);
4294 If the input (basic) set or relation is non-empty, then return
4295 a singleton subset of the input. Otherwise, return an empty set.
4297 =item * Optimization
4299 #include <isl/ilp.h>
4300 __isl_give isl_val *isl_basic_set_max_val(
4301 __isl_keep isl_basic_set *bset,
4302 __isl_keep isl_aff *obj);
4303 __isl_give isl_val *isl_set_min_val(
4304 __isl_keep isl_set *set,
4305 __isl_keep isl_aff *obj);
4306 __isl_give isl_val *isl_set_max_val(
4307 __isl_keep isl_set *set,
4308 __isl_keep isl_aff *obj);
4310 Compute the minimum or maximum of the integer affine expression C<obj>
4311 over the points in C<set>, returning the result in C<opt>.
4312 The result is C<NULL> in case of an error, the optimal value in case
4313 there is one, negative infinity or infinity if the problem is unbounded and
4314 NaN if the problem is empty.
4316 =item * Parametric optimization
4318 __isl_give isl_pw_aff *isl_set_dim_min(
4319 __isl_take isl_set *set, int pos);
4320 __isl_give isl_pw_aff *isl_set_dim_max(
4321 __isl_take isl_set *set, int pos);
4322 __isl_give isl_pw_aff *isl_map_dim_max(
4323 __isl_take isl_map *map, int pos);
4325 Compute the minimum or maximum of the given set or output dimension
4326 as a function of the parameters (and input dimensions), but independently
4327 of the other set or output dimensions.
4328 For lexicographic optimization, see L<"Lexicographic Optimization">.
4332 The following functions compute either the set of (rational) coefficient
4333 values of valid constraints for the given set or the set of (rational)
4334 values satisfying the constraints with coefficients from the given set.
4335 Internally, these two sets of functions perform essentially the
4336 same operations, except that the set of coefficients is assumed to
4337 be a cone, while the set of values may be any polyhedron.
4338 The current implementation is based on the Farkas lemma and
4339 Fourier-Motzkin elimination, but this may change or be made optional
4340 in future. In particular, future implementations may use different
4341 dualization algorithms or skip the elimination step.
4343 __isl_give isl_basic_set *isl_basic_set_coefficients(
4344 __isl_take isl_basic_set *bset);
4345 __isl_give isl_basic_set *isl_set_coefficients(
4346 __isl_take isl_set *set);
4347 __isl_give isl_union_set *isl_union_set_coefficients(
4348 __isl_take isl_union_set *bset);
4349 __isl_give isl_basic_set *isl_basic_set_solutions(
4350 __isl_take isl_basic_set *bset);
4351 __isl_give isl_basic_set *isl_set_solutions(
4352 __isl_take isl_set *set);
4353 __isl_give isl_union_set *isl_union_set_solutions(
4354 __isl_take isl_union_set *bset);
4358 __isl_give isl_map *isl_map_fixed_power_val(
4359 __isl_take isl_map *map,
4360 __isl_take isl_val *exp);
4361 __isl_give isl_union_map *
4362 isl_union_map_fixed_power_val(
4363 __isl_take isl_union_map *umap,
4364 __isl_take isl_val *exp);
4366 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4367 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4368 of C<map> is computed.
4370 __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4372 __isl_give isl_union_map *isl_union_map_power(
4373 __isl_take isl_union_map *umap, int *exact);
4375 Compute a parametric representation for all positive powers I<k> of C<map>.
4376 The result maps I<k> to a nested relation corresponding to the
4377 I<k>th power of C<map>.
4378 The result may be an overapproximation. If the result is known to be exact,
4379 then C<*exact> is set to C<1>.
4381 =item * Transitive closure
4383 __isl_give isl_map *isl_map_transitive_closure(
4384 __isl_take isl_map *map, int *exact);
4385 __isl_give isl_union_map *isl_union_map_transitive_closure(
4386 __isl_take isl_union_map *umap, int *exact);
4388 Compute the transitive closure of C<map>.
4389 The result may be an overapproximation. If the result is known to be exact,
4390 then C<*exact> is set to C<1>.
4392 =item * Reaching path lengths
4394 __isl_give isl_map *isl_map_reaching_path_lengths(
4395 __isl_take isl_map *map, int *exact);
4397 Compute a relation that maps each element in the range of C<map>
4398 to the lengths of all paths composed of edges in C<map> that
4399 end up in the given element.
4400 The result may be an overapproximation. If the result is known to be exact,
4401 then C<*exact> is set to C<1>.
4402 To compute the I<maximal> path length, the resulting relation
4403 should be postprocessed by C<isl_map_lexmax>.
4404 In particular, if the input relation is a dependence relation
4405 (mapping sources to sinks), then the maximal path length corresponds
4406 to the free schedule.
4407 Note, however, that C<isl_map_lexmax> expects the maximum to be
4408 finite, so if the path lengths are unbounded (possibly due to
4409 the overapproximation), then you will get an error message.
4413 #include <isl/space.h>
4414 __isl_give isl_space *isl_space_wrap(
4415 __isl_take isl_space *space);
4416 __isl_give isl_space *isl_space_unwrap(
4417 __isl_take isl_space *space);
4419 #include <isl/set.h>
4420 __isl_give isl_basic_map *isl_basic_set_unwrap(
4421 __isl_take isl_basic_set *bset);
4422 __isl_give isl_map *isl_set_unwrap(
4423 __isl_take isl_set *set);
4425 #include <isl/map.h>
4426 __isl_give isl_basic_set *isl_basic_map_wrap(
4427 __isl_take isl_basic_map *bmap);
4428 __isl_give isl_set *isl_map_wrap(
4429 __isl_take isl_map *map);
4431 #include <isl/union_set.h>
4432 __isl_give isl_union_map *isl_union_set_unwrap(
4433 __isl_take isl_union_set *uset);
4435 #include <isl/union_map.h>
4436 __isl_give isl_union_set *isl_union_map_wrap(
4437 __isl_take isl_union_map *umap);
4439 The input to C<isl_space_unwrap> should
4440 be the space of a set, while that of
4441 C<isl_space_wrap> should be the space of a relation.
4442 Conversely, the output of C<isl_space_unwrap> is the space
4443 of a relation, while that of C<isl_space_wrap> is the space of a set.
4447 Remove any internal structure of domain (and range) of the given
4448 set or relation. If there is any such internal structure in the input,
4449 then the name of the space is also removed.
4451 #include <isl/local_space.h>
4452 __isl_give isl_local_space *
4453 isl_local_space_flatten_domain(
4454 __isl_take isl_local_space *ls);
4455 __isl_give isl_local_space *
4456 isl_local_space_flatten_range(
4457 __isl_take isl_local_space *ls);
4459 #include <isl/set.h>
4460 __isl_give isl_basic_set *isl_basic_set_flatten(
4461 __isl_take isl_basic_set *bset);
4462 __isl_give isl_set *isl_set_flatten(
4463 __isl_take isl_set *set);
4465 #include <isl/map.h>
4466 __isl_give isl_basic_map *isl_basic_map_flatten_domain(
4467 __isl_take isl_basic_map *bmap);
4468 __isl_give isl_basic_map *isl_basic_map_flatten_range(
4469 __isl_take isl_basic_map *bmap);
4470 __isl_give isl_map *isl_map_flatten_range(
4471 __isl_take isl_map *map);
4472 __isl_give isl_map *isl_map_flatten_domain(
4473 __isl_take isl_map *map);
4474 __isl_give isl_basic_map *isl_basic_map_flatten(
4475 __isl_take isl_basic_map *bmap);
4476 __isl_give isl_map *isl_map_flatten(
4477 __isl_take isl_map *map);
4479 #include <isl/val.h>
4480 __isl_give isl_multi_val *isl_multi_val_flatten_range(
4481 __isl_take isl_multi_val *mv);
4483 #include <isl/aff.h>
4484 __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
4485 __isl_take isl_multi_aff *ma);
4486 __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
4487 __isl_take isl_multi_aff *ma);
4488 __isl_give isl_multi_pw_aff *
4489 isl_multi_pw_aff_flatten_range(
4490 __isl_take isl_multi_pw_aff *mpa);
4492 #include <isl/map.h>
4493 __isl_give isl_map *isl_set_flatten_map(
4494 __isl_take isl_set *set);
4496 The function above constructs a relation
4497 that maps the input set to a flattened version of the set.
4501 Lift the input set to a space with extra dimensions corresponding
4502 to the existentially quantified variables in the input.
4503 In particular, the result lives in a wrapped map where the domain
4504 is the original space and the range corresponds to the original
4505 existentially quantified variables.
4507 #include <isl/set.h>
4508 __isl_give isl_basic_set *isl_basic_set_lift(
4509 __isl_take isl_basic_set *bset);
4510 __isl_give isl_set *isl_set_lift(
4511 __isl_take isl_set *set);
4512 __isl_give isl_union_set *isl_union_set_lift(
4513 __isl_take isl_union_set *uset);
4515 Given a local space that contains the existentially quantified
4516 variables of a set, a basic relation that, when applied to
4517 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
4518 can be constructed using the following function.
4520 #include <isl/local_space.h>
4521 __isl_give isl_basic_map *isl_local_space_lifting(
4522 __isl_take isl_local_space *ls);
4524 #include <isl/aff.h>
4525 __isl_give isl_multi_aff *isl_multi_aff_lift(
4526 __isl_take isl_multi_aff *maff,
4527 __isl_give isl_local_space **ls);
4529 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
4530 then it is assigned the local space that lies at the basis of
4531 the lifting applied.
4533 =item * Internal Product
4535 #include <isl/space.h>
4536 __isl_give isl_space *isl_space_zip(
4537 __isl_take isl_space *space);
4539 #include <isl/map.h>
4540 __isl_give isl_basic_map *isl_basic_map_zip(
4541 __isl_take isl_basic_map *bmap);
4542 __isl_give isl_map *isl_map_zip(
4543 __isl_take isl_map *map);
4545 #include <isl/union_map.h>
4546 __isl_give isl_union_map *isl_union_map_zip(
4547 __isl_take isl_union_map *umap);
4549 Given a relation with nested relations for domain and range,
4550 interchange the range of the domain with the domain of the range.
4554 #include <isl/space.h>
4555 __isl_give isl_space *isl_space_curry(
4556 __isl_take isl_space *space);
4557 __isl_give isl_space *isl_space_uncurry(
4558 __isl_take isl_space *space);
4560 #include <isl/map.h>
4561 __isl_give isl_basic_map *isl_basic_map_curry(
4562 __isl_take isl_basic_map *bmap);
4563 __isl_give isl_basic_map *isl_basic_map_uncurry(
4564 __isl_take isl_basic_map *bmap);
4565 __isl_give isl_map *isl_map_curry(
4566 __isl_take isl_map *map);
4567 __isl_give isl_map *isl_map_uncurry(
4568 __isl_take isl_map *map);
4570 #include <isl/union_map.h>
4571 __isl_give isl_union_map *isl_union_map_curry(
4572 __isl_take isl_union_map *umap);
4573 __isl_give isl_union_map *isl_union_map_uncurry(
4574 __isl_take isl_union_map *umap);
4576 Given a relation with a nested relation for domain,
4577 the C<curry> functions
4578 move the range of the nested relation out of the domain
4579 and use it as the domain of a nested relation in the range,
4580 with the original range as range of this nested relation.
4581 The C<uncurry> functions perform the inverse operation.
4583 =item * Aligning parameters
4585 Change the order of the parameters of the given set, relation
4587 such that the first parameters match those of C<model>.
4588 This may involve the introduction of extra parameters.
4589 All parameters need to be named.
4591 #include <isl/space.h>
4592 __isl_give isl_space *isl_space_align_params(
4593 __isl_take isl_space *space1,
4594 __isl_take isl_space *space2)
4596 #include <isl/set.h>
4597 __isl_give isl_basic_set *isl_basic_set_align_params(
4598 __isl_take isl_basic_set *bset,
4599 __isl_take isl_space *model);
4600 __isl_give isl_set *isl_set_align_params(
4601 __isl_take isl_set *set,
4602 __isl_take isl_space *model);
4604 #include <isl/map.h>
4605 __isl_give isl_basic_map *isl_basic_map_align_params(
4606 __isl_take isl_basic_map *bmap,
4607 __isl_take isl_space *model);
4608 __isl_give isl_map *isl_map_align_params(
4609 __isl_take isl_map *map,
4610 __isl_take isl_space *model);
4612 #include <isl/val.h>
4613 __isl_give isl_multi_val *isl_multi_val_align_params(
4614 __isl_take isl_multi_val *mv,
4615 __isl_take isl_space *model);
4617 #include <isl/aff.h>
4618 __isl_give isl_aff *isl_aff_align_params(
4619 __isl_take isl_aff *aff,
4620 __isl_take isl_space *model);
4621 __isl_give isl_multi_aff *isl_multi_aff_align_params(
4622 __isl_take isl_multi_aff *multi,
4623 __isl_take isl_space *model);
4624 __isl_give isl_pw_aff *isl_pw_aff_align_params(
4625 __isl_take isl_pw_aff *pwaff,
4626 __isl_take isl_space *model);
4627 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
4628 __isl_take isl_pw_multi_aff *pma,
4629 __isl_take isl_space *model);
4630 __isl_give isl_union_pw_multi_aff *
4631 isl_union_pw_multi_aff_align_params(
4632 __isl_take isl_union_pw_multi_aff *upma,
4633 __isl_take isl_space *model);
4635 #include <isl/polynomial.h>
4636 __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
4637 __isl_take isl_qpolynomial *qp,
4638 __isl_take isl_space *model);
4640 =item * Unary Arithmethic Operations
4642 #include <isl/aff.h>
4643 __isl_give isl_aff *isl_aff_neg(
4644 __isl_take isl_aff *aff);
4645 __isl_give isl_pw_aff *isl_pw_aff_neg(
4646 __isl_take isl_pw_aff *pwaff);
4647 __isl_give isl_aff *isl_aff_ceil(
4648 __isl_take isl_aff *aff);
4649 __isl_give isl_pw_aff *isl_pw_aff_ceil(
4650 __isl_take isl_pw_aff *pwaff);
4651 __isl_give isl_aff *isl_aff_floor(
4652 __isl_take isl_aff *aff);
4653 __isl_give isl_multi_aff *isl_multi_aff_floor(
4654 __isl_take isl_multi_aff *ma);
4655 __isl_give isl_pw_aff *isl_pw_aff_floor(
4656 __isl_take isl_pw_aff *pwaff);
4658 #include <isl/aff.h>
4659 __isl_give isl_pw_aff *isl_pw_aff_list_min(
4660 __isl_take isl_pw_aff_list *list);
4661 __isl_give isl_pw_aff *isl_pw_aff_list_max(
4662 __isl_take isl_pw_aff_list *list);
4664 #include <isl/polynomial.h>
4665 __isl_give isl_qpolynomial *isl_qpolynomial_neg(
4666 __isl_take isl_qpolynomial *qp);
4667 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
4668 __isl_take isl_pw_qpolynomial *pwqp);
4669 __isl_give isl_union_pw_qpolynomial *
4670 isl_union_pw_qpolynomial_neg(
4671 __isl_take isl_union_pw_qpolynomial *upwqp);
4672 __isl_give isl_qpolynomial *isl_qpolynomial_pow(
4673 __isl_take isl_qpolynomial *qp,
4675 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
4676 __isl_take isl_pw_qpolynomial *pwqp,
4681 The following functions evaluate a function in a point.
4683 #include <isl/polynomial.h>
4684 __isl_give isl_val *isl_pw_qpolynomial_eval(
4685 __isl_take isl_pw_qpolynomial *pwqp,
4686 __isl_take isl_point *pnt);
4687 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
4688 __isl_take isl_pw_qpolynomial_fold *pwf,
4689 __isl_take isl_point *pnt);
4690 __isl_give isl_val *isl_union_pw_qpolynomial_eval(
4691 __isl_take isl_union_pw_qpolynomial *upwqp,
4692 __isl_take isl_point *pnt);
4693 __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
4694 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4695 __isl_take isl_point *pnt);
4697 =item * Dimension manipulation
4699 It is usually not advisable to directly change the (input or output)
4700 space of a set or a relation as this removes the name and the internal
4701 structure of the space. However, the functions below can be useful
4702 to add new parameters, assuming
4703 C<isl_set_align_params> and C<isl_map_align_params>
4706 #include <isl/space.h>
4707 __isl_give isl_space *isl_space_add_dims(
4708 __isl_take isl_space *space,
4709 enum isl_dim_type type, unsigned n);
4710 __isl_give isl_space *isl_space_insert_dims(
4711 __isl_take isl_space *space,
4712 enum isl_dim_type type, unsigned pos, unsigned n);
4713 __isl_give isl_space *isl_space_drop_dims(
4714 __isl_take isl_space *space,
4715 enum isl_dim_type type, unsigned first, unsigned n);
4716 __isl_give isl_space *isl_space_move_dims(
4717 __isl_take isl_space *space,
4718 enum isl_dim_type dst_type, unsigned dst_pos,
4719 enum isl_dim_type src_type, unsigned src_pos,
4722 #include <isl/local_space.h>
4723 __isl_give isl_local_space *isl_local_space_add_dims(
4724 __isl_take isl_local_space *ls,
4725 enum isl_dim_type type, unsigned n);
4726 __isl_give isl_local_space *isl_local_space_insert_dims(
4727 __isl_take isl_local_space *ls,
4728 enum isl_dim_type type, unsigned first, unsigned n);
4729 __isl_give isl_local_space *isl_local_space_drop_dims(
4730 __isl_take isl_local_space *ls,
4731 enum isl_dim_type type, unsigned first, unsigned n);
4733 #include <isl/set.h>
4734 __isl_give isl_basic_set *isl_basic_set_add_dims(
4735 __isl_take isl_basic_set *bset,
4736 enum isl_dim_type type, unsigned n);
4737 __isl_give isl_set *isl_set_add_dims(
4738 __isl_take isl_set *set,
4739 enum isl_dim_type type, unsigned n);
4740 __isl_give isl_basic_set *isl_basic_set_insert_dims(
4741 __isl_take isl_basic_set *bset,
4742 enum isl_dim_type type, unsigned pos,
4744 __isl_give isl_set *isl_set_insert_dims(
4745 __isl_take isl_set *set,
4746 enum isl_dim_type type, unsigned pos, unsigned n);
4747 __isl_give isl_basic_set *isl_basic_set_move_dims(
4748 __isl_take isl_basic_set *bset,
4749 enum isl_dim_type dst_type, unsigned dst_pos,
4750 enum isl_dim_type src_type, unsigned src_pos,
4752 __isl_give isl_set *isl_set_move_dims(
4753 __isl_take isl_set *set,
4754 enum isl_dim_type dst_type, unsigned dst_pos,
4755 enum isl_dim_type src_type, unsigned src_pos,
4758 #include <isl/map.h>
4759 __isl_give isl_map *isl_map_add_dims(
4760 __isl_take isl_map *map,
4761 enum isl_dim_type type, unsigned n);
4762 __isl_give isl_basic_map *isl_basic_map_insert_dims(
4763 __isl_take isl_basic_map *bmap,
4764 enum isl_dim_type type, unsigned pos,
4766 __isl_give isl_map *isl_map_insert_dims(
4767 __isl_take isl_map *map,
4768 enum isl_dim_type type, unsigned pos, unsigned n);
4769 __isl_give isl_basic_map *isl_basic_map_move_dims(
4770 __isl_take isl_basic_map *bmap,
4771 enum isl_dim_type dst_type, unsigned dst_pos,
4772 enum isl_dim_type src_type, unsigned src_pos,
4774 __isl_give isl_map *isl_map_move_dims(
4775 __isl_take isl_map *map,
4776 enum isl_dim_type dst_type, unsigned dst_pos,
4777 enum isl_dim_type src_type, unsigned src_pos,
4780 #include <isl/val.h>
4781 __isl_give isl_multi_val *isl_multi_val_insert_dims(
4782 __isl_take isl_multi_val *mv,
4783 enum isl_dim_type type, unsigned first, unsigned n);
4784 __isl_give isl_multi_val *isl_multi_val_add_dims(
4785 __isl_take isl_multi_val *mv,
4786 enum isl_dim_type type, unsigned n);
4787 __isl_give isl_multi_val *isl_multi_val_drop_dims(
4788 __isl_take isl_multi_val *mv,
4789 enum isl_dim_type type, unsigned first, unsigned n);
4791 #include <isl/aff.h>
4792 __isl_give isl_aff *isl_aff_insert_dims(
4793 __isl_take isl_aff *aff,
4794 enum isl_dim_type type, unsigned first, unsigned n);
4795 __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
4796 __isl_take isl_multi_aff *ma,
4797 enum isl_dim_type type, unsigned first, unsigned n);
4798 __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
4799 __isl_take isl_pw_aff *pwaff,
4800 enum isl_dim_type type, unsigned first, unsigned n);
4801 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
4802 __isl_take isl_multi_pw_aff *mpa,
4803 enum isl_dim_type type, unsigned first, unsigned n);
4804 __isl_give isl_aff *isl_aff_add_dims(
4805 __isl_take isl_aff *aff,
4806 enum isl_dim_type type, unsigned n);
4807 __isl_give isl_multi_aff *isl_multi_aff_add_dims(
4808 __isl_take isl_multi_aff *ma,
4809 enum isl_dim_type type, unsigned n);
4810 __isl_give isl_pw_aff *isl_pw_aff_add_dims(
4811 __isl_take isl_pw_aff *pwaff,
4812 enum isl_dim_type type, unsigned n);
4813 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
4814 __isl_take isl_multi_pw_aff *mpa,
4815 enum isl_dim_type type, unsigned n);
4816 __isl_give isl_aff *isl_aff_drop_dims(
4817 __isl_take isl_aff *aff,
4818 enum isl_dim_type type, unsigned first, unsigned n);
4819 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
4820 __isl_take isl_multi_aff *maff,
4821 enum isl_dim_type type, unsigned first, unsigned n);
4822 __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
4823 __isl_take isl_pw_aff *pwaff,
4824 enum isl_dim_type type, unsigned first, unsigned n);
4825 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
4826 __isl_take isl_pw_multi_aff *pma,
4827 enum isl_dim_type type, unsigned first, unsigned n);
4828 __isl_give isl_aff *isl_aff_move_dims(
4829 __isl_take isl_aff *aff,
4830 enum isl_dim_type dst_type, unsigned dst_pos,
4831 enum isl_dim_type src_type, unsigned src_pos,
4833 __isl_give isl_multi_aff *isl_multi_aff_move_dims(
4834 __isl_take isl_multi_aff *ma,
4835 enum isl_dim_type dst_type, unsigned dst_pos,
4836 enum isl_dim_type src_type, unsigned src_pos,
4838 __isl_give isl_pw_aff *isl_pw_aff_move_dims(
4839 __isl_take isl_pw_aff *pa,
4840 enum isl_dim_type dst_type, unsigned dst_pos,
4841 enum isl_dim_type src_type, unsigned src_pos,
4843 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
4844 __isl_take isl_multi_pw_aff *pma,
4845 enum isl_dim_type dst_type, unsigned dst_pos,
4846 enum isl_dim_type src_type, unsigned src_pos,
4851 =head2 Binary Operations
4853 The two arguments of a binary operation not only need to live
4854 in the same C<isl_ctx>, they currently also need to have
4855 the same (number of) parameters.
4857 =head3 Basic Operations
4861 =item * Intersection
4863 #include <isl/local_space.h>
4864 __isl_give isl_local_space *isl_local_space_intersect(
4865 __isl_take isl_local_space *ls1,
4866 __isl_take isl_local_space *ls2);
4868 #include <isl/set.h>
4869 __isl_give isl_basic_set *isl_basic_set_intersect_params(
4870 __isl_take isl_basic_set *bset1,
4871 __isl_take isl_basic_set *bset2);
4872 __isl_give isl_basic_set *isl_basic_set_intersect(
4873 __isl_take isl_basic_set *bset1,
4874 __isl_take isl_basic_set *bset2);
4875 __isl_give isl_basic_set *isl_basic_set_list_intersect(
4876 __isl_take struct isl_basic_set_list *list);
4877 __isl_give isl_set *isl_set_intersect_params(
4878 __isl_take isl_set *set,
4879 __isl_take isl_set *params);
4880 __isl_give isl_set *isl_set_intersect(
4881 __isl_take isl_set *set1,
4882 __isl_take isl_set *set2);
4884 #include <isl/map.h>
4885 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
4886 __isl_take isl_basic_map *bmap,
4887 __isl_take isl_basic_set *bset);
4888 __isl_give isl_basic_map *isl_basic_map_intersect_range(
4889 __isl_take isl_basic_map *bmap,
4890 __isl_take isl_basic_set *bset);
4891 __isl_give isl_basic_map *isl_basic_map_intersect(
4892 __isl_take isl_basic_map *bmap1,
4893 __isl_take isl_basic_map *bmap2);
4894 __isl_give isl_map *isl_map_intersect_params(
4895 __isl_take isl_map *map,
4896 __isl_take isl_set *params);
4897 __isl_give isl_map *isl_map_intersect_domain(
4898 __isl_take isl_map *map,
4899 __isl_take isl_set *set);
4900 __isl_give isl_map *isl_map_intersect_range(
4901 __isl_take isl_map *map,
4902 __isl_take isl_set *set);
4903 __isl_give isl_map *isl_map_intersect(
4904 __isl_take isl_map *map1,
4905 __isl_take isl_map *map2);
4907 #include <isl/union_set.h>
4908 __isl_give isl_union_set *isl_union_set_intersect_params(
4909 __isl_take isl_union_set *uset,
4910 __isl_take isl_set *set);
4911 __isl_give isl_union_set *isl_union_set_intersect(
4912 __isl_take isl_union_set *uset1,
4913 __isl_take isl_union_set *uset2);
4915 #include <isl/union_map.h>
4916 __isl_give isl_union_map *isl_union_map_intersect_params(
4917 __isl_take isl_union_map *umap,
4918 __isl_take isl_set *set);
4919 __isl_give isl_union_map *isl_union_map_intersect_domain(
4920 __isl_take isl_union_map *umap,
4921 __isl_take isl_union_set *uset);
4922 __isl_give isl_union_map *isl_union_map_intersect_range(
4923 __isl_take isl_union_map *umap,
4924 __isl_take isl_union_set *uset);
4925 __isl_give isl_union_map *isl_union_map_intersect(
4926 __isl_take isl_union_map *umap1,
4927 __isl_take isl_union_map *umap2);
4929 #include <isl/aff.h>
4930 __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
4931 __isl_take isl_pw_aff *pa,
4932 __isl_take isl_set *set);
4933 __isl_give isl_multi_pw_aff *
4934 isl_multi_pw_aff_intersect_domain(
4935 __isl_take isl_multi_pw_aff *mpa,
4936 __isl_take isl_set *domain);
4937 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
4938 __isl_take isl_pw_multi_aff *pma,
4939 __isl_take isl_set *set);
4940 __isl_give isl_union_pw_multi_aff *
4941 isl_union_pw_multi_aff_intersect_domain(
4942 __isl_take isl_union_pw_multi_aff *upma,
4943 __isl_take isl_union_set *uset);
4944 __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
4945 __isl_take isl_pw_aff *pa,
4946 __isl_take isl_set *set);
4947 __isl_give isl_multi_pw_aff *
4948 isl_multi_pw_aff_intersect_params(
4949 __isl_take isl_multi_pw_aff *mpa,
4950 __isl_take isl_set *set);
4951 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
4952 __isl_take isl_pw_multi_aff *pma,
4953 __isl_take isl_set *set);
4954 __isl_give isl_union_pw_multi_aff *
4955 isl_union_pw_multi_aff_intersect_params(
4956 __isl_take isl_union_pw_multi_aff *upma,
4957 __isl_take isl_set *set);
4959 #include <isl/polynomial.h>
4960 __isl_give isl_pw_qpolynomial *
4961 isl_pw_qpolynomial_intersect_domain(
4962 __isl_take isl_pw_qpolynomial *pwpq,
4963 __isl_take isl_set *set);
4964 __isl_give isl_union_pw_qpolynomial *
4965 isl_union_pw_qpolynomial_intersect_domain(
4966 __isl_take isl_union_pw_qpolynomial *upwpq,
4967 __isl_take isl_union_set *uset);
4968 __isl_give isl_union_pw_qpolynomial_fold *
4969 isl_union_pw_qpolynomial_fold_intersect_domain(
4970 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4971 __isl_take isl_union_set *uset);
4972 __isl_give isl_pw_qpolynomial *
4973 isl_pw_qpolynomial_intersect_params(
4974 __isl_take isl_pw_qpolynomial *pwpq,
4975 __isl_take isl_set *set);
4976 __isl_give isl_pw_qpolynomial_fold *
4977 isl_pw_qpolynomial_fold_intersect_params(
4978 __isl_take isl_pw_qpolynomial_fold *pwf,
4979 __isl_take isl_set *set);
4980 __isl_give isl_union_pw_qpolynomial *
4981 isl_union_pw_qpolynomial_intersect_params(
4982 __isl_take isl_union_pw_qpolynomial *upwpq,
4983 __isl_take isl_set *set);
4984 __isl_give isl_union_pw_qpolynomial_fold *
4985 isl_union_pw_qpolynomial_fold_intersect_params(
4986 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4987 __isl_take isl_set *set);
4989 The second argument to the C<_params> functions needs to be
4990 a parametric (basic) set. For the other functions, a parametric set
4991 for either argument is only allowed if the other argument is
4992 a parametric set as well.
4993 The list passed to C<isl_basic_set_list_intersect> needs to have
4994 at least one element and all elements need to live in the same space.
4998 __isl_give isl_set *isl_basic_set_union(
4999 __isl_take isl_basic_set *bset1,
5000 __isl_take isl_basic_set *bset2);
5001 __isl_give isl_map *isl_basic_map_union(
5002 __isl_take isl_basic_map *bmap1,
5003 __isl_take isl_basic_map *bmap2);
5004 __isl_give isl_set *isl_set_union(
5005 __isl_take isl_set *set1,
5006 __isl_take isl_set *set2);
5007 __isl_give isl_map *isl_map_union(
5008 __isl_take isl_map *map1,
5009 __isl_take isl_map *map2);
5010 __isl_give isl_union_set *isl_union_set_union(
5011 __isl_take isl_union_set *uset1,
5012 __isl_take isl_union_set *uset2);
5013 __isl_give isl_union_map *isl_union_map_union(
5014 __isl_take isl_union_map *umap1,
5015 __isl_take isl_union_map *umap2);
5017 =item * Set difference
5019 __isl_give isl_set *isl_set_subtract(
5020 __isl_take isl_set *set1,
5021 __isl_take isl_set *set2);
5022 __isl_give isl_map *isl_map_subtract(
5023 __isl_take isl_map *map1,
5024 __isl_take isl_map *map2);
5025 __isl_give isl_map *isl_map_subtract_domain(
5026 __isl_take isl_map *map,
5027 __isl_take isl_set *dom);
5028 __isl_give isl_map *isl_map_subtract_range(
5029 __isl_take isl_map *map,
5030 __isl_take isl_set *dom);
5031 __isl_give isl_union_set *isl_union_set_subtract(
5032 __isl_take isl_union_set *uset1,
5033 __isl_take isl_union_set *uset2);
5034 __isl_give isl_union_map *isl_union_map_subtract(
5035 __isl_take isl_union_map *umap1,
5036 __isl_take isl_union_map *umap2);
5037 __isl_give isl_union_map *isl_union_map_subtract_domain(
5038 __isl_take isl_union_map *umap,
5039 __isl_take isl_union_set *dom);
5040 __isl_give isl_union_map *isl_union_map_subtract_range(
5041 __isl_take isl_union_map *umap,
5042 __isl_take isl_union_set *dom);
5046 #include <isl/space.h>
5047 __isl_give isl_space *isl_space_join(
5048 __isl_take isl_space *left,
5049 __isl_take isl_space *right);
5051 #include <isl/map.h>
5052 __isl_give isl_basic_set *isl_basic_set_apply(
5053 __isl_take isl_basic_set *bset,
5054 __isl_take isl_basic_map *bmap);
5055 __isl_give isl_set *isl_set_apply(
5056 __isl_take isl_set *set,
5057 __isl_take isl_map *map);
5058 __isl_give isl_union_set *isl_union_set_apply(
5059 __isl_take isl_union_set *uset,
5060 __isl_take isl_union_map *umap);
5061 __isl_give isl_basic_map *isl_basic_map_apply_domain(
5062 __isl_take isl_basic_map *bmap1,
5063 __isl_take isl_basic_map *bmap2);
5064 __isl_give isl_basic_map *isl_basic_map_apply_range(
5065 __isl_take isl_basic_map *bmap1,
5066 __isl_take isl_basic_map *bmap2);
5067 __isl_give isl_map *isl_map_apply_domain(
5068 __isl_take isl_map *map1,
5069 __isl_take isl_map *map2);
5070 __isl_give isl_map *isl_map_apply_range(
5071 __isl_take isl_map *map1,
5072 __isl_take isl_map *map2);
5074 #include <isl/union_map.h>
5075 __isl_give isl_union_map *isl_union_map_apply_domain(
5076 __isl_take isl_union_map *umap1,
5077 __isl_take isl_union_map *umap2);
5078 __isl_give isl_union_map *isl_union_map_apply_range(
5079 __isl_take isl_union_map *umap1,
5080 __isl_take isl_union_map *umap2);
5082 #include <isl/polynomial.h>
5083 __isl_give isl_pw_qpolynomial_fold *
5084 isl_set_apply_pw_qpolynomial_fold(
5085 __isl_take isl_set *set,
5086 __isl_take isl_pw_qpolynomial_fold *pwf,
5088 __isl_give isl_pw_qpolynomial_fold *
5089 isl_map_apply_pw_qpolynomial_fold(
5090 __isl_take isl_map *map,
5091 __isl_take isl_pw_qpolynomial_fold *pwf,
5093 __isl_give isl_union_pw_qpolynomial_fold *
5094 isl_union_set_apply_union_pw_qpolynomial_fold(
5095 __isl_take isl_union_set *uset,
5096 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5098 __isl_give isl_union_pw_qpolynomial_fold *
5099 isl_union_map_apply_union_pw_qpolynomial_fold(
5100 __isl_take isl_union_map *umap,
5101 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5104 The functions taking a map
5105 compose the given map with the given piecewise quasipolynomial reduction.
5106 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5107 over all elements in the intersection of the range of the map
5108 and the domain of the piecewise quasipolynomial reduction
5109 as a function of an element in the domain of the map.
5110 The functions taking a set compute a bound over all elements in the
5111 intersection of the set and the domain of the
5112 piecewise quasipolynomial reduction.
5116 #include <isl/set.h>
5117 __isl_give isl_basic_set *
5118 isl_basic_set_preimage_multi_aff(
5119 __isl_take isl_basic_set *bset,
5120 __isl_take isl_multi_aff *ma);
5121 __isl_give isl_set *isl_set_preimage_multi_aff(
5122 __isl_take isl_set *set,
5123 __isl_take isl_multi_aff *ma);
5124 __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5125 __isl_take isl_set *set,
5126 __isl_take isl_pw_multi_aff *pma);
5127 __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5128 __isl_take isl_set *set,
5129 __isl_take isl_multi_pw_aff *mpa);
5131 #include <isl/union_set.h>
5132 __isl_give isl_union_set *
5133 isl_union_set_preimage_multi_aff(
5134 __isl_take isl_union_set *uset,
5135 __isl_take isl_multi_aff *ma);
5136 __isl_give isl_union_set *
5137 isl_union_set_preimage_pw_multi_aff(
5138 __isl_take isl_union_set *uset,
5139 __isl_take isl_pw_multi_aff *pma);
5140 __isl_give isl_union_set *
5141 isl_union_set_preimage_union_pw_multi_aff(
5142 __isl_take isl_union_set *uset,
5143 __isl_take isl_union_pw_multi_aff *upma);
5145 #include <isl/map.h>
5146 __isl_give isl_basic_map *
5147 isl_basic_map_preimage_domain_multi_aff(
5148 __isl_take isl_basic_map *bmap,
5149 __isl_take isl_multi_aff *ma);
5150 __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5151 __isl_take isl_map *map,
5152 __isl_take isl_multi_aff *ma);
5153 __isl_give isl_map *isl_map_preimage_range_multi_aff(
5154 __isl_take isl_map *map,
5155 __isl_take isl_multi_aff *ma);
5156 __isl_give isl_map *
5157 isl_map_preimage_domain_pw_multi_aff(
5158 __isl_take isl_map *map,
5159 __isl_take isl_pw_multi_aff *pma);
5160 __isl_give isl_map *
5161 isl_map_preimage_range_pw_multi_aff(
5162 __isl_take isl_map *map,
5163 __isl_take isl_pw_multi_aff *pma);
5164 __isl_give isl_map *
5165 isl_map_preimage_domain_multi_pw_aff(
5166 __isl_take isl_map *map,
5167 __isl_take isl_multi_pw_aff *mpa);
5168 __isl_give isl_basic_map *
5169 isl_basic_map_preimage_range_multi_aff(
5170 __isl_take isl_basic_map *bmap,
5171 __isl_take isl_multi_aff *ma);
5173 #include <isl/union_map.h>
5174 __isl_give isl_union_map *
5175 isl_union_map_preimage_domain_multi_aff(
5176 __isl_take isl_union_map *umap,
5177 __isl_take isl_multi_aff *ma);
5178 __isl_give isl_union_map *
5179 isl_union_map_preimage_range_multi_aff(
5180 __isl_take isl_union_map *umap,
5181 __isl_take isl_multi_aff *ma);
5182 __isl_give isl_union_map *
5183 isl_union_map_preimage_domain_pw_multi_aff(
5184 __isl_take isl_union_map *umap,
5185 __isl_take isl_pw_multi_aff *pma);
5186 __isl_give isl_union_map *
5187 isl_union_map_preimage_range_pw_multi_aff(
5188 __isl_take isl_union_map *umap,
5189 __isl_take isl_pw_multi_aff *pma);
5190 __isl_give isl_union_map *
5191 isl_union_map_preimage_domain_union_pw_multi_aff(
5192 __isl_take isl_union_map *umap,
5193 __isl_take isl_union_pw_multi_aff *upma);
5194 __isl_give isl_union_map *
5195 isl_union_map_preimage_range_union_pw_multi_aff(
5196 __isl_take isl_union_map *umap,
5197 __isl_take isl_union_pw_multi_aff *upma);
5199 These functions compute the preimage of the given set or map domain/range under
5200 the given function. In other words, the expression is plugged
5201 into the set description or into the domain/range of the map.
5205 #include <isl/aff.h>
5206 __isl_give isl_aff *isl_aff_pullback_aff(
5207 __isl_take isl_aff *aff1,
5208 __isl_take isl_aff *aff2);
5209 __isl_give isl_aff *isl_aff_pullback_multi_aff(
5210 __isl_take isl_aff *aff,
5211 __isl_take isl_multi_aff *ma);
5212 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5213 __isl_take isl_pw_aff *pa,
5214 __isl_take isl_multi_aff *ma);
5215 __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5216 __isl_take isl_pw_aff *pa,
5217 __isl_take isl_pw_multi_aff *pma);
5218 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5219 __isl_take isl_pw_aff *pa,
5220 __isl_take isl_multi_pw_aff *mpa);
5221 __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5222 __isl_take isl_multi_aff *ma1,
5223 __isl_take isl_multi_aff *ma2);
5224 __isl_give isl_pw_multi_aff *
5225 isl_pw_multi_aff_pullback_multi_aff(
5226 __isl_take isl_pw_multi_aff *pma,
5227 __isl_take isl_multi_aff *ma);
5228 __isl_give isl_multi_pw_aff *
5229 isl_multi_pw_aff_pullback_multi_aff(
5230 __isl_take isl_multi_pw_aff *mpa,
5231 __isl_take isl_multi_aff *ma);
5232 __isl_give isl_pw_multi_aff *
5233 isl_pw_multi_aff_pullback_pw_multi_aff(
5234 __isl_take isl_pw_multi_aff *pma1,
5235 __isl_take isl_pw_multi_aff *pma2);
5236 __isl_give isl_multi_pw_aff *
5237 isl_multi_pw_aff_pullback_pw_multi_aff(
5238 __isl_take isl_multi_pw_aff *mpa,
5239 __isl_take isl_pw_multi_aff *pma);
5240 __isl_give isl_multi_pw_aff *
5241 isl_multi_pw_aff_pullback_multi_pw_aff(
5242 __isl_take isl_multi_pw_aff *mpa1,
5243 __isl_take isl_multi_pw_aff *mpa2);
5245 These functions precompose the first expression by the second function.
5246 In other words, the second function is plugged
5247 into the first expression.
5251 #include <isl/aff.h>
5252 __isl_give isl_basic_set *isl_aff_le_basic_set(
5253 __isl_take isl_aff *aff1,
5254 __isl_take isl_aff *aff2);
5255 __isl_give isl_basic_set *isl_aff_ge_basic_set(
5256 __isl_take isl_aff *aff1,
5257 __isl_take isl_aff *aff2);
5258 __isl_give isl_set *isl_pw_aff_eq_set(
5259 __isl_take isl_pw_aff *pwaff1,
5260 __isl_take isl_pw_aff *pwaff2);
5261 __isl_give isl_set *isl_pw_aff_ne_set(
5262 __isl_take isl_pw_aff *pwaff1,
5263 __isl_take isl_pw_aff *pwaff2);
5264 __isl_give isl_set *isl_pw_aff_le_set(
5265 __isl_take isl_pw_aff *pwaff1,
5266 __isl_take isl_pw_aff *pwaff2);
5267 __isl_give isl_set *isl_pw_aff_lt_set(
5268 __isl_take isl_pw_aff *pwaff1,
5269 __isl_take isl_pw_aff *pwaff2);
5270 __isl_give isl_set *isl_pw_aff_ge_set(
5271 __isl_take isl_pw_aff *pwaff1,
5272 __isl_take isl_pw_aff *pwaff2);
5273 __isl_give isl_set *isl_pw_aff_gt_set(
5274 __isl_take isl_pw_aff *pwaff1,
5275 __isl_take isl_pw_aff *pwaff2);
5277 __isl_give isl_set *isl_multi_aff_lex_le_set(
5278 __isl_take isl_multi_aff *ma1,
5279 __isl_take isl_multi_aff *ma2);
5280 __isl_give isl_set *isl_multi_aff_lex_ge_set(
5281 __isl_take isl_multi_aff *ma1,
5282 __isl_take isl_multi_aff *ma2);
5284 __isl_give isl_set *isl_pw_aff_list_eq_set(
5285 __isl_take isl_pw_aff_list *list1,
5286 __isl_take isl_pw_aff_list *list2);
5287 __isl_give isl_set *isl_pw_aff_list_ne_set(
5288 __isl_take isl_pw_aff_list *list1,
5289 __isl_take isl_pw_aff_list *list2);
5290 __isl_give isl_set *isl_pw_aff_list_le_set(
5291 __isl_take isl_pw_aff_list *list1,
5292 __isl_take isl_pw_aff_list *list2);
5293 __isl_give isl_set *isl_pw_aff_list_lt_set(
5294 __isl_take isl_pw_aff_list *list1,
5295 __isl_take isl_pw_aff_list *list2);
5296 __isl_give isl_set *isl_pw_aff_list_ge_set(
5297 __isl_take isl_pw_aff_list *list1,
5298 __isl_take isl_pw_aff_list *list2);
5299 __isl_give isl_set *isl_pw_aff_list_gt_set(
5300 __isl_take isl_pw_aff_list *list1,
5301 __isl_take isl_pw_aff_list *list2);
5303 The function C<isl_aff_ge_basic_set> returns a basic set
5304 containing those elements in the shared space
5305 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
5306 The function C<isl_pw_aff_ge_set> returns a set
5307 containing those elements in the shared domain
5308 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
5309 greater than or equal to C<pwaff2>.
5310 The function C<isl_multi_aff_lex_le_set> returns a set
5311 containing those elements in the shared domain space
5312 where C<ma1> is lexicographically smaller than or
5314 The functions operating on C<isl_pw_aff_list> apply the corresponding
5315 C<isl_pw_aff> function to each pair of elements in the two lists.
5317 =item * Cartesian Product
5319 #include <isl/space.h>
5320 __isl_give isl_space *isl_space_product(
5321 __isl_take isl_space *space1,
5322 __isl_take isl_space *space2);
5323 __isl_give isl_space *isl_space_domain_product(
5324 __isl_take isl_space *space1,
5325 __isl_take isl_space *space2);
5326 __isl_give isl_space *isl_space_range_product(
5327 __isl_take isl_space *space1,
5328 __isl_take isl_space *space2);
5331 C<isl_space_product>, C<isl_space_domain_product>
5332 and C<isl_space_range_product> take pairs or relation spaces and
5333 produce a single relations space, where either the domain, the range
5334 or both domain and range are wrapped spaces of relations between
5335 the domains and/or ranges of the input spaces.
5336 If the product is only constructed over the domain or the range
5337 then the ranges or the domains of the inputs should be the same.
5338 The function C<isl_space_product> also accepts a pair of set spaces,
5339 in which case it returns a wrapped space of a relation between the
5342 #include <isl/set.h>
5343 __isl_give isl_set *isl_set_product(
5344 __isl_take isl_set *set1,
5345 __isl_take isl_set *set2);
5347 #include <isl/map.h>
5348 __isl_give isl_basic_map *isl_basic_map_domain_product(
5349 __isl_take isl_basic_map *bmap1,
5350 __isl_take isl_basic_map *bmap2);
5351 __isl_give isl_basic_map *isl_basic_map_range_product(
5352 __isl_take isl_basic_map *bmap1,
5353 __isl_take isl_basic_map *bmap2);
5354 __isl_give isl_basic_map *isl_basic_map_product(
5355 __isl_take isl_basic_map *bmap1,
5356 __isl_take isl_basic_map *bmap2);
5357 __isl_give isl_map *isl_map_domain_product(
5358 __isl_take isl_map *map1,
5359 __isl_take isl_map *map2);
5360 __isl_give isl_map *isl_map_range_product(
5361 __isl_take isl_map *map1,
5362 __isl_take isl_map *map2);
5363 __isl_give isl_map *isl_map_product(
5364 __isl_take isl_map *map1,
5365 __isl_take isl_map *map2);
5367 #include <isl/union_set.h>
5368 __isl_give isl_union_set *isl_union_set_product(
5369 __isl_take isl_union_set *uset1,
5370 __isl_take isl_union_set *uset2);
5372 #include <isl/union_map.h>
5373 __isl_give isl_union_map *isl_union_map_domain_product(
5374 __isl_take isl_union_map *umap1,
5375 __isl_take isl_union_map *umap2);
5376 __isl_give isl_union_map *isl_union_map_range_product(
5377 __isl_take isl_union_map *umap1,
5378 __isl_take isl_union_map *umap2);
5379 __isl_give isl_union_map *isl_union_map_product(
5380 __isl_take isl_union_map *umap1,
5381 __isl_take isl_union_map *umap2);
5383 #include <isl/val.h>
5384 __isl_give isl_multi_val *isl_multi_val_range_product(
5385 __isl_take isl_multi_val *mv1,
5386 __isl_take isl_multi_val *mv2);
5387 __isl_give isl_multi_val *isl_multi_val_product(
5388 __isl_take isl_multi_val *mv1,
5389 __isl_take isl_multi_val *mv2);
5391 #include <isl/aff.h>
5392 __isl_give isl_multi_aff *isl_multi_aff_range_product(
5393 __isl_take isl_multi_aff *ma1,
5394 __isl_take isl_multi_aff *ma2);
5395 __isl_give isl_multi_aff *isl_multi_aff_product(
5396 __isl_take isl_multi_aff *ma1,
5397 __isl_take isl_multi_aff *ma2);
5398 __isl_give isl_multi_pw_aff *
5399 isl_multi_pw_aff_range_product(
5400 __isl_take isl_multi_pw_aff *mpa1,
5401 __isl_take isl_multi_pw_aff *mpa2);
5402 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
5403 __isl_take isl_multi_pw_aff *mpa1,
5404 __isl_take isl_multi_pw_aff *mpa2);
5405 __isl_give isl_pw_multi_aff *
5406 isl_pw_multi_aff_range_product(
5407 __isl_take isl_pw_multi_aff *pma1,
5408 __isl_take isl_pw_multi_aff *pma2);
5409 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
5410 __isl_take isl_pw_multi_aff *pma1,
5411 __isl_take isl_pw_multi_aff *pma2);
5413 The above functions compute the cross product of the given
5414 sets, relations or functions. The domains and ranges of the results
5415 are wrapped maps between domains and ranges of the inputs.
5416 To obtain a ``flat'' product, use the following functions
5419 #include <isl/set.h>
5420 __isl_give isl_basic_set *isl_basic_set_flat_product(
5421 __isl_take isl_basic_set *bset1,
5422 __isl_take isl_basic_set *bset2);
5423 __isl_give isl_set *isl_set_flat_product(
5424 __isl_take isl_set *set1,
5425 __isl_take isl_set *set2);
5427 #include <isl/map.h>
5428 __isl_give isl_basic_map *isl_basic_map_flat_range_product(
5429 __isl_take isl_basic_map *bmap1,
5430 __isl_take isl_basic_map *bmap2);
5431 __isl_give isl_map *isl_map_flat_domain_product(
5432 __isl_take isl_map *map1,
5433 __isl_take isl_map *map2);
5434 __isl_give isl_map *isl_map_flat_range_product(
5435 __isl_take isl_map *map1,
5436 __isl_take isl_map *map2);
5437 __isl_give isl_basic_map *isl_basic_map_flat_product(
5438 __isl_take isl_basic_map *bmap1,
5439 __isl_take isl_basic_map *bmap2);
5440 __isl_give isl_map *isl_map_flat_product(
5441 __isl_take isl_map *map1,
5442 __isl_take isl_map *map2);
5444 #include <isl/union_map.h>
5445 __isl_give isl_union_map *
5446 isl_union_map_flat_range_product(
5447 __isl_take isl_union_map *umap1,
5448 __isl_take isl_union_map *umap2);
5450 #include <isl/val.h>
5451 __isl_give isl_multi_val *isl_multi_val_flat_range_product(
5452 __isl_take isl_multi_val *mv1,
5453 __isl_take isl_multi_aff *mv2);
5455 #include <isl/aff.h>
5456 __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
5457 __isl_take isl_multi_aff *ma1,
5458 __isl_take isl_multi_aff *ma2);
5459 __isl_give isl_pw_multi_aff *
5460 isl_pw_multi_aff_flat_range_product(
5461 __isl_take isl_pw_multi_aff *pma1,
5462 __isl_take isl_pw_multi_aff *pma2);
5463 __isl_give isl_multi_pw_aff *
5464 isl_multi_pw_aff_flat_range_product(
5465 __isl_take isl_multi_pw_aff *mpa1,
5466 __isl_take isl_multi_pw_aff *mpa2);
5467 __isl_give isl_union_pw_multi_aff *
5468 isl_union_pw_multi_aff_flat_range_product(
5469 __isl_take isl_union_pw_multi_aff *upma1,
5470 __isl_take isl_union_pw_multi_aff *upma2);
5472 #include <isl/space.h>
5473 __isl_give isl_space *isl_space_domain_factor_domain(
5474 __isl_take isl_space *space);
5475 __isl_give isl_space *isl_space_range_factor_domain(
5476 __isl_take isl_space *space);
5477 __isl_give isl_space *isl_space_range_factor_range(
5478 __isl_take isl_space *space);
5480 The functions C<isl_space_range_factor_domain> and
5481 C<isl_space_range_factor_range> extract the two arguments from
5482 the result of a call to C<isl_space_range_product>.
5484 The arguments of a call to C<isl_map_range_product> can be extracted
5485 from the result using the following two functions.
5487 #include <isl/map.h>
5488 __isl_give isl_map *isl_map_range_factor_domain(
5489 __isl_take isl_map *map);
5490 __isl_give isl_map *isl_map_range_factor_range(
5491 __isl_take isl_map *map);
5493 #include <isl/val.h>
5494 __isl_give isl_multi_val *
5495 isl_multi_val_range_factor_domain(
5496 __isl_take isl_multi_val *mv);
5497 __isl_give isl_multi_val *
5498 isl_multi_val_range_factor_range(
5499 __isl_take isl_multi_val *mv);
5501 #include <isl/aff.h>
5502 __isl_give isl_multi_aff *
5503 isl_multi_aff_range_factor_domain(
5504 __isl_take isl_multi_aff *ma);
5505 __isl_give isl_multi_aff *
5506 isl_multi_aff_range_factor_range(
5507 __isl_take isl_multi_aff *ma);
5508 __isl_give isl_multi_pw_aff *
5509 isl_multi_pw_aff_range_factor_domain(
5510 __isl_take isl_multi_pw_aff *mpa);
5511 __isl_give isl_multi_pw_aff *
5512 isl_multi_pw_aff_range_factor_range(
5513 __isl_take isl_multi_pw_aff *mpa);
5515 The splice functions are a generalization of the flat product functions,
5516 where the second argument may be inserted at any position inside
5517 the first argument rather than being placed at the end.
5519 #include <isl/val.h>
5520 __isl_give isl_multi_val *isl_multi_val_range_splice(
5521 __isl_take isl_multi_val *mv1, unsigned pos,
5522 __isl_take isl_multi_val *mv2);
5524 #include <isl/aff.h>
5525 __isl_give isl_multi_aff *isl_multi_aff_range_splice(
5526 __isl_take isl_multi_aff *ma1, unsigned pos,
5527 __isl_take isl_multi_aff *ma2);
5528 __isl_give isl_multi_aff *isl_multi_aff_splice(
5529 __isl_take isl_multi_aff *ma1,
5530 unsigned in_pos, unsigned out_pos,
5531 __isl_take isl_multi_aff *ma2);
5532 __isl_give isl_multi_pw_aff *
5533 isl_multi_pw_aff_range_splice(
5534 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
5535 __isl_take isl_multi_pw_aff *mpa2);
5536 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
5537 __isl_take isl_multi_pw_aff *mpa1,
5538 unsigned in_pos, unsigned out_pos,
5539 __isl_take isl_multi_pw_aff *mpa2);
5541 =item * Simplification
5543 When applied to a set or relation,
5544 the gist operation returns a set or relation that has the
5545 same intersection with the context as the input set or relation.
5546 Any implicit equality in the intersection is made explicit in the result,
5547 while all inequalities that are redundant with respect to the intersection
5549 In case of union sets and relations, the gist operation is performed
5552 When applied to a function,
5553 the gist operation applies the set gist operation to each of
5554 the cells in the domain of the input piecewise expression.
5555 The context is also exploited
5556 to simplify the expression associated to each cell.
5558 #include <isl/set.h>
5559 __isl_give isl_basic_set *isl_basic_set_gist(
5560 __isl_take isl_basic_set *bset,
5561 __isl_take isl_basic_set *context);
5562 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
5563 __isl_take isl_set *context);
5564 __isl_give isl_set *isl_set_gist_params(
5565 __isl_take isl_set *set,
5566 __isl_take isl_set *context);
5568 #include <isl/map.h>
5569 __isl_give isl_basic_map *isl_basic_map_gist(
5570 __isl_take isl_basic_map *bmap,
5571 __isl_take isl_basic_map *context);
5572 __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
5573 __isl_take isl_map *context);
5574 __isl_give isl_map *isl_map_gist_params(
5575 __isl_take isl_map *map,
5576 __isl_take isl_set *context);
5577 __isl_give isl_map *isl_map_gist_domain(
5578 __isl_take isl_map *map,
5579 __isl_take isl_set *context);
5580 __isl_give isl_map *isl_map_gist_range(
5581 __isl_take isl_map *map,
5582 __isl_take isl_set *context);
5584 #include <isl/union_set.h>
5585 __isl_give isl_union_set *isl_union_set_gist(
5586 __isl_take isl_union_set *uset,
5587 __isl_take isl_union_set *context);
5588 __isl_give isl_union_set *isl_union_set_gist_params(
5589 __isl_take isl_union_set *uset,
5590 __isl_take isl_set *set);
5592 #include <isl/union_map.h>
5593 __isl_give isl_union_map *isl_union_map_gist(
5594 __isl_take isl_union_map *umap,
5595 __isl_take isl_union_map *context);
5596 __isl_give isl_union_map *isl_union_map_gist_params(
5597 __isl_take isl_union_map *umap,
5598 __isl_take isl_set *set);
5599 __isl_give isl_union_map *isl_union_map_gist_domain(
5600 __isl_take isl_union_map *umap,
5601 __isl_take isl_union_set *uset);
5602 __isl_give isl_union_map *isl_union_map_gist_range(
5603 __isl_take isl_union_map *umap,
5604 __isl_take isl_union_set *uset);
5606 #include <isl/aff.h>
5607 __isl_give isl_aff *isl_aff_gist_params(
5608 __isl_take isl_aff *aff,
5609 __isl_take isl_set *context);
5610 __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
5611 __isl_take isl_set *context);
5612 __isl_give isl_multi_aff *isl_multi_aff_gist_params(
5613 __isl_take isl_multi_aff *maff,
5614 __isl_take isl_set *context);
5615 __isl_give isl_multi_aff *isl_multi_aff_gist(
5616 __isl_take isl_multi_aff *maff,
5617 __isl_take isl_set *context);
5618 __isl_give isl_pw_aff *isl_pw_aff_gist_params(
5619 __isl_take isl_pw_aff *pwaff,
5620 __isl_take isl_set *context);
5621 __isl_give isl_pw_aff *isl_pw_aff_gist(
5622 __isl_take isl_pw_aff *pwaff,
5623 __isl_take isl_set *context);
5624 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
5625 __isl_take isl_pw_multi_aff *pma,
5626 __isl_take isl_set *set);
5627 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
5628 __isl_take isl_pw_multi_aff *pma,
5629 __isl_take isl_set *set);
5630 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
5631 __isl_take isl_multi_pw_aff *mpa,
5632 __isl_take isl_set *set);
5633 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
5634 __isl_take isl_multi_pw_aff *mpa,
5635 __isl_take isl_set *set);
5636 __isl_give isl_union_pw_multi_aff *
5637 isl_union_pw_multi_aff_gist_params(
5638 __isl_take isl_union_pw_multi_aff *upma,
5639 __isl_take isl_set *context);
5640 __isl_give isl_union_pw_multi_aff *
5641 isl_union_pw_multi_aff_gist(
5642 __isl_take isl_union_pw_multi_aff *upma,
5643 __isl_take isl_union_set *context);
5645 #include <isl/polynomial.h>
5646 __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
5647 __isl_take isl_qpolynomial *qp,
5648 __isl_take isl_set *context);
5649 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
5650 __isl_take isl_qpolynomial *qp,
5651 __isl_take isl_set *context);
5652 __isl_give isl_qpolynomial_fold *
5653 isl_qpolynomial_fold_gist_params(
5654 __isl_take isl_qpolynomial_fold *fold,
5655 __isl_take isl_set *context);
5656 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
5657 __isl_take isl_qpolynomial_fold *fold,
5658 __isl_take isl_set *context);
5659 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
5660 __isl_take isl_pw_qpolynomial *pwqp,
5661 __isl_take isl_set *context);
5662 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
5663 __isl_take isl_pw_qpolynomial *pwqp,
5664 __isl_take isl_set *context);
5665 __isl_give isl_pw_qpolynomial_fold *
5666 isl_pw_qpolynomial_fold_gist(
5667 __isl_take isl_pw_qpolynomial_fold *pwf,
5668 __isl_take isl_set *context);
5669 __isl_give isl_pw_qpolynomial_fold *
5670 isl_pw_qpolynomial_fold_gist_params(
5671 __isl_take isl_pw_qpolynomial_fold *pwf,
5672 __isl_take isl_set *context);
5673 __isl_give isl_union_pw_qpolynomial *
5674 isl_union_pw_qpolynomial_gist_params(
5675 __isl_take isl_union_pw_qpolynomial *upwqp,
5676 __isl_take isl_set *context);
5677 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
5678 __isl_take isl_union_pw_qpolynomial *upwqp,
5679 __isl_take isl_union_set *context);
5680 __isl_give isl_union_pw_qpolynomial_fold *
5681 isl_union_pw_qpolynomial_fold_gist(
5682 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5683 __isl_take isl_union_set *context);
5684 __isl_give isl_union_pw_qpolynomial_fold *
5685 isl_union_pw_qpolynomial_fold_gist_params(
5686 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5687 __isl_take isl_set *context);
5689 =item * Binary Arithmethic Operations
5691 #include <isl/aff.h>
5692 __isl_give isl_aff *isl_aff_add(
5693 __isl_take isl_aff *aff1,
5694 __isl_take isl_aff *aff2);
5695 __isl_give isl_multi_aff *isl_multi_aff_add(
5696 __isl_take isl_multi_aff *maff1,
5697 __isl_take isl_multi_aff *maff2);
5698 __isl_give isl_pw_aff *isl_pw_aff_add(
5699 __isl_take isl_pw_aff *pwaff1,
5700 __isl_take isl_pw_aff *pwaff2);
5701 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
5702 __isl_take isl_pw_multi_aff *pma1,
5703 __isl_take isl_pw_multi_aff *pma2);
5704 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
5705 __isl_take isl_union_pw_multi_aff *upma1,
5706 __isl_take isl_union_pw_multi_aff *upma2);
5707 __isl_give isl_pw_aff *isl_pw_aff_min(
5708 __isl_take isl_pw_aff *pwaff1,
5709 __isl_take isl_pw_aff *pwaff2);
5710 __isl_give isl_pw_aff *isl_pw_aff_max(
5711 __isl_take isl_pw_aff *pwaff1,
5712 __isl_take isl_pw_aff *pwaff2);
5713 __isl_give isl_aff *isl_aff_sub(
5714 __isl_take isl_aff *aff1,
5715 __isl_take isl_aff *aff2);
5716 __isl_give isl_multi_aff *isl_multi_aff_sub(
5717 __isl_take isl_multi_aff *ma1,
5718 __isl_take isl_multi_aff *ma2);
5719 __isl_give isl_pw_aff *isl_pw_aff_sub(
5720 __isl_take isl_pw_aff *pwaff1,
5721 __isl_take isl_pw_aff *pwaff2);
5722 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
5723 __isl_take isl_pw_multi_aff *pma1,
5724 __isl_take isl_pw_multi_aff *pma2);
5725 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
5726 __isl_take isl_union_pw_multi_aff *upma1,
5727 __isl_take isl_union_pw_multi_aff *upma2);
5729 C<isl_aff_sub> subtracts the second argument from the first.
5731 #include <isl/polynomial.h>
5732 __isl_give isl_qpolynomial *isl_qpolynomial_add(
5733 __isl_take isl_qpolynomial *qp1,
5734 __isl_take isl_qpolynomial *qp2);
5735 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
5736 __isl_take isl_pw_qpolynomial *pwqp1,
5737 __isl_take isl_pw_qpolynomial *pwqp2);
5738 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
5739 __isl_take isl_pw_qpolynomial *pwqp1,
5740 __isl_take isl_pw_qpolynomial *pwqp2);
5741 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
5742 __isl_take isl_pw_qpolynomial_fold *pwf1,
5743 __isl_take isl_pw_qpolynomial_fold *pwf2);
5744 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
5745 __isl_take isl_union_pw_qpolynomial *upwqp1,
5746 __isl_take isl_union_pw_qpolynomial *upwqp2);
5747 __isl_give isl_qpolynomial *isl_qpolynomial_sub(
5748 __isl_take isl_qpolynomial *qp1,
5749 __isl_take isl_qpolynomial *qp2);
5750 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
5751 __isl_take isl_pw_qpolynomial *pwqp1,
5752 __isl_take isl_pw_qpolynomial *pwqp2);
5753 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
5754 __isl_take isl_union_pw_qpolynomial *upwqp1,
5755 __isl_take isl_union_pw_qpolynomial *upwqp2);
5756 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
5757 __isl_take isl_pw_qpolynomial_fold *pwf1,
5758 __isl_take isl_pw_qpolynomial_fold *pwf2);
5759 __isl_give isl_union_pw_qpolynomial_fold *
5760 isl_union_pw_qpolynomial_fold_fold(
5761 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
5762 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
5764 #include <isl/aff.h>
5765 __isl_give isl_pw_aff *isl_pw_aff_union_add(
5766 __isl_take isl_pw_aff *pwaff1,
5767 __isl_take isl_pw_aff *pwaff2);
5768 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
5769 __isl_take isl_pw_multi_aff *pma1,
5770 __isl_take isl_pw_multi_aff *pma2);
5771 __isl_give isl_union_pw_multi_aff *
5772 isl_union_pw_multi_aff_union_add(
5773 __isl_take isl_union_pw_multi_aff *upma1,
5774 __isl_take isl_union_pw_multi_aff *upma2);
5775 __isl_give isl_pw_aff *isl_pw_aff_union_min(
5776 __isl_take isl_pw_aff *pwaff1,
5777 __isl_take isl_pw_aff *pwaff2);
5778 __isl_give isl_pw_aff *isl_pw_aff_union_max(
5779 __isl_take isl_pw_aff *pwaff1,
5780 __isl_take isl_pw_aff *pwaff2);
5782 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
5783 expression with a domain that is the union of those of C<pwaff1> and
5784 C<pwaff2> and such that on each cell, the quasi-affine expression is
5785 the maximum of those of C<pwaff1> and C<pwaff2>. If only one of
5786 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
5787 associated expression is the defined one.
5788 This in contrast to the C<isl_pw_aff_max> function, which is
5789 only defined on the shared definition domain of the arguments.
5791 #include <isl/val.h>
5792 __isl_give isl_multi_val *isl_multi_val_add_val(
5793 __isl_take isl_multi_val *mv,
5794 __isl_take isl_val *v);
5795 __isl_give isl_multi_val *isl_multi_val_mod_val(
5796 __isl_take isl_multi_val *mv,
5797 __isl_take isl_val *v);
5798 __isl_give isl_multi_val *isl_multi_val_scale_val(
5799 __isl_take isl_multi_val *mv,
5800 __isl_take isl_val *v);
5801 __isl_give isl_multi_val *isl_multi_val_scale_down_val(
5802 __isl_take isl_multi_val *mv,
5803 __isl_take isl_val *v);
5805 #include <isl/aff.h>
5806 __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
5807 __isl_take isl_val *mod);
5808 __isl_give isl_pw_aff *isl_pw_aff_mod_val(
5809 __isl_take isl_pw_aff *pa,
5810 __isl_take isl_val *mod);
5811 __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
5812 __isl_take isl_val *v);
5813 __isl_give isl_multi_aff *isl_multi_aff_scale_val(
5814 __isl_take isl_multi_aff *ma,
5815 __isl_take isl_val *v);
5816 __isl_give isl_pw_aff *isl_pw_aff_scale_val(
5817 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
5818 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
5819 __isl_take isl_multi_pw_aff *mpa,
5820 __isl_take isl_val *v);
5821 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
5822 __isl_take isl_pw_multi_aff *pma,
5823 __isl_take isl_val *v);
5824 __isl_give isl_union_pw_multi_aff *
5825 isl_union_pw_multi_aff_scale_val(
5826 __isl_take isl_union_pw_multi_aff *upma,
5827 __isl_take isl_val *val);
5828 __isl_give isl_aff *isl_aff_scale_down_ui(
5829 __isl_take isl_aff *aff, unsigned f);
5830 __isl_give isl_aff *isl_aff_scale_down_val(
5831 __isl_take isl_aff *aff, __isl_take isl_val *v);
5832 __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
5833 __isl_take isl_multi_aff *ma,
5834 __isl_take isl_val *v);
5835 __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
5836 __isl_take isl_pw_aff *pa,
5837 __isl_take isl_val *f);
5838 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
5839 __isl_take isl_multi_pw_aff *mpa,
5840 __isl_take isl_val *v);
5841 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
5842 __isl_take isl_pw_multi_aff *pma,
5843 __isl_take isl_val *v);
5844 __isl_give isl_union_pw_multi_aff *
5845 isl_union_pw_multi_aff_scale_down_val(
5846 __isl_take isl_union_pw_multi_aff *upma,
5847 __isl_take isl_val *val);
5849 #include <isl/polynomial.h>
5850 __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
5851 __isl_take isl_qpolynomial *qp,
5852 __isl_take isl_val *v);
5853 __isl_give isl_qpolynomial_fold *
5854 isl_qpolynomial_fold_scale_val(
5855 __isl_take isl_qpolynomial_fold *fold,
5856 __isl_take isl_val *v);
5857 __isl_give isl_pw_qpolynomial *
5858 isl_pw_qpolynomial_scale_val(
5859 __isl_take isl_pw_qpolynomial *pwqp,
5860 __isl_take isl_val *v);
5861 __isl_give isl_pw_qpolynomial_fold *
5862 isl_pw_qpolynomial_fold_scale_val(
5863 __isl_take isl_pw_qpolynomial_fold *pwf,
5864 __isl_take isl_val *v);
5865 __isl_give isl_union_pw_qpolynomial *
5866 isl_union_pw_qpolynomial_scale_val(
5867 __isl_take isl_union_pw_qpolynomial *upwqp,
5868 __isl_take isl_val *v);
5869 __isl_give isl_union_pw_qpolynomial_fold *
5870 isl_union_pw_qpolynomial_fold_scale_val(
5871 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5872 __isl_take isl_val *v);
5873 __isl_give isl_qpolynomial *
5874 isl_qpolynomial_scale_down_val(
5875 __isl_take isl_qpolynomial *qp,
5876 __isl_take isl_val *v);
5877 __isl_give isl_qpolynomial_fold *
5878 isl_qpolynomial_fold_scale_down_val(
5879 __isl_take isl_qpolynomial_fold *fold,
5880 __isl_take isl_val *v);
5881 __isl_give isl_pw_qpolynomial *
5882 isl_pw_qpolynomial_scale_down_val(
5883 __isl_take isl_pw_qpolynomial *pwqp,
5884 __isl_take isl_val *v);
5885 __isl_give isl_pw_qpolynomial_fold *
5886 isl_pw_qpolynomial_fold_scale_down_val(
5887 __isl_take isl_pw_qpolynomial_fold *pwf,
5888 __isl_take isl_val *v);
5889 __isl_give isl_union_pw_qpolynomial *
5890 isl_union_pw_qpolynomial_scale_down_val(
5891 __isl_take isl_union_pw_qpolynomial *upwqp,
5892 __isl_take isl_val *v);
5893 __isl_give isl_union_pw_qpolynomial_fold *
5894 isl_union_pw_qpolynomial_fold_scale_down_val(
5895 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5896 __isl_take isl_val *v);
5898 #include <isl/val.h>
5899 __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
5900 __isl_take isl_multi_val *mv1,
5901 __isl_take isl_multi_val *mv2);
5902 __isl_give isl_multi_val *
5903 isl_multi_val_scale_down_multi_val(
5904 __isl_take isl_multi_val *mv1,
5905 __isl_take isl_multi_val *mv2);
5907 #include <isl/aff.h>
5908 __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
5909 __isl_take isl_multi_aff *ma,
5910 __isl_take isl_multi_val *mv);
5911 __isl_give isl_pw_multi_aff *
5912 isl_pw_multi_aff_scale_multi_val(
5913 __isl_take isl_pw_multi_aff *pma,
5914 __isl_take isl_multi_val *mv);
5915 __isl_give isl_multi_pw_aff *
5916 isl_multi_pw_aff_scale_multi_val(
5917 __isl_take isl_multi_pw_aff *mpa,
5918 __isl_take isl_multi_val *mv);
5919 __isl_give isl_union_pw_multi_aff *
5920 isl_union_pw_multi_aff_scale_multi_val(
5921 __isl_take isl_union_pw_multi_aff *upma,
5922 __isl_take isl_multi_val *mv);
5923 __isl_give isl_multi_aff *
5924 isl_multi_aff_scale_down_multi_val(
5925 __isl_take isl_multi_aff *ma,
5926 __isl_take isl_multi_val *mv);
5927 __isl_give isl_multi_pw_aff *
5928 isl_multi_pw_aff_scale_down_multi_val(
5929 __isl_take isl_multi_pw_aff *mpa,
5930 __isl_take isl_multi_val *mv);
5932 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
5933 by the corresponding elements of C<mv>.
5935 #include <isl/aff.h>
5936 __isl_give isl_aff *isl_aff_mul(
5937 __isl_take isl_aff *aff1,
5938 __isl_take isl_aff *aff2);
5939 __isl_give isl_aff *isl_aff_div(
5940 __isl_take isl_aff *aff1,
5941 __isl_take isl_aff *aff2);
5942 __isl_give isl_pw_aff *isl_pw_aff_mul(
5943 __isl_take isl_pw_aff *pwaff1,
5944 __isl_take isl_pw_aff *pwaff2);
5945 __isl_give isl_pw_aff *isl_pw_aff_div(
5946 __isl_take isl_pw_aff *pa1,
5947 __isl_take isl_pw_aff *pa2);
5948 __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
5949 __isl_take isl_pw_aff *pa1,
5950 __isl_take isl_pw_aff *pa2);
5951 __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
5952 __isl_take isl_pw_aff *pa1,
5953 __isl_take isl_pw_aff *pa2);
5955 When multiplying two affine expressions, at least one of the two needs
5956 to be a constant. Similarly, when dividing an affine expression by another,
5957 the second expression needs to be a constant.
5958 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
5959 rounding towards zero. C<isl_pw_aff_tdiv_r> computes the corresponding
5962 #include <isl/polynomial.h>
5963 __isl_give isl_qpolynomial *isl_qpolynomial_mul(
5964 __isl_take isl_qpolynomial *qp1,
5965 __isl_take isl_qpolynomial *qp2);
5966 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
5967 __isl_take isl_pw_qpolynomial *pwqp1,
5968 __isl_take isl_pw_qpolynomial *pwqp2);
5969 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
5970 __isl_take isl_union_pw_qpolynomial *upwqp1,
5971 __isl_take isl_union_pw_qpolynomial *upwqp2);
5975 =head3 Lexicographic Optimization
5977 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
5978 the following functions
5979 compute a set that contains the lexicographic minimum or maximum
5980 of the elements in C<set> (or C<bset>) for those values of the parameters
5981 that satisfy C<dom>.
5982 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
5983 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
5985 In other words, the union of the parameter values
5986 for which the result is non-empty and of C<*empty>
5989 #include <isl/set.h>
5990 __isl_give isl_set *isl_basic_set_partial_lexmin(
5991 __isl_take isl_basic_set *bset,
5992 __isl_take isl_basic_set *dom,
5993 __isl_give isl_set **empty);
5994 __isl_give isl_set *isl_basic_set_partial_lexmax(
5995 __isl_take isl_basic_set *bset,
5996 __isl_take isl_basic_set *dom,
5997 __isl_give isl_set **empty);
5998 __isl_give isl_set *isl_set_partial_lexmin(
5999 __isl_take isl_set *set, __isl_take isl_set *dom,
6000 __isl_give isl_set **empty);
6001 __isl_give isl_set *isl_set_partial_lexmax(
6002 __isl_take isl_set *set, __isl_take isl_set *dom,
6003 __isl_give isl_set **empty);
6005 Given a (basic) set C<set> (or C<bset>), the following functions simply
6006 return a set containing the lexicographic minimum or maximum
6007 of the elements in C<set> (or C<bset>).
6008 In case of union sets, the optimum is computed per space.
6010 #include <isl/set.h>
6011 __isl_give isl_set *isl_basic_set_lexmin(
6012 __isl_take isl_basic_set *bset);
6013 __isl_give isl_set *isl_basic_set_lexmax(
6014 __isl_take isl_basic_set *bset);
6015 __isl_give isl_set *isl_set_lexmin(
6016 __isl_take isl_set *set);
6017 __isl_give isl_set *isl_set_lexmax(
6018 __isl_take isl_set *set);
6019 __isl_give isl_union_set *isl_union_set_lexmin(
6020 __isl_take isl_union_set *uset);
6021 __isl_give isl_union_set *isl_union_set_lexmax(
6022 __isl_take isl_union_set *uset);
6024 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6025 the following functions
6026 compute a relation that maps each element of C<dom>
6027 to the single lexicographic minimum or maximum
6028 of the elements that are associated to that same
6029 element in C<map> (or C<bmap>).
6030 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6031 that contains the elements in C<dom> that do not map
6032 to any elements in C<map> (or C<bmap>).
6033 In other words, the union of the domain of the result and of C<*empty>
6036 #include <isl/map.h>
6037 __isl_give isl_map *isl_basic_map_partial_lexmax(
6038 __isl_take isl_basic_map *bmap,
6039 __isl_take isl_basic_set *dom,
6040 __isl_give isl_set **empty);
6041 __isl_give isl_map *isl_basic_map_partial_lexmin(
6042 __isl_take isl_basic_map *bmap,
6043 __isl_take isl_basic_set *dom,
6044 __isl_give isl_set **empty);
6045 __isl_give isl_map *isl_map_partial_lexmax(
6046 __isl_take isl_map *map, __isl_take isl_set *dom,
6047 __isl_give isl_set **empty);
6048 __isl_give isl_map *isl_map_partial_lexmin(
6049 __isl_take isl_map *map, __isl_take isl_set *dom,
6050 __isl_give isl_set **empty);
6052 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6053 return a map mapping each element in the domain of
6054 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6055 of all elements associated to that element.
6056 In case of union relations, the optimum is computed per space.
6058 #include <isl/map.h>
6059 __isl_give isl_map *isl_basic_map_lexmin(
6060 __isl_take isl_basic_map *bmap);
6061 __isl_give isl_map *isl_basic_map_lexmax(
6062 __isl_take isl_basic_map *bmap);
6063 __isl_give isl_map *isl_map_lexmin(
6064 __isl_take isl_map *map);
6065 __isl_give isl_map *isl_map_lexmax(
6066 __isl_take isl_map *map);
6067 __isl_give isl_union_map *isl_union_map_lexmin(
6068 __isl_take isl_union_map *umap);
6069 __isl_give isl_union_map *isl_union_map_lexmax(
6070 __isl_take isl_union_map *umap);
6072 The following functions return their result in the form of
6073 a piecewise multi-affine expression,
6074 but are otherwise equivalent to the corresponding functions
6075 returning a basic set or relation.
6077 #include <isl/set.h>
6078 __isl_give isl_pw_multi_aff *
6079 isl_basic_set_partial_lexmin_pw_multi_aff(
6080 __isl_take isl_basic_set *bset,
6081 __isl_take isl_basic_set *dom,
6082 __isl_give isl_set **empty);
6083 __isl_give isl_pw_multi_aff *
6084 isl_basic_set_partial_lexmax_pw_multi_aff(
6085 __isl_take isl_basic_set *bset,
6086 __isl_take isl_basic_set *dom,
6087 __isl_give isl_set **empty);
6088 __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6089 __isl_take isl_set *set);
6090 __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6091 __isl_take isl_set *set);
6093 #include <isl/map.h>
6094 __isl_give isl_pw_multi_aff *
6095 isl_basic_map_lexmin_pw_multi_aff(
6096 __isl_take isl_basic_map *bmap);
6097 __isl_give isl_pw_multi_aff *
6098 isl_basic_map_partial_lexmin_pw_multi_aff(
6099 __isl_take isl_basic_map *bmap,
6100 __isl_take isl_basic_set *dom,
6101 __isl_give isl_set **empty);
6102 __isl_give isl_pw_multi_aff *
6103 isl_basic_map_partial_lexmax_pw_multi_aff(
6104 __isl_take isl_basic_map *bmap,
6105 __isl_take isl_basic_set *dom,
6106 __isl_give isl_set **empty);
6107 __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
6108 __isl_take isl_map *map);
6109 __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
6110 __isl_take isl_map *map);
6112 The following functions return the lexicographic minimum or maximum
6113 on the shared domain of the inputs and the single defined function
6114 on those parts of the domain where only a single function is defined.
6116 #include <isl/aff.h>
6117 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
6118 __isl_take isl_pw_multi_aff *pma1,
6119 __isl_take isl_pw_multi_aff *pma2);
6120 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
6121 __isl_take isl_pw_multi_aff *pma1,
6122 __isl_take isl_pw_multi_aff *pma2);
6124 =head2 Ternary Operations
6126 #include <isl/aff.h>
6127 __isl_give isl_pw_aff *isl_pw_aff_cond(
6128 __isl_take isl_pw_aff *cond,
6129 __isl_take isl_pw_aff *pwaff_true,
6130 __isl_take isl_pw_aff *pwaff_false);
6132 The function C<isl_pw_aff_cond> performs a conditional operator
6133 and returns an expression that is equal to C<pwaff_true>
6134 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
6135 where C<cond> is zero.
6139 Lists are defined over several element types, including
6140 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_constraint>,
6141 C<isl_basic_set>, C<isl_set>, C<isl_ast_expr> and C<isl_ast_node>.
6142 Here we take lists of C<isl_set>s as an example.
6143 Lists can be created, copied, modified and freed using the following functions.
6145 #include <isl/set.h>
6146 __isl_give isl_set_list *isl_set_list_from_set(
6147 __isl_take isl_set *el);
6148 __isl_give isl_set_list *isl_set_list_alloc(
6149 isl_ctx *ctx, int n);
6150 __isl_give isl_set_list *isl_set_list_copy(
6151 __isl_keep isl_set_list *list);
6152 __isl_give isl_set_list *isl_set_list_insert(
6153 __isl_take isl_set_list *list, unsigned pos,
6154 __isl_take isl_set *el);
6155 __isl_give isl_set_list *isl_set_list_add(
6156 __isl_take isl_set_list *list,
6157 __isl_take isl_set *el);
6158 __isl_give isl_set_list *isl_set_list_drop(
6159 __isl_take isl_set_list *list,
6160 unsigned first, unsigned n);
6161 __isl_give isl_set_list *isl_set_list_set_set(
6162 __isl_take isl_set_list *list, int index,
6163 __isl_take isl_set *set);
6164 __isl_give isl_set_list *isl_set_list_concat(
6165 __isl_take isl_set_list *list1,
6166 __isl_take isl_set_list *list2);
6167 __isl_give isl_set_list *isl_set_list_sort(
6168 __isl_take isl_set_list *list,
6169 int (*cmp)(__isl_keep isl_set *a,
6170 __isl_keep isl_set *b, void *user),
6172 __isl_null isl_set_list *isl_set_list_free(
6173 __isl_take isl_set_list *list);
6175 C<isl_set_list_alloc> creates an empty list with a capacity for
6176 C<n> elements. C<isl_set_list_from_set> creates a list with a single
6179 Lists can be inspected using the following functions.
6181 #include <isl/set.h>
6182 int isl_set_list_n_set(__isl_keep isl_set_list *list);
6183 __isl_give isl_set *isl_set_list_get_set(
6184 __isl_keep isl_set_list *list, int index);
6185 int isl_set_list_foreach(__isl_keep isl_set_list *list,
6186 int (*fn)(__isl_take isl_set *el, void *user),
6188 int isl_set_list_foreach_scc(__isl_keep isl_set_list *list,
6189 int (*follows)(__isl_keep isl_set *a,
6190 __isl_keep isl_set *b, void *user),
6192 int (*fn)(__isl_take isl_set *el, void *user),
6195 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
6196 strongly connected components of the graph with as vertices the elements
6197 of C<list> and a directed edge from vertex C<b> to vertex C<a>
6198 iff C<follows(a, b)> returns C<1>. The callbacks C<follows> and C<fn>
6199 should return C<-1> on error.
6201 Lists can be printed using
6203 #include <isl/set.h>
6204 __isl_give isl_printer *isl_printer_print_set_list(
6205 __isl_take isl_printer *p,
6206 __isl_keep isl_set_list *list);
6208 =head2 Associative arrays
6210 Associative arrays map isl objects of a specific type to isl objects
6211 of some (other) specific type. They are defined for several pairs
6212 of types, including (C<isl_map>, C<isl_basic_set>),
6213 (C<isl_id>, C<isl_ast_expr>) and.
6214 (C<isl_id>, C<isl_pw_aff>).
6215 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
6218 Associative arrays can be created, copied and freed using
6219 the following functions.
6221 #include <isl/id_to_ast_expr.h>
6222 __isl_give id_to_ast_expr *isl_id_to_ast_expr_alloc(
6223 isl_ctx *ctx, int min_size);
6224 __isl_give id_to_ast_expr *isl_id_to_ast_expr_copy(
6225 __isl_keep id_to_ast_expr *id2expr);
6226 __isl_null id_to_ast_expr *isl_id_to_ast_expr_free(
6227 __isl_take id_to_ast_expr *id2expr);
6229 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
6230 to specify the expected size of the associative array.
6231 The associative array will be grown automatically as needed.
6233 Associative arrays can be inspected using the following functions.
6235 #include <isl/id_to_ast_expr.h>
6236 int isl_id_to_ast_expr_has(
6237 __isl_keep id_to_ast_expr *id2expr,
6238 __isl_keep isl_id *key);
6239 __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
6240 __isl_keep id_to_ast_expr *id2expr,
6241 __isl_take isl_id *key);
6242 int isl_id_to_ast_expr_foreach(
6243 __isl_keep id_to_ast_expr *id2expr,
6244 int (*fn)(__isl_take isl_id *key,
6245 __isl_take isl_ast_expr *val, void *user),
6248 They can be modified using the following function.
6250 #include <isl/id_to_ast_expr.h>
6251 __isl_give id_to_ast_expr *isl_id_to_ast_expr_set(
6252 __isl_take id_to_ast_expr *id2expr,
6253 __isl_take isl_id *key,
6254 __isl_take isl_ast_expr *val);
6255 __isl_give id_to_ast_expr *isl_id_to_ast_expr_drop(
6256 __isl_take id_to_ast_expr *id2expr,
6257 __isl_take isl_id *key);
6259 Associative arrays can be printed using the following function.
6261 #include <isl/id_to_ast_expr.h>
6262 __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
6263 __isl_take isl_printer *p,
6264 __isl_keep id_to_ast_expr *id2expr);
6268 Vectors can be created, copied and freed using the following functions.
6270 #include <isl/vec.h>
6271 __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
6273 __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
6274 __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
6276 Note that the elements of a newly created vector may have arbitrary values.
6277 The elements can be changed and inspected using the following functions.
6279 int isl_vec_size(__isl_keep isl_vec *vec);
6280 __isl_give isl_val *isl_vec_get_element_val(
6281 __isl_keep isl_vec *vec, int pos);
6282 __isl_give isl_vec *isl_vec_set_element_si(
6283 __isl_take isl_vec *vec, int pos, int v);
6284 __isl_give isl_vec *isl_vec_set_element_val(
6285 __isl_take isl_vec *vec, int pos,
6286 __isl_take isl_val *v);
6287 __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
6289 __isl_give isl_vec *isl_vec_set_val(
6290 __isl_take isl_vec *vec, __isl_take isl_val *v);
6291 int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
6292 __isl_keep isl_vec *vec2, int pos);
6294 C<isl_vec_get_element> will return a negative value if anything went wrong.
6295 In that case, the value of C<*v> is undefined.
6297 The following function can be used to concatenate two vectors.
6299 __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
6300 __isl_take isl_vec *vec2);
6304 Matrices can be created, copied and freed using the following functions.
6306 #include <isl/mat.h>
6307 __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
6308 unsigned n_row, unsigned n_col);
6309 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
6310 __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
6312 Note that the elements of a newly created matrix may have arbitrary values.
6313 The elements can be changed and inspected using the following functions.
6315 int isl_mat_rows(__isl_keep isl_mat *mat);
6316 int isl_mat_cols(__isl_keep isl_mat *mat);
6317 __isl_give isl_val *isl_mat_get_element_val(
6318 __isl_keep isl_mat *mat, int row, int col);
6319 __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
6320 int row, int col, int v);
6321 __isl_give isl_mat *isl_mat_set_element_val(
6322 __isl_take isl_mat *mat, int row, int col,
6323 __isl_take isl_val *v);
6325 C<isl_mat_get_element> will return a negative value if anything went wrong.
6326 In that case, the value of C<*v> is undefined.
6328 The following function can be used to compute the (right) inverse
6329 of a matrix, i.e., a matrix such that the product of the original
6330 and the inverse (in that order) is a multiple of the identity matrix.
6331 The input matrix is assumed to be of full row-rank.
6333 __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
6335 The following function can be used to compute the (right) kernel
6336 (or null space) of a matrix, i.e., a matrix such that the product of
6337 the original and the kernel (in that order) is the zero matrix.
6339 __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
6341 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
6343 The following functions determine
6344 an upper or lower bound on a quasipolynomial over its domain.
6346 __isl_give isl_pw_qpolynomial_fold *
6347 isl_pw_qpolynomial_bound(
6348 __isl_take isl_pw_qpolynomial *pwqp,
6349 enum isl_fold type, int *tight);
6351 __isl_give isl_union_pw_qpolynomial_fold *
6352 isl_union_pw_qpolynomial_bound(
6353 __isl_take isl_union_pw_qpolynomial *upwqp,
6354 enum isl_fold type, int *tight);
6356 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
6357 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
6358 is the returned bound is known be tight, i.e., for each value
6359 of the parameters there is at least
6360 one element in the domain that reaches the bound.
6361 If the domain of C<pwqp> is not wrapping, then the bound is computed
6362 over all elements in that domain and the result has a purely parametric
6363 domain. If the domain of C<pwqp> is wrapping, then the bound is
6364 computed over the range of the wrapped relation. The domain of the
6365 wrapped relation becomes the domain of the result.
6367 =head2 Parametric Vertex Enumeration
6369 The parametric vertex enumeration described in this section
6370 is mainly intended to be used internally and by the C<barvinok>
6373 #include <isl/vertices.h>
6374 __isl_give isl_vertices *isl_basic_set_compute_vertices(
6375 __isl_keep isl_basic_set *bset);
6377 The function C<isl_basic_set_compute_vertices> performs the
6378 actual computation of the parametric vertices and the chamber
6379 decomposition and store the result in an C<isl_vertices> object.
6380 This information can be queried by either iterating over all
6381 the vertices or iterating over all the chambers or cells
6382 and then iterating over all vertices that are active on the chamber.
6384 int isl_vertices_foreach_vertex(
6385 __isl_keep isl_vertices *vertices,
6386 int (*fn)(__isl_take isl_vertex *vertex, void *user),
6389 int isl_vertices_foreach_cell(
6390 __isl_keep isl_vertices *vertices,
6391 int (*fn)(__isl_take isl_cell *cell, void *user),
6393 int isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
6394 int (*fn)(__isl_take isl_vertex *vertex, void *user),
6397 Other operations that can be performed on an C<isl_vertices> object are
6400 int isl_vertices_get_n_vertices(
6401 __isl_keep isl_vertices *vertices);
6402 void isl_vertices_free(__isl_take isl_vertices *vertices);
6404 Vertices can be inspected and destroyed using the following functions.
6406 int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
6407 __isl_give isl_basic_set *isl_vertex_get_domain(
6408 __isl_keep isl_vertex *vertex);
6409 __isl_give isl_multi_aff *isl_vertex_get_expr(
6410 __isl_keep isl_vertex *vertex);
6411 void isl_vertex_free(__isl_take isl_vertex *vertex);
6413 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
6414 describing the vertex in terms of the parameters,
6415 while C<isl_vertex_get_domain> returns the activity domain
6418 Chambers can be inspected and destroyed using the following functions.
6420 __isl_give isl_basic_set *isl_cell_get_domain(
6421 __isl_keep isl_cell *cell);
6422 void isl_cell_free(__isl_take isl_cell *cell);
6424 =head1 Polyhedral Compilation Library
6426 This section collects functionality in C<isl> that has been specifically
6427 designed for use during polyhedral compilation.
6429 =head2 Dependence Analysis
6431 C<isl> contains specialized functionality for performing
6432 array dataflow analysis. That is, given a I<sink> access relation
6433 and a collection of possible I<source> access relations,
6434 C<isl> can compute relations that describe
6435 for each iteration of the sink access, which iteration
6436 of which of the source access relations was the last
6437 to access the same data element before the given iteration
6439 The resulting dependence relations map source iterations
6440 to the corresponding sink iterations.
6441 To compute standard flow dependences, the sink should be
6442 a read, while the sources should be writes.
6443 If any of the source accesses are marked as being I<may>
6444 accesses, then there will be a dependence from the last
6445 I<must> access B<and> from any I<may> access that follows
6446 this last I<must> access.
6447 In particular, if I<all> sources are I<may> accesses,
6448 then memory based dependence analysis is performed.
6449 If, on the other hand, all sources are I<must> accesses,
6450 then value based dependence analysis is performed.
6452 #include <isl/flow.h>
6454 typedef int (*isl_access_level_before)(void *first, void *second);
6456 __isl_give isl_access_info *isl_access_info_alloc(
6457 __isl_take isl_map *sink,
6458 void *sink_user, isl_access_level_before fn,
6460 __isl_give isl_access_info *isl_access_info_add_source(
6461 __isl_take isl_access_info *acc,
6462 __isl_take isl_map *source, int must,
6464 __isl_null isl_access_info *isl_access_info_free(
6465 __isl_take isl_access_info *acc);
6467 __isl_give isl_flow *isl_access_info_compute_flow(
6468 __isl_take isl_access_info *acc);
6470 int isl_flow_foreach(__isl_keep isl_flow *deps,
6471 int (*fn)(__isl_take isl_map *dep, int must,
6472 void *dep_user, void *user),
6474 __isl_give isl_map *isl_flow_get_no_source(
6475 __isl_keep isl_flow *deps, int must);
6476 void isl_flow_free(__isl_take isl_flow *deps);
6478 The function C<isl_access_info_compute_flow> performs the actual
6479 dependence analysis. The other functions are used to construct
6480 the input for this function or to read off the output.
6482 The input is collected in an C<isl_access_info>, which can
6483 be created through a call to C<isl_access_info_alloc>.
6484 The arguments to this functions are the sink access relation
6485 C<sink>, a token C<sink_user> used to identify the sink
6486 access to the user, a callback function for specifying the
6487 relative order of source and sink accesses, and the number
6488 of source access relations that will be added.
6489 The callback function has type C<int (*)(void *first, void *second)>.
6490 The function is called with two user supplied tokens identifying
6491 either a source or the sink and it should return the shared nesting
6492 level and the relative order of the two accesses.
6493 In particular, let I<n> be the number of loops shared by
6494 the two accesses. If C<first> precedes C<second> textually,
6495 then the function should return I<2 * n + 1>; otherwise,
6496 it should return I<2 * n>.
6497 The sources can be added to the C<isl_access_info> by performing
6498 (at most) C<max_source> calls to C<isl_access_info_add_source>.
6499 C<must> indicates whether the source is a I<must> access
6500 or a I<may> access. Note that a multi-valued access relation
6501 should only be marked I<must> if every iteration in the domain
6502 of the relation accesses I<all> elements in its image.
6503 The C<source_user> token is again used to identify
6504 the source access. The range of the source access relation
6505 C<source> should have the same dimension as the range
6506 of the sink access relation.
6507 The C<isl_access_info_free> function should usually not be
6508 called explicitly, because it is called implicitly by
6509 C<isl_access_info_compute_flow>.
6511 The result of the dependence analysis is collected in an
6512 C<isl_flow>. There may be elements of
6513 the sink access for which no preceding source access could be
6514 found or for which all preceding sources are I<may> accesses.
6515 The relations containing these elements can be obtained through
6516 calls to C<isl_flow_get_no_source>, the first with C<must> set
6517 and the second with C<must> unset.
6518 In the case of standard flow dependence analysis,
6519 with the sink a read and the sources I<must> writes,
6520 the first relation corresponds to the reads from uninitialized
6521 array elements and the second relation is empty.
6522 The actual flow dependences can be extracted using
6523 C<isl_flow_foreach>. This function will call the user-specified
6524 callback function C<fn> for each B<non-empty> dependence between
6525 a source and the sink. The callback function is called
6526 with four arguments, the actual flow dependence relation
6527 mapping source iterations to sink iterations, a boolean that
6528 indicates whether it is a I<must> or I<may> dependence, a token
6529 identifying the source and an additional C<void *> with value
6530 equal to the third argument of the C<isl_flow_foreach> call.
6531 A dependence is marked I<must> if it originates from a I<must>
6532 source and if it is not followed by any I<may> sources.
6534 After finishing with an C<isl_flow>, the user should call
6535 C<isl_flow_free> to free all associated memory.
6537 A higher-level interface to dependence analysis is provided
6538 by the following function.
6540 #include <isl/flow.h>
6542 int isl_union_map_compute_flow(__isl_take isl_union_map *sink,
6543 __isl_take isl_union_map *must_source,
6544 __isl_take isl_union_map *may_source,
6545 __isl_take isl_union_map *schedule,
6546 __isl_give isl_union_map **must_dep,
6547 __isl_give isl_union_map **may_dep,
6548 __isl_give isl_union_map **must_no_source,
6549 __isl_give isl_union_map **may_no_source);
6551 The arrays are identified by the tuple names of the ranges
6552 of the accesses. The iteration domains by the tuple names
6553 of the domains of the accesses and of the schedule.
6554 The relative order of the iteration domains is given by the
6555 schedule. The relations returned through C<must_no_source>
6556 and C<may_no_source> are subsets of C<sink>.
6557 Any of C<must_dep>, C<may_dep>, C<must_no_source>
6558 or C<may_no_source> may be C<NULL>, but a C<NULL> value for
6559 any of the other arguments is treated as an error.
6561 =head3 Interaction with Dependence Analysis
6563 During the dependence analysis, we frequently need to perform
6564 the following operation. Given a relation between sink iterations
6565 and potential source iterations from a particular source domain,
6566 what is the last potential source iteration corresponding to each
6567 sink iteration. It can sometimes be convenient to adjust
6568 the set of potential source iterations before or after each such operation.
6569 The prototypical example is fuzzy array dataflow analysis,
6570 where we need to analyze if, based on data-dependent constraints,
6571 the sink iteration can ever be executed without one or more of
6572 the corresponding potential source iterations being executed.
6573 If so, we can introduce extra parameters and select an unknown
6574 but fixed source iteration from the potential source iterations.
6575 To be able to perform such manipulations, C<isl> provides the following
6578 #include <isl/flow.h>
6580 typedef __isl_give isl_restriction *(*isl_access_restrict)(
6581 __isl_keep isl_map *source_map,
6582 __isl_keep isl_set *sink, void *source_user,
6584 __isl_give isl_access_info *isl_access_info_set_restrict(
6585 __isl_take isl_access_info *acc,
6586 isl_access_restrict fn, void *user);
6588 The function C<isl_access_info_set_restrict> should be called
6589 before calling C<isl_access_info_compute_flow> and registers a callback function
6590 that will be called any time C<isl> is about to compute the last
6591 potential source. The first argument is the (reverse) proto-dependence,
6592 mapping sink iterations to potential source iterations.
6593 The second argument represents the sink iterations for which
6594 we want to compute the last source iteration.
6595 The third argument is the token corresponding to the source
6596 and the final argument is the token passed to C<isl_access_info_set_restrict>.
6597 The callback is expected to return a restriction on either the input or
6598 the output of the operation computing the last potential source.
6599 If the input needs to be restricted then restrictions are needed
6600 for both the source and the sink iterations. The sink iterations
6601 and the potential source iterations will be intersected with these sets.
6602 If the output needs to be restricted then only a restriction on the source
6603 iterations is required.
6604 If any error occurs, the callback should return C<NULL>.
6605 An C<isl_restriction> object can be created, freed and inspected
6606 using the following functions.
6608 #include <isl/flow.h>
6610 __isl_give isl_restriction *isl_restriction_input(
6611 __isl_take isl_set *source_restr,
6612 __isl_take isl_set *sink_restr);
6613 __isl_give isl_restriction *isl_restriction_output(
6614 __isl_take isl_set *source_restr);
6615 __isl_give isl_restriction *isl_restriction_none(
6616 __isl_take isl_map *source_map);
6617 __isl_give isl_restriction *isl_restriction_empty(
6618 __isl_take isl_map *source_map);
6619 __isl_null isl_restriction *isl_restriction_free(
6620 __isl_take isl_restriction *restr);
6622 C<isl_restriction_none> and C<isl_restriction_empty> are special
6623 cases of C<isl_restriction_input>. C<isl_restriction_none>
6624 is essentially equivalent to
6626 isl_restriction_input(isl_set_universe(
6627 isl_space_range(isl_map_get_space(source_map))),
6629 isl_space_domain(isl_map_get_space(source_map))));
6631 whereas C<isl_restriction_empty> is essentially equivalent to
6633 isl_restriction_input(isl_set_empty(
6634 isl_space_range(isl_map_get_space(source_map))),
6636 isl_space_domain(isl_map_get_space(source_map))));
6640 B<The functionality described in this section is fairly new
6641 and may be subject to change.>
6643 #include <isl/schedule.h>
6644 __isl_give isl_schedule *
6645 isl_schedule_constraints_compute_schedule(
6646 __isl_take isl_schedule_constraints *sc);
6647 __isl_null isl_schedule *isl_schedule_free(
6648 __isl_take isl_schedule *sched);
6650 The function C<isl_schedule_constraints_compute_schedule> can be
6651 used to compute a schedule that satisfies the given schedule constraints.
6652 These schedule constraints include the iteration domain for which
6653 a schedule should be computed and dependences between pairs of
6654 iterations. In particular, these dependences include
6655 I<validity> dependences and I<proximity> dependences.
6656 By default, the algorithm used to construct the schedule is similar
6657 to that of C<Pluto>.
6658 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
6660 The generated schedule respects all validity dependences.
6661 That is, all dependence distances over these dependences in the
6662 scheduled space are lexicographically positive.
6663 The default algorithm tries to ensure that the dependence distances
6664 over coincidence constraints are zero and to minimize the
6665 dependence distances over proximity dependences.
6666 Moreover, it tries to obtain sequences (bands) of schedule dimensions
6667 for groups of domains where the dependence distances over validity
6668 dependences have only non-negative values.
6669 When using Feautrier's algorithm, the coincidence and proximity constraints
6670 are only taken into account during the extension to a
6671 full-dimensional schedule.
6673 An C<isl_schedule_constraints> object can be constructed
6674 and manipulated using the following functions.
6676 #include <isl/schedule.h>
6677 __isl_give isl_schedule_constraints *
6678 isl_schedule_constraints_copy(
6679 __isl_keep isl_schedule_constraints *sc);
6680 __isl_give isl_schedule_constraints *
6681 isl_schedule_constraints_on_domain(
6682 __isl_take isl_union_set *domain);
6683 __isl_give isl_schedule_constraints *
6684 isl_schedule_constraints_set_validity(
6685 __isl_take isl_schedule_constraints *sc,
6686 __isl_take isl_union_map *validity);
6687 __isl_give isl_schedule_constraints *
6688 isl_schedule_constraints_set_coincidence(
6689 __isl_take isl_schedule_constraints *sc,
6690 __isl_take isl_union_map *coincidence);
6691 __isl_give isl_schedule_constraints *
6692 isl_schedule_constraints_set_proximity(
6693 __isl_take isl_schedule_constraints *sc,
6694 __isl_take isl_union_map *proximity);
6695 __isl_give isl_schedule_constraints *
6696 isl_schedule_constraints_set_conditional_validity(
6697 __isl_take isl_schedule_constraints *sc,
6698 __isl_take isl_union_map *condition,
6699 __isl_take isl_union_map *validity);
6700 __isl_null isl_schedule_constraints *
6701 isl_schedule_constraints_free(
6702 __isl_take isl_schedule_constraints *sc);
6704 The initial C<isl_schedule_constraints> object created by
6705 C<isl_schedule_constraints_on_domain> does not impose any constraints.
6706 That is, it has an empty set of dependences.
6707 The function C<isl_schedule_constraints_set_validity> replaces the
6708 validity dependences, mapping domain elements I<i> to domain
6709 elements that should be scheduled after I<i>.
6710 The function C<isl_schedule_constraints_set_coincidence> replaces the
6711 coincidence dependences, mapping domain elements I<i> to domain
6712 elements that should be scheduled together with I<I>, if possible.
6713 The function C<isl_schedule_constraints_set_proximity> replaces the
6714 proximity dependences, mapping domain elements I<i> to domain
6715 elements that should be scheduled either before I<I>
6716 or as early as possible after I<i>.
6718 The function C<isl_schedule_constraints_set_conditional_validity>
6719 replaces the conditional validity constraints.
6720 A conditional validity constraint is only imposed when any of the corresponding
6721 conditions is satisfied, i.e., when any of them is non-zero.
6722 That is, the scheduler ensures that within each band if the dependence
6723 distances over the condition constraints are not all zero
6724 then all corresponding conditional validity constraints are respected.
6725 A conditional validity constraint corresponds to a condition
6726 if the two are adjacent, i.e., if the domain of one relation intersect
6727 the range of the other relation.
6728 The typical use case of conditional validity constraints is
6729 to allow order constraints between live ranges to be violated
6730 as long as the live ranges themselves are local to the band.
6731 To allow more fine-grained control over which conditions correspond
6732 to which conditional validity constraints, the domains and ranges
6733 of these relations may include I<tags>. That is, the domains and
6734 ranges of those relation may themselves be wrapped relations
6735 where the iteration domain appears in the domain of those wrapped relations
6736 and the range of the wrapped relations can be arbitrarily chosen
6737 by the user. Conditions and conditional validity constraints are only
6738 considered adjacent to each other if the entire wrapped relation matches.
6739 In particular, a relation with a tag will never be considered adjacent
6740 to a relation without a tag.
6742 The following function computes a schedule directly from
6743 an iteration domain and validity and proximity dependences
6744 and is implemented in terms of the functions described above.
6745 The use of C<isl_union_set_compute_schedule> is discouraged.
6747 #include <isl/schedule.h>
6748 __isl_give isl_schedule *isl_union_set_compute_schedule(
6749 __isl_take isl_union_set *domain,
6750 __isl_take isl_union_map *validity,
6751 __isl_take isl_union_map *proximity);
6753 A mapping from the domains to the scheduled space can be obtained
6754 from an C<isl_schedule> using the following function.
6756 __isl_give isl_union_map *isl_schedule_get_map(
6757 __isl_keep isl_schedule *sched);
6759 A representation of the schedule can be printed using
6761 __isl_give isl_printer *isl_printer_print_schedule(
6762 __isl_take isl_printer *p,
6763 __isl_keep isl_schedule *schedule);
6765 A representation of the schedule as a forest of bands can be obtained
6766 using the following function.
6768 __isl_give isl_band_list *isl_schedule_get_band_forest(
6769 __isl_keep isl_schedule *schedule);
6771 The individual bands can be visited in depth-first post-order
6772 using the following function.
6774 #include <isl/schedule.h>
6775 int isl_schedule_foreach_band(
6776 __isl_keep isl_schedule *sched,
6777 int (*fn)(__isl_keep isl_band *band, void *user),
6780 The list can be manipulated as explained in L<"Lists">.
6781 The bands inside the list can be copied and freed using the following
6784 #include <isl/band.h>
6785 __isl_give isl_band *isl_band_copy(
6786 __isl_keep isl_band *band);
6787 __isl_null isl_band *isl_band_free(
6788 __isl_take isl_band *band);
6790 Each band contains zero or more scheduling dimensions.
6791 These are referred to as the members of the band.
6792 The section of the schedule that corresponds to the band is
6793 referred to as the partial schedule of the band.
6794 For those nodes that participate in a band, the outer scheduling
6795 dimensions form the prefix schedule, while the inner scheduling
6796 dimensions form the suffix schedule.
6797 That is, if we take a cut of the band forest, then the union of
6798 the concatenations of the prefix, partial and suffix schedules of
6799 each band in the cut is equal to the entire schedule (modulo
6800 some possible padding at the end with zero scheduling dimensions).
6801 The properties of a band can be inspected using the following functions.
6803 #include <isl/band.h>
6804 int isl_band_has_children(__isl_keep isl_band *band);
6805 __isl_give isl_band_list *isl_band_get_children(
6806 __isl_keep isl_band *band);
6808 __isl_give isl_union_map *isl_band_get_prefix_schedule(
6809 __isl_keep isl_band *band);
6810 __isl_give isl_union_map *isl_band_get_partial_schedule(
6811 __isl_keep isl_band *band);
6812 __isl_give isl_union_map *isl_band_get_suffix_schedule(
6813 __isl_keep isl_band *band);
6815 int isl_band_n_member(__isl_keep isl_band *band);
6816 int isl_band_member_is_coincident(
6817 __isl_keep isl_band *band, int pos);
6819 int isl_band_list_foreach_band(
6820 __isl_keep isl_band_list *list,
6821 int (*fn)(__isl_keep isl_band *band, void *user),
6824 Note that a scheduling dimension is considered to be ``coincident''
6825 if it satisfies the coincidence constraints within its band.
6826 That is, if the dependence distances of the coincidence
6827 constraints are all zero in that direction (for fixed
6828 iterations of outer bands).
6829 Like C<isl_schedule_foreach_band>,
6830 the function C<isl_band_list_foreach_band> calls C<fn> on the bands
6831 in depth-first post-order.
6833 A band can be tiled using the following function.
6835 #include <isl/band.h>
6836 int isl_band_tile(__isl_keep isl_band *band,
6837 __isl_take isl_vec *sizes);
6839 int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
6841 int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
6842 int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
6844 int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
6846 The C<isl_band_tile> function tiles the band using the given tile sizes
6847 inside its schedule.
6848 A new child band is created to represent the point loops and it is
6849 inserted between the modified band and its children.
6850 The C<tile_scale_tile_loops> option specifies whether the tile
6851 loops iterators should be scaled by the tile sizes.
6852 If the C<tile_shift_point_loops> option is set, then the point loops
6853 are shifted to start at zero.
6855 A band can be split into two nested bands using the following function.
6857 int isl_band_split(__isl_keep isl_band *band, int pos);
6859 The resulting outer band contains the first C<pos> dimensions of C<band>
6860 while the inner band contains the remaining dimensions.
6862 A representation of the band can be printed using
6864 #include <isl/band.h>
6865 __isl_give isl_printer *isl_printer_print_band(
6866 __isl_take isl_printer *p,
6867 __isl_keep isl_band *band);
6871 #include <isl/schedule.h>
6872 int isl_options_set_schedule_max_coefficient(
6873 isl_ctx *ctx, int val);
6874 int isl_options_get_schedule_max_coefficient(
6876 int isl_options_set_schedule_max_constant_term(
6877 isl_ctx *ctx, int val);
6878 int isl_options_get_schedule_max_constant_term(
6880 int isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
6881 int isl_options_get_schedule_fuse(isl_ctx *ctx);
6882 int isl_options_set_schedule_maximize_band_depth(
6883 isl_ctx *ctx, int val);
6884 int isl_options_get_schedule_maximize_band_depth(
6886 int isl_options_set_schedule_outer_coincidence(
6887 isl_ctx *ctx, int val);
6888 int isl_options_get_schedule_outer_coincidence(
6890 int isl_options_set_schedule_split_scaled(
6891 isl_ctx *ctx, int val);
6892 int isl_options_get_schedule_split_scaled(
6894 int isl_options_set_schedule_algorithm(
6895 isl_ctx *ctx, int val);
6896 int isl_options_get_schedule_algorithm(
6898 int isl_options_set_schedule_separate_components(
6899 isl_ctx *ctx, int val);
6900 int isl_options_get_schedule_separate_components(
6905 =item * schedule_max_coefficient
6907 This option enforces that the coefficients for variable and parameter
6908 dimensions in the calculated schedule are not larger than the specified value.
6909 This option can significantly increase the speed of the scheduling calculation
6910 and may also prevent fusing of unrelated dimensions. A value of -1 means that
6911 this option does not introduce bounds on the variable or parameter
6914 =item * schedule_max_constant_term
6916 This option enforces that the constant coefficients in the calculated schedule
6917 are not larger than the maximal constant term. This option can significantly
6918 increase the speed of the scheduling calculation and may also prevent fusing of
6919 unrelated dimensions. A value of -1 means that this option does not introduce
6920 bounds on the constant coefficients.
6922 =item * schedule_fuse
6924 This option controls the level of fusion.
6925 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
6926 resulting schedule will be distributed as much as possible.
6927 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
6928 try to fuse loops in the resulting schedule.
6930 =item * schedule_maximize_band_depth
6932 If this option is set, we do not split bands at the point
6933 where we detect splitting is necessary. Instead, we
6934 backtrack and split bands as early as possible. This
6935 reduces the number of splits and maximizes the width of
6936 the bands. Wider bands give more possibilities for tiling.
6937 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
6938 then bands will be split as early as possible, even if there is no need.
6939 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
6941 =item * schedule_outer_coincidence
6943 If this option is set, then we try to construct schedules
6944 where the outermost scheduling dimension in each band
6945 satisfies the coincidence constraints.
6947 =item * schedule_split_scaled
6949 If this option is set, then we try to construct schedules in which the
6950 constant term is split off from the linear part if the linear parts of
6951 the scheduling rows for all nodes in the graphs have a common non-trivial
6953 The constant term is then placed in a separate band and the linear
6956 =item * schedule_algorithm
6958 Selects the scheduling algorithm to be used.
6959 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
6960 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
6962 =item * schedule_separate_components
6964 If at any point the dependence graph contains any (weakly connected) components,
6965 then these components are scheduled separately.
6966 If this option is not set, then some iterations of the domains
6967 in these components may be scheduled together.
6968 If this option is set, then the components are given consecutive
6973 =head2 AST Generation
6975 This section describes the C<isl> functionality for generating
6976 ASTs that visit all the elements
6977 in a domain in an order specified by a schedule.
6978 In particular, given a C<isl_union_map>, an AST is generated
6979 that visits all the elements in the domain of the C<isl_union_map>
6980 according to the lexicographic order of the corresponding image
6981 element(s). If the range of the C<isl_union_map> consists of
6982 elements in more than one space, then each of these spaces is handled
6983 separately in an arbitrary order.
6984 It should be noted that the image elements only specify the I<order>
6985 in which the corresponding domain elements should be visited.
6986 No direct relation between the image elements and the loop iterators
6987 in the generated AST should be assumed.
6989 Each AST is generated within a build. The initial build
6990 simply specifies the constraints on the parameters (if any)
6991 and can be created, inspected, copied and freed using the following functions.
6993 #include <isl/ast_build.h>
6994 __isl_give isl_ast_build *isl_ast_build_from_context(
6995 __isl_take isl_set *set);
6996 __isl_give isl_ast_build *isl_ast_build_copy(
6997 __isl_keep isl_ast_build *build);
6998 __isl_null isl_ast_build *isl_ast_build_free(
6999 __isl_take isl_ast_build *build);
7001 The C<set> argument is usually a parameter set with zero or more parameters.
7002 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
7003 and L</"Fine-grained Control over AST Generation">.
7004 Finally, the AST itself can be constructed using the following
7007 #include <isl/ast_build.h>
7008 __isl_give isl_ast_node *isl_ast_build_ast_from_schedule(
7009 __isl_keep isl_ast_build *build,
7010 __isl_take isl_union_map *schedule);
7012 =head3 Inspecting the AST
7014 The basic properties of an AST node can be obtained as follows.
7016 #include <isl/ast.h>
7017 enum isl_ast_node_type isl_ast_node_get_type(
7018 __isl_keep isl_ast_node *node);
7020 The type of an AST node is one of
7021 C<isl_ast_node_for>,
7023 C<isl_ast_node_block> or
7024 C<isl_ast_node_user>.
7025 An C<isl_ast_node_for> represents a for node.
7026 An C<isl_ast_node_if> represents an if node.
7027 An C<isl_ast_node_block> represents a compound node.
7028 An C<isl_ast_node_user> represents an expression statement.
7029 An expression statement typically corresponds to a domain element, i.e.,
7030 one of the elements that is visited by the AST.
7032 Each type of node has its own additional properties.
7034 #include <isl/ast.h>
7035 __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
7036 __isl_keep isl_ast_node *node);
7037 __isl_give isl_ast_expr *isl_ast_node_for_get_init(
7038 __isl_keep isl_ast_node *node);
7039 __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
7040 __isl_keep isl_ast_node *node);
7041 __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
7042 __isl_keep isl_ast_node *node);
7043 __isl_give isl_ast_node *isl_ast_node_for_get_body(
7044 __isl_keep isl_ast_node *node);
7045 int isl_ast_node_for_is_degenerate(
7046 __isl_keep isl_ast_node *node);
7048 An C<isl_ast_for> is considered degenerate if it is known to execute
7051 #include <isl/ast.h>
7052 __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
7053 __isl_keep isl_ast_node *node);
7054 __isl_give isl_ast_node *isl_ast_node_if_get_then(
7055 __isl_keep isl_ast_node *node);
7056 int isl_ast_node_if_has_else(
7057 __isl_keep isl_ast_node *node);
7058 __isl_give isl_ast_node *isl_ast_node_if_get_else(
7059 __isl_keep isl_ast_node *node);
7061 __isl_give isl_ast_node_list *
7062 isl_ast_node_block_get_children(
7063 __isl_keep isl_ast_node *node);
7065 __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
7066 __isl_keep isl_ast_node *node);
7068 Each of the returned C<isl_ast_expr>s can in turn be inspected using
7069 the following functions.
7071 #include <isl/ast.h>
7072 enum isl_ast_expr_type isl_ast_expr_get_type(
7073 __isl_keep isl_ast_expr *expr);
7075 The type of an AST expression is one of
7077 C<isl_ast_expr_id> or
7078 C<isl_ast_expr_int>.
7079 An C<isl_ast_expr_op> represents the result of an operation.
7080 An C<isl_ast_expr_id> represents an identifier.
7081 An C<isl_ast_expr_int> represents an integer value.
7083 Each type of expression has its own additional properties.
7085 #include <isl/ast.h>
7086 enum isl_ast_op_type isl_ast_expr_get_op_type(
7087 __isl_keep isl_ast_expr *expr);
7088 int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
7089 __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
7090 __isl_keep isl_ast_expr *expr, int pos);
7091 int isl_ast_node_foreach_ast_op_type(
7092 __isl_keep isl_ast_node *node,
7093 int (*fn)(enum isl_ast_op_type type, void *user),
7096 C<isl_ast_expr_get_op_type> returns the type of the operation
7097 performed. C<isl_ast_expr_get_op_n_arg> returns the number of
7098 arguments. C<isl_ast_expr_get_op_arg> returns the specified
7100 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
7101 C<isl_ast_op_type> that appears in C<node>.
7102 The operation type is one of the following.
7106 =item C<isl_ast_op_and>
7108 Logical I<and> of two arguments.
7109 Both arguments can be evaluated.
7111 =item C<isl_ast_op_and_then>
7113 Logical I<and> of two arguments.
7114 The second argument can only be evaluated if the first evaluates to true.
7116 =item C<isl_ast_op_or>
7118 Logical I<or> of two arguments.
7119 Both arguments can be evaluated.
7121 =item C<isl_ast_op_or_else>
7123 Logical I<or> of two arguments.
7124 The second argument can only be evaluated if the first evaluates to false.
7126 =item C<isl_ast_op_max>
7128 Maximum of two or more arguments.
7130 =item C<isl_ast_op_min>
7132 Minimum of two or more arguments.
7134 =item C<isl_ast_op_minus>
7138 =item C<isl_ast_op_add>
7140 Sum of two arguments.
7142 =item C<isl_ast_op_sub>
7144 Difference of two arguments.
7146 =item C<isl_ast_op_mul>
7148 Product of two arguments.
7150 =item C<isl_ast_op_div>
7152 Exact division. That is, the result is known to be an integer.
7154 =item C<isl_ast_op_fdiv_q>
7156 Result of integer division, rounded towards negative
7159 =item C<isl_ast_op_pdiv_q>
7161 Result of integer division, where dividend is known to be non-negative.
7163 =item C<isl_ast_op_pdiv_r>
7165 Remainder of integer division, where dividend is known to be non-negative.
7167 =item C<isl_ast_op_zdiv_r>
7169 Equal to zero iff the remainder on integer division is zero.
7171 =item C<isl_ast_op_cond>
7173 Conditional operator defined on three arguments.
7174 If the first argument evaluates to true, then the result
7175 is equal to the second argument. Otherwise, the result
7176 is equal to the third argument.
7177 The second and third argument may only be evaluated if
7178 the first argument evaluates to true and false, respectively.
7179 Corresponds to C<a ? b : c> in C.
7181 =item C<isl_ast_op_select>
7183 Conditional operator defined on three arguments.
7184 If the first argument evaluates to true, then the result
7185 is equal to the second argument. Otherwise, the result
7186 is equal to the third argument.
7187 The second and third argument may be evaluated independently
7188 of the value of the first argument.
7189 Corresponds to C<a * b + (1 - a) * c> in C.
7191 =item C<isl_ast_op_eq>
7195 =item C<isl_ast_op_le>
7197 Less than or equal relation.
7199 =item C<isl_ast_op_lt>
7203 =item C<isl_ast_op_ge>
7205 Greater than or equal relation.
7207 =item C<isl_ast_op_gt>
7209 Greater than relation.
7211 =item C<isl_ast_op_call>
7214 The number of arguments of the C<isl_ast_expr> is one more than
7215 the number of arguments in the function call, the first argument
7216 representing the function being called.
7218 =item C<isl_ast_op_access>
7221 The number of arguments of the C<isl_ast_expr> is one more than
7222 the number of index expressions in the array access, the first argument
7223 representing the array being accessed.
7225 =item C<isl_ast_op_member>
7228 This operation has two arguments, a structure and the name of
7229 the member of the structure being accessed.
7233 #include <isl/ast.h>
7234 __isl_give isl_id *isl_ast_expr_get_id(
7235 __isl_keep isl_ast_expr *expr);
7237 Return the identifier represented by the AST expression.
7239 #include <isl/ast.h>
7240 __isl_give isl_val *isl_ast_expr_get_val(
7241 __isl_keep isl_ast_expr *expr);
7243 Return the integer represented by the AST expression.
7245 =head3 Properties of ASTs
7247 #include <isl/ast.h>
7248 int isl_ast_expr_is_equal(__isl_keep isl_ast_expr *expr1,
7249 __isl_keep isl_ast_expr *expr2);
7251 Check if two C<isl_ast_expr>s are equal to each other.
7253 =head3 Manipulating and printing the AST
7255 AST nodes can be copied and freed using the following functions.
7257 #include <isl/ast.h>
7258 __isl_give isl_ast_node *isl_ast_node_copy(
7259 __isl_keep isl_ast_node *node);
7260 __isl_null isl_ast_node *isl_ast_node_free(
7261 __isl_take isl_ast_node *node);
7263 AST expressions can be copied and freed using the following functions.
7265 #include <isl/ast.h>
7266 __isl_give isl_ast_expr *isl_ast_expr_copy(
7267 __isl_keep isl_ast_expr *expr);
7268 __isl_null isl_ast_expr *isl_ast_expr_free(
7269 __isl_take isl_ast_expr *expr);
7271 New AST expressions can be created either directly or within
7272 the context of an C<isl_ast_build>.
7274 #include <isl/ast.h>
7275 __isl_give isl_ast_expr *isl_ast_expr_from_val(
7276 __isl_take isl_val *v);
7277 __isl_give isl_ast_expr *isl_ast_expr_from_id(
7278 __isl_take isl_id *id);
7279 __isl_give isl_ast_expr *isl_ast_expr_neg(
7280 __isl_take isl_ast_expr *expr);
7281 __isl_give isl_ast_expr *isl_ast_expr_address_of(
7282 __isl_take isl_ast_expr *expr);
7283 __isl_give isl_ast_expr *isl_ast_expr_add(
7284 __isl_take isl_ast_expr *expr1,
7285 __isl_take isl_ast_expr *expr2);
7286 __isl_give isl_ast_expr *isl_ast_expr_sub(
7287 __isl_take isl_ast_expr *expr1,
7288 __isl_take isl_ast_expr *expr2);
7289 __isl_give isl_ast_expr *isl_ast_expr_mul(
7290 __isl_take isl_ast_expr *expr1,
7291 __isl_take isl_ast_expr *expr2);
7292 __isl_give isl_ast_expr *isl_ast_expr_div(
7293 __isl_take isl_ast_expr *expr1,
7294 __isl_take isl_ast_expr *expr2);
7295 __isl_give isl_ast_expr *isl_ast_expr_and(
7296 __isl_take isl_ast_expr *expr1,
7297 __isl_take isl_ast_expr *expr2)
7298 __isl_give isl_ast_expr *isl_ast_expr_or(
7299 __isl_take isl_ast_expr *expr1,
7300 __isl_take isl_ast_expr *expr2)
7301 __isl_give isl_ast_expr *isl_ast_expr_eq(
7302 __isl_take isl_ast_expr *expr1,
7303 __isl_take isl_ast_expr *expr2);
7304 __isl_give isl_ast_expr *isl_ast_expr_le(
7305 __isl_take isl_ast_expr *expr1,
7306 __isl_take isl_ast_expr *expr2);
7307 __isl_give isl_ast_expr *isl_ast_expr_lt(
7308 __isl_take isl_ast_expr *expr1,
7309 __isl_take isl_ast_expr *expr2);
7310 __isl_give isl_ast_expr *isl_ast_expr_ge(
7311 __isl_take isl_ast_expr *expr1,
7312 __isl_take isl_ast_expr *expr2);
7313 __isl_give isl_ast_expr *isl_ast_expr_gt(
7314 __isl_take isl_ast_expr *expr1,
7315 __isl_take isl_ast_expr *expr2);
7316 __isl_give isl_ast_expr *isl_ast_expr_access(
7317 __isl_take isl_ast_expr *array,
7318 __isl_take isl_ast_expr_list *indices);
7320 The function C<isl_ast_expr_address_of> can be applied to an
7321 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
7322 to represent the address of the C<isl_ast_expr_access>.
7324 #include <isl/ast_build.h>
7325 __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
7326 __isl_keep isl_ast_build *build,
7327 __isl_take isl_pw_aff *pa);
7328 __isl_give isl_ast_expr *
7329 isl_ast_build_access_from_pw_multi_aff(
7330 __isl_keep isl_ast_build *build,
7331 __isl_take isl_pw_multi_aff *pma);
7332 __isl_give isl_ast_expr *
7333 isl_ast_build_access_from_multi_pw_aff(
7334 __isl_keep isl_ast_build *build,
7335 __isl_take isl_multi_pw_aff *mpa);
7336 __isl_give isl_ast_expr *
7337 isl_ast_build_call_from_pw_multi_aff(
7338 __isl_keep isl_ast_build *build,
7339 __isl_take isl_pw_multi_aff *pma);
7340 __isl_give isl_ast_expr *
7341 isl_ast_build_call_from_multi_pw_aff(
7342 __isl_keep isl_ast_build *build,
7343 __isl_take isl_multi_pw_aff *mpa);
7345 The domains of C<pa>, C<mpa> and C<pma> should correspond
7346 to the schedule space of C<build>.
7347 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
7348 the function being called.
7349 If the accessed space is a nested relation, then it is taken
7350 to represent an access of the member specified by the range
7351 of this nested relation of the structure specified by the domain
7352 of the nested relation.
7354 The following functions can be used to modify an C<isl_ast_expr>.
7356 #include <isl/ast.h>
7357 __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
7358 __isl_take isl_ast_expr *expr, int pos,
7359 __isl_take isl_ast_expr *arg);
7361 Replace the argument of C<expr> at position C<pos> by C<arg>.
7363 #include <isl/ast.h>
7364 __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
7365 __isl_take isl_ast_expr *expr,
7366 __isl_take isl_id_to_ast_expr *id2expr);
7368 The function C<isl_ast_expr_substitute_ids> replaces the
7369 subexpressions of C<expr> of type C<isl_ast_expr_id>
7370 by the corresponding expression in C<id2expr>, if there is any.
7373 User specified data can be attached to an C<isl_ast_node> and obtained
7374 from the same C<isl_ast_node> using the following functions.
7376 #include <isl/ast.h>
7377 __isl_give isl_ast_node *isl_ast_node_set_annotation(
7378 __isl_take isl_ast_node *node,
7379 __isl_take isl_id *annotation);
7380 __isl_give isl_id *isl_ast_node_get_annotation(
7381 __isl_keep isl_ast_node *node);
7383 Basic printing can be performed using the following functions.
7385 #include <isl/ast.h>
7386 __isl_give isl_printer *isl_printer_print_ast_expr(
7387 __isl_take isl_printer *p,
7388 __isl_keep isl_ast_expr *expr);
7389 __isl_give isl_printer *isl_printer_print_ast_node(
7390 __isl_take isl_printer *p,
7391 __isl_keep isl_ast_node *node);
7392 __isl_give char *isl_ast_expr_to_str(
7393 __isl_keep isl_ast_expr *expr);
7395 More advanced printing can be performed using the following functions.
7397 #include <isl/ast.h>
7398 __isl_give isl_printer *isl_ast_op_type_print_macro(
7399 enum isl_ast_op_type type,
7400 __isl_take isl_printer *p);
7401 __isl_give isl_printer *isl_ast_node_print_macros(
7402 __isl_keep isl_ast_node *node,
7403 __isl_take isl_printer *p);
7404 __isl_give isl_printer *isl_ast_node_print(
7405 __isl_keep isl_ast_node *node,
7406 __isl_take isl_printer *p,
7407 __isl_take isl_ast_print_options *options);
7408 __isl_give isl_printer *isl_ast_node_for_print(
7409 __isl_keep isl_ast_node *node,
7410 __isl_take isl_printer *p,
7411 __isl_take isl_ast_print_options *options);
7412 __isl_give isl_printer *isl_ast_node_if_print(
7413 __isl_keep isl_ast_node *node,
7414 __isl_take isl_printer *p,
7415 __isl_take isl_ast_print_options *options);
7417 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
7418 C<isl> may print out an AST that makes use of macros such
7419 as C<floord>, C<min> and C<max>.
7420 C<isl_ast_op_type_print_macro> prints out the macro
7421 corresponding to a specific C<isl_ast_op_type>.
7422 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
7423 for expressions where these macros would be used and prints
7424 out the required macro definitions.
7425 Essentially, C<isl_ast_node_print_macros> calls
7426 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
7427 as function argument.
7428 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
7429 C<isl_ast_node_if_print> print an C<isl_ast_node>
7430 in C<ISL_FORMAT_C>, but allow for some extra control
7431 through an C<isl_ast_print_options> object.
7432 This object can be created using the following functions.
7434 #include <isl/ast.h>
7435 __isl_give isl_ast_print_options *
7436 isl_ast_print_options_alloc(isl_ctx *ctx);
7437 __isl_give isl_ast_print_options *
7438 isl_ast_print_options_copy(
7439 __isl_keep isl_ast_print_options *options);
7440 __isl_null isl_ast_print_options *
7441 isl_ast_print_options_free(
7442 __isl_take isl_ast_print_options *options);
7444 __isl_give isl_ast_print_options *
7445 isl_ast_print_options_set_print_user(
7446 __isl_take isl_ast_print_options *options,
7447 __isl_give isl_printer *(*print_user)(
7448 __isl_take isl_printer *p,
7449 __isl_take isl_ast_print_options *options,
7450 __isl_keep isl_ast_node *node, void *user),
7452 __isl_give isl_ast_print_options *
7453 isl_ast_print_options_set_print_for(
7454 __isl_take isl_ast_print_options *options,
7455 __isl_give isl_printer *(*print_for)(
7456 __isl_take isl_printer *p,
7457 __isl_take isl_ast_print_options *options,
7458 __isl_keep isl_ast_node *node, void *user),
7461 The callback set by C<isl_ast_print_options_set_print_user>
7462 is called whenever a node of type C<isl_ast_node_user> needs to
7464 The callback set by C<isl_ast_print_options_set_print_for>
7465 is called whenever a node of type C<isl_ast_node_for> needs to
7467 Note that C<isl_ast_node_for_print> will I<not> call the
7468 callback set by C<isl_ast_print_options_set_print_for> on the node
7469 on which C<isl_ast_node_for_print> is called, but only on nested
7470 nodes of type C<isl_ast_node_for>. It is therefore safe to
7471 call C<isl_ast_node_for_print> from within the callback set by
7472 C<isl_ast_print_options_set_print_for>.
7474 The following option determines the type to be used for iterators
7475 while printing the AST.
7477 int isl_options_set_ast_iterator_type(
7478 isl_ctx *ctx, const char *val);
7479 const char *isl_options_get_ast_iterator_type(
7482 The AST printer only prints body nodes as blocks if these
7483 blocks cannot be safely omitted.
7484 For example, a C<for> node with one body node will not be
7485 surrounded with braces in C<ISL_FORMAT_C>.
7486 A block will always be printed by setting the following option.
7488 int isl_options_set_ast_always_print_block(isl_ctx *ctx,
7490 int isl_options_get_ast_always_print_block(isl_ctx *ctx);
7494 #include <isl/ast_build.h>
7495 int isl_options_set_ast_build_atomic_upper_bound(
7496 isl_ctx *ctx, int val);
7497 int isl_options_get_ast_build_atomic_upper_bound(
7499 int isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
7501 int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
7502 int isl_options_set_ast_build_exploit_nested_bounds(
7503 isl_ctx *ctx, int val);
7504 int isl_options_get_ast_build_exploit_nested_bounds(
7506 int isl_options_set_ast_build_group_coscheduled(
7507 isl_ctx *ctx, int val);
7508 int isl_options_get_ast_build_group_coscheduled(
7510 int isl_options_set_ast_build_scale_strides(
7511 isl_ctx *ctx, int val);
7512 int isl_options_get_ast_build_scale_strides(
7514 int isl_options_set_ast_build_allow_else(isl_ctx *ctx,
7516 int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
7517 int isl_options_set_ast_build_allow_or(isl_ctx *ctx,
7519 int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
7523 =item * ast_build_atomic_upper_bound
7525 Generate loop upper bounds that consist of the current loop iterator,
7526 an operator and an expression not involving the iterator.
7527 If this option is not set, then the current loop iterator may appear
7528 several times in the upper bound.
7529 For example, when this option is turned off, AST generation
7532 [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
7536 for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
7539 When the option is turned on, the following AST is generated
7541 for (int c0 = 0; c0 <= min(100, n); c0 += 1)
7544 =item * ast_build_prefer_pdiv
7546 If this option is turned off, then the AST generation will
7547 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
7548 operators, but no C<isl_ast_op_pdiv_q> or
7549 C<isl_ast_op_pdiv_r> operators.
7550 If this options is turned on, then C<isl> will try to convert
7551 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
7552 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
7554 =item * ast_build_exploit_nested_bounds
7556 Simplify conditions based on bounds of nested for loops.
7557 In particular, remove conditions that are implied by the fact
7558 that one or more nested loops have at least one iteration,
7559 meaning that the upper bound is at least as large as the lower bound.
7560 For example, when this option is turned off, AST generation
7563 [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
7569 for (int c0 = 0; c0 <= N; c0 += 1)
7570 for (int c1 = 0; c1 <= M; c1 += 1)
7573 When the option is turned on, the following AST is generated
7575 for (int c0 = 0; c0 <= N; c0 += 1)
7576 for (int c1 = 0; c1 <= M; c1 += 1)
7579 =item * ast_build_group_coscheduled
7581 If two domain elements are assigned the same schedule point, then
7582 they may be executed in any order and they may even appear in different
7583 loops. If this options is set, then the AST generator will make
7584 sure that coscheduled domain elements do not appear in separate parts
7585 of the AST. This is useful in case of nested AST generation
7586 if the outer AST generation is given only part of a schedule
7587 and the inner AST generation should handle the domains that are
7588 coscheduled by this initial part of the schedule together.
7589 For example if an AST is generated for a schedule
7591 { A[i] -> [0]; B[i] -> [0] }
7593 then the C<isl_ast_build_set_create_leaf> callback described
7594 below may get called twice, once for each domain.
7595 Setting this option ensures that the callback is only called once
7596 on both domains together.
7598 =item * ast_build_separation_bounds
7600 This option specifies which bounds to use during separation.
7601 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
7602 then all (possibly implicit) bounds on the current dimension will
7603 be used during separation.
7604 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
7605 then only those bounds that are explicitly available will
7606 be used during separation.
7608 =item * ast_build_scale_strides
7610 This option specifies whether the AST generator is allowed
7611 to scale down iterators of strided loops.
7613 =item * ast_build_allow_else
7615 This option specifies whether the AST generator is allowed
7616 to construct if statements with else branches.
7618 =item * ast_build_allow_or
7620 This option specifies whether the AST generator is allowed
7621 to construct if conditions with disjunctions.
7625 =head3 Fine-grained Control over AST Generation
7627 Besides specifying the constraints on the parameters,
7628 an C<isl_ast_build> object can be used to control
7629 various aspects of the AST generation process.
7630 The most prominent way of control is through ``options'',
7631 which can be set using the following function.
7633 #include <isl/ast_build.h>
7634 __isl_give isl_ast_build *
7635 isl_ast_build_set_options(
7636 __isl_take isl_ast_build *control,
7637 __isl_take isl_union_map *options);
7639 The options are encoded in an C<isl_union_map>.
7640 The domain of this union relation refers to the schedule domain,
7641 i.e., the range of the schedule passed to C<isl_ast_build_ast_from_schedule>.
7642 In the case of nested AST generation (see L</"Nested AST Generation">),
7643 the domain of C<options> should refer to the extra piece of the schedule.
7644 That is, it should be equal to the range of the wrapped relation in the
7645 range of the schedule.
7646 The range of the options can consist of elements in one or more spaces,
7647 the names of which determine the effect of the option.
7648 The values of the range typically also refer to the schedule dimension
7649 to which the option applies. In case of nested AST generation
7650 (see L</"Nested AST Generation">), these values refer to the position
7651 of the schedule dimension within the innermost AST generation.
7652 The constraints on the domain elements of
7653 the option should only refer to this dimension and earlier dimensions.
7654 We consider the following spaces.
7658 =item C<separation_class>
7660 This space is a wrapped relation between two one dimensional spaces.
7661 The input space represents the schedule dimension to which the option
7662 applies and the output space represents the separation class.
7663 While constructing a loop corresponding to the specified schedule
7664 dimension(s), the AST generator will try to generate separate loops
7665 for domain elements that are assigned different classes.
7666 If only some of the elements are assigned a class, then those elements
7667 that are not assigned any class will be treated as belonging to a class
7668 that is separate from the explicitly assigned classes.
7669 The typical use case for this option is to separate full tiles from
7671 The other options, described below, are applied after the separation
7674 As an example, consider the separation into full and partial tiles
7675 of a tiling of a triangular domain.
7676 Take, for example, the domain
7678 { A[i,j] : 0 <= i,j and i + j <= 100 }
7680 and a tiling into tiles of 10 by 10. The input to the AST generator
7681 is then the schedule
7683 { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
7686 Without any options, the following AST is generated
7688 for (int c0 = 0; c0 <= 10; c0 += 1)
7689 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
7690 for (int c2 = 10 * c0;
7691 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
7693 for (int c3 = 10 * c1;
7694 c3 <= min(10 * c1 + 9, -c2 + 100);
7698 Separation into full and partial tiles can be obtained by assigning
7699 a class, say C<0>, to the full tiles. The full tiles are represented by those
7700 values of the first and second schedule dimensions for which there are
7701 values of the third and fourth dimensions to cover an entire tile.
7702 That is, we need to specify the following option
7704 { [a,b,c,d] -> separation_class[[0]->[0]] :
7705 exists b': 0 <= 10a,10b' and
7706 10a+9+10b'+9 <= 100;
7707 [a,b,c,d] -> separation_class[[1]->[0]] :
7708 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
7712 { [a, b, c, d] -> separation_class[[1] -> [0]] :
7713 a >= 0 and b >= 0 and b <= 8 - a;
7714 [a, b, c, d] -> separation_class[[0] -> [0]] :
7717 With this option, the generated AST is as follows
7720 for (int c0 = 0; c0 <= 8; c0 += 1) {
7721 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
7722 for (int c2 = 10 * c0;
7723 c2 <= 10 * c0 + 9; c2 += 1)
7724 for (int c3 = 10 * c1;
7725 c3 <= 10 * c1 + 9; c3 += 1)
7727 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
7728 for (int c2 = 10 * c0;
7729 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
7731 for (int c3 = 10 * c1;
7732 c3 <= min(-c2 + 100, 10 * c1 + 9);
7736 for (int c0 = 9; c0 <= 10; c0 += 1)
7737 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
7738 for (int c2 = 10 * c0;
7739 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
7741 for (int c3 = 10 * c1;
7742 c3 <= min(10 * c1 + 9, -c2 + 100);
7749 This is a single-dimensional space representing the schedule dimension(s)
7750 to which ``separation'' should be applied. Separation tries to split
7751 a loop into several pieces if this can avoid the generation of guards
7753 See also the C<atomic> option.
7757 This is a single-dimensional space representing the schedule dimension(s)
7758 for which the domains should be considered ``atomic''. That is, the
7759 AST generator will make sure that any given domain space will only appear
7760 in a single loop at the specified level.
7762 Consider the following schedule
7764 { a[i] -> [i] : 0 <= i < 10;
7765 b[i] -> [i+1] : 0 <= i < 10 }
7767 If the following option is specified
7769 { [i] -> separate[x] }
7771 then the following AST will be generated
7775 for (int c0 = 1; c0 <= 9; c0 += 1) {
7782 If, on the other hand, the following option is specified
7784 { [i] -> atomic[x] }
7786 then the following AST will be generated
7788 for (int c0 = 0; c0 <= 10; c0 += 1) {
7795 If neither C<atomic> nor C<separate> is specified, then the AST generator
7796 may produce either of these two results or some intermediate form.
7800 This is a single-dimensional space representing the schedule dimension(s)
7801 that should be I<completely> unrolled.
7802 To obtain a partial unrolling, the user should apply an additional
7803 strip-mining to the schedule and fully unroll the inner loop.
7807 Additional control is available through the following functions.
7809 #include <isl/ast_build.h>
7810 __isl_give isl_ast_build *
7811 isl_ast_build_set_iterators(
7812 __isl_take isl_ast_build *control,
7813 __isl_take isl_id_list *iterators);
7815 The function C<isl_ast_build_set_iterators> allows the user to
7816 specify a list of iterator C<isl_id>s to be used as iterators.
7817 If the input schedule is injective, then
7818 the number of elements in this list should be as large as the dimension
7819 of the schedule space, but no direct correspondence should be assumed
7820 between dimensions and elements.
7821 If the input schedule is not injective, then an additional number
7822 of C<isl_id>s equal to the largest dimension of the input domains
7824 If the number of provided C<isl_id>s is insufficient, then additional
7825 names are automatically generated.
7827 #include <isl/ast_build.h>
7828 __isl_give isl_ast_build *
7829 isl_ast_build_set_create_leaf(
7830 __isl_take isl_ast_build *control,
7831 __isl_give isl_ast_node *(*fn)(
7832 __isl_take isl_ast_build *build,
7833 void *user), void *user);
7836 C<isl_ast_build_set_create_leaf> function allows for the
7837 specification of a callback that should be called whenever the AST
7838 generator arrives at an element of the schedule domain.
7839 The callback should return an AST node that should be inserted
7840 at the corresponding position of the AST. The default action (when
7841 the callback is not set) is to continue generating parts of the AST to scan
7842 all the domain elements associated to the schedule domain element
7843 and to insert user nodes, ``calling'' the domain element, for each of them.
7844 The C<build> argument contains the current state of the C<isl_ast_build>.
7845 To ease nested AST generation (see L</"Nested AST Generation">),
7846 all control information that is
7847 specific to the current AST generation such as the options and
7848 the callbacks has been removed from this C<isl_ast_build>.
7849 The callback would typically return the result of a nested
7851 user defined node created using the following function.
7853 #include <isl/ast.h>
7854 __isl_give isl_ast_node *isl_ast_node_alloc_user(
7855 __isl_take isl_ast_expr *expr);
7857 #include <isl/ast_build.h>
7858 __isl_give isl_ast_build *
7859 isl_ast_build_set_at_each_domain(
7860 __isl_take isl_ast_build *build,
7861 __isl_give isl_ast_node *(*fn)(
7862 __isl_take isl_ast_node *node,
7863 __isl_keep isl_ast_build *build,
7864 void *user), void *user);
7865 __isl_give isl_ast_build *
7866 isl_ast_build_set_before_each_for(
7867 __isl_take isl_ast_build *build,
7868 __isl_give isl_id *(*fn)(
7869 __isl_keep isl_ast_build *build,
7870 void *user), void *user);
7871 __isl_give isl_ast_build *
7872 isl_ast_build_set_after_each_for(
7873 __isl_take isl_ast_build *build,
7874 __isl_give isl_ast_node *(*fn)(
7875 __isl_take isl_ast_node *node,
7876 __isl_keep isl_ast_build *build,
7877 void *user), void *user);
7879 The callback set by C<isl_ast_build_set_at_each_domain> will
7880 be called for each domain AST node.
7881 The callbacks set by C<isl_ast_build_set_before_each_for>
7882 and C<isl_ast_build_set_after_each_for> will be called
7883 for each for AST node. The first will be called in depth-first
7884 pre-order, while the second will be called in depth-first post-order.
7885 Since C<isl_ast_build_set_before_each_for> is called before the for
7886 node is actually constructed, it is only passed an C<isl_ast_build>.
7887 The returned C<isl_id> will be added as an annotation (using
7888 C<isl_ast_node_set_annotation>) to the constructed for node.
7889 In particular, if the user has also specified an C<after_each_for>
7890 callback, then the annotation can be retrieved from the node passed to
7891 that callback using C<isl_ast_node_get_annotation>.
7892 All callbacks should C<NULL> on failure.
7893 The given C<isl_ast_build> can be used to create new
7894 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
7895 or C<isl_ast_build_call_from_pw_multi_aff>.
7897 =head3 Nested AST Generation
7899 C<isl> allows the user to create an AST within the context
7900 of another AST. These nested ASTs are created using the
7901 same C<isl_ast_build_ast_from_schedule> function that is used to create the
7902 outer AST. The C<build> argument should be an C<isl_ast_build>
7903 passed to a callback set by
7904 C<isl_ast_build_set_create_leaf>.
7905 The space of the range of the C<schedule> argument should refer
7906 to this build. In particular, the space should be a wrapped
7907 relation and the domain of this wrapped relation should be the
7908 same as that of the range of the schedule returned by
7909 C<isl_ast_build_get_schedule> below.
7910 In practice, the new schedule is typically
7911 created by calling C<isl_union_map_range_product> on the old schedule
7912 and some extra piece of the schedule.
7913 The space of the schedule domain is also available from
7914 the C<isl_ast_build>.
7916 #include <isl/ast_build.h>
7917 __isl_give isl_union_map *isl_ast_build_get_schedule(
7918 __isl_keep isl_ast_build *build);
7919 __isl_give isl_space *isl_ast_build_get_schedule_space(
7920 __isl_keep isl_ast_build *build);
7921 __isl_give isl_ast_build *isl_ast_build_restrict(
7922 __isl_take isl_ast_build *build,
7923 __isl_take isl_set *set);
7925 The C<isl_ast_build_get_schedule> function returns a (partial)
7926 schedule for the domains elements for which part of the AST still needs to
7927 be generated in the current build.
7928 In particular, the domain elements are mapped to those iterations of the loops
7929 enclosing the current point of the AST generation inside which
7930 the domain elements are executed.
7931 No direct correspondence between
7932 the input schedule and this schedule should be assumed.
7933 The space obtained from C<isl_ast_build_get_schedule_space> can be used
7934 to create a set for C<isl_ast_build_restrict> to intersect
7935 with the current build. In particular, the set passed to
7936 C<isl_ast_build_restrict> can have additional parameters.
7937 The ids of the set dimensions in the space returned by
7938 C<isl_ast_build_get_schedule_space> correspond to the
7939 iterators of the already generated loops.
7940 The user should not rely on the ids of the output dimensions
7941 of the relations in the union relation returned by
7942 C<isl_ast_build_get_schedule> having any particular value.
7946 Although C<isl> is mainly meant to be used as a library,
7947 it also contains some basic applications that use some
7948 of the functionality of C<isl>.
7949 The input may be specified in either the L<isl format>
7950 or the L<PolyLib format>.
7952 =head2 C<isl_polyhedron_sample>
7954 C<isl_polyhedron_sample> takes a polyhedron as input and prints
7955 an integer element of the polyhedron, if there is any.
7956 The first column in the output is the denominator and is always
7957 equal to 1. If the polyhedron contains no integer points,
7958 then a vector of length zero is printed.
7962 C<isl_pip> takes the same input as the C<example> program
7963 from the C<piplib> distribution, i.e., a set of constraints
7964 on the parameters, a line containing only -1 and finally a set
7965 of constraints on a parametric polyhedron.
7966 The coefficients of the parameters appear in the last columns
7967 (but before the final constant column).
7968 The output is the lexicographic minimum of the parametric polyhedron.
7969 As C<isl> currently does not have its own output format, the output
7970 is just a dump of the internal state.
7972 =head2 C<isl_polyhedron_minimize>
7974 C<isl_polyhedron_minimize> computes the minimum of some linear
7975 or affine objective function over the integer points in a polyhedron.
7976 If an affine objective function
7977 is given, then the constant should appear in the last column.
7979 =head2 C<isl_polytope_scan>
7981 Given a polytope, C<isl_polytope_scan> prints
7982 all integer points in the polytope.
7984 =head2 C<isl_codegen>
7986 Given a schedule, a context set and an options relation,
7987 C<isl_codegen> prints out an AST that scans the domain elements
7988 of the schedule in the order of their image(s) taking into account
7989 the constraints in the context set.