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);
1288 int isl_union_pw_multi_aff_find_dim_by_name(
1289 __isl_keep isl_union_pw_multi_aff *upma,
1290 enum isl_dim_type type, const char *name);
1292 #include <isl/polynomial.h>
1293 int isl_pw_qpolynomial_find_dim_by_name(
1294 __isl_keep isl_pw_qpolynomial *pwqp,
1295 enum isl_dim_type type, const char *name);
1296 int isl_pw_qpolynomial_fold_find_dim_by_name(
1297 __isl_keep isl_pw_qpolynomial_fold *pwf,
1298 enum isl_dim_type type, const char *name);
1299 int isl_union_pw_qpolynomial_find_dim_by_name(
1300 __isl_keep isl_union_pw_qpolynomial *upwqp,
1301 enum isl_dim_type type, const char *name);
1302 int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1303 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1304 enum isl_dim_type type, const char *name);
1306 The identifiers or names of entire spaces may be set or read off
1307 using the following functions.
1309 #include <isl/space.h>
1310 __isl_give isl_space *isl_space_set_tuple_id(
1311 __isl_take isl_space *space,
1312 enum isl_dim_type type, __isl_take isl_id *id);
1313 __isl_give isl_space *isl_space_reset_tuple_id(
1314 __isl_take isl_space *space, enum isl_dim_type type);
1315 int isl_space_has_tuple_id(__isl_keep isl_space *space,
1316 enum isl_dim_type type);
1317 __isl_give isl_id *isl_space_get_tuple_id(
1318 __isl_keep isl_space *space, enum isl_dim_type type);
1319 __isl_give isl_space *isl_space_set_tuple_name(
1320 __isl_take isl_space *space,
1321 enum isl_dim_type type, const char *s);
1322 int isl_space_has_tuple_name(__isl_keep isl_space *space,
1323 enum isl_dim_type type);
1324 const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1325 enum isl_dim_type type);
1327 #include <isl/local_space.h>
1328 __isl_give isl_local_space *isl_local_space_set_tuple_id(
1329 __isl_take isl_local_space *ls,
1330 enum isl_dim_type type, __isl_take isl_id *id);
1332 #include <isl/set.h>
1333 __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1334 __isl_take isl_basic_set *bset,
1335 __isl_take isl_id *id);
1336 __isl_give isl_set *isl_set_set_tuple_id(
1337 __isl_take isl_set *set, __isl_take isl_id *id);
1338 __isl_give isl_set *isl_set_reset_tuple_id(
1339 __isl_take isl_set *set);
1340 int isl_set_has_tuple_id(__isl_keep isl_set *set);
1341 __isl_give isl_id *isl_set_get_tuple_id(
1342 __isl_keep isl_set *set);
1343 __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1344 __isl_take isl_basic_set *set, const char *s);
1345 __isl_give isl_set *isl_set_set_tuple_name(
1346 __isl_take isl_set *set, const char *s);
1347 const char *isl_basic_set_get_tuple_name(
1348 __isl_keep isl_basic_set *bset);
1349 int isl_set_has_tuple_name(__isl_keep isl_set *set);
1350 const char *isl_set_get_tuple_name(
1351 __isl_keep isl_set *set);
1353 #include <isl/map.h>
1354 __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1355 __isl_take isl_basic_map *bmap,
1356 enum isl_dim_type type, __isl_take isl_id *id);
1357 __isl_give isl_map *isl_map_set_tuple_id(
1358 __isl_take isl_map *map, enum isl_dim_type type,
1359 __isl_take isl_id *id);
1360 __isl_give isl_map *isl_map_reset_tuple_id(
1361 __isl_take isl_map *map, enum isl_dim_type type);
1362 int isl_map_has_tuple_id(__isl_keep isl_map *map,
1363 enum isl_dim_type type);
1364 __isl_give isl_id *isl_map_get_tuple_id(
1365 __isl_keep isl_map *map, enum isl_dim_type type);
1366 __isl_give isl_map *isl_map_set_tuple_name(
1367 __isl_take isl_map *map,
1368 enum isl_dim_type type, const char *s);
1369 const char *isl_basic_map_get_tuple_name(
1370 __isl_keep isl_basic_map *bmap,
1371 enum isl_dim_type type);
1372 __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1373 __isl_take isl_basic_map *bmap,
1374 enum isl_dim_type type, const char *s);
1375 int isl_map_has_tuple_name(__isl_keep isl_map *map,
1376 enum isl_dim_type type);
1377 const char *isl_map_get_tuple_name(
1378 __isl_keep isl_map *map,
1379 enum isl_dim_type type);
1381 #include <isl/val.h>
1382 __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1383 __isl_take isl_multi_val *mv,
1384 enum isl_dim_type type, __isl_take isl_id *id);
1385 __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1386 __isl_take isl_multi_val *mv,
1387 enum isl_dim_type type);
1388 int isl_multi_val_has_tuple_id(__isl_keep isl_multi_val *mv,
1389 enum isl_dim_type type);
1390 __isl_give isl_id *isl_multi_val_get_tuple_id(
1391 __isl_keep isl_multi_val *mv,
1392 enum isl_dim_type type);
1393 __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1394 __isl_take isl_multi_val *mv,
1395 enum isl_dim_type type, const char *s);
1396 const char *isl_multi_val_get_tuple_name(
1397 __isl_keep isl_multi_val *mv,
1398 enum isl_dim_type type);
1400 #include <isl/aff.h>
1401 __isl_give isl_aff *isl_aff_set_tuple_id(
1402 __isl_take isl_aff *aff,
1403 enum isl_dim_type type, __isl_take isl_id *id);
1404 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1405 __isl_take isl_multi_aff *maff,
1406 enum isl_dim_type type, __isl_take isl_id *id);
1407 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1408 __isl_take isl_pw_aff *pwaff,
1409 enum isl_dim_type type, __isl_take isl_id *id);
1410 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1411 __isl_take isl_pw_multi_aff *pma,
1412 enum isl_dim_type type, __isl_take isl_id *id);
1413 __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1414 __isl_take isl_multi_aff *ma,
1415 enum isl_dim_type type);
1416 __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1417 __isl_take isl_pw_aff *pa,
1418 enum isl_dim_type type);
1419 __isl_give isl_multi_pw_aff *
1420 isl_multi_pw_aff_reset_tuple_id(
1421 __isl_take isl_multi_pw_aff *mpa,
1422 enum isl_dim_type type);
1423 __isl_give isl_pw_multi_aff *
1424 isl_pw_multi_aff_reset_tuple_id(
1425 __isl_take isl_pw_multi_aff *pma,
1426 enum isl_dim_type type);
1427 int isl_multi_aff_has_tuple_id(__isl_keep isl_multi_aff *ma,
1428 enum isl_dim_type type);
1429 __isl_give isl_id *isl_multi_aff_get_tuple_id(
1430 __isl_keep isl_multi_aff *ma,
1431 enum isl_dim_type type);
1432 int isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1433 enum isl_dim_type type);
1434 __isl_give isl_id *isl_pw_aff_get_tuple_id(
1435 __isl_keep isl_pw_aff *pa,
1436 enum isl_dim_type type);
1437 int isl_pw_multi_aff_has_tuple_id(
1438 __isl_keep isl_pw_multi_aff *pma,
1439 enum isl_dim_type type);
1440 __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1441 __isl_keep isl_pw_multi_aff *pma,
1442 enum isl_dim_type type);
1443 int isl_multi_pw_aff_has_tuple_id(
1444 __isl_keep isl_multi_pw_aff *mpa,
1445 enum isl_dim_type type);
1446 __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1447 __isl_keep isl_multi_pw_aff *mpa,
1448 enum isl_dim_type type);
1449 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1450 __isl_take isl_multi_aff *maff,
1451 enum isl_dim_type type, const char *s);
1452 __isl_give isl_multi_pw_aff *
1453 isl_multi_pw_aff_set_tuple_name(
1454 __isl_take isl_multi_pw_aff *mpa,
1455 enum isl_dim_type type, const char *s);
1456 const char *isl_multi_aff_get_tuple_name(
1457 __isl_keep isl_multi_aff *multi,
1458 enum isl_dim_type type);
1459 int isl_pw_multi_aff_has_tuple_name(
1460 __isl_keep isl_pw_multi_aff *pma,
1461 enum isl_dim_type type);
1462 const char *isl_pw_multi_aff_get_tuple_name(
1463 __isl_keep isl_pw_multi_aff *pma,
1464 enum isl_dim_type type);
1466 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1467 or C<isl_dim_set>. As with C<isl_space_get_name>,
1468 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1470 Binary operations require the corresponding spaces of their arguments
1471 to have the same name.
1473 To keep the names of all parameters and tuples, but reset the user pointers
1474 of all the corresponding identifiers, use the following function.
1476 #include <isl/space.h>
1477 __isl_give isl_space *isl_space_reset_user(
1478 __isl_take isl_space *space);
1480 #include <isl/set.h>
1481 __isl_give isl_set *isl_set_reset_user(
1482 __isl_take isl_set *set);
1484 #include <isl/map.h>
1485 __isl_give isl_map *isl_map_reset_user(
1486 __isl_take isl_map *map);
1488 #include <isl/union_set.h>
1489 __isl_give isl_union_set *isl_union_set_reset_user(
1490 __isl_take isl_union_set *uset);
1492 #include <isl/union_map.h>
1493 __isl_give isl_union_map *isl_union_map_reset_user(
1494 __isl_take isl_union_map *umap);
1496 #include <isl/val.h>
1497 __isl_give isl_multi_val *isl_multi_val_reset_user(
1498 __isl_take isl_multi_val *mv);
1500 #include <isl/aff.h>
1501 __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1502 __isl_take isl_multi_aff *ma);
1503 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1504 __isl_take isl_multi_pw_aff *mpa);
1506 Spaces can be nested. In particular, the domain of a set or
1507 the domain or range of a relation can be a nested relation.
1508 This process is also called I<wrapping>.
1509 The functions for detecting, constructing and deconstructing
1510 such nested spaces can be found in the wrapping properties
1511 of L</"Unary Properties">, the wrapping operations
1512 of L</"Unary Operations"> and the Cartesian product operations
1513 of L</"Basic Operations">.
1515 Spaces can be created from other spaces
1516 using the functions described in L</"Unary Operations">
1517 and L</"Binary Operations">.
1521 A local space is essentially a space with
1522 zero or more existentially quantified variables.
1523 The local space of various objects can be obtained
1524 using the following functions.
1526 #include <isl/constraint.h>
1527 __isl_give isl_local_space *isl_constraint_get_local_space(
1528 __isl_keep isl_constraint *constraint);
1530 #include <isl/set.h>
1531 __isl_give isl_local_space *isl_basic_set_get_local_space(
1532 __isl_keep isl_basic_set *bset);
1534 #include <isl/map.h>
1535 __isl_give isl_local_space *isl_basic_map_get_local_space(
1536 __isl_keep isl_basic_map *bmap);
1538 #include <isl/aff.h>
1539 __isl_give isl_local_space *isl_aff_get_domain_local_space(
1540 __isl_keep isl_aff *aff);
1541 __isl_give isl_local_space *isl_aff_get_local_space(
1542 __isl_keep isl_aff *aff);
1544 A new local space can be created from a space using
1546 #include <isl/local_space.h>
1547 __isl_give isl_local_space *isl_local_space_from_space(
1548 __isl_take isl_space *space);
1550 They can be inspected, modified, copied and freed using the following functions.
1552 #include <isl/local_space.h>
1553 int isl_local_space_is_params(
1554 __isl_keep isl_local_space *ls);
1555 int isl_local_space_is_set(__isl_keep isl_local_space *ls);
1556 __isl_give isl_space *isl_local_space_get_space(
1557 __isl_keep isl_local_space *ls);
1558 __isl_give isl_aff *isl_local_space_get_div(
1559 __isl_keep isl_local_space *ls, int pos);
1560 __isl_give isl_local_space *isl_local_space_copy(
1561 __isl_keep isl_local_space *ls);
1562 __isl_null isl_local_space *isl_local_space_free(
1563 __isl_take isl_local_space *ls);
1565 Note that C<isl_local_space_get_div> can only be used on local spaces
1568 Two local spaces can be compared using
1570 int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
1571 __isl_keep isl_local_space *ls2);
1573 Local spaces can be created from other local spaces
1574 using the functions described in L</"Unary Operations">
1575 and L</"Binary Operations">.
1577 =head2 Creating New Sets and Relations
1579 C<isl> has functions for creating some standard sets and relations.
1583 =item * Empty sets and relations
1585 __isl_give isl_basic_set *isl_basic_set_empty(
1586 __isl_take isl_space *space);
1587 __isl_give isl_basic_map *isl_basic_map_empty(
1588 __isl_take isl_space *space);
1589 __isl_give isl_set *isl_set_empty(
1590 __isl_take isl_space *space);
1591 __isl_give isl_map *isl_map_empty(
1592 __isl_take isl_space *space);
1593 __isl_give isl_union_set *isl_union_set_empty(
1594 __isl_take isl_space *space);
1595 __isl_give isl_union_map *isl_union_map_empty(
1596 __isl_take isl_space *space);
1598 For C<isl_union_set>s and C<isl_union_map>s, the space
1599 is only used to specify the parameters.
1601 =item * Universe sets and relations
1603 __isl_give isl_basic_set *isl_basic_set_universe(
1604 __isl_take isl_space *space);
1605 __isl_give isl_basic_map *isl_basic_map_universe(
1606 __isl_take isl_space *space);
1607 __isl_give isl_set *isl_set_universe(
1608 __isl_take isl_space *space);
1609 __isl_give isl_map *isl_map_universe(
1610 __isl_take isl_space *space);
1611 __isl_give isl_union_set *isl_union_set_universe(
1612 __isl_take isl_union_set *uset);
1613 __isl_give isl_union_map *isl_union_map_universe(
1614 __isl_take isl_union_map *umap);
1616 The sets and relations constructed by the functions above
1617 contain all integer values, while those constructed by the
1618 functions below only contain non-negative values.
1620 __isl_give isl_basic_set *isl_basic_set_nat_universe(
1621 __isl_take isl_space *space);
1622 __isl_give isl_basic_map *isl_basic_map_nat_universe(
1623 __isl_take isl_space *space);
1624 __isl_give isl_set *isl_set_nat_universe(
1625 __isl_take isl_space *space);
1626 __isl_give isl_map *isl_map_nat_universe(
1627 __isl_take isl_space *space);
1629 =item * Identity relations
1631 __isl_give isl_basic_map *isl_basic_map_identity(
1632 __isl_take isl_space *space);
1633 __isl_give isl_map *isl_map_identity(
1634 __isl_take isl_space *space);
1636 The number of input and output dimensions in C<space> needs
1639 =item * Lexicographic order
1641 __isl_give isl_map *isl_map_lex_lt(
1642 __isl_take isl_space *set_space);
1643 __isl_give isl_map *isl_map_lex_le(
1644 __isl_take isl_space *set_space);
1645 __isl_give isl_map *isl_map_lex_gt(
1646 __isl_take isl_space *set_space);
1647 __isl_give isl_map *isl_map_lex_ge(
1648 __isl_take isl_space *set_space);
1649 __isl_give isl_map *isl_map_lex_lt_first(
1650 __isl_take isl_space *space, unsigned n);
1651 __isl_give isl_map *isl_map_lex_le_first(
1652 __isl_take isl_space *space, unsigned n);
1653 __isl_give isl_map *isl_map_lex_gt_first(
1654 __isl_take isl_space *space, unsigned n);
1655 __isl_give isl_map *isl_map_lex_ge_first(
1656 __isl_take isl_space *space, unsigned n);
1658 The first four functions take a space for a B<set>
1659 and return relations that express that the elements in the domain
1660 are lexicographically less
1661 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1662 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1663 than the elements in the range.
1664 The last four functions take a space for a map
1665 and return relations that express that the first C<n> dimensions
1666 in the domain are lexicographically less
1667 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1668 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1669 than the first C<n> dimensions in the range.
1673 A basic set or relation can be converted to a set or relation
1674 using the following functions.
1676 __isl_give isl_set *isl_set_from_basic_set(
1677 __isl_take isl_basic_set *bset);
1678 __isl_give isl_map *isl_map_from_basic_map(
1679 __isl_take isl_basic_map *bmap);
1681 Sets and relations can be converted to union sets and relations
1682 using the following functions.
1684 __isl_give isl_union_set *isl_union_set_from_basic_set(
1685 __isl_take isl_basic_set *bset);
1686 __isl_give isl_union_map *isl_union_map_from_basic_map(
1687 __isl_take isl_basic_map *bmap);
1688 __isl_give isl_union_set *isl_union_set_from_set(
1689 __isl_take isl_set *set);
1690 __isl_give isl_union_map *isl_union_map_from_map(
1691 __isl_take isl_map *map);
1693 The inverse conversions below can only be used if the input
1694 union set or relation is known to contain elements in exactly one
1697 __isl_give isl_set *isl_set_from_union_set(
1698 __isl_take isl_union_set *uset);
1699 __isl_give isl_map *isl_map_from_union_map(
1700 __isl_take isl_union_map *umap);
1702 Sets and relations can be copied and freed again using the following
1705 __isl_give isl_basic_set *isl_basic_set_copy(
1706 __isl_keep isl_basic_set *bset);
1707 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1708 __isl_give isl_union_set *isl_union_set_copy(
1709 __isl_keep isl_union_set *uset);
1710 __isl_give isl_basic_map *isl_basic_map_copy(
1711 __isl_keep isl_basic_map *bmap);
1712 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1713 __isl_give isl_union_map *isl_union_map_copy(
1714 __isl_keep isl_union_map *umap);
1715 __isl_null isl_basic_set *isl_basic_set_free(
1716 __isl_take isl_basic_set *bset);
1717 __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1718 __isl_null isl_union_set *isl_union_set_free(
1719 __isl_take isl_union_set *uset);
1720 __isl_null isl_basic_map *isl_basic_map_free(
1721 __isl_take isl_basic_map *bmap);
1722 __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1723 __isl_null isl_union_map *isl_union_map_free(
1724 __isl_take isl_union_map *umap);
1726 Other sets and relations can be constructed by starting
1727 from a universe set or relation, adding equality and/or
1728 inequality constraints and then projecting out the
1729 existentially quantified variables, if any.
1730 Constraints can be constructed, manipulated and
1731 added to (or removed from) (basic) sets and relations
1732 using the following functions.
1734 #include <isl/constraint.h>
1735 __isl_give isl_constraint *isl_equality_alloc(
1736 __isl_take isl_local_space *ls);
1737 __isl_give isl_constraint *isl_inequality_alloc(
1738 __isl_take isl_local_space *ls);
1739 __isl_give isl_constraint *isl_constraint_set_constant_si(
1740 __isl_take isl_constraint *constraint, int v);
1741 __isl_give isl_constraint *isl_constraint_set_constant_val(
1742 __isl_take isl_constraint *constraint,
1743 __isl_take isl_val *v);
1744 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1745 __isl_take isl_constraint *constraint,
1746 enum isl_dim_type type, int pos, int v);
1747 __isl_give isl_constraint *
1748 isl_constraint_set_coefficient_val(
1749 __isl_take isl_constraint *constraint,
1750 enum isl_dim_type type, int pos,
1751 __isl_take isl_val *v);
1752 __isl_give isl_basic_map *isl_basic_map_add_constraint(
1753 __isl_take isl_basic_map *bmap,
1754 __isl_take isl_constraint *constraint);
1755 __isl_give isl_basic_set *isl_basic_set_add_constraint(
1756 __isl_take isl_basic_set *bset,
1757 __isl_take isl_constraint *constraint);
1758 __isl_give isl_map *isl_map_add_constraint(
1759 __isl_take isl_map *map,
1760 __isl_take isl_constraint *constraint);
1761 __isl_give isl_set *isl_set_add_constraint(
1762 __isl_take isl_set *set,
1763 __isl_take isl_constraint *constraint);
1764 __isl_give isl_basic_set *isl_basic_set_drop_constraint(
1765 __isl_take isl_basic_set *bset,
1766 __isl_take isl_constraint *constraint);
1768 For example, to create a set containing the even integers
1769 between 10 and 42, you would use the following code.
1772 isl_local_space *ls;
1774 isl_basic_set *bset;
1776 space = isl_space_set_alloc(ctx, 0, 2);
1777 bset = isl_basic_set_universe(isl_space_copy(space));
1778 ls = isl_local_space_from_space(space);
1780 c = isl_equality_alloc(isl_local_space_copy(ls));
1781 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1782 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1783 bset = isl_basic_set_add_constraint(bset, c);
1785 c = isl_inequality_alloc(isl_local_space_copy(ls));
1786 c = isl_constraint_set_constant_si(c, -10);
1787 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1788 bset = isl_basic_set_add_constraint(bset, c);
1790 c = isl_inequality_alloc(ls);
1791 c = isl_constraint_set_constant_si(c, 42);
1792 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1793 bset = isl_basic_set_add_constraint(bset, c);
1795 bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1799 isl_basic_set *bset;
1800 bset = isl_basic_set_read_from_str(ctx,
1801 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1803 A basic set or relation can also be constructed from two matrices
1804 describing the equalities and the inequalities.
1806 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1807 __isl_take isl_space *space,
1808 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1809 enum isl_dim_type c1,
1810 enum isl_dim_type c2, enum isl_dim_type c3,
1811 enum isl_dim_type c4);
1812 __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1813 __isl_take isl_space *space,
1814 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1815 enum isl_dim_type c1,
1816 enum isl_dim_type c2, enum isl_dim_type c3,
1817 enum isl_dim_type c4, enum isl_dim_type c5);
1819 The C<isl_dim_type> arguments indicate the order in which
1820 different kinds of variables appear in the input matrices
1821 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1822 C<isl_dim_set> and C<isl_dim_div> for sets and
1823 of C<isl_dim_cst>, C<isl_dim_param>,
1824 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1826 A (basic or union) set or relation can also be constructed from a
1827 (union) (piecewise) (multiple) affine expression
1828 or a list of affine expressions
1829 (See L</"Functions">).
1831 __isl_give isl_basic_map *isl_basic_map_from_aff(
1832 __isl_take isl_aff *aff);
1833 __isl_give isl_map *isl_map_from_aff(
1834 __isl_take isl_aff *aff);
1835 __isl_give isl_set *isl_set_from_pw_aff(
1836 __isl_take isl_pw_aff *pwaff);
1837 __isl_give isl_map *isl_map_from_pw_aff(
1838 __isl_take isl_pw_aff *pwaff);
1839 __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1840 __isl_take isl_space *domain_space,
1841 __isl_take isl_aff_list *list);
1842 __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
1843 __isl_take isl_multi_aff *maff)
1844 __isl_give isl_map *isl_map_from_multi_aff(
1845 __isl_take isl_multi_aff *maff)
1846 __isl_give isl_set *isl_set_from_pw_multi_aff(
1847 __isl_take isl_pw_multi_aff *pma);
1848 __isl_give isl_map *isl_map_from_pw_multi_aff(
1849 __isl_take isl_pw_multi_aff *pma);
1850 __isl_give isl_set *isl_set_from_multi_pw_aff(
1851 __isl_take isl_multi_pw_aff *mpa);
1852 __isl_give isl_map *isl_map_from_multi_pw_aff(
1853 __isl_take isl_multi_pw_aff *mpa);
1854 __isl_give isl_union_map *
1855 isl_union_map_from_union_pw_multi_aff(
1856 __isl_take isl_union_pw_multi_aff *upma);
1858 The C<domain_space> argument describes the domain of the resulting
1859 basic relation. It is required because the C<list> may consist
1860 of zero affine expressions.
1862 =head2 Inspecting Sets and Relations
1864 Usually, the user should not have to care about the actual constraints
1865 of the sets and maps, but should instead apply the abstract operations
1866 explained in the following sections.
1867 Occasionally, however, it may be required to inspect the individual
1868 coefficients of the constraints. This section explains how to do so.
1869 In these cases, it may also be useful to have C<isl> compute
1870 an explicit representation of the existentially quantified variables.
1872 __isl_give isl_set *isl_set_compute_divs(
1873 __isl_take isl_set *set);
1874 __isl_give isl_map *isl_map_compute_divs(
1875 __isl_take isl_map *map);
1876 __isl_give isl_union_set *isl_union_set_compute_divs(
1877 __isl_take isl_union_set *uset);
1878 __isl_give isl_union_map *isl_union_map_compute_divs(
1879 __isl_take isl_union_map *umap);
1881 This explicit representation defines the existentially quantified
1882 variables as integer divisions of the other variables, possibly
1883 including earlier existentially quantified variables.
1884 An explicitly represented existentially quantified variable therefore
1885 has a unique value when the values of the other variables are known.
1886 If, furthermore, the same existentials, i.e., existentials
1887 with the same explicit representations, should appear in the
1888 same order in each of the disjuncts of a set or map, then the user should call
1889 either of the following functions.
1891 __isl_give isl_set *isl_set_align_divs(
1892 __isl_take isl_set *set);
1893 __isl_give isl_map *isl_map_align_divs(
1894 __isl_take isl_map *map);
1896 Alternatively, the existentially quantified variables can be removed
1897 using the following functions, which compute an overapproximation.
1899 __isl_give isl_basic_set *isl_basic_set_remove_divs(
1900 __isl_take isl_basic_set *bset);
1901 __isl_give isl_basic_map *isl_basic_map_remove_divs(
1902 __isl_take isl_basic_map *bmap);
1903 __isl_give isl_set *isl_set_remove_divs(
1904 __isl_take isl_set *set);
1905 __isl_give isl_map *isl_map_remove_divs(
1906 __isl_take isl_map *map);
1908 It is also possible to only remove those divs that are defined
1909 in terms of a given range of dimensions or only those for which
1910 no explicit representation is known.
1912 __isl_give isl_basic_set *
1913 isl_basic_set_remove_divs_involving_dims(
1914 __isl_take isl_basic_set *bset,
1915 enum isl_dim_type type,
1916 unsigned first, unsigned n);
1917 __isl_give isl_basic_map *
1918 isl_basic_map_remove_divs_involving_dims(
1919 __isl_take isl_basic_map *bmap,
1920 enum isl_dim_type type,
1921 unsigned first, unsigned n);
1922 __isl_give isl_set *isl_set_remove_divs_involving_dims(
1923 __isl_take isl_set *set, enum isl_dim_type type,
1924 unsigned first, unsigned n);
1925 __isl_give isl_map *isl_map_remove_divs_involving_dims(
1926 __isl_take isl_map *map, enum isl_dim_type type,
1927 unsigned first, unsigned n);
1929 __isl_give isl_basic_set *
1930 isl_basic_set_remove_unknown_divs(
1931 __isl_take isl_basic_set *bset);
1932 __isl_give isl_set *isl_set_remove_unknown_divs(
1933 __isl_take isl_set *set);
1934 __isl_give isl_map *isl_map_remove_unknown_divs(
1935 __isl_take isl_map *map);
1937 To iterate over all the sets or maps in a union set or map, use
1939 int isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
1940 int (*fn)(__isl_take isl_set *set, void *user),
1942 int isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
1943 int (*fn)(__isl_take isl_map *map, void *user),
1946 The number of sets or maps in a union set or map can be obtained
1949 int isl_union_set_n_set(__isl_keep isl_union_set *uset);
1950 int isl_union_map_n_map(__isl_keep isl_union_map *umap);
1952 To extract the set or map in a given space from a union, use
1954 __isl_give isl_set *isl_union_set_extract_set(
1955 __isl_keep isl_union_set *uset,
1956 __isl_take isl_space *space);
1957 __isl_give isl_map *isl_union_map_extract_map(
1958 __isl_keep isl_union_map *umap,
1959 __isl_take isl_space *space);
1961 To iterate over all the basic sets or maps in a set or map, use
1963 int isl_set_foreach_basic_set(__isl_keep isl_set *set,
1964 int (*fn)(__isl_take isl_basic_set *bset, void *user),
1966 int isl_map_foreach_basic_map(__isl_keep isl_map *map,
1967 int (*fn)(__isl_take isl_basic_map *bmap, void *user),
1970 The callback function C<fn> should return 0 if successful and
1971 -1 if an error occurs. In the latter case, or if any other error
1972 occurs, the above functions will return -1.
1974 It should be noted that C<isl> does not guarantee that
1975 the basic sets or maps passed to C<fn> are disjoint.
1976 If this is required, then the user should call one of
1977 the following functions first.
1979 __isl_give isl_set *isl_set_make_disjoint(
1980 __isl_take isl_set *set);
1981 __isl_give isl_map *isl_map_make_disjoint(
1982 __isl_take isl_map *map);
1984 The number of basic sets in a set can be obtained
1985 or the number of basic maps in a map can be obtained
1988 #include <isl/set.h>
1989 int isl_set_n_basic_set(__isl_keep isl_set *set);
1991 #include <isl/map.h>
1992 int isl_map_n_basic_map(__isl_keep isl_map *map);
1994 To iterate over the constraints of a basic set or map, use
1996 #include <isl/constraint.h>
1998 int isl_basic_set_n_constraint(
1999 __isl_keep isl_basic_set *bset);
2000 int isl_basic_set_foreach_constraint(
2001 __isl_keep isl_basic_set *bset,
2002 int (*fn)(__isl_take isl_constraint *c, void *user),
2004 int isl_basic_map_n_constraint(
2005 __isl_keep isl_basic_map *bmap);
2006 int isl_basic_map_foreach_constraint(
2007 __isl_keep isl_basic_map *bmap,
2008 int (*fn)(__isl_take isl_constraint *c, void *user),
2010 __isl_null isl_constraint *isl_constraint_free(
2011 __isl_take isl_constraint *c);
2013 Again, the callback function C<fn> should return 0 if successful and
2014 -1 if an error occurs. In the latter case, or if any other error
2015 occurs, the above functions will return -1.
2016 The constraint C<c> represents either an equality or an inequality.
2017 Use the following function to find out whether a constraint
2018 represents an equality. If not, it represents an inequality.
2020 int isl_constraint_is_equality(
2021 __isl_keep isl_constraint *constraint);
2023 It is also possible to obtain a list of constraints from a basic
2026 #include <isl/constraint.h>
2027 __isl_give isl_constraint_list *
2028 isl_basic_map_get_constraint_list(
2029 __isl_keep isl_basic_map *bmap);
2030 __isl_give isl_constraint_list *
2031 isl_basic_set_get_constraint_list(
2032 __isl_keep isl_basic_set *bset);
2034 These functions require that all existentially quantified variables
2035 have an explicit representation.
2036 The returned list can be manipulated using the functions in L<"Lists">.
2038 The coefficients of the constraints can be inspected using
2039 the following functions.
2041 int isl_constraint_is_lower_bound(
2042 __isl_keep isl_constraint *constraint,
2043 enum isl_dim_type type, unsigned pos);
2044 int isl_constraint_is_upper_bound(
2045 __isl_keep isl_constraint *constraint,
2046 enum isl_dim_type type, unsigned pos);
2047 __isl_give isl_val *isl_constraint_get_constant_val(
2048 __isl_keep isl_constraint *constraint);
2049 __isl_give isl_val *isl_constraint_get_coefficient_val(
2050 __isl_keep isl_constraint *constraint,
2051 enum isl_dim_type type, int pos);
2053 The explicit representations of the existentially quantified
2054 variables can be inspected using the following function.
2055 Note that the user is only allowed to use this function
2056 if the inspected set or map is the result of a call
2057 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2058 The existentially quantified variable is equal to the floor
2059 of the returned affine expression. The affine expression
2060 itself can be inspected using the functions in
2063 __isl_give isl_aff *isl_constraint_get_div(
2064 __isl_keep isl_constraint *constraint, int pos);
2066 To obtain the constraints of a basic set or map in matrix
2067 form, use the following functions.
2069 __isl_give isl_mat *isl_basic_set_equalities_matrix(
2070 __isl_keep isl_basic_set *bset,
2071 enum isl_dim_type c1, enum isl_dim_type c2,
2072 enum isl_dim_type c3, enum isl_dim_type c4);
2073 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2074 __isl_keep isl_basic_set *bset,
2075 enum isl_dim_type c1, enum isl_dim_type c2,
2076 enum isl_dim_type c3, enum isl_dim_type c4);
2077 __isl_give isl_mat *isl_basic_map_equalities_matrix(
2078 __isl_keep isl_basic_map *bmap,
2079 enum isl_dim_type c1,
2080 enum isl_dim_type c2, enum isl_dim_type c3,
2081 enum isl_dim_type c4, enum isl_dim_type c5);
2082 __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2083 __isl_keep isl_basic_map *bmap,
2084 enum isl_dim_type c1,
2085 enum isl_dim_type c2, enum isl_dim_type c3,
2086 enum isl_dim_type c4, enum isl_dim_type c5);
2088 The C<isl_dim_type> arguments dictate the order in which
2089 different kinds of variables appear in the resulting matrix.
2090 For set inputs, they should be a permutation of
2091 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2092 For map inputs, they should be a permutation of
2093 C<isl_dim_cst>, C<isl_dim_param>,
2094 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2098 Points are elements of a set. They can be used to construct
2099 simple sets (boxes) or they can be used to represent the
2100 individual elements of a set.
2101 The zero point (the origin) can be created using
2103 __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2105 The coordinates of a point can be inspected, set and changed
2108 __isl_give isl_val *isl_point_get_coordinate_val(
2109 __isl_keep isl_point *pnt,
2110 enum isl_dim_type type, int pos);
2111 __isl_give isl_point *isl_point_set_coordinate_val(
2112 __isl_take isl_point *pnt,
2113 enum isl_dim_type type, int pos,
2114 __isl_take isl_val *v);
2116 __isl_give isl_point *isl_point_add_ui(
2117 __isl_take isl_point *pnt,
2118 enum isl_dim_type type, int pos, unsigned val);
2119 __isl_give isl_point *isl_point_sub_ui(
2120 __isl_take isl_point *pnt,
2121 enum isl_dim_type type, int pos, unsigned val);
2123 Points can be copied or freed using
2125 __isl_give isl_point *isl_point_copy(
2126 __isl_keep isl_point *pnt);
2127 void isl_point_free(__isl_take isl_point *pnt);
2129 A singleton set can be created from a point using
2131 __isl_give isl_basic_set *isl_basic_set_from_point(
2132 __isl_take isl_point *pnt);
2133 __isl_give isl_set *isl_set_from_point(
2134 __isl_take isl_point *pnt);
2136 and a box can be created from two opposite extremal points using
2138 __isl_give isl_basic_set *isl_basic_set_box_from_points(
2139 __isl_take isl_point *pnt1,
2140 __isl_take isl_point *pnt2);
2141 __isl_give isl_set *isl_set_box_from_points(
2142 __isl_take isl_point *pnt1,
2143 __isl_take isl_point *pnt2);
2145 All elements of a B<bounded> (union) set can be enumerated using
2146 the following functions.
2148 int isl_set_foreach_point(__isl_keep isl_set *set,
2149 int (*fn)(__isl_take isl_point *pnt, void *user),
2151 int isl_union_set_foreach_point(__isl_keep isl_union_set *uset,
2152 int (*fn)(__isl_take isl_point *pnt, void *user),
2155 The function C<fn> is called for each integer point in
2156 C<set> with as second argument the last argument of
2157 the C<isl_set_foreach_point> call. The function C<fn>
2158 should return C<0> on success and C<-1> on failure.
2159 In the latter case, C<isl_set_foreach_point> will stop
2160 enumerating and return C<-1> as well.
2161 If the enumeration is performed successfully and to completion,
2162 then C<isl_set_foreach_point> returns C<0>.
2164 To obtain a single point of a (basic) set, use
2166 __isl_give isl_point *isl_basic_set_sample_point(
2167 __isl_take isl_basic_set *bset);
2168 __isl_give isl_point *isl_set_sample_point(
2169 __isl_take isl_set *set);
2171 If C<set> does not contain any (integer) points, then the
2172 resulting point will be ``void'', a property that can be
2175 int isl_point_is_void(__isl_keep isl_point *pnt);
2179 Besides sets and relation, C<isl> also supports various types of functions.
2180 Each of these types is derived from the value type (see L</"Values">)
2181 or from one of two primitive function types
2182 through the application of zero or more type constructors.
2183 We first describe the primitive type and then we describe
2184 the types derived from these primitive types.
2186 =head3 Primitive Functions
2188 C<isl> support two primitive function types, quasi-affine
2189 expressions and quasipolynomials.
2190 A quasi-affine expression is defined either over a parameter
2191 space or over a set and is composed of integer constants,
2192 parameters and set variables, addition, subtraction and
2193 integer division by an integer constant.
2194 For example, the quasi-affine expression
2196 [n] -> { [x] -> [2*floor((4 n + x)/9] }
2198 maps C<x> to C<2*floor((4 n + x)/9>.
2199 A quasipolynomial is a polynomial expression in quasi-affine
2200 expression. That is, it additionally allows for multiplication.
2201 Note, though, that it is not allowed to construct an integer
2202 division of an expression involving multiplications.
2203 Here is an example of a quasipolynomial that is not
2204 quasi-affine expression
2206 [n] -> { [x] -> (n*floor((4 n + x)/9) }
2208 Note that the external representations of quasi-affine expressions
2209 and quasipolynomials are different. Quasi-affine expressions
2210 use a notation with square brackets just like binary relations,
2211 while quasipolynomials do not. This might change at some point.
2213 If a primitive function is defined over a parameter space,
2214 then the space of the function itself is that of a set.
2215 If it is defined over a set, then the space of the function
2216 is that of a relation. In both cases, the set space (or
2217 the output space) is single-dimensional, anonymous and unstructured.
2218 To create functions with multiple dimensions or with other kinds
2219 of set or output spaces, use multiple expressions
2220 (see L</"Multiple Expressions">).
2224 =item * Quasi-affine Expressions
2226 Besides the expressions described above, a quasi-affine
2227 expression can also be set to NaN. Such expressions
2228 typically represent a failure to represent a result
2229 as a quasi-affine expression.
2231 The zero quasi affine expression or the quasi affine expression
2232 that is equal to a given value or
2233 a specified dimension on a given domain can be created using
2235 #include <isl/aff.h>
2236 __isl_give isl_aff *isl_aff_zero_on_domain(
2237 __isl_take isl_local_space *ls);
2238 __isl_give isl_aff *isl_aff_val_on_domain(
2239 __isl_take isl_local_space *ls,
2240 __isl_take isl_val *val);
2241 __isl_give isl_aff *isl_aff_var_on_domain(
2242 __isl_take isl_local_space *ls,
2243 enum isl_dim_type type, unsigned pos);
2244 __isl_give isl_aff *isl_aff_nan_on_domain(
2245 __isl_take isl_local_space *ls);
2247 Quasi affine expressions can be copied and freed using
2249 #include <isl/aff.h>
2250 __isl_give isl_aff *isl_aff_copy(
2251 __isl_keep isl_aff *aff);
2252 __isl_null isl_aff *isl_aff_free(
2253 __isl_take isl_aff *aff);
2255 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2256 using the following function. The constraint is required to have
2257 a non-zero coefficient for the specified dimension.
2259 #include <isl/constraint.h>
2260 __isl_give isl_aff *isl_constraint_get_bound(
2261 __isl_keep isl_constraint *constraint,
2262 enum isl_dim_type type, int pos);
2264 The entire affine expression of the constraint can also be extracted
2265 using the following function.
2267 #include <isl/constraint.h>
2268 __isl_give isl_aff *isl_constraint_get_aff(
2269 __isl_keep isl_constraint *constraint);
2271 Conversely, an equality constraint equating
2272 the affine expression to zero or an inequality constraint enforcing
2273 the affine expression to be non-negative, can be constructed using
2275 __isl_give isl_constraint *isl_equality_from_aff(
2276 __isl_take isl_aff *aff);
2277 __isl_give isl_constraint *isl_inequality_from_aff(
2278 __isl_take isl_aff *aff);
2280 The coefficients and the integer divisions of an affine expression
2281 can be inspected using the following functions.
2283 #include <isl/aff.h>
2284 __isl_give isl_val *isl_aff_get_constant_val(
2285 __isl_keep isl_aff *aff);
2286 __isl_give isl_val *isl_aff_get_coefficient_val(
2287 __isl_keep isl_aff *aff,
2288 enum isl_dim_type type, int pos);
2289 int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2290 enum isl_dim_type type, int pos);
2291 __isl_give isl_val *isl_aff_get_denominator_val(
2292 __isl_keep isl_aff *aff);
2293 __isl_give isl_aff *isl_aff_get_div(
2294 __isl_keep isl_aff *aff, int pos);
2296 They can be modified using the following functions.
2298 #include <isl/aff.h>
2299 __isl_give isl_aff *isl_aff_set_constant_si(
2300 __isl_take isl_aff *aff, int v);
2301 __isl_give isl_aff *isl_aff_set_constant_val(
2302 __isl_take isl_aff *aff, __isl_take isl_val *v);
2303 __isl_give isl_aff *isl_aff_set_coefficient_si(
2304 __isl_take isl_aff *aff,
2305 enum isl_dim_type type, int pos, int v);
2306 __isl_give isl_aff *isl_aff_set_coefficient_val(
2307 __isl_take isl_aff *aff,
2308 enum isl_dim_type type, int pos,
2309 __isl_take isl_val *v);
2311 __isl_give isl_aff *isl_aff_add_constant_si(
2312 __isl_take isl_aff *aff, int v);
2313 __isl_give isl_aff *isl_aff_add_constant_val(
2314 __isl_take isl_aff *aff, __isl_take isl_val *v);
2315 __isl_give isl_aff *isl_aff_add_constant_num_si(
2316 __isl_take isl_aff *aff, int v);
2317 __isl_give isl_aff *isl_aff_add_coefficient_si(
2318 __isl_take isl_aff *aff,
2319 enum isl_dim_type type, int pos, int v);
2320 __isl_give isl_aff *isl_aff_add_coefficient_val(
2321 __isl_take isl_aff *aff,
2322 enum isl_dim_type type, int pos,
2323 __isl_take isl_val *v);
2325 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2326 set the I<numerator> of the constant or coefficient, while
2327 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2328 the constant or coefficient as a whole.
2329 The C<add_constant> and C<add_coefficient> functions add an integer
2330 or rational value to
2331 the possibly rational constant or coefficient.
2332 The C<add_constant_num> functions add an integer value to
2335 =item * Quasipolynomials
2337 Some simple quasipolynomials can be created using the following functions.
2339 #include <isl/polynomial.h>
2340 __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2341 __isl_take isl_space *domain);
2342 __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2343 __isl_take isl_space *domain);
2344 __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2345 __isl_take isl_space *domain);
2346 __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2347 __isl_take isl_space *domain);
2348 __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2349 __isl_take isl_space *domain);
2350 __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2351 __isl_take isl_space *domain,
2352 __isl_take isl_val *val);
2353 __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2354 __isl_take isl_space *domain,
2355 enum isl_dim_type type, unsigned pos);
2356 __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2357 __isl_take isl_aff *aff);
2359 Recall that the space in which a quasipolynomial lives is a map space
2360 with a one-dimensional range. The C<domain> argument in some of
2361 the functions above corresponds to the domain of this map space.
2363 Quasipolynomials can be copied and freed again using the following
2366 #include <isl/polynomial.h>
2367 __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2368 __isl_keep isl_qpolynomial *qp);
2369 __isl_null isl_qpolynomial *isl_qpolynomial_free(
2370 __isl_take isl_qpolynomial *qp);
2372 The constant term of a quasipolynomial can be extracted using
2374 __isl_give isl_val *isl_qpolynomial_get_constant_val(
2375 __isl_keep isl_qpolynomial *qp);
2377 To iterate over all terms in a quasipolynomial,
2380 int isl_qpolynomial_foreach_term(
2381 __isl_keep isl_qpolynomial *qp,
2382 int (*fn)(__isl_take isl_term *term,
2383 void *user), void *user);
2385 The terms themselves can be inspected and freed using
2388 unsigned isl_term_dim(__isl_keep isl_term *term,
2389 enum isl_dim_type type);
2390 __isl_give isl_val *isl_term_get_coefficient_val(
2391 __isl_keep isl_term *term);
2392 int isl_term_get_exp(__isl_keep isl_term *term,
2393 enum isl_dim_type type, unsigned pos);
2394 __isl_give isl_aff *isl_term_get_div(
2395 __isl_keep isl_term *term, unsigned pos);
2396 void isl_term_free(__isl_take isl_term *term);
2398 Each term is a product of parameters, set variables and
2399 integer divisions. The function C<isl_term_get_exp>
2400 returns the exponent of a given dimensions in the given term.
2406 A reduction represents a maximum or a minimum of its
2408 The only reduction type defined by C<isl> is
2409 C<isl_qpolynomial_fold>.
2411 There are currently no functions to directly create such
2412 objects, but they do appear in the piecewise quasipolynomial
2413 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2415 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2417 Reductions can be copied and freed using
2418 the following functions.
2420 #include <isl/polynomial.h>
2421 __isl_give isl_qpolynomial_fold *
2422 isl_qpolynomial_fold_copy(
2423 __isl_keep isl_qpolynomial_fold *fold);
2424 void isl_qpolynomial_fold_free(
2425 __isl_take isl_qpolynomial_fold *fold);
2427 To iterate over all quasipolynomials in a reduction, use
2429 int isl_qpolynomial_fold_foreach_qpolynomial(
2430 __isl_keep isl_qpolynomial_fold *fold,
2431 int (*fn)(__isl_take isl_qpolynomial *qp,
2432 void *user), void *user);
2434 =head3 Multiple Expressions
2436 A multiple expression represents a sequence of zero or
2437 more base expressions, all defined on the same domain space.
2438 The domain space of the multiple expression is the same
2439 as that of the base expressions, but the range space
2440 can be any space. In case the base expressions have
2441 a set space, the corresponding multiple expression
2442 also has a set space.
2443 Objects of the value type do not have an associated space.
2444 The space of a multiple value is therefore always a set space.
2446 The multiple expression types defined by C<isl>
2447 are C<isl_multi_val>, C<isl_multi_aff> and C<isl_multi_pw_aff>.
2449 A multiple expression with the value zero for
2450 each output (or set) dimension can be created
2451 using the following functions.
2453 #include <isl/val.h>
2454 __isl_give isl_multi_val *isl_multi_val_zero(
2455 __isl_take isl_space *space);
2457 #include <isl/aff.h>
2458 __isl_give isl_multi_aff *isl_multi_aff_zero(
2459 __isl_take isl_space *space);
2460 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2461 __isl_take isl_space *space);
2463 An identity function can be created using the following
2464 functions. The space needs to be that of a relation
2465 with the same number of input and output dimensions.
2467 #include <isl/aff.h>
2468 __isl_give isl_multi_aff *isl_multi_aff_identity(
2469 __isl_take isl_space *space);
2470 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2471 __isl_take isl_space *space);
2473 A function that performs a projection on a universe
2474 relation or set can be created using the following functions.
2475 See also the corresponding
2476 projection operations in L</"Unary Operations">.
2478 #include <isl/aff.h>
2479 __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2480 __isl_take isl_space *space);
2481 __isl_give isl_multi_aff *isl_multi_aff_range_map(
2482 __isl_take isl_space *space);
2483 __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2484 __isl_take isl_space *space,
2485 enum isl_dim_type type,
2486 unsigned first, unsigned n);
2488 A multiple expression can be created from a single
2489 base expression using the following functions.
2490 The space of the created multiple expression is the same
2491 as that of the base expression.
2493 #include <isl/aff.h>
2494 __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2495 __isl_take isl_aff *aff);
2496 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2497 __isl_take isl_pw_aff *pa);
2499 A multiple expression can be created from a list
2500 of base expression in a specified space.
2501 The domain of this space needs to be the same
2502 as the domains of the base expressions in the list.
2503 If the base expressions have a set space (or no associated space),
2504 then this space also needs to be a set space.
2506 #include <isl/val.h>
2507 __isl_give isl_multi_val *isl_multi_val_from_val_list(
2508 __isl_take isl_space *space,
2509 __isl_take isl_val_list *list);
2511 #include <isl/aff.h>
2512 __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2513 __isl_take isl_space *space,
2514 __isl_take isl_aff_list *list);
2516 As a convenience, a multiple piecewise expression can
2517 also be created from a multiple expression.
2518 Each piecewise expression in the result has a single
2521 #include <isl/aff.h>
2522 __isl_give isl_multi_pw_aff *
2523 isl_multi_pw_aff_from_multi_aff(
2524 __isl_take isl_multi_aff *ma);
2526 A multiple quasi-affine expression can be created from
2527 a multiple value with a given domain space using the following
2530 #include <isl/aff.h>
2531 __isl_give isl_multi_aff *
2532 isl_multi_aff_multi_val_on_space(
2533 __isl_take isl_space *space,
2534 __isl_take isl_multi_val *mv);
2536 Multiple expressions can be copied and freed using
2537 the following functions.
2539 #include <isl/val.h>
2540 __isl_give isl_multi_val *isl_multi_val_copy(
2541 __isl_keep isl_multi_val *mv);
2542 __isl_null isl_multi_val *isl_multi_val_free(
2543 __isl_take isl_multi_val *mv);
2545 #include <isl/aff.h>
2546 __isl_give isl_multi_aff *isl_multi_aff_copy(
2547 __isl_keep isl_multi_aff *maff);
2548 __isl_null isl_multi_aff *isl_multi_aff_free(
2549 __isl_take isl_multi_aff *maff);
2550 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2551 __isl_keep isl_multi_pw_aff *mpa);
2552 __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2553 __isl_take isl_multi_pw_aff *mpa);
2555 The base expression at a given position of a multiple
2556 expression can be extracted using the following functions.
2558 #include <isl/val.h>
2559 __isl_give isl_val *isl_multi_val_get_val(
2560 __isl_keep isl_multi_val *mv, int pos);
2562 #include <isl/aff.h>
2563 __isl_give isl_aff *isl_multi_aff_get_aff(
2564 __isl_keep isl_multi_aff *multi, int pos);
2565 __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2566 __isl_keep isl_multi_pw_aff *mpa, int pos);
2568 It can be replaced using the following functions.
2570 #include <isl/val.h>
2571 __isl_give isl_multi_val *isl_multi_val_set_val(
2572 __isl_take isl_multi_val *mv, int pos,
2573 __isl_take isl_val *val);
2575 #include <isl/aff.h>
2576 __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2577 __isl_take isl_multi_aff *multi, int pos,
2578 __isl_take isl_aff *aff);
2580 =head3 Piecewise Expressions
2582 A piecewise expression is an expression that is described
2583 using zero or more base expression defined over the same
2584 number of cells in the domain space of the base expressions.
2585 All base expressions are defined over the same
2586 domain space and the cells are disjoint.
2587 The space of a piecewise expression is the same as
2588 that of the base expressions.
2589 If the union of the cells is a strict subset of the domain
2590 space, then the value of the piecewise expression outside
2591 this union is different for types derived from quasi-affine
2592 expressions and those derived from quasipolynomials.
2593 Piecewise expressions derived from quasi-affine expressions
2594 are considered to be undefined outside the union of their cells.
2595 Piecewise expressions derived from quasipolynomials
2596 are considered to be zero outside the union of their cells.
2598 Piecewise quasipolynomials are mainly used by the C<barvinok>
2599 library for representing the number of elements in a parametric set or map.
2600 For example, the piecewise quasipolynomial
2602 [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2604 represents the number of points in the map
2606 [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2608 The piecewise expression types defined by C<isl>
2609 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2610 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2612 A piecewise expression with no cells can be created using
2613 the following functions.
2615 #include <isl/aff.h>
2616 __isl_give isl_pw_aff *isl_pw_aff_empty(
2617 __isl_take isl_space *space);
2618 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2619 __isl_take isl_space *space);
2621 A piecewise expression with a single universe cell can be
2622 created using the following functions.
2624 #include <isl/aff.h>
2625 __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2626 __isl_take isl_aff *aff);
2627 __isl_give isl_pw_multi_aff *
2628 isl_pw_multi_aff_from_multi_aff(
2629 __isl_take isl_multi_aff *ma);
2631 #include <isl/polynomial.h>
2632 __isl_give isl_pw_qpolynomial *
2633 isl_pw_qpolynomial_from_qpolynomial(
2634 __isl_take isl_qpolynomial *qp);
2636 A piecewise expression with a single specified cell can be
2637 created using the following functions.
2639 #include <isl/aff.h>
2640 __isl_give isl_pw_aff *isl_pw_aff_alloc(
2641 __isl_take isl_set *set, __isl_take isl_aff *aff);
2642 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2643 __isl_take isl_set *set,
2644 __isl_take isl_multi_aff *maff);
2646 #include <isl/polynomial.h>
2647 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2648 __isl_take isl_set *set,
2649 __isl_take isl_qpolynomial *qp);
2651 The following convenience functions first create a base expression and
2652 then create a piecewise expression over a universe domain.
2654 #include <isl/aff.h>
2655 __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2656 __isl_take isl_local_space *ls);
2657 __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2658 __isl_take isl_local_space *ls,
2659 enum isl_dim_type type, unsigned pos);
2660 __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2661 __isl_take isl_local_space *ls);
2662 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2663 __isl_take isl_space *space);
2664 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2665 __isl_take isl_space *space);
2666 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2667 __isl_take isl_space *space);
2668 __isl_give isl_pw_multi_aff *
2669 isl_pw_multi_aff_project_out_map(
2670 __isl_take isl_space *space,
2671 enum isl_dim_type type,
2672 unsigned first, unsigned n);
2674 #include <isl/polynomial.h>
2675 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2676 __isl_take isl_space *space);
2678 The following convenience functions first create a base expression and
2679 then create a piecewise expression over a given domain.
2681 #include <isl/aff.h>
2682 __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2683 __isl_take isl_set *domain,
2684 __isl_take isl_val *v);
2685 __isl_give isl_pw_multi_aff *
2686 isl_pw_multi_aff_multi_val_on_domain(
2687 __isl_take isl_set *domain,
2688 __isl_take isl_multi_val *mv);
2690 As a convenience, a piecewise multiple expression can
2691 also be created from a piecewise expression.
2692 Each multiple expression in the result is derived
2693 from the corresponding base expression.
2695 #include <isl/aff.h>
2696 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2697 __isl_take isl_pw_aff *pa);
2699 Similarly, a piecewise quasipolynomial can be
2700 created from a piecewise quasi-affine expression using
2701 the following function.
2703 #include <isl/polynomial.h>
2704 __isl_give isl_pw_qpolynomial *
2705 isl_pw_qpolynomial_from_pw_aff(
2706 __isl_take isl_pw_aff *pwaff);
2708 Piecewise expressions can be copied and freed using the following functions.
2710 #include <isl/aff.h>
2711 __isl_give isl_pw_aff *isl_pw_aff_copy(
2712 __isl_keep isl_pw_aff *pwaff);
2713 __isl_null isl_pw_aff *isl_pw_aff_free(
2714 __isl_take isl_pw_aff *pwaff);
2715 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
2716 __isl_keep isl_pw_multi_aff *pma);
2717 __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
2718 __isl_take isl_pw_multi_aff *pma);
2720 #include <isl/polynomial.h>
2721 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
2722 __isl_keep isl_pw_qpolynomial *pwqp);
2723 __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
2724 __isl_take isl_pw_qpolynomial *pwqp);
2725 __isl_give isl_pw_qpolynomial_fold *
2726 isl_pw_qpolynomial_fold_copy(
2727 __isl_keep isl_pw_qpolynomial_fold *pwf);
2728 __isl_null isl_pw_qpolynomial_fold *
2729 isl_pw_qpolynomial_fold_free(
2730 __isl_take isl_pw_qpolynomial_fold *pwf);
2732 To iterate over the different cells of a piecewise expression,
2733 use the following functions.
2735 #include <isl/aff.h>
2736 int isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
2737 int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
2738 int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
2739 int (*fn)(__isl_take isl_set *set,
2740 __isl_take isl_aff *aff,
2741 void *user), void *user);
2742 int isl_pw_multi_aff_foreach_piece(
2743 __isl_keep isl_pw_multi_aff *pma,
2744 int (*fn)(__isl_take isl_set *set,
2745 __isl_take isl_multi_aff *maff,
2746 void *user), void *user);
2748 #include <isl/polynomial.h>
2749 int isl_pw_qpolynomial_foreach_piece(
2750 __isl_keep isl_pw_qpolynomial *pwqp,
2751 int (*fn)(__isl_take isl_set *set,
2752 __isl_take isl_qpolynomial *qp,
2753 void *user), void *user);
2754 int isl_pw_qpolynomial_foreach_lifted_piece(
2755 __isl_keep isl_pw_qpolynomial *pwqp,
2756 int (*fn)(__isl_take isl_set *set,
2757 __isl_take isl_qpolynomial *qp,
2758 void *user), void *user);
2759 int isl_pw_qpolynomial_fold_foreach_piece(
2760 __isl_keep isl_pw_qpolynomial_fold *pwf,
2761 int (*fn)(__isl_take isl_set *set,
2762 __isl_take isl_qpolynomial_fold *fold,
2763 void *user), void *user);
2764 int isl_pw_qpolynomial_fold_foreach_lifted_piece(
2765 __isl_keep isl_pw_qpolynomial_fold *pwf,
2766 int (*fn)(__isl_take isl_set *set,
2767 __isl_take isl_qpolynomial_fold *fold,
2768 void *user), void *user);
2770 As usual, the function C<fn> should return C<0> on success
2771 and C<-1> on failure. The difference between
2772 C<isl_pw_qpolynomial_foreach_piece> and
2773 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
2774 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
2775 compute unique representations for all existentially quantified
2776 variables and then turn these existentially quantified variables
2777 into extra set variables, adapting the associated quasipolynomial
2778 accordingly. This means that the C<set> passed to C<fn>
2779 will not have any existentially quantified variables, but that
2780 the dimensions of the sets may be different for different
2781 invocations of C<fn>.
2782 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
2783 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
2785 A piecewise expression consisting of the expressions at a given
2786 position of a piecewise multiple expression can be extracted
2787 using the following function.
2789 #include <isl/aff.h>
2790 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
2791 __isl_keep isl_pw_multi_aff *pma, int pos);
2793 These expressions can be replaced using the following function.
2795 #include <isl/aff.h>
2796 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
2797 __isl_take isl_pw_multi_aff *pma, unsigned pos,
2798 __isl_take isl_pw_aff *pa);
2800 Note that there is a difference between C<isl_multi_pw_aff> and
2801 C<isl_pw_multi_aff> objects. The first is a sequence of piecewise
2802 affine expressions, while the second is a piecewise sequence
2803 of affine expressions. In particular, each of the piecewise
2804 affine expressions in an C<isl_multi_pw_aff> may have a different
2805 domain, while all multiple expressions associated to a cell
2806 in an C<isl_pw_multi_aff> have the same domain.
2807 It is possible to convert between the two, but when converting
2808 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
2809 of the result is the intersection of the domains of the input.
2810 The reverse conversion is exact.
2812 #include <isl/aff.h>
2813 __isl_give isl_pw_multi_aff *
2814 isl_pw_multi_aff_from_multi_pw_aff(
2815 __isl_take isl_multi_pw_aff *mpa);
2816 __isl_give isl_multi_pw_aff *
2817 isl_multi_pw_aff_from_pw_multi_aff(
2818 __isl_take isl_pw_multi_aff *pma);
2820 =head3 Union Expressions
2822 A union expression collects base expressions defined
2823 over different domains. The space of a union expression
2824 is that of the shared parameter space.
2826 The union expression types defined by C<isl>
2827 are C<isl_union_pw_multi_aff>, C<isl_union_pw_qpolynomial> and
2828 C<isl_union_pw_qpolynomial_fold>.
2830 An empty union expression can be created using the following functions.
2832 #include <isl/aff.h>
2833 __isl_give isl_union_pw_multi_aff *
2834 isl_union_pw_multi_aff_empty(
2835 __isl_take isl_space *space);
2837 #include <isl/polynomial.h>
2838 __isl_give isl_union_pw_qpolynomial *
2839 isl_union_pw_qpolynomial_zero(
2840 __isl_take isl_space *space);
2842 A union expression containing a single base expression
2843 can be created using the following functions.
2845 #include <isl/aff.h>
2846 __isl_give isl_union_pw_multi_aff *
2847 isl_union_pw_multi_aff_from_pw_multi_aff(
2848 __isl_take isl_pw_multi_aff *pma);
2850 #include <isl/polynomial.h>
2851 __isl_give isl_union_pw_qpolynomial *
2852 isl_union_pw_qpolynomial_from_pw_qpolynomial(
2853 __isl_take isl_pw_qpolynomial *pwqp);
2855 The following function creates a base expression on each
2856 of the sets in the union set and collects the results.
2858 #include <isl/aff.h>
2859 __isl_give isl_union_pw_multi_aff *
2860 isl_union_pw_multi_aff_multi_val_on_domain(
2861 __isl_take isl_union_set *domain,
2862 __isl_take isl_multi_val *mv);
2864 A base expression can be added to a union expression using
2865 the following functions.
2867 #include <isl/aff.h>
2868 __isl_give isl_union_pw_multi_aff *
2869 isl_union_pw_multi_aff_add_pw_multi_aff(
2870 __isl_take isl_union_pw_multi_aff *upma,
2871 __isl_take isl_pw_multi_aff *pma);
2873 #include <isl/polynomial.h>
2874 __isl_give isl_union_pw_qpolynomial *
2875 isl_union_pw_qpolynomial_add_pw_qpolynomial(
2876 __isl_take isl_union_pw_qpolynomial *upwqp,
2877 __isl_take isl_pw_qpolynomial *pwqp);
2879 Union expressions can be copied and freed using
2880 the following functions.
2882 #include <isl/aff.h>
2883 __isl_give isl_union_pw_multi_aff *
2884 isl_union_pw_multi_aff_copy(
2885 __isl_keep isl_union_pw_multi_aff *upma);
2886 __isl_null isl_union_pw_multi_aff *
2887 isl_union_pw_multi_aff_free(
2888 __isl_take isl_union_pw_multi_aff *upma);
2890 #include <isl/polynomial.h>
2891 __isl_give isl_union_pw_qpolynomial *
2892 isl_union_pw_qpolynomial_copy(
2893 __isl_keep isl_union_pw_qpolynomial *upwqp);
2894 __isl_null isl_union_pw_qpolynomial *
2895 isl_union_pw_qpolynomial_free(
2896 __isl_take isl_union_pw_qpolynomial *upwqp);
2897 __isl_give isl_union_pw_qpolynomial_fold *
2898 isl_union_pw_qpolynomial_fold_copy(
2899 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
2900 __isl_null isl_union_pw_qpolynomial_fold *
2901 isl_union_pw_qpolynomial_fold_free(
2902 __isl_take isl_union_pw_qpolynomial_fold *upwf);
2904 To iterate over the base expressions in a union expression,
2905 use the following functions.
2907 #include <isl/aff.h>
2908 int isl_union_pw_multi_aff_foreach_pw_multi_aff(
2909 __isl_keep isl_union_pw_multi_aff *upma,
2910 int (*fn)(__isl_take isl_pw_multi_aff *pma,
2911 void *user), void *user);
2913 #include <isl/polynomial.h>
2914 int isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
2915 __isl_keep isl_union_pw_qpolynomial *upwqp,
2916 int (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
2917 void *user), void *user);
2918 int isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
2919 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
2920 int (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
2921 void *user), void *user);
2923 To extract the base expression in a given space from a union, use
2924 the following functions.
2926 #include <isl/aff.h>
2927 __isl_give isl_pw_multi_aff *
2928 isl_union_pw_multi_aff_extract_pw_multi_aff(
2929 __isl_keep isl_union_pw_multi_aff *upma,
2930 __isl_take isl_space *space);
2932 #include <isl/polynomial.h>
2933 __isl_give isl_pw_qpolynomial *
2934 isl_union_pw_qpolynomial_extract_pw_qpolynomial(
2935 __isl_keep isl_union_pw_qpolynomial *upwqp,
2936 __isl_take isl_space *space);
2938 =head2 Input and Output
2940 For set and relation,
2941 C<isl> supports its own input/output format, which is similar
2942 to the C<Omega> format, but also supports the C<PolyLib> format
2944 For other object types, typically only an C<isl> format is supported.
2946 =head3 C<isl> format
2948 The C<isl> format is similar to that of C<Omega>, but has a different
2949 syntax for describing the parameters and allows for the definition
2950 of an existentially quantified variable as the integer division
2951 of an affine expression.
2952 For example, the set of integers C<i> between C<0> and C<n>
2953 such that C<i % 10 <= 6> can be described as
2955 [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
2958 A set or relation can have several disjuncts, separated
2959 by the keyword C<or>. Each disjunct is either a conjunction
2960 of constraints or a projection (C<exists>) of a conjunction
2961 of constraints. The constraints are separated by the keyword
2964 =head3 C<PolyLib> format
2966 If the represented set is a union, then the first line
2967 contains a single number representing the number of disjuncts.
2968 Otherwise, a line containing the number C<1> is optional.
2970 Each disjunct is represented by a matrix of constraints.
2971 The first line contains two numbers representing
2972 the number of rows and columns,
2973 where the number of rows is equal to the number of constraints
2974 and the number of columns is equal to two plus the number of variables.
2975 The following lines contain the actual rows of the constraint matrix.
2976 In each row, the first column indicates whether the constraint
2977 is an equality (C<0>) or inequality (C<1>). The final column
2978 corresponds to the constant term.
2980 If the set is parametric, then the coefficients of the parameters
2981 appear in the last columns before the constant column.
2982 The coefficients of any existentially quantified variables appear
2983 between those of the set variables and those of the parameters.
2985 =head3 Extended C<PolyLib> format
2987 The extended C<PolyLib> format is nearly identical to the
2988 C<PolyLib> format. The only difference is that the line
2989 containing the number of rows and columns of a constraint matrix
2990 also contains four additional numbers:
2991 the number of output dimensions, the number of input dimensions,
2992 the number of local dimensions (i.e., the number of existentially
2993 quantified variables) and the number of parameters.
2994 For sets, the number of ``output'' dimensions is equal
2995 to the number of set dimensions, while the number of ``input''
3000 Objects can be read from input using the following functions.
3002 #include <isl/val.h>
3003 __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3005 __isl_give isl_multi_val *isl_multi_val_read_from_str(
3006 isl_ctx *ctx, const char *str);
3008 #include <isl/set.h>
3009 __isl_give isl_basic_set *isl_basic_set_read_from_file(
3010 isl_ctx *ctx, FILE *input);
3011 __isl_give isl_basic_set *isl_basic_set_read_from_str(
3012 isl_ctx *ctx, const char *str);
3013 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3015 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3018 #include <isl/map.h>
3019 __isl_give isl_basic_map *isl_basic_map_read_from_file(
3020 isl_ctx *ctx, FILE *input);
3021 __isl_give isl_basic_map *isl_basic_map_read_from_str(
3022 isl_ctx *ctx, const char *str);
3023 __isl_give isl_map *isl_map_read_from_file(
3024 isl_ctx *ctx, FILE *input);
3025 __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3028 #include <isl/union_set.h>
3029 __isl_give isl_union_set *isl_union_set_read_from_file(
3030 isl_ctx *ctx, FILE *input);
3031 __isl_give isl_union_set *isl_union_set_read_from_str(
3032 isl_ctx *ctx, const char *str);
3034 #include <isl/union_map.h>
3035 __isl_give isl_union_map *isl_union_map_read_from_file(
3036 isl_ctx *ctx, FILE *input);
3037 __isl_give isl_union_map *isl_union_map_read_from_str(
3038 isl_ctx *ctx, const char *str);
3040 #include <isl/aff.h>
3041 __isl_give isl_aff *isl_aff_read_from_str(
3042 isl_ctx *ctx, const char *str);
3043 __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3044 isl_ctx *ctx, const char *str);
3045 __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3046 isl_ctx *ctx, const char *str);
3047 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3048 isl_ctx *ctx, const char *str);
3049 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3050 isl_ctx *ctx, const char *str);
3051 __isl_give isl_union_pw_multi_aff *
3052 isl_union_pw_multi_aff_read_from_str(
3053 isl_ctx *ctx, const char *str);
3055 #include <isl/polynomial.h>
3056 __isl_give isl_union_pw_qpolynomial *
3057 isl_union_pw_qpolynomial_read_from_str(
3058 isl_ctx *ctx, const char *str);
3060 For sets and relations,
3061 the input format is autodetected and may be either the C<PolyLib> format
3062 or the C<isl> format.
3066 Before anything can be printed, an C<isl_printer> needs to
3069 __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3071 __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3072 __isl_null isl_printer *isl_printer_free(
3073 __isl_take isl_printer *printer);
3074 __isl_give char *isl_printer_get_str(
3075 __isl_keep isl_printer *printer);
3077 The printer can be inspected using the following functions.
3079 FILE *isl_printer_get_file(
3080 __isl_keep isl_printer *printer);
3081 int isl_printer_get_output_format(
3082 __isl_keep isl_printer *p);
3084 The behavior of the printer can be modified in various ways
3086 __isl_give isl_printer *isl_printer_set_output_format(
3087 __isl_take isl_printer *p, int output_format);
3088 __isl_give isl_printer *isl_printer_set_indent(
3089 __isl_take isl_printer *p, int indent);
3090 __isl_give isl_printer *isl_printer_set_indent_prefix(
3091 __isl_take isl_printer *p, const char *prefix);
3092 __isl_give isl_printer *isl_printer_indent(
3093 __isl_take isl_printer *p, int indent);
3094 __isl_give isl_printer *isl_printer_set_prefix(
3095 __isl_take isl_printer *p, const char *prefix);
3096 __isl_give isl_printer *isl_printer_set_suffix(
3097 __isl_take isl_printer *p, const char *suffix);
3099 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3100 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3101 and defaults to C<ISL_FORMAT_ISL>.
3102 Each line in the output is prefixed by C<indent_prefix>,
3103 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3104 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3105 In the C<PolyLib> format output,
3106 the coefficients of the existentially quantified variables
3107 appear between those of the set variables and those
3109 The function C<isl_printer_indent> increases the indentation
3110 by the specified amount (which may be negative).
3112 To actually print something, use
3114 #include <isl/printer.h>
3115 __isl_give isl_printer *isl_printer_print_double(
3116 __isl_take isl_printer *p, double d);
3118 #include <isl/val.h>
3119 __isl_give isl_printer *isl_printer_print_val(
3120 __isl_take isl_printer *p, __isl_keep isl_val *v);
3122 #include <isl/set.h>
3123 __isl_give isl_printer *isl_printer_print_basic_set(
3124 __isl_take isl_printer *printer,
3125 __isl_keep isl_basic_set *bset);
3126 __isl_give isl_printer *isl_printer_print_set(
3127 __isl_take isl_printer *printer,
3128 __isl_keep isl_set *set);
3130 #include <isl/map.h>
3131 __isl_give isl_printer *isl_printer_print_basic_map(
3132 __isl_take isl_printer *printer,
3133 __isl_keep isl_basic_map *bmap);
3134 __isl_give isl_printer *isl_printer_print_map(
3135 __isl_take isl_printer *printer,
3136 __isl_keep isl_map *map);
3138 #include <isl/union_set.h>
3139 __isl_give isl_printer *isl_printer_print_union_set(
3140 __isl_take isl_printer *p,
3141 __isl_keep isl_union_set *uset);
3143 #include <isl/union_map.h>
3144 __isl_give isl_printer *isl_printer_print_union_map(
3145 __isl_take isl_printer *p,
3146 __isl_keep isl_union_map *umap);
3148 #include <isl/val.h>
3149 __isl_give isl_printer *isl_printer_print_multi_val(
3150 __isl_take isl_printer *p,
3151 __isl_keep isl_multi_val *mv);
3153 #include <isl/aff.h>
3154 __isl_give isl_printer *isl_printer_print_aff(
3155 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3156 __isl_give isl_printer *isl_printer_print_multi_aff(
3157 __isl_take isl_printer *p,
3158 __isl_keep isl_multi_aff *maff);
3159 __isl_give isl_printer *isl_printer_print_pw_aff(
3160 __isl_take isl_printer *p,
3161 __isl_keep isl_pw_aff *pwaff);
3162 __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3163 __isl_take isl_printer *p,
3164 __isl_keep isl_pw_multi_aff *pma);
3165 __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3166 __isl_take isl_printer *p,
3167 __isl_keep isl_multi_pw_aff *mpa);
3168 __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3169 __isl_take isl_printer *p,
3170 __isl_keep isl_union_pw_multi_aff *upma);
3172 #include <isl/polynomial.h>
3173 __isl_give isl_printer *isl_printer_print_qpolynomial(
3174 __isl_take isl_printer *p,
3175 __isl_keep isl_qpolynomial *qp);
3176 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3177 __isl_take isl_printer *p,
3178 __isl_keep isl_pw_qpolynomial *pwqp);
3179 __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3180 __isl_take isl_printer *p,
3181 __isl_keep isl_union_pw_qpolynomial *upwqp);
3183 __isl_give isl_printer *
3184 isl_printer_print_pw_qpolynomial_fold(
3185 __isl_take isl_printer *p,
3186 __isl_keep isl_pw_qpolynomial_fold *pwf);
3187 __isl_give isl_printer *
3188 isl_printer_print_union_pw_qpolynomial_fold(
3189 __isl_take isl_printer *p,
3190 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3192 For C<isl_printer_print_qpolynomial>,
3193 C<isl_printer_print_pw_qpolynomial> and
3194 C<isl_printer_print_pw_qpolynomial_fold>,
3195 the output format of the printer
3196 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3197 For C<isl_printer_print_union_pw_qpolynomial> and
3198 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3200 In case of printing in C<ISL_FORMAT_C>, the user may want
3201 to set the names of all dimensions first.
3203 When called on a file printer, the following function flushes
3204 the file. When called on a string printer, the buffer is cleared.
3206 __isl_give isl_printer *isl_printer_flush(
3207 __isl_take isl_printer *p);
3209 Alternatively, a string representation can be obtained
3210 directly using the following functions, which always print
3213 #include <isl/space.h>
3214 __isl_give char *isl_space_to_str(
3215 __isl_keep isl_space *space);
3217 #include <isl/val.h>
3218 __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3219 __isl_give char *isl_multi_val_to_str(
3220 __isl_keep isl_multi_val *mv);
3222 #include <isl/set.h>
3223 __isl_give char *isl_set_to_str(
3224 __isl_keep isl_set *set);
3226 #include <isl/union_set.h>
3227 __isl_give char *isl_union_set_to_str(
3228 __isl_keep isl_union_set *uset);
3230 #include <isl/map.h>
3231 __isl_give char *isl_map_to_str(
3232 __isl_keep isl_map *map);
3234 #include <isl/union_map.h>
3235 __isl_give char *isl_union_map_to_str(
3236 __isl_keep isl_union_map *umap);
3238 #include <isl/aff.h>
3239 __isl_give char *isl_multi_aff_to_str(
3240 __isl_keep isl_multi_aff *aff);
3241 __isl_give char *isl_union_pw_multi_aff_to_str(
3242 __isl_keep isl_union_pw_multi_aff *upma);
3246 =head3 Unary Properties
3252 The following functions test whether the given set or relation
3253 contains any integer points. The ``plain'' variants do not perform
3254 any computations, but simply check if the given set or relation
3255 is already known to be empty.
3257 int isl_basic_set_plain_is_empty(__isl_keep isl_basic_set *bset);
3258 int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
3259 int isl_set_plain_is_empty(__isl_keep isl_set *set);
3260 int isl_set_is_empty(__isl_keep isl_set *set);
3261 int isl_union_set_is_empty(__isl_keep isl_union_set *uset);
3262 int isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
3263 int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
3264 int isl_map_plain_is_empty(__isl_keep isl_map *map);
3265 int isl_map_is_empty(__isl_keep isl_map *map);
3266 int isl_union_map_is_empty(__isl_keep isl_union_map *umap);
3268 =item * Universality
3270 int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
3271 int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
3272 int isl_set_plain_is_universe(__isl_keep isl_set *set);
3274 =item * Single-valuedness
3276 #include <isl/set.h>
3277 int isl_set_is_singleton(__isl_keep isl_set *set);
3279 #include <isl/map.h>
3280 int isl_basic_map_is_single_valued(
3281 __isl_keep isl_basic_map *bmap);
3282 int isl_map_plain_is_single_valued(
3283 __isl_keep isl_map *map);
3284 int isl_map_is_single_valued(__isl_keep isl_map *map);
3286 #include <isl/union_map.h>
3287 int isl_union_map_is_single_valued(__isl_keep isl_union_map *umap);
3291 int isl_map_plain_is_injective(__isl_keep isl_map *map);
3292 int isl_map_is_injective(__isl_keep isl_map *map);
3293 int isl_union_map_plain_is_injective(
3294 __isl_keep isl_union_map *umap);
3295 int isl_union_map_is_injective(
3296 __isl_keep isl_union_map *umap);
3300 int isl_map_is_bijective(__isl_keep isl_map *map);
3301 int isl_union_map_is_bijective(__isl_keep isl_union_map *umap);
3305 __isl_give isl_val *
3306 isl_basic_map_plain_get_val_if_fixed(
3307 __isl_keep isl_basic_map *bmap,
3308 enum isl_dim_type type, unsigned pos);
3309 __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3310 __isl_keep isl_set *set,
3311 enum isl_dim_type type, unsigned pos);
3312 __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3313 __isl_keep isl_map *map,
3314 enum isl_dim_type type, unsigned pos);
3316 If the set or relation obviously lies on a hyperplane where the given dimension
3317 has a fixed value, then return that value.
3318 Otherwise return NaN.
3322 int isl_set_dim_residue_class_val(
3323 __isl_keep isl_set *set,
3324 int pos, __isl_give isl_val **modulo,
3325 __isl_give isl_val **residue);
3327 Check if the values of the given set dimension are equal to a fixed
3328 value modulo some integer value. If so, assign the modulo to C<*modulo>
3329 and the fixed value to C<*residue>. If the given dimension attains only
3330 a single value, then assign C<0> to C<*modulo> and the fixed value to
3332 If the dimension does not attain only a single value and if no modulo
3333 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3337 To check whether the description of a set, relation or function depends
3338 on one or more given dimensions,
3339 the following functions can be used.
3341 #include <isl/constraint.h>
3342 int isl_constraint_involves_dims(
3343 __isl_keep isl_constraint *constraint,
3344 enum isl_dim_type type, unsigned first, unsigned n);
3346 #include <isl/set.h>
3347 int isl_basic_set_involves_dims(
3348 __isl_keep isl_basic_set *bset,
3349 enum isl_dim_type type, unsigned first, unsigned n);
3350 int isl_set_involves_dims(__isl_keep isl_set *set,
3351 enum isl_dim_type type, unsigned first, unsigned n);
3353 #include <isl/map.h>
3354 int isl_basic_map_involves_dims(
3355 __isl_keep isl_basic_map *bmap,
3356 enum isl_dim_type type, unsigned first, unsigned n);
3357 int isl_map_involves_dims(__isl_keep isl_map *map,
3358 enum isl_dim_type type, unsigned first, unsigned n);
3360 #include <isl/union_map.h>
3361 int isl_union_map_involves_dims(
3362 __isl_keep isl_union_map *umap,
3363 enum isl_dim_type type, unsigned first, unsigned n);
3365 #include <isl/aff.h>
3366 int isl_aff_involves_dims(__isl_keep isl_aff *aff,
3367 enum isl_dim_type type, unsigned first, unsigned n);
3368 int isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff,
3369 enum isl_dim_type type, unsigned first, unsigned n);
3370 int isl_multi_aff_involves_dims(
3371 __isl_keep isl_multi_aff *ma,
3372 enum isl_dim_type type, unsigned first, unsigned n);
3373 int isl_multi_pw_aff_involves_dims(
3374 __isl_keep isl_multi_pw_aff *mpa,
3375 enum isl_dim_type type, unsigned first, unsigned n);
3377 Similarly, the following functions can be used to check whether
3378 a given dimension is involved in any lower or upper bound.
3380 #include <isl/set.h>
3381 int isl_set_dim_has_any_lower_bound(__isl_keep isl_set *set,
3382 enum isl_dim_type type, unsigned pos);
3383 int isl_set_dim_has_any_upper_bound(__isl_keep isl_set *set,
3384 enum isl_dim_type type, unsigned pos);
3386 Note that these functions return true even if there is a bound on
3387 the dimension on only some of the basic sets of C<set>.
3388 To check if they have a bound for all of the basic sets in C<set>,
3389 use the following functions instead.
3391 #include <isl/set.h>
3392 int isl_set_dim_has_lower_bound(__isl_keep isl_set *set,
3393 enum isl_dim_type type, unsigned pos);
3394 int isl_set_dim_has_upper_bound(__isl_keep isl_set *set,
3395 enum isl_dim_type type, unsigned pos);
3399 To check whether a set is a parameter domain, use this function:
3401 int isl_set_is_params(__isl_keep isl_set *set);
3402 int isl_union_set_is_params(
3403 __isl_keep isl_union_set *uset);
3407 The following functions check whether the space of the given
3408 (basic) set or relation range is a wrapped relation.
3410 #include <isl/space.h>
3411 int isl_space_is_wrapping(
3412 __isl_keep isl_space *space);
3413 int isl_space_domain_is_wrapping(
3414 __isl_keep isl_space *space);
3415 int isl_space_range_is_wrapping(
3416 __isl_keep isl_space *space);
3418 #include <isl/set.h>
3419 int isl_basic_set_is_wrapping(
3420 __isl_keep isl_basic_set *bset);
3421 int isl_set_is_wrapping(__isl_keep isl_set *set);
3423 #include <isl/map.h>
3424 int isl_map_domain_is_wrapping(
3425 __isl_keep isl_map *map);
3426 int isl_map_range_is_wrapping(
3427 __isl_keep isl_map *map);
3429 #include <isl/val.h>
3430 int isl_multi_val_range_is_wrapping(
3431 __isl_keep isl_multi_val *mv);
3433 #include <isl/aff.h>
3434 int isl_multi_aff_range_is_wrapping(
3435 __isl_keep isl_multi_aff *ma);
3436 int isl_multi_pw_aff_range_is_wrapping(
3437 __isl_keep isl_multi_pw_aff *mpa);
3439 The input to C<isl_space_is_wrapping> should
3440 be the space of a set, while that of
3441 C<isl_space_domain_is_wrapping> and
3442 C<isl_space_range_is_wrapping> should be the space of a relation.
3444 =item * Internal Product
3446 int isl_basic_map_can_zip(
3447 __isl_keep isl_basic_map *bmap);
3448 int isl_map_can_zip(__isl_keep isl_map *map);
3450 Check whether the product of domain and range of the given relation
3452 i.e., whether both domain and range are nested relations.
3456 int isl_basic_map_can_curry(
3457 __isl_keep isl_basic_map *bmap);
3458 int isl_map_can_curry(__isl_keep isl_map *map);
3460 Check whether the domain of the (basic) relation is a wrapped relation.
3462 int isl_basic_map_can_uncurry(
3463 __isl_keep isl_basic_map *bmap);
3464 int isl_map_can_uncurry(__isl_keep isl_map *map);
3466 Check whether the range of the (basic) relation is a wrapped relation.
3468 =item * Special Values
3470 #include <isl/aff.h>
3471 int isl_aff_is_cst(__isl_keep isl_aff *aff);
3472 int isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3474 Check whether the given expression is a constant.
3476 #include <isl/aff.h>
3477 int isl_aff_is_nan(__isl_keep isl_aff *aff);
3478 int isl_pw_aff_involves_nan(__isl_keep isl_pw_aff *pa);
3480 Check whether the given expression is equal to or involves NaN.
3482 #include <isl/aff.h>
3483 int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
3485 Check whether the affine expression is obviously zero.
3489 =head3 Binary Properties
3495 The following functions check whether two objects
3496 represent the same set, relation or function.
3497 The C<plain> variants only return true if the objects
3498 are obviously the same. That is, they may return false
3499 even if the objects are the same, but they will never
3500 return true if the objects are not the same.
3502 #include <isl/set.h>
3503 int isl_basic_set_plain_is_equal(
3504 __isl_keep isl_basic_set *bset1,
3505 __isl_keep isl_basic_set *bset2);
3506 int isl_set_plain_is_equal(__isl_keep isl_set *set1,
3507 __isl_keep isl_set *set2);
3508 int isl_set_is_equal(__isl_keep isl_set *set1,
3509 __isl_keep isl_set *set2);
3511 #include <isl/map.h>
3512 int isl_basic_map_is_equal(
3513 __isl_keep isl_basic_map *bmap1,
3514 __isl_keep isl_basic_map *bmap2);
3515 int isl_map_is_equal(__isl_keep isl_map *map1,
3516 __isl_keep isl_map *map2);
3517 int isl_map_plain_is_equal(__isl_keep isl_map *map1,
3518 __isl_keep isl_map *map2);
3520 #include <isl/union_set.h>
3521 int isl_union_set_is_equal(
3522 __isl_keep isl_union_set *uset1,
3523 __isl_keep isl_union_set *uset2);
3525 #include <isl/union_map.h>
3526 int isl_union_map_is_equal(
3527 __isl_keep isl_union_map *umap1,
3528 __isl_keep isl_union_map *umap2);
3530 #include <isl/aff.h>
3531 int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1,
3532 __isl_keep isl_aff *aff2);
3533 int isl_multi_aff_plain_is_equal(
3534 __isl_keep isl_multi_aff *maff1,
3535 __isl_keep isl_multi_aff *maff2);
3536 int isl_pw_aff_plain_is_equal(
3537 __isl_keep isl_pw_aff *pwaff1,
3538 __isl_keep isl_pw_aff *pwaff2);
3539 int isl_pw_multi_aff_plain_is_equal(
3540 __isl_keep isl_pw_multi_aff *pma1,
3541 __isl_keep isl_pw_multi_aff *pma2);
3542 int isl_multi_pw_aff_plain_is_equal(
3543 __isl_keep isl_multi_pw_aff *mpa1,
3544 __isl_keep isl_multi_pw_aff *mpa2);
3545 int isl_multi_pw_aff_is_equal(
3546 __isl_keep isl_multi_pw_aff *mpa1,
3547 __isl_keep isl_multi_pw_aff *mpa2);
3548 int isl_union_pw_multi_aff_plain_is_equal(
3549 __isl_keep isl_union_pw_multi_aff *upma1,
3550 __isl_keep isl_union_pw_multi_aff *upma2);
3552 #include <isl/polynomial.h>
3553 int isl_union_pw_qpolynomial_plain_is_equal(
3554 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3555 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3556 int isl_union_pw_qpolynomial_fold_plain_is_equal(
3557 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3558 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3560 =item * Disjointness
3562 #include <isl/set.h>
3563 int isl_basic_set_is_disjoint(
3564 __isl_keep isl_basic_set *bset1,
3565 __isl_keep isl_basic_set *bset2);
3566 int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
3567 __isl_keep isl_set *set2);
3568 int isl_set_is_disjoint(__isl_keep isl_set *set1,
3569 __isl_keep isl_set *set2);
3571 #include <isl/map.h>
3572 int isl_basic_map_is_disjoint(
3573 __isl_keep isl_basic_map *bmap1,
3574 __isl_keep isl_basic_map *bmap2);
3575 int isl_map_is_disjoint(__isl_keep isl_map *map1,
3576 __isl_keep isl_map *map2);
3578 #include <isl/union_set.h>
3579 int isl_union_set_is_disjoint(
3580 __isl_keep isl_union_set *uset1,
3581 __isl_keep isl_union_set *uset2);
3583 #include <isl/union_map.h>
3584 int isl_union_map_is_disjoint(
3585 __isl_keep isl_union_map *umap1,
3586 __isl_keep isl_union_map *umap2);
3590 int isl_basic_set_is_subset(
3591 __isl_keep isl_basic_set *bset1,
3592 __isl_keep isl_basic_set *bset2);
3593 int isl_set_is_subset(__isl_keep isl_set *set1,
3594 __isl_keep isl_set *set2);
3595 int isl_set_is_strict_subset(
3596 __isl_keep isl_set *set1,
3597 __isl_keep isl_set *set2);
3598 int isl_union_set_is_subset(
3599 __isl_keep isl_union_set *uset1,
3600 __isl_keep isl_union_set *uset2);
3601 int isl_union_set_is_strict_subset(
3602 __isl_keep isl_union_set *uset1,
3603 __isl_keep isl_union_set *uset2);
3604 int isl_basic_map_is_subset(
3605 __isl_keep isl_basic_map *bmap1,
3606 __isl_keep isl_basic_map *bmap2);
3607 int isl_basic_map_is_strict_subset(
3608 __isl_keep isl_basic_map *bmap1,
3609 __isl_keep isl_basic_map *bmap2);
3610 int isl_map_is_subset(
3611 __isl_keep isl_map *map1,
3612 __isl_keep isl_map *map2);
3613 int isl_map_is_strict_subset(
3614 __isl_keep isl_map *map1,
3615 __isl_keep isl_map *map2);
3616 int isl_union_map_is_subset(
3617 __isl_keep isl_union_map *umap1,
3618 __isl_keep isl_union_map *umap2);
3619 int isl_union_map_is_strict_subset(
3620 __isl_keep isl_union_map *umap1,
3621 __isl_keep isl_union_map *umap2);
3623 Check whether the first argument is a (strict) subset of the
3628 Every comparison function returns a negative value if the first
3629 argument is considered smaller than the second, a positive value
3630 if the first argument is considered greater and zero if the two
3631 constraints are considered the same by the comparison criterion.
3633 #include <isl/constraint.h>
3634 int isl_constraint_plain_cmp(
3635 __isl_keep isl_constraint *c1,
3636 __isl_keep isl_constraint *c2);
3638 This function is useful for sorting C<isl_constraint>s.
3639 The order depends on the internal representation of the inputs.
3640 The order is fixed over different calls to the function (assuming
3641 the internal representation of the inputs has not changed), but may
3642 change over different versions of C<isl>.
3644 #include <isl/constraint.h>
3645 int isl_constraint_cmp_last_non_zero(
3646 __isl_keep isl_constraint *c1,
3647 __isl_keep isl_constraint *c2);
3649 This function can be used to sort constraints that live in the same
3650 local space. Constraints that involve ``earlier'' dimensions or
3651 that have a smaller coefficient for the shared latest dimension
3652 are considered smaller than other constraints.
3653 This function only defines a B<partial> order.
3655 #include <isl/set.h>
3656 int isl_set_plain_cmp(__isl_keep isl_set *set1,
3657 __isl_keep isl_set *set2);
3659 This function is useful for sorting C<isl_set>s.
3660 The order depends on the internal representation of the inputs.
3661 The order is fixed over different calls to the function (assuming
3662 the internal representation of the inputs has not changed), but may
3663 change over different versions of C<isl>.
3665 #include <isl/aff.h>
3666 int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
3667 __isl_keep isl_pw_aff *pa2);
3669 The function C<isl_pw_aff_plain_cmp> can be used to sort
3670 C<isl_pw_aff>s. The order is not strictly defined.
3671 The current order sorts expressions that only involve
3672 earlier dimensions before those that involve later dimensions.
3676 =head2 Unary Operations
3682 __isl_give isl_set *isl_set_complement(
3683 __isl_take isl_set *set);
3684 __isl_give isl_map *isl_map_complement(
3685 __isl_take isl_map *map);
3689 #include <isl/space.h>
3690 __isl_give isl_space *isl_space_reverse(
3691 __isl_take isl_space *space);
3693 #include <isl/map.h>
3694 __isl_give isl_basic_map *isl_basic_map_reverse(
3695 __isl_take isl_basic_map *bmap);
3696 __isl_give isl_map *isl_map_reverse(
3697 __isl_take isl_map *map);
3699 #include <isl/union_map.h>
3700 __isl_give isl_union_map *isl_union_map_reverse(
3701 __isl_take isl_union_map *umap);
3705 #include <isl/space.h>
3706 __isl_give isl_space *isl_space_domain(
3707 __isl_take isl_space *space);
3708 __isl_give isl_space *isl_space_range(
3709 __isl_take isl_space *space);
3710 __isl_give isl_space *isl_space_params(
3711 __isl_take isl_space *space);
3713 #include <isl/local_space.h>
3714 __isl_give isl_local_space *isl_local_space_domain(
3715 __isl_take isl_local_space *ls);
3716 __isl_give isl_local_space *isl_local_space_range(
3717 __isl_take isl_local_space *ls);
3719 #include <isl/set.h>
3720 __isl_give isl_basic_set *isl_basic_set_project_out(
3721 __isl_take isl_basic_set *bset,
3722 enum isl_dim_type type, unsigned first, unsigned n);
3723 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
3724 enum isl_dim_type type, unsigned first, unsigned n);
3725 __isl_give isl_basic_set *isl_basic_set_params(
3726 __isl_take isl_basic_set *bset);
3727 __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
3729 #include <isl/map.h>
3730 __isl_give isl_basic_map *isl_basic_map_project_out(
3731 __isl_take isl_basic_map *bmap,
3732 enum isl_dim_type type, unsigned first, unsigned n);
3733 __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
3734 enum isl_dim_type type, unsigned first, unsigned n);
3735 __isl_give isl_basic_set *isl_basic_map_domain(
3736 __isl_take isl_basic_map *bmap);
3737 __isl_give isl_basic_set *isl_basic_map_range(
3738 __isl_take isl_basic_map *bmap);
3739 __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
3740 __isl_give isl_set *isl_map_domain(
3741 __isl_take isl_map *bmap);
3742 __isl_give isl_set *isl_map_range(
3743 __isl_take isl_map *map);
3745 #include <isl/union_set.h>
3746 __isl_give isl_union_set *isl_union_set_project_out(
3747 __isl_take isl_union_set *uset,
3748 enum isl_dim_type type,
3749 unsigned first, unsigned n);
3750 __isl_give isl_set *isl_union_set_params(
3751 __isl_take isl_union_set *uset);
3753 The function C<isl_union_set_project_out> can only project out
3756 #include <isl/union_map.h>
3757 __isl_give isl_union_map *isl_union_map_project_out(
3758 __isl_take isl_union_map *umap,
3759 enum isl_dim_type type, unsigned first, unsigned n);
3760 __isl_give isl_set *isl_union_map_params(
3761 __isl_take isl_union_map *umap);
3762 __isl_give isl_union_set *isl_union_map_domain(
3763 __isl_take isl_union_map *umap);
3764 __isl_give isl_union_set *isl_union_map_range(
3765 __isl_take isl_union_map *umap);
3767 The function C<isl_union_map_project_out> can only project out
3770 #include <isl/aff.h>
3771 __isl_give isl_aff *isl_aff_project_domain_on_params(
3772 __isl_take isl_aff *aff);
3773 __isl_give isl_pw_multi_aff *
3774 isl_pw_multi_aff_project_domain_on_params(
3775 __isl_take isl_pw_multi_aff *pma);
3776 __isl_give isl_set *isl_pw_aff_domain(
3777 __isl_take isl_pw_aff *pwaff);
3778 __isl_give isl_set *isl_pw_multi_aff_domain(
3779 __isl_take isl_pw_multi_aff *pma);
3780 __isl_give isl_set *isl_multi_pw_aff_domain(
3781 __isl_take isl_multi_pw_aff *mpa);
3782 __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
3783 __isl_take isl_union_pw_multi_aff *upma);
3784 __isl_give isl_set *isl_pw_aff_params(
3785 __isl_take isl_pw_aff *pwa);
3787 #include <isl/polynomial.h>
3788 __isl_give isl_qpolynomial *
3789 isl_qpolynomial_project_domain_on_params(
3790 __isl_take isl_qpolynomial *qp);
3791 __isl_give isl_pw_qpolynomial *
3792 isl_pw_qpolynomial_project_domain_on_params(
3793 __isl_take isl_pw_qpolynomial *pwqp);
3794 __isl_give isl_pw_qpolynomial_fold *
3795 isl_pw_qpolynomial_fold_project_domain_on_params(
3796 __isl_take isl_pw_qpolynomial_fold *pwf);
3797 __isl_give isl_set *isl_pw_qpolynomial_domain(
3798 __isl_take isl_pw_qpolynomial *pwqp);
3799 __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
3800 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3801 __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
3802 __isl_take isl_union_pw_qpolynomial *upwqp);
3804 #include <isl/space.h>
3805 __isl_give isl_space *isl_space_domain_map(
3806 __isl_take isl_space *space);
3807 __isl_give isl_space *isl_space_range_map(
3808 __isl_take isl_space *space);
3810 #include <isl/map.h>
3811 __isl_give isl_map *isl_set_wrapped_domain_map(
3812 __isl_take isl_set *set);
3813 __isl_give isl_basic_map *isl_basic_map_domain_map(
3814 __isl_take isl_basic_map *bmap);
3815 __isl_give isl_basic_map *isl_basic_map_range_map(
3816 __isl_take isl_basic_map *bmap);
3817 __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
3818 __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
3820 #include <isl/union_map.h>
3821 __isl_give isl_union_map *isl_union_map_domain_map(
3822 __isl_take isl_union_map *umap);
3823 __isl_give isl_union_map *isl_union_map_range_map(
3824 __isl_take isl_union_map *umap);
3825 __isl_give isl_union_map *
3826 isl_union_set_wrapped_domain_map(
3827 __isl_take isl_union_set *uset);
3829 The functions above construct a (basic, regular or union) relation
3830 that maps (a wrapped version of) the input relation to its domain or range.
3831 C<isl_set_wrapped_domain_map> maps the input set to the domain
3832 of its wrapped relation.
3836 __isl_give isl_basic_set *isl_basic_set_eliminate(
3837 __isl_take isl_basic_set *bset,
3838 enum isl_dim_type type,
3839 unsigned first, unsigned n);
3840 __isl_give isl_set *isl_set_eliminate(
3841 __isl_take isl_set *set, enum isl_dim_type type,
3842 unsigned first, unsigned n);
3843 __isl_give isl_basic_map *isl_basic_map_eliminate(
3844 __isl_take isl_basic_map *bmap,
3845 enum isl_dim_type type,
3846 unsigned first, unsigned n);
3847 __isl_give isl_map *isl_map_eliminate(
3848 __isl_take isl_map *map, enum isl_dim_type type,
3849 unsigned first, unsigned n);
3851 Eliminate the coefficients for the given dimensions from the constraints,
3852 without removing the dimensions.
3854 =item * Constructing a set from a parameter domain
3856 A zero-dimensional space or (basic) set can be constructed
3857 on a given parameter domain using the following functions.
3859 #include <isl/space.h>
3860 __isl_give isl_space *isl_space_set_from_params(
3861 __isl_take isl_space *space);
3863 #include <isl/set.h>
3864 __isl_give isl_basic_set *isl_basic_set_from_params(
3865 __isl_take isl_basic_set *bset);
3866 __isl_give isl_set *isl_set_from_params(
3867 __isl_take isl_set *set);
3869 =item * Constructing a relation from a set
3871 Create a relation with the given set as domain or range.
3872 The range or domain of the created relation is a zero-dimensional
3873 flat anonymous space.
3875 #include <isl/space.h>
3876 __isl_give isl_space *isl_space_from_domain(
3877 __isl_take isl_space *space);
3878 __isl_give isl_space *isl_space_from_range(
3879 __isl_take isl_space *space);
3880 __isl_give isl_space *isl_space_map_from_set(
3881 __isl_take isl_space *space);
3882 __isl_give isl_space *isl_space_map_from_domain_and_range(
3883 __isl_take isl_space *domain,
3884 __isl_take isl_space *range);
3886 #include <isl/local_space.h>
3887 __isl_give isl_local_space *isl_local_space_from_domain(
3888 __isl_take isl_local_space *ls);
3890 #include <isl/map.h>
3891 __isl_give isl_map *isl_map_from_domain(
3892 __isl_take isl_set *set);
3893 __isl_give isl_map *isl_map_from_range(
3894 __isl_take isl_set *set);
3896 #include <isl/val.h>
3897 __isl_give isl_multi_val *isl_multi_val_from_range(
3898 __isl_take isl_multi_val *mv);
3900 #include <isl/aff.h>
3901 __isl_give isl_multi_aff *isl_multi_aff_from_range(
3902 __isl_take isl_multi_aff *ma);
3903 __isl_give isl_pw_aff *isl_pw_aff_from_range(
3904 __isl_take isl_pw_aff *pwa);
3905 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
3906 __isl_take isl_multi_pw_aff *mpa);
3907 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
3908 __isl_take isl_set *set);
3909 __isl_give isl_union_pw_multi_aff *
3910 isl_union_pw_multi_aff_from_domain(
3911 __isl_take isl_union_set *uset);
3915 #include <isl/set.h>
3916 __isl_give isl_basic_set *isl_basic_set_fix_si(
3917 __isl_take isl_basic_set *bset,
3918 enum isl_dim_type type, unsigned pos, int value);
3919 __isl_give isl_basic_set *isl_basic_set_fix_val(
3920 __isl_take isl_basic_set *bset,
3921 enum isl_dim_type type, unsigned pos,
3922 __isl_take isl_val *v);
3923 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
3924 enum isl_dim_type type, unsigned pos, int value);
3925 __isl_give isl_set *isl_set_fix_val(
3926 __isl_take isl_set *set,
3927 enum isl_dim_type type, unsigned pos,
3928 __isl_take isl_val *v);
3930 #include <isl/map.h>
3931 __isl_give isl_basic_map *isl_basic_map_fix_si(
3932 __isl_take isl_basic_map *bmap,
3933 enum isl_dim_type type, unsigned pos, int value);
3934 __isl_give isl_basic_map *isl_basic_map_fix_val(
3935 __isl_take isl_basic_map *bmap,
3936 enum isl_dim_type type, unsigned pos,
3937 __isl_take isl_val *v);
3938 __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
3939 enum isl_dim_type type, unsigned pos, int value);
3940 __isl_give isl_map *isl_map_fix_val(
3941 __isl_take isl_map *map,
3942 enum isl_dim_type type, unsigned pos,
3943 __isl_take isl_val *v);
3945 #include <isl/aff.h>
3946 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
3947 __isl_take isl_pw_multi_aff *pma,
3948 enum isl_dim_type type, unsigned pos, int value);
3950 #include <isl/polynomial.h>
3951 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
3952 __isl_take isl_pw_qpolynomial *pwqp,
3953 enum isl_dim_type type, unsigned n,
3954 __isl_take isl_val *v);
3956 Intersect the set, relation or function domain
3957 with the hyperplane where the given
3958 dimension has the fixed given value.
3960 __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
3961 __isl_take isl_basic_map *bmap,
3962 enum isl_dim_type type, unsigned pos, int value);
3963 __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
3964 __isl_take isl_basic_map *bmap,
3965 enum isl_dim_type type, unsigned pos, int value);
3966 __isl_give isl_set *isl_set_lower_bound_si(
3967 __isl_take isl_set *set,
3968 enum isl_dim_type type, unsigned pos, int value);
3969 __isl_give isl_set *isl_set_lower_bound_val(
3970 __isl_take isl_set *set,
3971 enum isl_dim_type type, unsigned pos,
3972 __isl_take isl_val *value);
3973 __isl_give isl_map *isl_map_lower_bound_si(
3974 __isl_take isl_map *map,
3975 enum isl_dim_type type, unsigned pos, int value);
3976 __isl_give isl_set *isl_set_upper_bound_si(
3977 __isl_take isl_set *set,
3978 enum isl_dim_type type, unsigned pos, int value);
3979 __isl_give isl_set *isl_set_upper_bound_val(
3980 __isl_take isl_set *set,
3981 enum isl_dim_type type, unsigned pos,
3982 __isl_take isl_val *value);
3983 __isl_give isl_map *isl_map_upper_bound_si(
3984 __isl_take isl_map *map,
3985 enum isl_dim_type type, unsigned pos, int value);
3987 Intersect the set or relation with the half-space where the given
3988 dimension has a value bounded by the fixed given integer value.
3990 __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
3991 enum isl_dim_type type1, int pos1,
3992 enum isl_dim_type type2, int pos2);
3993 __isl_give isl_basic_map *isl_basic_map_equate(
3994 __isl_take isl_basic_map *bmap,
3995 enum isl_dim_type type1, int pos1,
3996 enum isl_dim_type type2, int pos2);
3997 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
3998 enum isl_dim_type type1, int pos1,
3999 enum isl_dim_type type2, int pos2);
4001 Intersect the set or relation with the hyperplane where the given
4002 dimensions are equal to each other.
4004 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4005 enum isl_dim_type type1, int pos1,
4006 enum isl_dim_type type2, int pos2);
4008 Intersect the relation with the hyperplane where the given
4009 dimensions have opposite values.
4011 __isl_give isl_map *isl_map_order_le(
4012 __isl_take isl_map *map,
4013 enum isl_dim_type type1, int pos1,
4014 enum isl_dim_type type2, int pos2);
4015 __isl_give isl_basic_map *isl_basic_map_order_ge(
4016 __isl_take isl_basic_map *bmap,
4017 enum isl_dim_type type1, int pos1,
4018 enum isl_dim_type type2, int pos2);
4019 __isl_give isl_map *isl_map_order_ge(
4020 __isl_take isl_map *map,
4021 enum isl_dim_type type1, int pos1,
4022 enum isl_dim_type type2, int pos2);
4023 __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4024 enum isl_dim_type type1, int pos1,
4025 enum isl_dim_type type2, int pos2);
4026 __isl_give isl_basic_map *isl_basic_map_order_gt(
4027 __isl_take isl_basic_map *bmap,
4028 enum isl_dim_type type1, int pos1,
4029 enum isl_dim_type type2, int pos2);
4030 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4031 enum isl_dim_type type1, int pos1,
4032 enum isl_dim_type type2, int pos2);
4034 Intersect the relation with the half-space where the given
4035 dimensions satisfy the given ordering.
4039 #include <isl/aff.h>
4040 __isl_give isl_basic_set *isl_aff_zero_basic_set(
4041 __isl_take isl_aff *aff);
4042 __isl_give isl_basic_set *isl_aff_neg_basic_set(
4043 __isl_take isl_aff *aff);
4044 __isl_give isl_set *isl_pw_aff_pos_set(
4045 __isl_take isl_pw_aff *pa);
4046 __isl_give isl_set *isl_pw_aff_nonneg_set(
4047 __isl_take isl_pw_aff *pwaff);
4048 __isl_give isl_set *isl_pw_aff_zero_set(
4049 __isl_take isl_pw_aff *pwaff);
4050 __isl_give isl_set *isl_pw_aff_non_zero_set(
4051 __isl_take isl_pw_aff *pwaff);
4053 The function C<isl_aff_neg_basic_set> returns a basic set
4054 containing those elements in the domain space
4055 of C<aff> where C<aff> is negative.
4056 The function C<isl_pw_aff_nonneg_set> returns a set
4057 containing those elements in the domain
4058 of C<pwaff> where C<pwaff> is non-negative.
4062 __isl_give isl_map *isl_set_identity(
4063 __isl_take isl_set *set);
4064 __isl_give isl_union_map *isl_union_set_identity(
4065 __isl_take isl_union_set *uset);
4066 __isl_give isl_union_pw_multi_aff *
4067 isl_union_set_identity_union_pw_multi_aff(
4068 __isl_take isl_union_set *uset);
4070 Construct an identity relation on the given (union) set.
4072 =item * Function Extraction
4074 A piecewise quasi affine expression that is equal to 1 on a set
4075 and 0 outside the set can be created using the following function.
4077 #include <isl/aff.h>
4078 __isl_give isl_pw_aff *isl_set_indicator_function(
4079 __isl_take isl_set *set);
4081 A piecewise multiple quasi affine expression can be extracted
4082 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4083 and the C<isl_map> is single-valued.
4084 In case of a conversion from an C<isl_union_map>
4085 to an C<isl_union_pw_multi_aff>, these properties need to hold
4086 in each domain space.
4088 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4089 __isl_take isl_set *set);
4090 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4091 __isl_take isl_map *map);
4093 __isl_give isl_union_pw_multi_aff *
4094 isl_union_pw_multi_aff_from_union_set(
4095 __isl_take isl_union_set *uset);
4096 __isl_give isl_union_pw_multi_aff *
4097 isl_union_pw_multi_aff_from_union_map(
4098 __isl_take isl_union_map *umap);
4102 __isl_give isl_basic_set *isl_basic_map_deltas(
4103 __isl_take isl_basic_map *bmap);
4104 __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4105 __isl_give isl_union_set *isl_union_map_deltas(
4106 __isl_take isl_union_map *umap);
4108 These functions return a (basic) set containing the differences
4109 between image elements and corresponding domain elements in the input.
4111 __isl_give isl_basic_map *isl_basic_map_deltas_map(
4112 __isl_take isl_basic_map *bmap);
4113 __isl_give isl_map *isl_map_deltas_map(
4114 __isl_take isl_map *map);
4115 __isl_give isl_union_map *isl_union_map_deltas_map(
4116 __isl_take isl_union_map *umap);
4118 The functions above construct a (basic, regular or union) relation
4119 that maps (a wrapped version of) the input relation to its delta set.
4123 Simplify the representation of a set, relation or functions by trying
4124 to combine pairs of basic sets or relations into a single
4125 basic set or relation.
4127 #include <isl/set.h>
4128 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4130 #include <isl/map.h>
4131 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4133 #include <isl/union_set.h>
4134 __isl_give isl_union_set *isl_union_set_coalesce(
4135 __isl_take isl_union_set *uset);
4137 #include <isl/union_map.h>
4138 __isl_give isl_union_map *isl_union_map_coalesce(
4139 __isl_take isl_union_map *umap);
4141 #include <isl/aff.h>
4142 __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4143 __isl_take isl_pw_aff *pwqp);
4144 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4145 __isl_take isl_pw_multi_aff *pma);
4146 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4147 __isl_take isl_multi_pw_aff *mpa);
4148 __isl_give isl_union_pw_multi_aff *
4149 isl_union_pw_multi_aff_coalesce(
4150 __isl_take isl_union_pw_multi_aff *upma);
4152 #include <isl/polynomial.h>
4153 __isl_give isl_pw_qpolynomial_fold *
4154 isl_pw_qpolynomial_fold_coalesce(
4155 __isl_take isl_pw_qpolynomial_fold *pwf);
4156 __isl_give isl_union_pw_qpolynomial *
4157 isl_union_pw_qpolynomial_coalesce(
4158 __isl_take isl_union_pw_qpolynomial *upwqp);
4159 __isl_give isl_union_pw_qpolynomial_fold *
4160 isl_union_pw_qpolynomial_fold_coalesce(
4161 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4163 One of the methods for combining pairs of basic sets or relations
4164 can result in coefficients that are much larger than those that appear
4165 in the constraints of the input. By default, the coefficients are
4166 not allowed to grow larger, but this can be changed by unsetting
4167 the following option.
4169 int isl_options_set_coalesce_bounded_wrapping(
4170 isl_ctx *ctx, int val);
4171 int isl_options_get_coalesce_bounded_wrapping(
4174 =item * Detecting equalities
4176 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4177 __isl_take isl_basic_set *bset);
4178 __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4179 __isl_take isl_basic_map *bmap);
4180 __isl_give isl_set *isl_set_detect_equalities(
4181 __isl_take isl_set *set);
4182 __isl_give isl_map *isl_map_detect_equalities(
4183 __isl_take isl_map *map);
4184 __isl_give isl_union_set *isl_union_set_detect_equalities(
4185 __isl_take isl_union_set *uset);
4186 __isl_give isl_union_map *isl_union_map_detect_equalities(
4187 __isl_take isl_union_map *umap);
4189 Simplify the representation of a set or relation by detecting implicit
4192 =item * Removing redundant constraints
4194 #include <isl/set.h>
4195 __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4196 __isl_take isl_basic_set *bset);
4197 __isl_give isl_set *isl_set_remove_redundancies(
4198 __isl_take isl_set *set);
4200 #include <isl/union_set.h>
4201 __isl_give isl_union_set *
4202 isl_union_set_remove_redundancies(
4203 __isl_take isl_union_set *uset);
4205 #include <isl/map.h>
4206 __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4207 __isl_take isl_basic_map *bmap);
4208 __isl_give isl_map *isl_map_remove_redundancies(
4209 __isl_take isl_map *map);
4211 #include <isl/union_map.h>
4212 __isl_give isl_union_map *
4213 isl_union_map_remove_redundancies(
4214 __isl_take isl_union_map *umap);
4218 __isl_give isl_basic_set *isl_set_convex_hull(
4219 __isl_take isl_set *set);
4220 __isl_give isl_basic_map *isl_map_convex_hull(
4221 __isl_take isl_map *map);
4223 If the input set or relation has any existentially quantified
4224 variables, then the result of these operations is currently undefined.
4228 #include <isl/set.h>
4229 __isl_give isl_basic_set *
4230 isl_set_unshifted_simple_hull(
4231 __isl_take isl_set *set);
4232 __isl_give isl_basic_set *isl_set_simple_hull(
4233 __isl_take isl_set *set);
4234 __isl_give isl_basic_set *
4235 isl_set_unshifted_simple_hull_from_set_list(
4236 __isl_take isl_set *set,
4237 __isl_take isl_set_list *list);
4239 #include <isl/map.h>
4240 __isl_give isl_basic_map *
4241 isl_map_unshifted_simple_hull(
4242 __isl_take isl_map *map);
4243 __isl_give isl_basic_map *isl_map_simple_hull(
4244 __isl_take isl_map *map);
4245 __isl_give isl_basic_map *
4246 isl_map_unshifted_simple_hull_from_map_list(
4247 __isl_take isl_map *map,
4248 __isl_take isl_map_list *list);
4250 #include <isl/union_map.h>
4251 __isl_give isl_union_map *isl_union_map_simple_hull(
4252 __isl_take isl_union_map *umap);
4254 These functions compute a single basic set or relation
4255 that contains the whole input set or relation.
4256 In particular, the output is described by translates
4257 of the constraints describing the basic sets or relations in the input.
4258 In case of C<isl_set_unshifted_simple_hull>, only the original
4259 constraints are used, without any translation.
4260 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4261 C<isl_map_unshifted_simple_hull_from_map_list>, the
4262 constraints are taken from the elements of the second argument.
4266 (See \autoref{s:simple hull}.)
4272 __isl_give isl_basic_set *isl_basic_set_affine_hull(
4273 __isl_take isl_basic_set *bset);
4274 __isl_give isl_basic_set *isl_set_affine_hull(
4275 __isl_take isl_set *set);
4276 __isl_give isl_union_set *isl_union_set_affine_hull(
4277 __isl_take isl_union_set *uset);
4278 __isl_give isl_basic_map *isl_basic_map_affine_hull(
4279 __isl_take isl_basic_map *bmap);
4280 __isl_give isl_basic_map *isl_map_affine_hull(
4281 __isl_take isl_map *map);
4282 __isl_give isl_union_map *isl_union_map_affine_hull(
4283 __isl_take isl_union_map *umap);
4285 In case of union sets and relations, the affine hull is computed
4288 =item * Polyhedral hull
4290 __isl_give isl_basic_set *isl_set_polyhedral_hull(
4291 __isl_take isl_set *set);
4292 __isl_give isl_basic_map *isl_map_polyhedral_hull(
4293 __isl_take isl_map *map);
4294 __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4295 __isl_take isl_union_set *uset);
4296 __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4297 __isl_take isl_union_map *umap);
4299 These functions compute a single basic set or relation
4300 not involving any existentially quantified variables
4301 that contains the whole input set or relation.
4302 In case of union sets and relations, the polyhedral hull is computed
4305 =item * Other approximations
4307 #include <isl/set.h>
4308 __isl_give isl_basic_set *
4309 isl_basic_set_drop_constraints_involving_dims(
4310 __isl_take isl_basic_set *bset,
4311 enum isl_dim_type type,
4312 unsigned first, unsigned n);
4313 __isl_give isl_basic_set *
4314 isl_basic_set_drop_constraints_not_involving_dims(
4315 __isl_take isl_basic_set *bset,
4316 enum isl_dim_type type,
4317 unsigned first, unsigned n);
4318 __isl_give isl_set *
4319 isl_set_drop_constraints_involving_dims(
4320 __isl_take isl_set *set,
4321 enum isl_dim_type type,
4322 unsigned first, unsigned n);
4324 #include <isl/map.h>
4325 __isl_give isl_basic_map *
4326 isl_basic_map_drop_constraints_involving_dims(
4327 __isl_take isl_basic_map *bmap,
4328 enum isl_dim_type type,
4329 unsigned first, unsigned n);
4330 __isl_give isl_map *
4331 isl_map_drop_constraints_involving_dims(
4332 __isl_take isl_map *map,
4333 enum isl_dim_type type,
4334 unsigned first, unsigned n);
4336 These functions drop any constraints (not) involving the specified dimensions.
4337 Note that the result depends on the representation of the input.
4339 #include <isl/polynomial.h>
4340 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4341 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4342 __isl_give isl_union_pw_qpolynomial *
4343 isl_union_pw_qpolynomial_to_polynomial(
4344 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4346 Approximate each quasipolynomial by a polynomial. If C<sign> is positive,
4347 the polynomial will be an overapproximation. If C<sign> is negative,
4348 it will be an underapproximation. If C<sign> is zero, the approximation
4349 will lie somewhere in between.
4353 __isl_give isl_basic_set *isl_basic_set_sample(
4354 __isl_take isl_basic_set *bset);
4355 __isl_give isl_basic_set *isl_set_sample(
4356 __isl_take isl_set *set);
4357 __isl_give isl_basic_map *isl_basic_map_sample(
4358 __isl_take isl_basic_map *bmap);
4359 __isl_give isl_basic_map *isl_map_sample(
4360 __isl_take isl_map *map);
4362 If the input (basic) set or relation is non-empty, then return
4363 a singleton subset of the input. Otherwise, return an empty set.
4365 =item * Optimization
4367 #include <isl/ilp.h>
4368 __isl_give isl_val *isl_basic_set_max_val(
4369 __isl_keep isl_basic_set *bset,
4370 __isl_keep isl_aff *obj);
4371 __isl_give isl_val *isl_set_min_val(
4372 __isl_keep isl_set *set,
4373 __isl_keep isl_aff *obj);
4374 __isl_give isl_val *isl_set_max_val(
4375 __isl_keep isl_set *set,
4376 __isl_keep isl_aff *obj);
4378 Compute the minimum or maximum of the integer affine expression C<obj>
4379 over the points in C<set>, returning the result in C<opt>.
4380 The result is C<NULL> in case of an error, the optimal value in case
4381 there is one, negative infinity or infinity if the problem is unbounded and
4382 NaN if the problem is empty.
4384 =item * Parametric optimization
4386 __isl_give isl_pw_aff *isl_set_dim_min(
4387 __isl_take isl_set *set, int pos);
4388 __isl_give isl_pw_aff *isl_set_dim_max(
4389 __isl_take isl_set *set, int pos);
4390 __isl_give isl_pw_aff *isl_map_dim_max(
4391 __isl_take isl_map *map, int pos);
4393 Compute the minimum or maximum of the given set or output dimension
4394 as a function of the parameters (and input dimensions), but independently
4395 of the other set or output dimensions.
4396 For lexicographic optimization, see L<"Lexicographic Optimization">.
4400 The following functions compute either the set of (rational) coefficient
4401 values of valid constraints for the given set or the set of (rational)
4402 values satisfying the constraints with coefficients from the given set.
4403 Internally, these two sets of functions perform essentially the
4404 same operations, except that the set of coefficients is assumed to
4405 be a cone, while the set of values may be any polyhedron.
4406 The current implementation is based on the Farkas lemma and
4407 Fourier-Motzkin elimination, but this may change or be made optional
4408 in future. In particular, future implementations may use different
4409 dualization algorithms or skip the elimination step.
4411 __isl_give isl_basic_set *isl_basic_set_coefficients(
4412 __isl_take isl_basic_set *bset);
4413 __isl_give isl_basic_set *isl_set_coefficients(
4414 __isl_take isl_set *set);
4415 __isl_give isl_union_set *isl_union_set_coefficients(
4416 __isl_take isl_union_set *bset);
4417 __isl_give isl_basic_set *isl_basic_set_solutions(
4418 __isl_take isl_basic_set *bset);
4419 __isl_give isl_basic_set *isl_set_solutions(
4420 __isl_take isl_set *set);
4421 __isl_give isl_union_set *isl_union_set_solutions(
4422 __isl_take isl_union_set *bset);
4426 __isl_give isl_map *isl_map_fixed_power_val(
4427 __isl_take isl_map *map,
4428 __isl_take isl_val *exp);
4429 __isl_give isl_union_map *
4430 isl_union_map_fixed_power_val(
4431 __isl_take isl_union_map *umap,
4432 __isl_take isl_val *exp);
4434 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4435 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4436 of C<map> is computed.
4438 __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4440 __isl_give isl_union_map *isl_union_map_power(
4441 __isl_take isl_union_map *umap, int *exact);
4443 Compute a parametric representation for all positive powers I<k> of C<map>.
4444 The result maps I<k> to a nested relation corresponding to the
4445 I<k>th power of C<map>.
4446 The result may be an overapproximation. If the result is known to be exact,
4447 then C<*exact> is set to C<1>.
4449 =item * Transitive closure
4451 __isl_give isl_map *isl_map_transitive_closure(
4452 __isl_take isl_map *map, int *exact);
4453 __isl_give isl_union_map *isl_union_map_transitive_closure(
4454 __isl_take isl_union_map *umap, int *exact);
4456 Compute the transitive closure of C<map>.
4457 The result may be an overapproximation. If the result is known to be exact,
4458 then C<*exact> is set to C<1>.
4460 =item * Reaching path lengths
4462 __isl_give isl_map *isl_map_reaching_path_lengths(
4463 __isl_take isl_map *map, int *exact);
4465 Compute a relation that maps each element in the range of C<map>
4466 to the lengths of all paths composed of edges in C<map> that
4467 end up in the given element.
4468 The result may be an overapproximation. If the result is known to be exact,
4469 then C<*exact> is set to C<1>.
4470 To compute the I<maximal> path length, the resulting relation
4471 should be postprocessed by C<isl_map_lexmax>.
4472 In particular, if the input relation is a dependence relation
4473 (mapping sources to sinks), then the maximal path length corresponds
4474 to the free schedule.
4475 Note, however, that C<isl_map_lexmax> expects the maximum to be
4476 finite, so if the path lengths are unbounded (possibly due to
4477 the overapproximation), then you will get an error message.
4481 #include <isl/space.h>
4482 __isl_give isl_space *isl_space_wrap(
4483 __isl_take isl_space *space);
4484 __isl_give isl_space *isl_space_unwrap(
4485 __isl_take isl_space *space);
4487 #include <isl/local_space.h>
4488 __isl_give isl_local_space *isl_local_space_wrap(
4489 __isl_take isl_local_space *ls);
4491 #include <isl/set.h>
4492 __isl_give isl_basic_map *isl_basic_set_unwrap(
4493 __isl_take isl_basic_set *bset);
4494 __isl_give isl_map *isl_set_unwrap(
4495 __isl_take isl_set *set);
4497 #include <isl/map.h>
4498 __isl_give isl_basic_set *isl_basic_map_wrap(
4499 __isl_take isl_basic_map *bmap);
4500 __isl_give isl_set *isl_map_wrap(
4501 __isl_take isl_map *map);
4503 #include <isl/union_set.h>
4504 __isl_give isl_union_map *isl_union_set_unwrap(
4505 __isl_take isl_union_set *uset);
4507 #include <isl/union_map.h>
4508 __isl_give isl_union_set *isl_union_map_wrap(
4509 __isl_take isl_union_map *umap);
4511 The input to C<isl_space_unwrap> should
4512 be the space of a set, while that of
4513 C<isl_space_wrap> should be the space of a relation.
4514 Conversely, the output of C<isl_space_unwrap> is the space
4515 of a relation, while that of C<isl_space_wrap> is the space of a set.
4519 Remove any internal structure of domain (and range) of the given
4520 set or relation. If there is any such internal structure in the input,
4521 then the name of the space is also removed.
4523 #include <isl/local_space.h>
4524 __isl_give isl_local_space *
4525 isl_local_space_flatten_domain(
4526 __isl_take isl_local_space *ls);
4527 __isl_give isl_local_space *
4528 isl_local_space_flatten_range(
4529 __isl_take isl_local_space *ls);
4531 #include <isl/set.h>
4532 __isl_give isl_basic_set *isl_basic_set_flatten(
4533 __isl_take isl_basic_set *bset);
4534 __isl_give isl_set *isl_set_flatten(
4535 __isl_take isl_set *set);
4537 #include <isl/map.h>
4538 __isl_give isl_basic_map *isl_basic_map_flatten_domain(
4539 __isl_take isl_basic_map *bmap);
4540 __isl_give isl_basic_map *isl_basic_map_flatten_range(
4541 __isl_take isl_basic_map *bmap);
4542 __isl_give isl_map *isl_map_flatten_range(
4543 __isl_take isl_map *map);
4544 __isl_give isl_map *isl_map_flatten_domain(
4545 __isl_take isl_map *map);
4546 __isl_give isl_basic_map *isl_basic_map_flatten(
4547 __isl_take isl_basic_map *bmap);
4548 __isl_give isl_map *isl_map_flatten(
4549 __isl_take isl_map *map);
4551 #include <isl/val.h>
4552 __isl_give isl_multi_val *isl_multi_val_flatten_range(
4553 __isl_take isl_multi_val *mv);
4555 #include <isl/aff.h>
4556 __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
4557 __isl_take isl_multi_aff *ma);
4558 __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
4559 __isl_take isl_multi_aff *ma);
4560 __isl_give isl_multi_pw_aff *
4561 isl_multi_pw_aff_flatten_range(
4562 __isl_take isl_multi_pw_aff *mpa);
4564 #include <isl/map.h>
4565 __isl_give isl_map *isl_set_flatten_map(
4566 __isl_take isl_set *set);
4568 The function above constructs a relation
4569 that maps the input set to a flattened version of the set.
4573 Lift the input set to a space with extra dimensions corresponding
4574 to the existentially quantified variables in the input.
4575 In particular, the result lives in a wrapped map where the domain
4576 is the original space and the range corresponds to the original
4577 existentially quantified variables.
4579 #include <isl/set.h>
4580 __isl_give isl_basic_set *isl_basic_set_lift(
4581 __isl_take isl_basic_set *bset);
4582 __isl_give isl_set *isl_set_lift(
4583 __isl_take isl_set *set);
4584 __isl_give isl_union_set *isl_union_set_lift(
4585 __isl_take isl_union_set *uset);
4587 Given a local space that contains the existentially quantified
4588 variables of a set, a basic relation that, when applied to
4589 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
4590 can be constructed using the following function.
4592 #include <isl/local_space.h>
4593 __isl_give isl_basic_map *isl_local_space_lifting(
4594 __isl_take isl_local_space *ls);
4596 #include <isl/aff.h>
4597 __isl_give isl_multi_aff *isl_multi_aff_lift(
4598 __isl_take isl_multi_aff *maff,
4599 __isl_give isl_local_space **ls);
4601 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
4602 then it is assigned the local space that lies at the basis of
4603 the lifting applied.
4605 =item * Internal Product
4607 #include <isl/space.h>
4608 __isl_give isl_space *isl_space_zip(
4609 __isl_take isl_space *space);
4611 #include <isl/map.h>
4612 __isl_give isl_basic_map *isl_basic_map_zip(
4613 __isl_take isl_basic_map *bmap);
4614 __isl_give isl_map *isl_map_zip(
4615 __isl_take isl_map *map);
4617 #include <isl/union_map.h>
4618 __isl_give isl_union_map *isl_union_map_zip(
4619 __isl_take isl_union_map *umap);
4621 Given a relation with nested relations for domain and range,
4622 interchange the range of the domain with the domain of the range.
4626 #include <isl/space.h>
4627 __isl_give isl_space *isl_space_curry(
4628 __isl_take isl_space *space);
4629 __isl_give isl_space *isl_space_uncurry(
4630 __isl_take isl_space *space);
4632 #include <isl/map.h>
4633 __isl_give isl_basic_map *isl_basic_map_curry(
4634 __isl_take isl_basic_map *bmap);
4635 __isl_give isl_basic_map *isl_basic_map_uncurry(
4636 __isl_take isl_basic_map *bmap);
4637 __isl_give isl_map *isl_map_curry(
4638 __isl_take isl_map *map);
4639 __isl_give isl_map *isl_map_uncurry(
4640 __isl_take isl_map *map);
4642 #include <isl/union_map.h>
4643 __isl_give isl_union_map *isl_union_map_curry(
4644 __isl_take isl_union_map *umap);
4645 __isl_give isl_union_map *isl_union_map_uncurry(
4646 __isl_take isl_union_map *umap);
4648 Given a relation with a nested relation for domain,
4649 the C<curry> functions
4650 move the range of the nested relation out of the domain
4651 and use it as the domain of a nested relation in the range,
4652 with the original range as range of this nested relation.
4653 The C<uncurry> functions perform the inverse operation.
4655 =item * Aligning parameters
4657 Change the order of the parameters of the given set, relation
4659 such that the first parameters match those of C<model>.
4660 This may involve the introduction of extra parameters.
4661 All parameters need to be named.
4663 #include <isl/space.h>
4664 __isl_give isl_space *isl_space_align_params(
4665 __isl_take isl_space *space1,
4666 __isl_take isl_space *space2)
4668 #include <isl/set.h>
4669 __isl_give isl_basic_set *isl_basic_set_align_params(
4670 __isl_take isl_basic_set *bset,
4671 __isl_take isl_space *model);
4672 __isl_give isl_set *isl_set_align_params(
4673 __isl_take isl_set *set,
4674 __isl_take isl_space *model);
4676 #include <isl/map.h>
4677 __isl_give isl_basic_map *isl_basic_map_align_params(
4678 __isl_take isl_basic_map *bmap,
4679 __isl_take isl_space *model);
4680 __isl_give isl_map *isl_map_align_params(
4681 __isl_take isl_map *map,
4682 __isl_take isl_space *model);
4684 #include <isl/val.h>
4685 __isl_give isl_multi_val *isl_multi_val_align_params(
4686 __isl_take isl_multi_val *mv,
4687 __isl_take isl_space *model);
4689 #include <isl/aff.h>
4690 __isl_give isl_aff *isl_aff_align_params(
4691 __isl_take isl_aff *aff,
4692 __isl_take isl_space *model);
4693 __isl_give isl_multi_aff *isl_multi_aff_align_params(
4694 __isl_take isl_multi_aff *multi,
4695 __isl_take isl_space *model);
4696 __isl_give isl_pw_aff *isl_pw_aff_align_params(
4697 __isl_take isl_pw_aff *pwaff,
4698 __isl_take isl_space *model);
4699 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
4700 __isl_take isl_pw_multi_aff *pma,
4701 __isl_take isl_space *model);
4702 __isl_give isl_union_pw_multi_aff *
4703 isl_union_pw_multi_aff_align_params(
4704 __isl_take isl_union_pw_multi_aff *upma,
4705 __isl_take isl_space *model);
4707 #include <isl/polynomial.h>
4708 __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
4709 __isl_take isl_qpolynomial *qp,
4710 __isl_take isl_space *model);
4712 =item * Unary Arithmethic Operations
4714 #include <isl/val.h>
4715 __isl_give isl_multi_val *isl_multi_val_neg(
4716 __isl_take isl_multi_val *mv);
4718 #include <isl/aff.h>
4719 __isl_give isl_aff *isl_aff_neg(
4720 __isl_take isl_aff *aff);
4721 __isl_give isl_multi_aff *isl_multi_aff_neg(
4722 __isl_take isl_multi_aff *ma);
4723 __isl_give isl_pw_aff *isl_pw_aff_neg(
4724 __isl_take isl_pw_aff *pwaff);
4725 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
4726 __isl_take isl_pw_multi_aff *pma);
4727 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
4728 __isl_take isl_multi_pw_aff *mpa);
4729 __isl_give isl_union_pw_multi_aff *
4730 isl_union_pw_multi_aff_neg(
4731 __isl_take isl_union_pw_multi_aff *upma);
4732 __isl_give isl_aff *isl_aff_ceil(
4733 __isl_take isl_aff *aff);
4734 __isl_give isl_pw_aff *isl_pw_aff_ceil(
4735 __isl_take isl_pw_aff *pwaff);
4736 __isl_give isl_aff *isl_aff_floor(
4737 __isl_take isl_aff *aff);
4738 __isl_give isl_multi_aff *isl_multi_aff_floor(
4739 __isl_take isl_multi_aff *ma);
4740 __isl_give isl_pw_aff *isl_pw_aff_floor(
4741 __isl_take isl_pw_aff *pwaff);
4743 #include <isl/aff.h>
4744 __isl_give isl_pw_aff *isl_pw_aff_list_min(
4745 __isl_take isl_pw_aff_list *list);
4746 __isl_give isl_pw_aff *isl_pw_aff_list_max(
4747 __isl_take isl_pw_aff_list *list);
4749 #include <isl/polynomial.h>
4750 __isl_give isl_qpolynomial *isl_qpolynomial_neg(
4751 __isl_take isl_qpolynomial *qp);
4752 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
4753 __isl_take isl_pw_qpolynomial *pwqp);
4754 __isl_give isl_union_pw_qpolynomial *
4755 isl_union_pw_qpolynomial_neg(
4756 __isl_take isl_union_pw_qpolynomial *upwqp);
4757 __isl_give isl_qpolynomial *isl_qpolynomial_pow(
4758 __isl_take isl_qpolynomial *qp,
4760 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
4761 __isl_take isl_pw_qpolynomial *pwqp,
4766 The following functions evaluate a function in a point.
4768 #include <isl/polynomial.h>
4769 __isl_give isl_val *isl_pw_qpolynomial_eval(
4770 __isl_take isl_pw_qpolynomial *pwqp,
4771 __isl_take isl_point *pnt);
4772 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
4773 __isl_take isl_pw_qpolynomial_fold *pwf,
4774 __isl_take isl_point *pnt);
4775 __isl_give isl_val *isl_union_pw_qpolynomial_eval(
4776 __isl_take isl_union_pw_qpolynomial *upwqp,
4777 __isl_take isl_point *pnt);
4778 __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
4779 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4780 __isl_take isl_point *pnt);
4782 =item * Dimension manipulation
4784 It is usually not advisable to directly change the (input or output)
4785 space of a set or a relation as this removes the name and the internal
4786 structure of the space. However, the functions below can be useful
4787 to add new parameters, assuming
4788 C<isl_set_align_params> and C<isl_map_align_params>
4791 #include <isl/space.h>
4792 __isl_give isl_space *isl_space_add_dims(
4793 __isl_take isl_space *space,
4794 enum isl_dim_type type, unsigned n);
4795 __isl_give isl_space *isl_space_insert_dims(
4796 __isl_take isl_space *space,
4797 enum isl_dim_type type, unsigned pos, unsigned n);
4798 __isl_give isl_space *isl_space_drop_dims(
4799 __isl_take isl_space *space,
4800 enum isl_dim_type type, unsigned first, unsigned n);
4801 __isl_give isl_space *isl_space_move_dims(
4802 __isl_take isl_space *space,
4803 enum isl_dim_type dst_type, unsigned dst_pos,
4804 enum isl_dim_type src_type, unsigned src_pos,
4807 #include <isl/local_space.h>
4808 __isl_give isl_local_space *isl_local_space_add_dims(
4809 __isl_take isl_local_space *ls,
4810 enum isl_dim_type type, unsigned n);
4811 __isl_give isl_local_space *isl_local_space_insert_dims(
4812 __isl_take isl_local_space *ls,
4813 enum isl_dim_type type, unsigned first, unsigned n);
4814 __isl_give isl_local_space *isl_local_space_drop_dims(
4815 __isl_take isl_local_space *ls,
4816 enum isl_dim_type type, unsigned first, unsigned n);
4818 #include <isl/set.h>
4819 __isl_give isl_basic_set *isl_basic_set_add_dims(
4820 __isl_take isl_basic_set *bset,
4821 enum isl_dim_type type, unsigned n);
4822 __isl_give isl_set *isl_set_add_dims(
4823 __isl_take isl_set *set,
4824 enum isl_dim_type type, unsigned n);
4825 __isl_give isl_basic_set *isl_basic_set_insert_dims(
4826 __isl_take isl_basic_set *bset,
4827 enum isl_dim_type type, unsigned pos,
4829 __isl_give isl_set *isl_set_insert_dims(
4830 __isl_take isl_set *set,
4831 enum isl_dim_type type, unsigned pos, unsigned n);
4832 __isl_give isl_basic_set *isl_basic_set_move_dims(
4833 __isl_take isl_basic_set *bset,
4834 enum isl_dim_type dst_type, unsigned dst_pos,
4835 enum isl_dim_type src_type, unsigned src_pos,
4837 __isl_give isl_set *isl_set_move_dims(
4838 __isl_take isl_set *set,
4839 enum isl_dim_type dst_type, unsigned dst_pos,
4840 enum isl_dim_type src_type, unsigned src_pos,
4843 #include <isl/map.h>
4844 __isl_give isl_map *isl_map_add_dims(
4845 __isl_take isl_map *map,
4846 enum isl_dim_type type, unsigned n);
4847 __isl_give isl_basic_map *isl_basic_map_insert_dims(
4848 __isl_take isl_basic_map *bmap,
4849 enum isl_dim_type type, unsigned pos,
4851 __isl_give isl_map *isl_map_insert_dims(
4852 __isl_take isl_map *map,
4853 enum isl_dim_type type, unsigned pos, unsigned n);
4854 __isl_give isl_basic_map *isl_basic_map_move_dims(
4855 __isl_take isl_basic_map *bmap,
4856 enum isl_dim_type dst_type, unsigned dst_pos,
4857 enum isl_dim_type src_type, unsigned src_pos,
4859 __isl_give isl_map *isl_map_move_dims(
4860 __isl_take isl_map *map,
4861 enum isl_dim_type dst_type, unsigned dst_pos,
4862 enum isl_dim_type src_type, unsigned src_pos,
4865 #include <isl/val.h>
4866 __isl_give isl_multi_val *isl_multi_val_insert_dims(
4867 __isl_take isl_multi_val *mv,
4868 enum isl_dim_type type, unsigned first, unsigned n);
4869 __isl_give isl_multi_val *isl_multi_val_add_dims(
4870 __isl_take isl_multi_val *mv,
4871 enum isl_dim_type type, unsigned n);
4872 __isl_give isl_multi_val *isl_multi_val_drop_dims(
4873 __isl_take isl_multi_val *mv,
4874 enum isl_dim_type type, unsigned first, unsigned n);
4876 #include <isl/aff.h>
4877 __isl_give isl_aff *isl_aff_insert_dims(
4878 __isl_take isl_aff *aff,
4879 enum isl_dim_type type, unsigned first, unsigned n);
4880 __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
4881 __isl_take isl_multi_aff *ma,
4882 enum isl_dim_type type, unsigned first, unsigned n);
4883 __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
4884 __isl_take isl_pw_aff *pwaff,
4885 enum isl_dim_type type, unsigned first, unsigned n);
4886 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
4887 __isl_take isl_multi_pw_aff *mpa,
4888 enum isl_dim_type type, unsigned first, unsigned n);
4889 __isl_give isl_aff *isl_aff_add_dims(
4890 __isl_take isl_aff *aff,
4891 enum isl_dim_type type, unsigned n);
4892 __isl_give isl_multi_aff *isl_multi_aff_add_dims(
4893 __isl_take isl_multi_aff *ma,
4894 enum isl_dim_type type, unsigned n);
4895 __isl_give isl_pw_aff *isl_pw_aff_add_dims(
4896 __isl_take isl_pw_aff *pwaff,
4897 enum isl_dim_type type, unsigned n);
4898 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
4899 __isl_take isl_multi_pw_aff *mpa,
4900 enum isl_dim_type type, unsigned n);
4901 __isl_give isl_aff *isl_aff_drop_dims(
4902 __isl_take isl_aff *aff,
4903 enum isl_dim_type type, unsigned first, unsigned n);
4904 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
4905 __isl_take isl_multi_aff *maff,
4906 enum isl_dim_type type, unsigned first, unsigned n);
4907 __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
4908 __isl_take isl_pw_aff *pwaff,
4909 enum isl_dim_type type, unsigned first, unsigned n);
4910 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
4911 __isl_take isl_pw_multi_aff *pma,
4912 enum isl_dim_type type, unsigned first, unsigned n);
4913 __isl_give isl_aff *isl_aff_move_dims(
4914 __isl_take isl_aff *aff,
4915 enum isl_dim_type dst_type, unsigned dst_pos,
4916 enum isl_dim_type src_type, unsigned src_pos,
4918 __isl_give isl_multi_aff *isl_multi_aff_move_dims(
4919 __isl_take isl_multi_aff *ma,
4920 enum isl_dim_type dst_type, unsigned dst_pos,
4921 enum isl_dim_type src_type, unsigned src_pos,
4923 __isl_give isl_pw_aff *isl_pw_aff_move_dims(
4924 __isl_take isl_pw_aff *pa,
4925 enum isl_dim_type dst_type, unsigned dst_pos,
4926 enum isl_dim_type src_type, unsigned src_pos,
4928 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
4929 __isl_take isl_multi_pw_aff *pma,
4930 enum isl_dim_type dst_type, unsigned dst_pos,
4931 enum isl_dim_type src_type, unsigned src_pos,
4936 =head2 Binary Operations
4938 The two arguments of a binary operation not only need to live
4939 in the same C<isl_ctx>, they currently also need to have
4940 the same (number of) parameters.
4942 =head3 Basic Operations
4946 =item * Intersection
4948 #include <isl/local_space.h>
4949 __isl_give isl_local_space *isl_local_space_intersect(
4950 __isl_take isl_local_space *ls1,
4951 __isl_take isl_local_space *ls2);
4953 #include <isl/set.h>
4954 __isl_give isl_basic_set *isl_basic_set_intersect_params(
4955 __isl_take isl_basic_set *bset1,
4956 __isl_take isl_basic_set *bset2);
4957 __isl_give isl_basic_set *isl_basic_set_intersect(
4958 __isl_take isl_basic_set *bset1,
4959 __isl_take isl_basic_set *bset2);
4960 __isl_give isl_basic_set *isl_basic_set_list_intersect(
4961 __isl_take struct isl_basic_set_list *list);
4962 __isl_give isl_set *isl_set_intersect_params(
4963 __isl_take isl_set *set,
4964 __isl_take isl_set *params);
4965 __isl_give isl_set *isl_set_intersect(
4966 __isl_take isl_set *set1,
4967 __isl_take isl_set *set2);
4969 #include <isl/map.h>
4970 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
4971 __isl_take isl_basic_map *bmap,
4972 __isl_take isl_basic_set *bset);
4973 __isl_give isl_basic_map *isl_basic_map_intersect_range(
4974 __isl_take isl_basic_map *bmap,
4975 __isl_take isl_basic_set *bset);
4976 __isl_give isl_basic_map *isl_basic_map_intersect(
4977 __isl_take isl_basic_map *bmap1,
4978 __isl_take isl_basic_map *bmap2);
4979 __isl_give isl_basic_map *isl_basic_map_list_intersect(
4980 __isl_take isl_basic_map_list *list);
4981 __isl_give isl_map *isl_map_intersect_params(
4982 __isl_take isl_map *map,
4983 __isl_take isl_set *params);
4984 __isl_give isl_map *isl_map_intersect_domain(
4985 __isl_take isl_map *map,
4986 __isl_take isl_set *set);
4987 __isl_give isl_map *isl_map_intersect_range(
4988 __isl_take isl_map *map,
4989 __isl_take isl_set *set);
4990 __isl_give isl_map *isl_map_intersect(
4991 __isl_take isl_map *map1,
4992 __isl_take isl_map *map2);
4994 #include <isl/union_set.h>
4995 __isl_give isl_union_set *isl_union_set_intersect_params(
4996 __isl_take isl_union_set *uset,
4997 __isl_take isl_set *set);
4998 __isl_give isl_union_set *isl_union_set_intersect(
4999 __isl_take isl_union_set *uset1,
5000 __isl_take isl_union_set *uset2);
5002 #include <isl/union_map.h>
5003 __isl_give isl_union_map *isl_union_map_intersect_params(
5004 __isl_take isl_union_map *umap,
5005 __isl_take isl_set *set);
5006 __isl_give isl_union_map *isl_union_map_intersect_domain(
5007 __isl_take isl_union_map *umap,
5008 __isl_take isl_union_set *uset);
5009 __isl_give isl_union_map *isl_union_map_intersect_range(
5010 __isl_take isl_union_map *umap,
5011 __isl_take isl_union_set *uset);
5012 __isl_give isl_union_map *isl_union_map_intersect(
5013 __isl_take isl_union_map *umap1,
5014 __isl_take isl_union_map *umap2);
5016 #include <isl/aff.h>
5017 __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5018 __isl_take isl_pw_aff *pa,
5019 __isl_take isl_set *set);
5020 __isl_give isl_multi_pw_aff *
5021 isl_multi_pw_aff_intersect_domain(
5022 __isl_take isl_multi_pw_aff *mpa,
5023 __isl_take isl_set *domain);
5024 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5025 __isl_take isl_pw_multi_aff *pma,
5026 __isl_take isl_set *set);
5027 __isl_give isl_union_pw_multi_aff *
5028 isl_union_pw_multi_aff_intersect_domain(
5029 __isl_take isl_union_pw_multi_aff *upma,
5030 __isl_take isl_union_set *uset);
5031 __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5032 __isl_take isl_pw_aff *pa,
5033 __isl_take isl_set *set);
5034 __isl_give isl_multi_pw_aff *
5035 isl_multi_pw_aff_intersect_params(
5036 __isl_take isl_multi_pw_aff *mpa,
5037 __isl_take isl_set *set);
5038 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5039 __isl_take isl_pw_multi_aff *pma,
5040 __isl_take isl_set *set);
5041 __isl_give isl_union_pw_multi_aff *
5042 isl_union_pw_multi_aff_intersect_params(
5043 __isl_take isl_union_pw_multi_aff *upma,
5044 __isl_take isl_set *set);
5046 #include <isl/polynomial.h>
5047 __isl_give isl_pw_qpolynomial *
5048 isl_pw_qpolynomial_intersect_domain(
5049 __isl_take isl_pw_qpolynomial *pwpq,
5050 __isl_take isl_set *set);
5051 __isl_give isl_union_pw_qpolynomial *
5052 isl_union_pw_qpolynomial_intersect_domain(
5053 __isl_take isl_union_pw_qpolynomial *upwpq,
5054 __isl_take isl_union_set *uset);
5055 __isl_give isl_union_pw_qpolynomial_fold *
5056 isl_union_pw_qpolynomial_fold_intersect_domain(
5057 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5058 __isl_take isl_union_set *uset);
5059 __isl_give isl_pw_qpolynomial *
5060 isl_pw_qpolynomial_intersect_params(
5061 __isl_take isl_pw_qpolynomial *pwpq,
5062 __isl_take isl_set *set);
5063 __isl_give isl_pw_qpolynomial_fold *
5064 isl_pw_qpolynomial_fold_intersect_params(
5065 __isl_take isl_pw_qpolynomial_fold *pwf,
5066 __isl_take isl_set *set);
5067 __isl_give isl_union_pw_qpolynomial *
5068 isl_union_pw_qpolynomial_intersect_params(
5069 __isl_take isl_union_pw_qpolynomial *upwpq,
5070 __isl_take isl_set *set);
5071 __isl_give isl_union_pw_qpolynomial_fold *
5072 isl_union_pw_qpolynomial_fold_intersect_params(
5073 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5074 __isl_take isl_set *set);
5076 The second argument to the C<_params> functions needs to be
5077 a parametric (basic) set. For the other functions, a parametric set
5078 for either argument is only allowed if the other argument is
5079 a parametric set as well.
5080 The list passed to C<isl_basic_set_list_intersect> needs to have
5081 at least one element and all elements need to live in the same space.
5085 #include <isl/set.h>
5086 __isl_give isl_set *isl_basic_set_union(
5087 __isl_take isl_basic_set *bset1,
5088 __isl_take isl_basic_set *bset2);
5089 __isl_give isl_set *isl_set_union(
5090 __isl_take isl_set *set1,
5091 __isl_take isl_set *set2);
5093 #include <isl/map.h>
5094 __isl_give isl_map *isl_basic_map_union(
5095 __isl_take isl_basic_map *bmap1,
5096 __isl_take isl_basic_map *bmap2);
5097 __isl_give isl_map *isl_map_union(
5098 __isl_take isl_map *map1,
5099 __isl_take isl_map *map2);
5101 #include <isl/union_set.h>
5102 __isl_give isl_union_set *isl_union_set_union(
5103 __isl_take isl_union_set *uset1,
5104 __isl_take isl_union_set *uset2);
5105 __isl_give isl_union_set *isl_union_set_list_union(
5106 __isl_take isl_union_set_list *list);
5108 #include <isl/union_map.h>
5109 __isl_give isl_union_map *isl_union_map_union(
5110 __isl_take isl_union_map *umap1,
5111 __isl_take isl_union_map *umap2);
5113 =item * Set difference
5115 #include <isl/set.h>
5116 __isl_give isl_set *isl_set_subtract(
5117 __isl_take isl_set *set1,
5118 __isl_take isl_set *set2);
5120 #include <isl/map.h>
5121 __isl_give isl_map *isl_map_subtract(
5122 __isl_take isl_map *map1,
5123 __isl_take isl_map *map2);
5124 __isl_give isl_map *isl_map_subtract_domain(
5125 __isl_take isl_map *map,
5126 __isl_take isl_set *dom);
5127 __isl_give isl_map *isl_map_subtract_range(
5128 __isl_take isl_map *map,
5129 __isl_take isl_set *dom);
5131 #include <isl/union_set.h>
5132 __isl_give isl_union_set *isl_union_set_subtract(
5133 __isl_take isl_union_set *uset1,
5134 __isl_take isl_union_set *uset2);
5136 #include <isl/union_map.h>
5137 __isl_give isl_union_map *isl_union_map_subtract(
5138 __isl_take isl_union_map *umap1,
5139 __isl_take isl_union_map *umap2);
5140 __isl_give isl_union_map *isl_union_map_subtract_domain(
5141 __isl_take isl_union_map *umap,
5142 __isl_take isl_union_set *dom);
5143 __isl_give isl_union_map *isl_union_map_subtract_range(
5144 __isl_take isl_union_map *umap,
5145 __isl_take isl_union_set *dom);
5147 #include <isl/aff.h>
5148 __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5149 __isl_take isl_pw_aff *pa,
5150 __isl_take isl_set *set);
5151 __isl_give isl_pw_multi_aff *
5152 isl_pw_multi_aff_subtract_domain(
5153 __isl_take isl_pw_multi_aff *pma,
5154 __isl_take isl_set *set);
5155 __isl_give isl_union_pw_multi_aff *
5156 isl_union_pw_multi_aff_subtract_domain(
5157 __isl_take isl_union_pw_multi_aff *upma,
5158 __isl_take isl_union_set *uset);
5160 #include <isl/polynomial.h>
5161 __isl_give isl_pw_qpolynomial *
5162 isl_pw_qpolynomial_subtract_domain(
5163 __isl_take isl_pw_qpolynomial *pwpq,
5164 __isl_take isl_set *set);
5165 __isl_give isl_pw_qpolynomial_fold *
5166 isl_pw_qpolynomial_fold_subtract_domain(
5167 __isl_take isl_pw_qpolynomial_fold *pwf,
5168 __isl_take isl_set *set);
5169 __isl_give isl_union_pw_qpolynomial *
5170 isl_union_pw_qpolynomial_subtract_domain(
5171 __isl_take isl_union_pw_qpolynomial *upwpq,
5172 __isl_take isl_union_set *uset);
5173 __isl_give isl_union_pw_qpolynomial_fold *
5174 isl_union_pw_qpolynomial_fold_subtract_domain(
5175 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5176 __isl_take isl_union_set *uset);
5180 #include <isl/space.h>
5181 __isl_give isl_space *isl_space_join(
5182 __isl_take isl_space *left,
5183 __isl_take isl_space *right);
5185 #include <isl/map.h>
5186 __isl_give isl_basic_set *isl_basic_set_apply(
5187 __isl_take isl_basic_set *bset,
5188 __isl_take isl_basic_map *bmap);
5189 __isl_give isl_set *isl_set_apply(
5190 __isl_take isl_set *set,
5191 __isl_take isl_map *map);
5192 __isl_give isl_union_set *isl_union_set_apply(
5193 __isl_take isl_union_set *uset,
5194 __isl_take isl_union_map *umap);
5195 __isl_give isl_basic_map *isl_basic_map_apply_domain(
5196 __isl_take isl_basic_map *bmap1,
5197 __isl_take isl_basic_map *bmap2);
5198 __isl_give isl_basic_map *isl_basic_map_apply_range(
5199 __isl_take isl_basic_map *bmap1,
5200 __isl_take isl_basic_map *bmap2);
5201 __isl_give isl_map *isl_map_apply_domain(
5202 __isl_take isl_map *map1,
5203 __isl_take isl_map *map2);
5204 __isl_give isl_map *isl_map_apply_range(
5205 __isl_take isl_map *map1,
5206 __isl_take isl_map *map2);
5208 #include <isl/union_map.h>
5209 __isl_give isl_union_map *isl_union_map_apply_domain(
5210 __isl_take isl_union_map *umap1,
5211 __isl_take isl_union_map *umap2);
5212 __isl_give isl_union_map *isl_union_map_apply_range(
5213 __isl_take isl_union_map *umap1,
5214 __isl_take isl_union_map *umap2);
5216 #include <isl/polynomial.h>
5217 __isl_give isl_pw_qpolynomial_fold *
5218 isl_set_apply_pw_qpolynomial_fold(
5219 __isl_take isl_set *set,
5220 __isl_take isl_pw_qpolynomial_fold *pwf,
5222 __isl_give isl_pw_qpolynomial_fold *
5223 isl_map_apply_pw_qpolynomial_fold(
5224 __isl_take isl_map *map,
5225 __isl_take isl_pw_qpolynomial_fold *pwf,
5227 __isl_give isl_union_pw_qpolynomial_fold *
5228 isl_union_set_apply_union_pw_qpolynomial_fold(
5229 __isl_take isl_union_set *uset,
5230 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5232 __isl_give isl_union_pw_qpolynomial_fold *
5233 isl_union_map_apply_union_pw_qpolynomial_fold(
5234 __isl_take isl_union_map *umap,
5235 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5238 The functions taking a map
5239 compose the given map with the given piecewise quasipolynomial reduction.
5240 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5241 over all elements in the intersection of the range of the map
5242 and the domain of the piecewise quasipolynomial reduction
5243 as a function of an element in the domain of the map.
5244 The functions taking a set compute a bound over all elements in the
5245 intersection of the set and the domain of the
5246 piecewise quasipolynomial reduction.
5250 #include <isl/set.h>
5251 __isl_give isl_basic_set *
5252 isl_basic_set_preimage_multi_aff(
5253 __isl_take isl_basic_set *bset,
5254 __isl_take isl_multi_aff *ma);
5255 __isl_give isl_set *isl_set_preimage_multi_aff(
5256 __isl_take isl_set *set,
5257 __isl_take isl_multi_aff *ma);
5258 __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5259 __isl_take isl_set *set,
5260 __isl_take isl_pw_multi_aff *pma);
5261 __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5262 __isl_take isl_set *set,
5263 __isl_take isl_multi_pw_aff *mpa);
5265 #include <isl/union_set.h>
5266 __isl_give isl_union_set *
5267 isl_union_set_preimage_multi_aff(
5268 __isl_take isl_union_set *uset,
5269 __isl_take isl_multi_aff *ma);
5270 __isl_give isl_union_set *
5271 isl_union_set_preimage_pw_multi_aff(
5272 __isl_take isl_union_set *uset,
5273 __isl_take isl_pw_multi_aff *pma);
5274 __isl_give isl_union_set *
5275 isl_union_set_preimage_union_pw_multi_aff(
5276 __isl_take isl_union_set *uset,
5277 __isl_take isl_union_pw_multi_aff *upma);
5279 #include <isl/map.h>
5280 __isl_give isl_basic_map *
5281 isl_basic_map_preimage_domain_multi_aff(
5282 __isl_take isl_basic_map *bmap,
5283 __isl_take isl_multi_aff *ma);
5284 __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5285 __isl_take isl_map *map,
5286 __isl_take isl_multi_aff *ma);
5287 __isl_give isl_map *isl_map_preimage_range_multi_aff(
5288 __isl_take isl_map *map,
5289 __isl_take isl_multi_aff *ma);
5290 __isl_give isl_map *
5291 isl_map_preimage_domain_pw_multi_aff(
5292 __isl_take isl_map *map,
5293 __isl_take isl_pw_multi_aff *pma);
5294 __isl_give isl_map *
5295 isl_map_preimage_range_pw_multi_aff(
5296 __isl_take isl_map *map,
5297 __isl_take isl_pw_multi_aff *pma);
5298 __isl_give isl_map *
5299 isl_map_preimage_domain_multi_pw_aff(
5300 __isl_take isl_map *map,
5301 __isl_take isl_multi_pw_aff *mpa);
5302 __isl_give isl_basic_map *
5303 isl_basic_map_preimage_range_multi_aff(
5304 __isl_take isl_basic_map *bmap,
5305 __isl_take isl_multi_aff *ma);
5307 #include <isl/union_map.h>
5308 __isl_give isl_union_map *
5309 isl_union_map_preimage_domain_multi_aff(
5310 __isl_take isl_union_map *umap,
5311 __isl_take isl_multi_aff *ma);
5312 __isl_give isl_union_map *
5313 isl_union_map_preimage_range_multi_aff(
5314 __isl_take isl_union_map *umap,
5315 __isl_take isl_multi_aff *ma);
5316 __isl_give isl_union_map *
5317 isl_union_map_preimage_domain_pw_multi_aff(
5318 __isl_take isl_union_map *umap,
5319 __isl_take isl_pw_multi_aff *pma);
5320 __isl_give isl_union_map *
5321 isl_union_map_preimage_range_pw_multi_aff(
5322 __isl_take isl_union_map *umap,
5323 __isl_take isl_pw_multi_aff *pma);
5324 __isl_give isl_union_map *
5325 isl_union_map_preimage_domain_union_pw_multi_aff(
5326 __isl_take isl_union_map *umap,
5327 __isl_take isl_union_pw_multi_aff *upma);
5328 __isl_give isl_union_map *
5329 isl_union_map_preimage_range_union_pw_multi_aff(
5330 __isl_take isl_union_map *umap,
5331 __isl_take isl_union_pw_multi_aff *upma);
5333 These functions compute the preimage of the given set or map domain/range under
5334 the given function. In other words, the expression is plugged
5335 into the set description or into the domain/range of the map.
5339 #include <isl/aff.h>
5340 __isl_give isl_aff *isl_aff_pullback_aff(
5341 __isl_take isl_aff *aff1,
5342 __isl_take isl_aff *aff2);
5343 __isl_give isl_aff *isl_aff_pullback_multi_aff(
5344 __isl_take isl_aff *aff,
5345 __isl_take isl_multi_aff *ma);
5346 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5347 __isl_take isl_pw_aff *pa,
5348 __isl_take isl_multi_aff *ma);
5349 __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5350 __isl_take isl_pw_aff *pa,
5351 __isl_take isl_pw_multi_aff *pma);
5352 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5353 __isl_take isl_pw_aff *pa,
5354 __isl_take isl_multi_pw_aff *mpa);
5355 __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5356 __isl_take isl_multi_aff *ma1,
5357 __isl_take isl_multi_aff *ma2);
5358 __isl_give isl_pw_multi_aff *
5359 isl_pw_multi_aff_pullback_multi_aff(
5360 __isl_take isl_pw_multi_aff *pma,
5361 __isl_take isl_multi_aff *ma);
5362 __isl_give isl_multi_pw_aff *
5363 isl_multi_pw_aff_pullback_multi_aff(
5364 __isl_take isl_multi_pw_aff *mpa,
5365 __isl_take isl_multi_aff *ma);
5366 __isl_give isl_pw_multi_aff *
5367 isl_pw_multi_aff_pullback_pw_multi_aff(
5368 __isl_take isl_pw_multi_aff *pma1,
5369 __isl_take isl_pw_multi_aff *pma2);
5370 __isl_give isl_multi_pw_aff *
5371 isl_multi_pw_aff_pullback_pw_multi_aff(
5372 __isl_take isl_multi_pw_aff *mpa,
5373 __isl_take isl_pw_multi_aff *pma);
5374 __isl_give isl_multi_pw_aff *
5375 isl_multi_pw_aff_pullback_multi_pw_aff(
5376 __isl_take isl_multi_pw_aff *mpa1,
5377 __isl_take isl_multi_pw_aff *mpa2);
5379 These functions precompose the first expression by the second function.
5380 In other words, the second function is plugged
5381 into the first expression.
5385 #include <isl/aff.h>
5386 __isl_give isl_basic_set *isl_aff_le_basic_set(
5387 __isl_take isl_aff *aff1,
5388 __isl_take isl_aff *aff2);
5389 __isl_give isl_basic_set *isl_aff_ge_basic_set(
5390 __isl_take isl_aff *aff1,
5391 __isl_take isl_aff *aff2);
5392 __isl_give isl_set *isl_pw_aff_eq_set(
5393 __isl_take isl_pw_aff *pwaff1,
5394 __isl_take isl_pw_aff *pwaff2);
5395 __isl_give isl_set *isl_pw_aff_ne_set(
5396 __isl_take isl_pw_aff *pwaff1,
5397 __isl_take isl_pw_aff *pwaff2);
5398 __isl_give isl_set *isl_pw_aff_le_set(
5399 __isl_take isl_pw_aff *pwaff1,
5400 __isl_take isl_pw_aff *pwaff2);
5401 __isl_give isl_set *isl_pw_aff_lt_set(
5402 __isl_take isl_pw_aff *pwaff1,
5403 __isl_take isl_pw_aff *pwaff2);
5404 __isl_give isl_set *isl_pw_aff_ge_set(
5405 __isl_take isl_pw_aff *pwaff1,
5406 __isl_take isl_pw_aff *pwaff2);
5407 __isl_give isl_set *isl_pw_aff_gt_set(
5408 __isl_take isl_pw_aff *pwaff1,
5409 __isl_take isl_pw_aff *pwaff2);
5411 __isl_give isl_set *isl_multi_aff_lex_le_set(
5412 __isl_take isl_multi_aff *ma1,
5413 __isl_take isl_multi_aff *ma2);
5414 __isl_give isl_set *isl_multi_aff_lex_ge_set(
5415 __isl_take isl_multi_aff *ma1,
5416 __isl_take isl_multi_aff *ma2);
5418 __isl_give isl_set *isl_pw_aff_list_eq_set(
5419 __isl_take isl_pw_aff_list *list1,
5420 __isl_take isl_pw_aff_list *list2);
5421 __isl_give isl_set *isl_pw_aff_list_ne_set(
5422 __isl_take isl_pw_aff_list *list1,
5423 __isl_take isl_pw_aff_list *list2);
5424 __isl_give isl_set *isl_pw_aff_list_le_set(
5425 __isl_take isl_pw_aff_list *list1,
5426 __isl_take isl_pw_aff_list *list2);
5427 __isl_give isl_set *isl_pw_aff_list_lt_set(
5428 __isl_take isl_pw_aff_list *list1,
5429 __isl_take isl_pw_aff_list *list2);
5430 __isl_give isl_set *isl_pw_aff_list_ge_set(
5431 __isl_take isl_pw_aff_list *list1,
5432 __isl_take isl_pw_aff_list *list2);
5433 __isl_give isl_set *isl_pw_aff_list_gt_set(
5434 __isl_take isl_pw_aff_list *list1,
5435 __isl_take isl_pw_aff_list *list2);
5437 The function C<isl_aff_ge_basic_set> returns a basic set
5438 containing those elements in the shared space
5439 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
5440 The function C<isl_pw_aff_ge_set> returns a set
5441 containing those elements in the shared domain
5442 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
5443 greater than or equal to C<pwaff2>.
5444 The function C<isl_multi_aff_lex_le_set> returns a set
5445 containing those elements in the shared domain space
5446 where C<ma1> is lexicographically smaller than or
5448 The functions operating on C<isl_pw_aff_list> apply the corresponding
5449 C<isl_pw_aff> function to each pair of elements in the two lists.
5451 =item * Cartesian Product
5453 #include <isl/space.h>
5454 __isl_give isl_space *isl_space_product(
5455 __isl_take isl_space *space1,
5456 __isl_take isl_space *space2);
5457 __isl_give isl_space *isl_space_domain_product(
5458 __isl_take isl_space *space1,
5459 __isl_take isl_space *space2);
5460 __isl_give isl_space *isl_space_range_product(
5461 __isl_take isl_space *space1,
5462 __isl_take isl_space *space2);
5465 C<isl_space_product>, C<isl_space_domain_product>
5466 and C<isl_space_range_product> take pairs or relation spaces and
5467 produce a single relations space, where either the domain, the range
5468 or both domain and range are wrapped spaces of relations between
5469 the domains and/or ranges of the input spaces.
5470 If the product is only constructed over the domain or the range
5471 then the ranges or the domains of the inputs should be the same.
5472 The function C<isl_space_product> also accepts a pair of set spaces,
5473 in which case it returns a wrapped space of a relation between the
5476 #include <isl/set.h>
5477 __isl_give isl_set *isl_set_product(
5478 __isl_take isl_set *set1,
5479 __isl_take isl_set *set2);
5481 #include <isl/map.h>
5482 __isl_give isl_basic_map *isl_basic_map_domain_product(
5483 __isl_take isl_basic_map *bmap1,
5484 __isl_take isl_basic_map *bmap2);
5485 __isl_give isl_basic_map *isl_basic_map_range_product(
5486 __isl_take isl_basic_map *bmap1,
5487 __isl_take isl_basic_map *bmap2);
5488 __isl_give isl_basic_map *isl_basic_map_product(
5489 __isl_take isl_basic_map *bmap1,
5490 __isl_take isl_basic_map *bmap2);
5491 __isl_give isl_map *isl_map_domain_product(
5492 __isl_take isl_map *map1,
5493 __isl_take isl_map *map2);
5494 __isl_give isl_map *isl_map_range_product(
5495 __isl_take isl_map *map1,
5496 __isl_take isl_map *map2);
5497 __isl_give isl_map *isl_map_product(
5498 __isl_take isl_map *map1,
5499 __isl_take isl_map *map2);
5501 #include <isl/union_set.h>
5502 __isl_give isl_union_set *isl_union_set_product(
5503 __isl_take isl_union_set *uset1,
5504 __isl_take isl_union_set *uset2);
5506 #include <isl/union_map.h>
5507 __isl_give isl_union_map *isl_union_map_domain_product(
5508 __isl_take isl_union_map *umap1,
5509 __isl_take isl_union_map *umap2);
5510 __isl_give isl_union_map *isl_union_map_range_product(
5511 __isl_take isl_union_map *umap1,
5512 __isl_take isl_union_map *umap2);
5513 __isl_give isl_union_map *isl_union_map_product(
5514 __isl_take isl_union_map *umap1,
5515 __isl_take isl_union_map *umap2);
5517 #include <isl/val.h>
5518 __isl_give isl_multi_val *isl_multi_val_range_product(
5519 __isl_take isl_multi_val *mv1,
5520 __isl_take isl_multi_val *mv2);
5521 __isl_give isl_multi_val *isl_multi_val_product(
5522 __isl_take isl_multi_val *mv1,
5523 __isl_take isl_multi_val *mv2);
5525 #include <isl/aff.h>
5526 __isl_give isl_multi_aff *isl_multi_aff_range_product(
5527 __isl_take isl_multi_aff *ma1,
5528 __isl_take isl_multi_aff *ma2);
5529 __isl_give isl_multi_aff *isl_multi_aff_product(
5530 __isl_take isl_multi_aff *ma1,
5531 __isl_take isl_multi_aff *ma2);
5532 __isl_give isl_multi_pw_aff *
5533 isl_multi_pw_aff_range_product(
5534 __isl_take isl_multi_pw_aff *mpa1,
5535 __isl_take isl_multi_pw_aff *mpa2);
5536 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
5537 __isl_take isl_multi_pw_aff *mpa1,
5538 __isl_take isl_multi_pw_aff *mpa2);
5539 __isl_give isl_pw_multi_aff *
5540 isl_pw_multi_aff_range_product(
5541 __isl_take isl_pw_multi_aff *pma1,
5542 __isl_take isl_pw_multi_aff *pma2);
5543 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
5544 __isl_take isl_pw_multi_aff *pma1,
5545 __isl_take isl_pw_multi_aff *pma2);
5547 The above functions compute the cross product of the given
5548 sets, relations or functions. The domains and ranges of the results
5549 are wrapped maps between domains and ranges of the inputs.
5550 To obtain a ``flat'' product, use the following functions
5553 #include <isl/set.h>
5554 __isl_give isl_basic_set *isl_basic_set_flat_product(
5555 __isl_take isl_basic_set *bset1,
5556 __isl_take isl_basic_set *bset2);
5557 __isl_give isl_set *isl_set_flat_product(
5558 __isl_take isl_set *set1,
5559 __isl_take isl_set *set2);
5561 #include <isl/map.h>
5562 __isl_give isl_basic_map *isl_basic_map_flat_range_product(
5563 __isl_take isl_basic_map *bmap1,
5564 __isl_take isl_basic_map *bmap2);
5565 __isl_give isl_map *isl_map_flat_domain_product(
5566 __isl_take isl_map *map1,
5567 __isl_take isl_map *map2);
5568 __isl_give isl_map *isl_map_flat_range_product(
5569 __isl_take isl_map *map1,
5570 __isl_take isl_map *map2);
5571 __isl_give isl_basic_map *isl_basic_map_flat_product(
5572 __isl_take isl_basic_map *bmap1,
5573 __isl_take isl_basic_map *bmap2);
5574 __isl_give isl_map *isl_map_flat_product(
5575 __isl_take isl_map *map1,
5576 __isl_take isl_map *map2);
5578 #include <isl/union_map.h>
5579 __isl_give isl_union_map *
5580 isl_union_map_flat_domain_product(
5581 __isl_take isl_union_map *umap1,
5582 __isl_take isl_union_map *umap2);
5583 __isl_give isl_union_map *
5584 isl_union_map_flat_range_product(
5585 __isl_take isl_union_map *umap1,
5586 __isl_take isl_union_map *umap2);
5588 #include <isl/val.h>
5589 __isl_give isl_multi_val *isl_multi_val_flat_range_product(
5590 __isl_take isl_multi_val *mv1,
5591 __isl_take isl_multi_aff *mv2);
5593 #include <isl/aff.h>
5594 __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
5595 __isl_take isl_multi_aff *ma1,
5596 __isl_take isl_multi_aff *ma2);
5597 __isl_give isl_pw_multi_aff *
5598 isl_pw_multi_aff_flat_range_product(
5599 __isl_take isl_pw_multi_aff *pma1,
5600 __isl_take isl_pw_multi_aff *pma2);
5601 __isl_give isl_multi_pw_aff *
5602 isl_multi_pw_aff_flat_range_product(
5603 __isl_take isl_multi_pw_aff *mpa1,
5604 __isl_take isl_multi_pw_aff *mpa2);
5605 __isl_give isl_union_pw_multi_aff *
5606 isl_union_pw_multi_aff_flat_range_product(
5607 __isl_take isl_union_pw_multi_aff *upma1,
5608 __isl_take isl_union_pw_multi_aff *upma2);
5610 #include <isl/space.h>
5611 __isl_give isl_space *isl_space_factor_domain(
5612 __isl_take isl_space *space);
5613 __isl_give isl_space *isl_space_factor_range(
5614 __isl_take isl_space *space);
5615 __isl_give isl_space *isl_space_domain_factor_domain(
5616 __isl_take isl_space *space);
5617 __isl_give isl_space *isl_space_domain_factor_range(
5618 __isl_take isl_space *space);
5619 __isl_give isl_space *isl_space_range_factor_domain(
5620 __isl_take isl_space *space);
5621 __isl_give isl_space *isl_space_range_factor_range(
5622 __isl_take isl_space *space);
5624 The functions C<isl_space_range_factor_domain> and
5625 C<isl_space_range_factor_range> extract the two arguments from
5626 the result of a call to C<isl_space_range_product>.
5628 The arguments of a call to C<isl_map_range_product> can be extracted
5629 from the result using the following functions.
5631 #include <isl/map.h>
5632 __isl_give isl_map *isl_map_factor_domain(
5633 __isl_take isl_map *map);
5634 __isl_give isl_map *isl_map_factor_range(
5635 __isl_take isl_map *map);
5636 __isl_give isl_map *isl_map_domain_factor_domain(
5637 __isl_take isl_map *map);
5638 __isl_give isl_map *isl_map_domain_factor_range(
5639 __isl_take isl_map *map);
5640 __isl_give isl_map *isl_map_range_factor_domain(
5641 __isl_take isl_map *map);
5642 __isl_give isl_map *isl_map_range_factor_range(
5643 __isl_take isl_map *map);
5645 #include <isl/union_map.h>
5646 __isl_give isl_union_map *isl_union_map_factor_domain(
5647 __isl_take isl_union_map *umap);
5648 __isl_give isl_union_map *isl_union_map_factor_range(
5649 __isl_take isl_union_map *umap);
5650 __isl_give isl_union_map *
5651 isl_union_map_domain_factor_domain(
5652 __isl_take isl_union_map *umap);
5653 __isl_give isl_union_map *
5654 isl_union_map_domain_factor_range(
5655 __isl_take isl_union_map *umap);
5656 __isl_give isl_union_map *
5657 isl_union_map_range_factor_range(
5658 __isl_take isl_union_map *umap);
5660 #include <isl/val.h>
5661 __isl_give isl_multi_val *
5662 isl_multi_val_range_factor_domain(
5663 __isl_take isl_multi_val *mv);
5664 __isl_give isl_multi_val *
5665 isl_multi_val_range_factor_range(
5666 __isl_take isl_multi_val *mv);
5668 #include <isl/aff.h>
5669 __isl_give isl_multi_aff *
5670 isl_multi_aff_range_factor_domain(
5671 __isl_take isl_multi_aff *ma);
5672 __isl_give isl_multi_aff *
5673 isl_multi_aff_range_factor_range(
5674 __isl_take isl_multi_aff *ma);
5675 __isl_give isl_multi_pw_aff *
5676 isl_multi_pw_aff_range_factor_domain(
5677 __isl_take isl_multi_pw_aff *mpa);
5678 __isl_give isl_multi_pw_aff *
5679 isl_multi_pw_aff_range_factor_range(
5680 __isl_take isl_multi_pw_aff *mpa);
5682 The splice functions are a generalization of the flat product functions,
5683 where the second argument may be inserted at any position inside
5684 the first argument rather than being placed at the end.
5686 #include <isl/val.h>
5687 __isl_give isl_multi_val *isl_multi_val_range_splice(
5688 __isl_take isl_multi_val *mv1, unsigned pos,
5689 __isl_take isl_multi_val *mv2);
5691 #include <isl/aff.h>
5692 __isl_give isl_multi_aff *isl_multi_aff_range_splice(
5693 __isl_take isl_multi_aff *ma1, unsigned pos,
5694 __isl_take isl_multi_aff *ma2);
5695 __isl_give isl_multi_aff *isl_multi_aff_splice(
5696 __isl_take isl_multi_aff *ma1,
5697 unsigned in_pos, unsigned out_pos,
5698 __isl_take isl_multi_aff *ma2);
5699 __isl_give isl_multi_pw_aff *
5700 isl_multi_pw_aff_range_splice(
5701 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
5702 __isl_take isl_multi_pw_aff *mpa2);
5703 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
5704 __isl_take isl_multi_pw_aff *mpa1,
5705 unsigned in_pos, unsigned out_pos,
5706 __isl_take isl_multi_pw_aff *mpa2);
5708 =item * Simplification
5710 When applied to a set or relation,
5711 the gist operation returns a set or relation that has the
5712 same intersection with the context as the input set or relation.
5713 Any implicit equality in the intersection is made explicit in the result,
5714 while all inequalities that are redundant with respect to the intersection
5716 In case of union sets and relations, the gist operation is performed
5719 When applied to a function,
5720 the gist operation applies the set gist operation to each of
5721 the cells in the domain of the input piecewise expression.
5722 The context is also exploited
5723 to simplify the expression associated to each cell.
5725 #include <isl/set.h>
5726 __isl_give isl_basic_set *isl_basic_set_gist(
5727 __isl_take isl_basic_set *bset,
5728 __isl_take isl_basic_set *context);
5729 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
5730 __isl_take isl_set *context);
5731 __isl_give isl_set *isl_set_gist_params(
5732 __isl_take isl_set *set,
5733 __isl_take isl_set *context);
5735 #include <isl/map.h>
5736 __isl_give isl_basic_map *isl_basic_map_gist(
5737 __isl_take isl_basic_map *bmap,
5738 __isl_take isl_basic_map *context);
5739 __isl_give isl_basic_map *isl_basic_map_gist_domain(
5740 __isl_take isl_basic_map *bmap,
5741 __isl_take isl_basic_set *context);
5742 __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
5743 __isl_take isl_map *context);
5744 __isl_give isl_map *isl_map_gist_params(
5745 __isl_take isl_map *map,
5746 __isl_take isl_set *context);
5747 __isl_give isl_map *isl_map_gist_domain(
5748 __isl_take isl_map *map,
5749 __isl_take isl_set *context);
5750 __isl_give isl_map *isl_map_gist_range(
5751 __isl_take isl_map *map,
5752 __isl_take isl_set *context);
5754 #include <isl/union_set.h>
5755 __isl_give isl_union_set *isl_union_set_gist(
5756 __isl_take isl_union_set *uset,
5757 __isl_take isl_union_set *context);
5758 __isl_give isl_union_set *isl_union_set_gist_params(
5759 __isl_take isl_union_set *uset,
5760 __isl_take isl_set *set);
5762 #include <isl/union_map.h>
5763 __isl_give isl_union_map *isl_union_map_gist(
5764 __isl_take isl_union_map *umap,
5765 __isl_take isl_union_map *context);
5766 __isl_give isl_union_map *isl_union_map_gist_params(
5767 __isl_take isl_union_map *umap,
5768 __isl_take isl_set *set);
5769 __isl_give isl_union_map *isl_union_map_gist_domain(
5770 __isl_take isl_union_map *umap,
5771 __isl_take isl_union_set *uset);
5772 __isl_give isl_union_map *isl_union_map_gist_range(
5773 __isl_take isl_union_map *umap,
5774 __isl_take isl_union_set *uset);
5776 #include <isl/aff.h>
5777 __isl_give isl_aff *isl_aff_gist_params(
5778 __isl_take isl_aff *aff,
5779 __isl_take isl_set *context);
5780 __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
5781 __isl_take isl_set *context);
5782 __isl_give isl_multi_aff *isl_multi_aff_gist_params(
5783 __isl_take isl_multi_aff *maff,
5784 __isl_take isl_set *context);
5785 __isl_give isl_multi_aff *isl_multi_aff_gist(
5786 __isl_take isl_multi_aff *maff,
5787 __isl_take isl_set *context);
5788 __isl_give isl_pw_aff *isl_pw_aff_gist_params(
5789 __isl_take isl_pw_aff *pwaff,
5790 __isl_take isl_set *context);
5791 __isl_give isl_pw_aff *isl_pw_aff_gist(
5792 __isl_take isl_pw_aff *pwaff,
5793 __isl_take isl_set *context);
5794 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
5795 __isl_take isl_pw_multi_aff *pma,
5796 __isl_take isl_set *set);
5797 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
5798 __isl_take isl_pw_multi_aff *pma,
5799 __isl_take isl_set *set);
5800 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
5801 __isl_take isl_multi_pw_aff *mpa,
5802 __isl_take isl_set *set);
5803 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
5804 __isl_take isl_multi_pw_aff *mpa,
5805 __isl_take isl_set *set);
5806 __isl_give isl_union_pw_multi_aff *
5807 isl_union_pw_multi_aff_gist_params(
5808 __isl_take isl_union_pw_multi_aff *upma,
5809 __isl_take isl_set *context);
5810 __isl_give isl_union_pw_multi_aff *
5811 isl_union_pw_multi_aff_gist(
5812 __isl_take isl_union_pw_multi_aff *upma,
5813 __isl_take isl_union_set *context);
5815 #include <isl/polynomial.h>
5816 __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
5817 __isl_take isl_qpolynomial *qp,
5818 __isl_take isl_set *context);
5819 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
5820 __isl_take isl_qpolynomial *qp,
5821 __isl_take isl_set *context);
5822 __isl_give isl_qpolynomial_fold *
5823 isl_qpolynomial_fold_gist_params(
5824 __isl_take isl_qpolynomial_fold *fold,
5825 __isl_take isl_set *context);
5826 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
5827 __isl_take isl_qpolynomial_fold *fold,
5828 __isl_take isl_set *context);
5829 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
5830 __isl_take isl_pw_qpolynomial *pwqp,
5831 __isl_take isl_set *context);
5832 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
5833 __isl_take isl_pw_qpolynomial *pwqp,
5834 __isl_take isl_set *context);
5835 __isl_give isl_pw_qpolynomial_fold *
5836 isl_pw_qpolynomial_fold_gist(
5837 __isl_take isl_pw_qpolynomial_fold *pwf,
5838 __isl_take isl_set *context);
5839 __isl_give isl_pw_qpolynomial_fold *
5840 isl_pw_qpolynomial_fold_gist_params(
5841 __isl_take isl_pw_qpolynomial_fold *pwf,
5842 __isl_take isl_set *context);
5843 __isl_give isl_union_pw_qpolynomial *
5844 isl_union_pw_qpolynomial_gist_params(
5845 __isl_take isl_union_pw_qpolynomial *upwqp,
5846 __isl_take isl_set *context);
5847 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
5848 __isl_take isl_union_pw_qpolynomial *upwqp,
5849 __isl_take isl_union_set *context);
5850 __isl_give isl_union_pw_qpolynomial_fold *
5851 isl_union_pw_qpolynomial_fold_gist(
5852 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5853 __isl_take isl_union_set *context);
5854 __isl_give isl_union_pw_qpolynomial_fold *
5855 isl_union_pw_qpolynomial_fold_gist_params(
5856 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5857 __isl_take isl_set *context);
5859 =item * Binary Arithmethic Operations
5861 #include <isl/val.h>
5862 __isl_give isl_multi_val *isl_multi_val_sub(
5863 __isl_take isl_multi_val *mv1,
5864 __isl_take isl_multi_val *mv2);
5866 #include <isl/aff.h>
5867 __isl_give isl_aff *isl_aff_add(
5868 __isl_take isl_aff *aff1,
5869 __isl_take isl_aff *aff2);
5870 __isl_give isl_multi_aff *isl_multi_aff_add(
5871 __isl_take isl_multi_aff *maff1,
5872 __isl_take isl_multi_aff *maff2);
5873 __isl_give isl_pw_aff *isl_pw_aff_add(
5874 __isl_take isl_pw_aff *pwaff1,
5875 __isl_take isl_pw_aff *pwaff2);
5876 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
5877 __isl_take isl_pw_multi_aff *pma1,
5878 __isl_take isl_pw_multi_aff *pma2);
5879 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
5880 __isl_take isl_union_pw_multi_aff *upma1,
5881 __isl_take isl_union_pw_multi_aff *upma2);
5882 __isl_give isl_pw_aff *isl_pw_aff_min(
5883 __isl_take isl_pw_aff *pwaff1,
5884 __isl_take isl_pw_aff *pwaff2);
5885 __isl_give isl_pw_aff *isl_pw_aff_max(
5886 __isl_take isl_pw_aff *pwaff1,
5887 __isl_take isl_pw_aff *pwaff2);
5888 __isl_give isl_aff *isl_aff_sub(
5889 __isl_take isl_aff *aff1,
5890 __isl_take isl_aff *aff2);
5891 __isl_give isl_multi_aff *isl_multi_aff_sub(
5892 __isl_take isl_multi_aff *ma1,
5893 __isl_take isl_multi_aff *ma2);
5894 __isl_give isl_pw_aff *isl_pw_aff_sub(
5895 __isl_take isl_pw_aff *pwaff1,
5896 __isl_take isl_pw_aff *pwaff2);
5897 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
5898 __isl_take isl_multi_pw_aff *mpa1,
5899 __isl_take isl_multi_pw_aff *mpa2);
5900 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
5901 __isl_take isl_pw_multi_aff *pma1,
5902 __isl_take isl_pw_multi_aff *pma2);
5903 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
5904 __isl_take isl_union_pw_multi_aff *upma1,
5905 __isl_take isl_union_pw_multi_aff *upma2);
5907 C<isl_aff_sub> subtracts the second argument from the first.
5909 #include <isl/polynomial.h>
5910 __isl_give isl_qpolynomial *isl_qpolynomial_add(
5911 __isl_take isl_qpolynomial *qp1,
5912 __isl_take isl_qpolynomial *qp2);
5913 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
5914 __isl_take isl_pw_qpolynomial *pwqp1,
5915 __isl_take isl_pw_qpolynomial *pwqp2);
5916 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
5917 __isl_take isl_pw_qpolynomial *pwqp1,
5918 __isl_take isl_pw_qpolynomial *pwqp2);
5919 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
5920 __isl_take isl_pw_qpolynomial_fold *pwf1,
5921 __isl_take isl_pw_qpolynomial_fold *pwf2);
5922 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
5923 __isl_take isl_union_pw_qpolynomial *upwqp1,
5924 __isl_take isl_union_pw_qpolynomial *upwqp2);
5925 __isl_give isl_qpolynomial *isl_qpolynomial_sub(
5926 __isl_take isl_qpolynomial *qp1,
5927 __isl_take isl_qpolynomial *qp2);
5928 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
5929 __isl_take isl_pw_qpolynomial *pwqp1,
5930 __isl_take isl_pw_qpolynomial *pwqp2);
5931 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
5932 __isl_take isl_union_pw_qpolynomial *upwqp1,
5933 __isl_take isl_union_pw_qpolynomial *upwqp2);
5934 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
5935 __isl_take isl_pw_qpolynomial_fold *pwf1,
5936 __isl_take isl_pw_qpolynomial_fold *pwf2);
5937 __isl_give isl_union_pw_qpolynomial_fold *
5938 isl_union_pw_qpolynomial_fold_fold(
5939 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
5940 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
5942 #include <isl/aff.h>
5943 __isl_give isl_pw_aff *isl_pw_aff_union_add(
5944 __isl_take isl_pw_aff *pwaff1,
5945 __isl_take isl_pw_aff *pwaff2);
5946 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
5947 __isl_take isl_pw_multi_aff *pma1,
5948 __isl_take isl_pw_multi_aff *pma2);
5949 __isl_give isl_union_pw_multi_aff *
5950 isl_union_pw_multi_aff_union_add(
5951 __isl_take isl_union_pw_multi_aff *upma1,
5952 __isl_take isl_union_pw_multi_aff *upma2);
5953 __isl_give isl_pw_aff *isl_pw_aff_union_min(
5954 __isl_take isl_pw_aff *pwaff1,
5955 __isl_take isl_pw_aff *pwaff2);
5956 __isl_give isl_pw_aff *isl_pw_aff_union_max(
5957 __isl_take isl_pw_aff *pwaff1,
5958 __isl_take isl_pw_aff *pwaff2);
5960 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
5961 expression with a domain that is the union of those of C<pwaff1> and
5962 C<pwaff2> and such that on each cell, the quasi-affine expression is
5963 the maximum of those of C<pwaff1> and C<pwaff2>. If only one of
5964 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
5965 associated expression is the defined one.
5966 This in contrast to the C<isl_pw_aff_max> function, which is
5967 only defined on the shared definition domain of the arguments.
5969 #include <isl/val.h>
5970 __isl_give isl_multi_val *isl_multi_val_add_val(
5971 __isl_take isl_multi_val *mv,
5972 __isl_take isl_val *v);
5973 __isl_give isl_multi_val *isl_multi_val_mod_val(
5974 __isl_take isl_multi_val *mv,
5975 __isl_take isl_val *v);
5976 __isl_give isl_multi_val *isl_multi_val_scale_val(
5977 __isl_take isl_multi_val *mv,
5978 __isl_take isl_val *v);
5979 __isl_give isl_multi_val *isl_multi_val_scale_down_val(
5980 __isl_take isl_multi_val *mv,
5981 __isl_take isl_val *v);
5983 #include <isl/aff.h>
5984 __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
5985 __isl_take isl_val *mod);
5986 __isl_give isl_pw_aff *isl_pw_aff_mod_val(
5987 __isl_take isl_pw_aff *pa,
5988 __isl_take isl_val *mod);
5989 __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
5990 __isl_take isl_val *v);
5991 __isl_give isl_multi_aff *isl_multi_aff_scale_val(
5992 __isl_take isl_multi_aff *ma,
5993 __isl_take isl_val *v);
5994 __isl_give isl_pw_aff *isl_pw_aff_scale_val(
5995 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
5996 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
5997 __isl_take isl_multi_pw_aff *mpa,
5998 __isl_take isl_val *v);
5999 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6000 __isl_take isl_pw_multi_aff *pma,
6001 __isl_take isl_val *v);
6002 __isl_give isl_union_pw_multi_aff *
6003 isl_union_pw_multi_aff_scale_val(
6004 __isl_take isl_union_pw_multi_aff *upma,
6005 __isl_take isl_val *val);
6006 __isl_give isl_aff *isl_aff_scale_down_ui(
6007 __isl_take isl_aff *aff, unsigned f);
6008 __isl_give isl_aff *isl_aff_scale_down_val(
6009 __isl_take isl_aff *aff, __isl_take isl_val *v);
6010 __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6011 __isl_take isl_multi_aff *ma,
6012 __isl_take isl_val *v);
6013 __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6014 __isl_take isl_pw_aff *pa,
6015 __isl_take isl_val *f);
6016 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6017 __isl_take isl_multi_pw_aff *mpa,
6018 __isl_take isl_val *v);
6019 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6020 __isl_take isl_pw_multi_aff *pma,
6021 __isl_take isl_val *v);
6022 __isl_give isl_union_pw_multi_aff *
6023 isl_union_pw_multi_aff_scale_down_val(
6024 __isl_take isl_union_pw_multi_aff *upma,
6025 __isl_take isl_val *val);
6027 #include <isl/polynomial.h>
6028 __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6029 __isl_take isl_qpolynomial *qp,
6030 __isl_take isl_val *v);
6031 __isl_give isl_qpolynomial_fold *
6032 isl_qpolynomial_fold_scale_val(
6033 __isl_take isl_qpolynomial_fold *fold,
6034 __isl_take isl_val *v);
6035 __isl_give isl_pw_qpolynomial *
6036 isl_pw_qpolynomial_scale_val(
6037 __isl_take isl_pw_qpolynomial *pwqp,
6038 __isl_take isl_val *v);
6039 __isl_give isl_pw_qpolynomial_fold *
6040 isl_pw_qpolynomial_fold_scale_val(
6041 __isl_take isl_pw_qpolynomial_fold *pwf,
6042 __isl_take isl_val *v);
6043 __isl_give isl_union_pw_qpolynomial *
6044 isl_union_pw_qpolynomial_scale_val(
6045 __isl_take isl_union_pw_qpolynomial *upwqp,
6046 __isl_take isl_val *v);
6047 __isl_give isl_union_pw_qpolynomial_fold *
6048 isl_union_pw_qpolynomial_fold_scale_val(
6049 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6050 __isl_take isl_val *v);
6051 __isl_give isl_qpolynomial *
6052 isl_qpolynomial_scale_down_val(
6053 __isl_take isl_qpolynomial *qp,
6054 __isl_take isl_val *v);
6055 __isl_give isl_qpolynomial_fold *
6056 isl_qpolynomial_fold_scale_down_val(
6057 __isl_take isl_qpolynomial_fold *fold,
6058 __isl_take isl_val *v);
6059 __isl_give isl_pw_qpolynomial *
6060 isl_pw_qpolynomial_scale_down_val(
6061 __isl_take isl_pw_qpolynomial *pwqp,
6062 __isl_take isl_val *v);
6063 __isl_give isl_pw_qpolynomial_fold *
6064 isl_pw_qpolynomial_fold_scale_down_val(
6065 __isl_take isl_pw_qpolynomial_fold *pwf,
6066 __isl_take isl_val *v);
6067 __isl_give isl_union_pw_qpolynomial *
6068 isl_union_pw_qpolynomial_scale_down_val(
6069 __isl_take isl_union_pw_qpolynomial *upwqp,
6070 __isl_take isl_val *v);
6071 __isl_give isl_union_pw_qpolynomial_fold *
6072 isl_union_pw_qpolynomial_fold_scale_down_val(
6073 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6074 __isl_take isl_val *v);
6076 #include <isl/val.h>
6077 __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6078 __isl_take isl_multi_val *mv1,
6079 __isl_take isl_multi_val *mv2);
6080 __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6081 __isl_take isl_multi_val *mv1,
6082 __isl_take isl_multi_val *mv2);
6083 __isl_give isl_multi_val *
6084 isl_multi_val_scale_down_multi_val(
6085 __isl_take isl_multi_val *mv1,
6086 __isl_take isl_multi_val *mv2);
6088 #include <isl/aff.h>
6089 __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6090 __isl_take isl_multi_aff *ma,
6091 __isl_take isl_multi_val *mv);
6092 __isl_give isl_multi_pw_aff *
6093 isl_multi_pw_aff_mod_multi_val(
6094 __isl_take isl_multi_pw_aff *mpa,
6095 __isl_take isl_multi_val *mv);
6096 __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6097 __isl_take isl_multi_aff *ma,
6098 __isl_take isl_multi_val *mv);
6099 __isl_give isl_pw_multi_aff *
6100 isl_pw_multi_aff_scale_multi_val(
6101 __isl_take isl_pw_multi_aff *pma,
6102 __isl_take isl_multi_val *mv);
6103 __isl_give isl_multi_pw_aff *
6104 isl_multi_pw_aff_scale_multi_val(
6105 __isl_take isl_multi_pw_aff *mpa,
6106 __isl_take isl_multi_val *mv);
6107 __isl_give isl_union_pw_multi_aff *
6108 isl_union_pw_multi_aff_scale_multi_val(
6109 __isl_take isl_union_pw_multi_aff *upma,
6110 __isl_take isl_multi_val *mv);
6111 __isl_give isl_multi_aff *
6112 isl_multi_aff_scale_down_multi_val(
6113 __isl_take isl_multi_aff *ma,
6114 __isl_take isl_multi_val *mv);
6115 __isl_give isl_multi_pw_aff *
6116 isl_multi_pw_aff_scale_down_multi_val(
6117 __isl_take isl_multi_pw_aff *mpa,
6118 __isl_take isl_multi_val *mv);
6120 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6121 by the corresponding elements of C<mv>.
6123 #include <isl/aff.h>
6124 __isl_give isl_aff *isl_aff_mul(
6125 __isl_take isl_aff *aff1,
6126 __isl_take isl_aff *aff2);
6127 __isl_give isl_aff *isl_aff_div(
6128 __isl_take isl_aff *aff1,
6129 __isl_take isl_aff *aff2);
6130 __isl_give isl_pw_aff *isl_pw_aff_mul(
6131 __isl_take isl_pw_aff *pwaff1,
6132 __isl_take isl_pw_aff *pwaff2);
6133 __isl_give isl_pw_aff *isl_pw_aff_div(
6134 __isl_take isl_pw_aff *pa1,
6135 __isl_take isl_pw_aff *pa2);
6136 __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6137 __isl_take isl_pw_aff *pa1,
6138 __isl_take isl_pw_aff *pa2);
6139 __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6140 __isl_take isl_pw_aff *pa1,
6141 __isl_take isl_pw_aff *pa2);
6143 When multiplying two affine expressions, at least one of the two needs
6144 to be a constant. Similarly, when dividing an affine expression by another,
6145 the second expression needs to be a constant.
6146 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6147 rounding towards zero. C<isl_pw_aff_tdiv_r> computes the corresponding
6150 #include <isl/polynomial.h>
6151 __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6152 __isl_take isl_qpolynomial *qp1,
6153 __isl_take isl_qpolynomial *qp2);
6154 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6155 __isl_take isl_pw_qpolynomial *pwqp1,
6156 __isl_take isl_pw_qpolynomial *pwqp2);
6157 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6158 __isl_take isl_union_pw_qpolynomial *upwqp1,
6159 __isl_take isl_union_pw_qpolynomial *upwqp2);
6163 =head3 Lexicographic Optimization
6165 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6166 the following functions
6167 compute a set that contains the lexicographic minimum or maximum
6168 of the elements in C<set> (or C<bset>) for those values of the parameters
6169 that satisfy C<dom>.
6170 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6171 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6173 In other words, the union of the parameter values
6174 for which the result is non-empty and of C<*empty>
6177 #include <isl/set.h>
6178 __isl_give isl_set *isl_basic_set_partial_lexmin(
6179 __isl_take isl_basic_set *bset,
6180 __isl_take isl_basic_set *dom,
6181 __isl_give isl_set **empty);
6182 __isl_give isl_set *isl_basic_set_partial_lexmax(
6183 __isl_take isl_basic_set *bset,
6184 __isl_take isl_basic_set *dom,
6185 __isl_give isl_set **empty);
6186 __isl_give isl_set *isl_set_partial_lexmin(
6187 __isl_take isl_set *set, __isl_take isl_set *dom,
6188 __isl_give isl_set **empty);
6189 __isl_give isl_set *isl_set_partial_lexmax(
6190 __isl_take isl_set *set, __isl_take isl_set *dom,
6191 __isl_give isl_set **empty);
6193 Given a (basic) set C<set> (or C<bset>), the following functions simply
6194 return a set containing the lexicographic minimum or maximum
6195 of the elements in C<set> (or C<bset>).
6196 In case of union sets, the optimum is computed per space.
6198 #include <isl/set.h>
6199 __isl_give isl_set *isl_basic_set_lexmin(
6200 __isl_take isl_basic_set *bset);
6201 __isl_give isl_set *isl_basic_set_lexmax(
6202 __isl_take isl_basic_set *bset);
6203 __isl_give isl_set *isl_set_lexmin(
6204 __isl_take isl_set *set);
6205 __isl_give isl_set *isl_set_lexmax(
6206 __isl_take isl_set *set);
6207 __isl_give isl_union_set *isl_union_set_lexmin(
6208 __isl_take isl_union_set *uset);
6209 __isl_give isl_union_set *isl_union_set_lexmax(
6210 __isl_take isl_union_set *uset);
6212 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6213 the following functions
6214 compute a relation that maps each element of C<dom>
6215 to the single lexicographic minimum or maximum
6216 of the elements that are associated to that same
6217 element in C<map> (or C<bmap>).
6218 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6219 that contains the elements in C<dom> that do not map
6220 to any elements in C<map> (or C<bmap>).
6221 In other words, the union of the domain of the result and of C<*empty>
6224 #include <isl/map.h>
6225 __isl_give isl_map *isl_basic_map_partial_lexmax(
6226 __isl_take isl_basic_map *bmap,
6227 __isl_take isl_basic_set *dom,
6228 __isl_give isl_set **empty);
6229 __isl_give isl_map *isl_basic_map_partial_lexmin(
6230 __isl_take isl_basic_map *bmap,
6231 __isl_take isl_basic_set *dom,
6232 __isl_give isl_set **empty);
6233 __isl_give isl_map *isl_map_partial_lexmax(
6234 __isl_take isl_map *map, __isl_take isl_set *dom,
6235 __isl_give isl_set **empty);
6236 __isl_give isl_map *isl_map_partial_lexmin(
6237 __isl_take isl_map *map, __isl_take isl_set *dom,
6238 __isl_give isl_set **empty);
6240 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6241 return a map mapping each element in the domain of
6242 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6243 of all elements associated to that element.
6244 In case of union relations, the optimum is computed per space.
6246 #include <isl/map.h>
6247 __isl_give isl_map *isl_basic_map_lexmin(
6248 __isl_take isl_basic_map *bmap);
6249 __isl_give isl_map *isl_basic_map_lexmax(
6250 __isl_take isl_basic_map *bmap);
6251 __isl_give isl_map *isl_map_lexmin(
6252 __isl_take isl_map *map);
6253 __isl_give isl_map *isl_map_lexmax(
6254 __isl_take isl_map *map);
6255 __isl_give isl_union_map *isl_union_map_lexmin(
6256 __isl_take isl_union_map *umap);
6257 __isl_give isl_union_map *isl_union_map_lexmax(
6258 __isl_take isl_union_map *umap);
6260 The following functions return their result in the form of
6261 a piecewise multi-affine expression,
6262 but are otherwise equivalent to the corresponding functions
6263 returning a basic set or relation.
6265 #include <isl/set.h>
6266 __isl_give isl_pw_multi_aff *
6267 isl_basic_set_partial_lexmin_pw_multi_aff(
6268 __isl_take isl_basic_set *bset,
6269 __isl_take isl_basic_set *dom,
6270 __isl_give isl_set **empty);
6271 __isl_give isl_pw_multi_aff *
6272 isl_basic_set_partial_lexmax_pw_multi_aff(
6273 __isl_take isl_basic_set *bset,
6274 __isl_take isl_basic_set *dom,
6275 __isl_give isl_set **empty);
6276 __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6277 __isl_take isl_set *set);
6278 __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6279 __isl_take isl_set *set);
6281 #include <isl/map.h>
6282 __isl_give isl_pw_multi_aff *
6283 isl_basic_map_lexmin_pw_multi_aff(
6284 __isl_take isl_basic_map *bmap);
6285 __isl_give isl_pw_multi_aff *
6286 isl_basic_map_partial_lexmin_pw_multi_aff(
6287 __isl_take isl_basic_map *bmap,
6288 __isl_take isl_basic_set *dom,
6289 __isl_give isl_set **empty);
6290 __isl_give isl_pw_multi_aff *
6291 isl_basic_map_partial_lexmax_pw_multi_aff(
6292 __isl_take isl_basic_map *bmap,
6293 __isl_take isl_basic_set *dom,
6294 __isl_give isl_set **empty);
6295 __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
6296 __isl_take isl_map *map);
6297 __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
6298 __isl_take isl_map *map);
6300 The following functions return the lexicographic minimum or maximum
6301 on the shared domain of the inputs and the single defined function
6302 on those parts of the domain where only a single function is defined.
6304 #include <isl/aff.h>
6305 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
6306 __isl_take isl_pw_multi_aff *pma1,
6307 __isl_take isl_pw_multi_aff *pma2);
6308 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
6309 __isl_take isl_pw_multi_aff *pma1,
6310 __isl_take isl_pw_multi_aff *pma2);
6312 =head2 Ternary Operations
6314 #include <isl/aff.h>
6315 __isl_give isl_pw_aff *isl_pw_aff_cond(
6316 __isl_take isl_pw_aff *cond,
6317 __isl_take isl_pw_aff *pwaff_true,
6318 __isl_take isl_pw_aff *pwaff_false);
6320 The function C<isl_pw_aff_cond> performs a conditional operator
6321 and returns an expression that is equal to C<pwaff_true>
6322 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
6323 where C<cond> is zero.
6327 Lists are defined over several element types, including
6328 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>,
6329 C<isl_union_pw_multi_aff>, C<isl_constraint>,
6330 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
6331 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
6332 Here we take lists of C<isl_set>s as an example.
6333 Lists can be created, copied, modified and freed using the following functions.
6335 #include <isl/set.h>
6336 __isl_give isl_set_list *isl_set_list_from_set(
6337 __isl_take isl_set *el);
6338 __isl_give isl_set_list *isl_set_list_alloc(
6339 isl_ctx *ctx, int n);
6340 __isl_give isl_set_list *isl_set_list_copy(
6341 __isl_keep isl_set_list *list);
6342 __isl_give isl_set_list *isl_set_list_insert(
6343 __isl_take isl_set_list *list, unsigned pos,
6344 __isl_take isl_set *el);
6345 __isl_give isl_set_list *isl_set_list_add(
6346 __isl_take isl_set_list *list,
6347 __isl_take isl_set *el);
6348 __isl_give isl_set_list *isl_set_list_drop(
6349 __isl_take isl_set_list *list,
6350 unsigned first, unsigned n);
6351 __isl_give isl_set_list *isl_set_list_set_set(
6352 __isl_take isl_set_list *list, int index,
6353 __isl_take isl_set *set);
6354 __isl_give isl_set_list *isl_set_list_concat(
6355 __isl_take isl_set_list *list1,
6356 __isl_take isl_set_list *list2);
6357 __isl_give isl_set_list *isl_set_list_sort(
6358 __isl_take isl_set_list *list,
6359 int (*cmp)(__isl_keep isl_set *a,
6360 __isl_keep isl_set *b, void *user),
6362 __isl_null isl_set_list *isl_set_list_free(
6363 __isl_take isl_set_list *list);
6365 C<isl_set_list_alloc> creates an empty list with an initial capacity
6366 for C<n> elements. C<isl_set_list_insert> and C<isl_set_list_add>
6367 add elements to a list, increasing its capacity as needed.
6368 C<isl_set_list_from_set> creates a list with a single element.
6370 Lists can be inspected using the following functions.
6372 #include <isl/set.h>
6373 int isl_set_list_n_set(__isl_keep isl_set_list *list);
6374 __isl_give isl_set *isl_set_list_get_set(
6375 __isl_keep isl_set_list *list, int index);
6376 int isl_set_list_foreach(__isl_keep isl_set_list *list,
6377 int (*fn)(__isl_take isl_set *el, void *user),
6379 int isl_set_list_foreach_scc(__isl_keep isl_set_list *list,
6380 int (*follows)(__isl_keep isl_set *a,
6381 __isl_keep isl_set *b, void *user),
6383 int (*fn)(__isl_take isl_set *el, void *user),
6386 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
6387 strongly connected components of the graph with as vertices the elements
6388 of C<list> and a directed edge from vertex C<b> to vertex C<a>
6389 iff C<follows(a, b)> returns C<1>. The callbacks C<follows> and C<fn>
6390 should return C<-1> on error.
6392 Lists can be printed using
6394 #include <isl/set.h>
6395 __isl_give isl_printer *isl_printer_print_set_list(
6396 __isl_take isl_printer *p,
6397 __isl_keep isl_set_list *list);
6399 =head2 Associative arrays
6401 Associative arrays map isl objects of a specific type to isl objects
6402 of some (other) specific type. They are defined for several pairs
6403 of types, including (C<isl_map>, C<isl_basic_set>),
6404 (C<isl_id>, C<isl_ast_expr>) and.
6405 (C<isl_id>, C<isl_pw_aff>).
6406 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
6409 Associative arrays can be created, copied and freed using
6410 the following functions.
6412 #include <isl/id_to_ast_expr.h>
6413 __isl_give id_to_ast_expr *isl_id_to_ast_expr_alloc(
6414 isl_ctx *ctx, int min_size);
6415 __isl_give id_to_ast_expr *isl_id_to_ast_expr_copy(
6416 __isl_keep id_to_ast_expr *id2expr);
6417 __isl_null id_to_ast_expr *isl_id_to_ast_expr_free(
6418 __isl_take id_to_ast_expr *id2expr);
6420 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
6421 to specify the expected size of the associative array.
6422 The associative array will be grown automatically as needed.
6424 Associative arrays can be inspected using the following functions.
6426 #include <isl/id_to_ast_expr.h>
6427 int isl_id_to_ast_expr_has(
6428 __isl_keep id_to_ast_expr *id2expr,
6429 __isl_keep isl_id *key);
6430 __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
6431 __isl_keep id_to_ast_expr *id2expr,
6432 __isl_take isl_id *key);
6433 int isl_id_to_ast_expr_foreach(
6434 __isl_keep id_to_ast_expr *id2expr,
6435 int (*fn)(__isl_take isl_id *key,
6436 __isl_take isl_ast_expr *val, void *user),
6439 They can be modified using the following function.
6441 #include <isl/id_to_ast_expr.h>
6442 __isl_give id_to_ast_expr *isl_id_to_ast_expr_set(
6443 __isl_take id_to_ast_expr *id2expr,
6444 __isl_take isl_id *key,
6445 __isl_take isl_ast_expr *val);
6446 __isl_give id_to_ast_expr *isl_id_to_ast_expr_drop(
6447 __isl_take id_to_ast_expr *id2expr,
6448 __isl_take isl_id *key);
6450 Associative arrays can be printed using the following function.
6452 #include <isl/id_to_ast_expr.h>
6453 __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
6454 __isl_take isl_printer *p,
6455 __isl_keep id_to_ast_expr *id2expr);
6459 Vectors can be created, copied and freed using the following functions.
6461 #include <isl/vec.h>
6462 __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
6464 __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
6465 __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
6467 Note that the elements of a newly created vector may have arbitrary values.
6468 The elements can be changed and inspected using the following functions.
6470 int isl_vec_size(__isl_keep isl_vec *vec);
6471 __isl_give isl_val *isl_vec_get_element_val(
6472 __isl_keep isl_vec *vec, int pos);
6473 __isl_give isl_vec *isl_vec_set_element_si(
6474 __isl_take isl_vec *vec, int pos, int v);
6475 __isl_give isl_vec *isl_vec_set_element_val(
6476 __isl_take isl_vec *vec, int pos,
6477 __isl_take isl_val *v);
6478 __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
6480 __isl_give isl_vec *isl_vec_set_val(
6481 __isl_take isl_vec *vec, __isl_take isl_val *v);
6482 int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
6483 __isl_keep isl_vec *vec2, int pos);
6485 C<isl_vec_get_element> will return a negative value if anything went wrong.
6486 In that case, the value of C<*v> is undefined.
6488 The following function can be used to concatenate two vectors.
6490 __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
6491 __isl_take isl_vec *vec2);
6495 Matrices can be created, copied and freed using the following functions.
6497 #include <isl/mat.h>
6498 __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
6499 unsigned n_row, unsigned n_col);
6500 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
6501 __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
6503 Note that the elements of a newly created matrix may have arbitrary values.
6504 The elements can be changed and inspected using the following functions.
6506 int isl_mat_rows(__isl_keep isl_mat *mat);
6507 int isl_mat_cols(__isl_keep isl_mat *mat);
6508 __isl_give isl_val *isl_mat_get_element_val(
6509 __isl_keep isl_mat *mat, int row, int col);
6510 __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
6511 int row, int col, int v);
6512 __isl_give isl_mat *isl_mat_set_element_val(
6513 __isl_take isl_mat *mat, int row, int col,
6514 __isl_take isl_val *v);
6516 C<isl_mat_get_element> will return a negative value if anything went wrong.
6517 In that case, the value of C<*v> is undefined.
6519 The following function can be used to compute the (right) inverse
6520 of a matrix, i.e., a matrix such that the product of the original
6521 and the inverse (in that order) is a multiple of the identity matrix.
6522 The input matrix is assumed to be of full row-rank.
6524 __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
6526 The following function can be used to compute the (right) kernel
6527 (or null space) of a matrix, i.e., a matrix such that the product of
6528 the original and the kernel (in that order) is the zero matrix.
6530 __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
6532 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
6534 The following functions determine
6535 an upper or lower bound on a quasipolynomial over its domain.
6537 __isl_give isl_pw_qpolynomial_fold *
6538 isl_pw_qpolynomial_bound(
6539 __isl_take isl_pw_qpolynomial *pwqp,
6540 enum isl_fold type, int *tight);
6542 __isl_give isl_union_pw_qpolynomial_fold *
6543 isl_union_pw_qpolynomial_bound(
6544 __isl_take isl_union_pw_qpolynomial *upwqp,
6545 enum isl_fold type, int *tight);
6547 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
6548 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
6549 is the returned bound is known be tight, i.e., for each value
6550 of the parameters there is at least
6551 one element in the domain that reaches the bound.
6552 If the domain of C<pwqp> is not wrapping, then the bound is computed
6553 over all elements in that domain and the result has a purely parametric
6554 domain. If the domain of C<pwqp> is wrapping, then the bound is
6555 computed over the range of the wrapped relation. The domain of the
6556 wrapped relation becomes the domain of the result.
6558 =head2 Parametric Vertex Enumeration
6560 The parametric vertex enumeration described in this section
6561 is mainly intended to be used internally and by the C<barvinok>
6564 #include <isl/vertices.h>
6565 __isl_give isl_vertices *isl_basic_set_compute_vertices(
6566 __isl_keep isl_basic_set *bset);
6568 The function C<isl_basic_set_compute_vertices> performs the
6569 actual computation of the parametric vertices and the chamber
6570 decomposition and store the result in an C<isl_vertices> object.
6571 This information can be queried by either iterating over all
6572 the vertices or iterating over all the chambers or cells
6573 and then iterating over all vertices that are active on the chamber.
6575 int isl_vertices_foreach_vertex(
6576 __isl_keep isl_vertices *vertices,
6577 int (*fn)(__isl_take isl_vertex *vertex, void *user),
6580 int isl_vertices_foreach_cell(
6581 __isl_keep isl_vertices *vertices,
6582 int (*fn)(__isl_take isl_cell *cell, void *user),
6584 int isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
6585 int (*fn)(__isl_take isl_vertex *vertex, void *user),
6588 Other operations that can be performed on an C<isl_vertices> object are
6591 int isl_vertices_get_n_vertices(
6592 __isl_keep isl_vertices *vertices);
6593 void isl_vertices_free(__isl_take isl_vertices *vertices);
6595 Vertices can be inspected and destroyed using the following functions.
6597 int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
6598 __isl_give isl_basic_set *isl_vertex_get_domain(
6599 __isl_keep isl_vertex *vertex);
6600 __isl_give isl_multi_aff *isl_vertex_get_expr(
6601 __isl_keep isl_vertex *vertex);
6602 void isl_vertex_free(__isl_take isl_vertex *vertex);
6604 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
6605 describing the vertex in terms of the parameters,
6606 while C<isl_vertex_get_domain> returns the activity domain
6609 Chambers can be inspected and destroyed using the following functions.
6611 __isl_give isl_basic_set *isl_cell_get_domain(
6612 __isl_keep isl_cell *cell);
6613 void isl_cell_free(__isl_take isl_cell *cell);
6615 =head1 Polyhedral Compilation Library
6617 This section collects functionality in C<isl> that has been specifically
6618 designed for use during polyhedral compilation.
6620 =head2 Dependence Analysis
6622 C<isl> contains specialized functionality for performing
6623 array dataflow analysis. That is, given a I<sink> access relation
6624 and a collection of possible I<source> access relations,
6625 C<isl> can compute relations that describe
6626 for each iteration of the sink access, which iteration
6627 of which of the source access relations was the last
6628 to access the same data element before the given iteration
6630 The resulting dependence relations map source iterations
6631 to the corresponding sink iterations.
6632 To compute standard flow dependences, the sink should be
6633 a read, while the sources should be writes.
6634 If any of the source accesses are marked as being I<may>
6635 accesses, then there will be a dependence from the last
6636 I<must> access B<and> from any I<may> access that follows
6637 this last I<must> access.
6638 In particular, if I<all> sources are I<may> accesses,
6639 then memory based dependence analysis is performed.
6640 If, on the other hand, all sources are I<must> accesses,
6641 then value based dependence analysis is performed.
6643 #include <isl/flow.h>
6645 typedef int (*isl_access_level_before)(void *first, void *second);
6647 __isl_give isl_access_info *isl_access_info_alloc(
6648 __isl_take isl_map *sink,
6649 void *sink_user, isl_access_level_before fn,
6651 __isl_give isl_access_info *isl_access_info_add_source(
6652 __isl_take isl_access_info *acc,
6653 __isl_take isl_map *source, int must,
6655 __isl_null isl_access_info *isl_access_info_free(
6656 __isl_take isl_access_info *acc);
6658 __isl_give isl_flow *isl_access_info_compute_flow(
6659 __isl_take isl_access_info *acc);
6661 int isl_flow_foreach(__isl_keep isl_flow *deps,
6662 int (*fn)(__isl_take isl_map *dep, int must,
6663 void *dep_user, void *user),
6665 __isl_give isl_map *isl_flow_get_no_source(
6666 __isl_keep isl_flow *deps, int must);
6667 void isl_flow_free(__isl_take isl_flow *deps);
6669 The function C<isl_access_info_compute_flow> performs the actual
6670 dependence analysis. The other functions are used to construct
6671 the input for this function or to read off the output.
6673 The input is collected in an C<isl_access_info>, which can
6674 be created through a call to C<isl_access_info_alloc>.
6675 The arguments to this functions are the sink access relation
6676 C<sink>, a token C<sink_user> used to identify the sink
6677 access to the user, a callback function for specifying the
6678 relative order of source and sink accesses, and the number
6679 of source access relations that will be added.
6680 The callback function has type C<int (*)(void *first, void *second)>.
6681 The function is called with two user supplied tokens identifying
6682 either a source or the sink and it should return the shared nesting
6683 level and the relative order of the two accesses.
6684 In particular, let I<n> be the number of loops shared by
6685 the two accesses. If C<first> precedes C<second> textually,
6686 then the function should return I<2 * n + 1>; otherwise,
6687 it should return I<2 * n>.
6688 The sources can be added to the C<isl_access_info> by performing
6689 (at most) C<max_source> calls to C<isl_access_info_add_source>.
6690 C<must> indicates whether the source is a I<must> access
6691 or a I<may> access. Note that a multi-valued access relation
6692 should only be marked I<must> if every iteration in the domain
6693 of the relation accesses I<all> elements in its image.
6694 The C<source_user> token is again used to identify
6695 the source access. The range of the source access relation
6696 C<source> should have the same dimension as the range
6697 of the sink access relation.
6698 The C<isl_access_info_free> function should usually not be
6699 called explicitly, because it is called implicitly by
6700 C<isl_access_info_compute_flow>.
6702 The result of the dependence analysis is collected in an
6703 C<isl_flow>. There may be elements of
6704 the sink access for which no preceding source access could be
6705 found or for which all preceding sources are I<may> accesses.
6706 The relations containing these elements can be obtained through
6707 calls to C<isl_flow_get_no_source>, the first with C<must> set
6708 and the second with C<must> unset.
6709 In the case of standard flow dependence analysis,
6710 with the sink a read and the sources I<must> writes,
6711 the first relation corresponds to the reads from uninitialized
6712 array elements and the second relation is empty.
6713 The actual flow dependences can be extracted using
6714 C<isl_flow_foreach>. This function will call the user-specified
6715 callback function C<fn> for each B<non-empty> dependence between
6716 a source and the sink. The callback function is called
6717 with four arguments, the actual flow dependence relation
6718 mapping source iterations to sink iterations, a boolean that
6719 indicates whether it is a I<must> or I<may> dependence, a token
6720 identifying the source and an additional C<void *> with value
6721 equal to the third argument of the C<isl_flow_foreach> call.
6722 A dependence is marked I<must> if it originates from a I<must>
6723 source and if it is not followed by any I<may> sources.
6725 After finishing with an C<isl_flow>, the user should call
6726 C<isl_flow_free> to free all associated memory.
6728 A higher-level interface to dependence analysis is provided
6729 by the following function.
6731 #include <isl/flow.h>
6733 int isl_union_map_compute_flow(__isl_take isl_union_map *sink,
6734 __isl_take isl_union_map *must_source,
6735 __isl_take isl_union_map *may_source,
6736 __isl_take isl_union_map *schedule,
6737 __isl_give isl_union_map **must_dep,
6738 __isl_give isl_union_map **may_dep,
6739 __isl_give isl_union_map **must_no_source,
6740 __isl_give isl_union_map **may_no_source);
6742 The arrays are identified by the tuple names of the ranges
6743 of the accesses. The iteration domains by the tuple names
6744 of the domains of the accesses and of the schedule.
6745 The relative order of the iteration domains is given by the
6746 schedule. The relations returned through C<must_no_source>
6747 and C<may_no_source> are subsets of C<sink>.
6748 Any of C<must_dep>, C<may_dep>, C<must_no_source>
6749 or C<may_no_source> may be C<NULL>, but a C<NULL> value for
6750 any of the other arguments is treated as an error.
6752 =head3 Interaction with Dependence Analysis
6754 During the dependence analysis, we frequently need to perform
6755 the following operation. Given a relation between sink iterations
6756 and potential source iterations from a particular source domain,
6757 what is the last potential source iteration corresponding to each
6758 sink iteration. It can sometimes be convenient to adjust
6759 the set of potential source iterations before or after each such operation.
6760 The prototypical example is fuzzy array dataflow analysis,
6761 where we need to analyze if, based on data-dependent constraints,
6762 the sink iteration can ever be executed without one or more of
6763 the corresponding potential source iterations being executed.
6764 If so, we can introduce extra parameters and select an unknown
6765 but fixed source iteration from the potential source iterations.
6766 To be able to perform such manipulations, C<isl> provides the following
6769 #include <isl/flow.h>
6771 typedef __isl_give isl_restriction *(*isl_access_restrict)(
6772 __isl_keep isl_map *source_map,
6773 __isl_keep isl_set *sink, void *source_user,
6775 __isl_give isl_access_info *isl_access_info_set_restrict(
6776 __isl_take isl_access_info *acc,
6777 isl_access_restrict fn, void *user);
6779 The function C<isl_access_info_set_restrict> should be called
6780 before calling C<isl_access_info_compute_flow> and registers a callback function
6781 that will be called any time C<isl> is about to compute the last
6782 potential source. The first argument is the (reverse) proto-dependence,
6783 mapping sink iterations to potential source iterations.
6784 The second argument represents the sink iterations for which
6785 we want to compute the last source iteration.
6786 The third argument is the token corresponding to the source
6787 and the final argument is the token passed to C<isl_access_info_set_restrict>.
6788 The callback is expected to return a restriction on either the input or
6789 the output of the operation computing the last potential source.
6790 If the input needs to be restricted then restrictions are needed
6791 for both the source and the sink iterations. The sink iterations
6792 and the potential source iterations will be intersected with these sets.
6793 If the output needs to be restricted then only a restriction on the source
6794 iterations is required.
6795 If any error occurs, the callback should return C<NULL>.
6796 An C<isl_restriction> object can be created, freed and inspected
6797 using the following functions.
6799 #include <isl/flow.h>
6801 __isl_give isl_restriction *isl_restriction_input(
6802 __isl_take isl_set *source_restr,
6803 __isl_take isl_set *sink_restr);
6804 __isl_give isl_restriction *isl_restriction_output(
6805 __isl_take isl_set *source_restr);
6806 __isl_give isl_restriction *isl_restriction_none(
6807 __isl_take isl_map *source_map);
6808 __isl_give isl_restriction *isl_restriction_empty(
6809 __isl_take isl_map *source_map);
6810 __isl_null isl_restriction *isl_restriction_free(
6811 __isl_take isl_restriction *restr);
6813 C<isl_restriction_none> and C<isl_restriction_empty> are special
6814 cases of C<isl_restriction_input>. C<isl_restriction_none>
6815 is essentially equivalent to
6817 isl_restriction_input(isl_set_universe(
6818 isl_space_range(isl_map_get_space(source_map))),
6820 isl_space_domain(isl_map_get_space(source_map))));
6822 whereas C<isl_restriction_empty> is essentially equivalent to
6824 isl_restriction_input(isl_set_empty(
6825 isl_space_range(isl_map_get_space(source_map))),
6827 isl_space_domain(isl_map_get_space(source_map))));
6831 B<The functionality described in this section is fairly new
6832 and may be subject to change.>
6834 #include <isl/schedule.h>
6835 __isl_give isl_schedule *
6836 isl_schedule_constraints_compute_schedule(
6837 __isl_take isl_schedule_constraints *sc);
6838 __isl_null isl_schedule *isl_schedule_free(
6839 __isl_take isl_schedule *sched);
6841 The function C<isl_schedule_constraints_compute_schedule> can be
6842 used to compute a schedule that satisfies the given schedule constraints.
6843 These schedule constraints include the iteration domain for which
6844 a schedule should be computed and dependences between pairs of
6845 iterations. In particular, these dependences include
6846 I<validity> dependences and I<proximity> dependences.
6847 By default, the algorithm used to construct the schedule is similar
6848 to that of C<Pluto>.
6849 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
6851 The generated schedule respects all validity dependences.
6852 That is, all dependence distances over these dependences in the
6853 scheduled space are lexicographically positive.
6854 The default algorithm tries to ensure that the dependence distances
6855 over coincidence constraints are zero and to minimize the
6856 dependence distances over proximity dependences.
6857 Moreover, it tries to obtain sequences (bands) of schedule dimensions
6858 for groups of domains where the dependence distances over validity
6859 dependences have only non-negative values.
6860 When using Feautrier's algorithm, the coincidence and proximity constraints
6861 are only taken into account during the extension to a
6862 full-dimensional schedule.
6864 An C<isl_schedule_constraints> object can be constructed
6865 and manipulated using the following functions.
6867 #include <isl/schedule.h>
6868 __isl_give isl_schedule_constraints *
6869 isl_schedule_constraints_copy(
6870 __isl_keep isl_schedule_constraints *sc);
6871 __isl_give isl_schedule_constraints *
6872 isl_schedule_constraints_on_domain(
6873 __isl_take isl_union_set *domain);
6874 __isl_give isl_schedule_constraints *
6875 isl_schedule_constraints_set_validity(
6876 __isl_take isl_schedule_constraints *sc,
6877 __isl_take isl_union_map *validity);
6878 __isl_give isl_schedule_constraints *
6879 isl_schedule_constraints_set_coincidence(
6880 __isl_take isl_schedule_constraints *sc,
6881 __isl_take isl_union_map *coincidence);
6882 __isl_give isl_schedule_constraints *
6883 isl_schedule_constraints_set_proximity(
6884 __isl_take isl_schedule_constraints *sc,
6885 __isl_take isl_union_map *proximity);
6886 __isl_give isl_schedule_constraints *
6887 isl_schedule_constraints_set_conditional_validity(
6888 __isl_take isl_schedule_constraints *sc,
6889 __isl_take isl_union_map *condition,
6890 __isl_take isl_union_map *validity);
6891 __isl_null isl_schedule_constraints *
6892 isl_schedule_constraints_free(
6893 __isl_take isl_schedule_constraints *sc);
6895 The initial C<isl_schedule_constraints> object created by
6896 C<isl_schedule_constraints_on_domain> does not impose any constraints.
6897 That is, it has an empty set of dependences.
6898 The function C<isl_schedule_constraints_set_validity> replaces the
6899 validity dependences, mapping domain elements I<i> to domain
6900 elements that should be scheduled after I<i>.
6901 The function C<isl_schedule_constraints_set_coincidence> replaces the
6902 coincidence dependences, mapping domain elements I<i> to domain
6903 elements that should be scheduled together with I<I>, if possible.
6904 The function C<isl_schedule_constraints_set_proximity> replaces the
6905 proximity dependences, mapping domain elements I<i> to domain
6906 elements that should be scheduled either before I<I>
6907 or as early as possible after I<i>.
6909 The function C<isl_schedule_constraints_set_conditional_validity>
6910 replaces the conditional validity constraints.
6911 A conditional validity constraint is only imposed when any of the corresponding
6912 conditions is satisfied, i.e., when any of them is non-zero.
6913 That is, the scheduler ensures that within each band if the dependence
6914 distances over the condition constraints are not all zero
6915 then all corresponding conditional validity constraints are respected.
6916 A conditional validity constraint corresponds to a condition
6917 if the two are adjacent, i.e., if the domain of one relation intersect
6918 the range of the other relation.
6919 The typical use case of conditional validity constraints is
6920 to allow order constraints between live ranges to be violated
6921 as long as the live ranges themselves are local to the band.
6922 To allow more fine-grained control over which conditions correspond
6923 to which conditional validity constraints, the domains and ranges
6924 of these relations may include I<tags>. That is, the domains and
6925 ranges of those relation may themselves be wrapped relations
6926 where the iteration domain appears in the domain of those wrapped relations
6927 and the range of the wrapped relations can be arbitrarily chosen
6928 by the user. Conditions and conditional validity constraints are only
6929 considered adjacent to each other if the entire wrapped relation matches.
6930 In particular, a relation with a tag will never be considered adjacent
6931 to a relation without a tag.
6933 The following function computes a schedule directly from
6934 an iteration domain and validity and proximity dependences
6935 and is implemented in terms of the functions described above.
6936 The use of C<isl_union_set_compute_schedule> is discouraged.
6938 #include <isl/schedule.h>
6939 __isl_give isl_schedule *isl_union_set_compute_schedule(
6940 __isl_take isl_union_set *domain,
6941 __isl_take isl_union_map *validity,
6942 __isl_take isl_union_map *proximity);
6944 A mapping from the domains to the scheduled space can be obtained
6945 from an C<isl_schedule> using the following function.
6947 __isl_give isl_union_map *isl_schedule_get_map(
6948 __isl_keep isl_schedule *sched);
6950 A representation of the schedule can be printed using
6952 __isl_give isl_printer *isl_printer_print_schedule(
6953 __isl_take isl_printer *p,
6954 __isl_keep isl_schedule *schedule);
6956 A representation of the schedule as a forest of bands can be obtained
6957 using the following function.
6959 __isl_give isl_band_list *isl_schedule_get_band_forest(
6960 __isl_keep isl_schedule *schedule);
6962 The individual bands can be visited in depth-first post-order
6963 using the following function.
6965 #include <isl/schedule.h>
6966 int isl_schedule_foreach_band(
6967 __isl_keep isl_schedule *sched,
6968 int (*fn)(__isl_keep isl_band *band, void *user),
6971 The list can be manipulated as explained in L<"Lists">.
6972 The bands inside the list can be copied and freed using the following
6975 #include <isl/band.h>
6976 __isl_give isl_band *isl_band_copy(
6977 __isl_keep isl_band *band);
6978 __isl_null isl_band *isl_band_free(
6979 __isl_take isl_band *band);
6981 Each band contains zero or more scheduling dimensions.
6982 These are referred to as the members of the band.
6983 The section of the schedule that corresponds to the band is
6984 referred to as the partial schedule of the band.
6985 For those nodes that participate in a band, the outer scheduling
6986 dimensions form the prefix schedule, while the inner scheduling
6987 dimensions form the suffix schedule.
6988 That is, if we take a cut of the band forest, then the union of
6989 the concatenations of the prefix, partial and suffix schedules of
6990 each band in the cut is equal to the entire schedule (modulo
6991 some possible padding at the end with zero scheduling dimensions).
6992 The properties of a band can be inspected using the following functions.
6994 #include <isl/band.h>
6995 int isl_band_has_children(__isl_keep isl_band *band);
6996 __isl_give isl_band_list *isl_band_get_children(
6997 __isl_keep isl_band *band);
6999 __isl_give isl_union_map *isl_band_get_prefix_schedule(
7000 __isl_keep isl_band *band);
7001 __isl_give isl_union_map *isl_band_get_partial_schedule(
7002 __isl_keep isl_band *band);
7003 __isl_give isl_union_map *isl_band_get_suffix_schedule(
7004 __isl_keep isl_band *band);
7006 int isl_band_n_member(__isl_keep isl_band *band);
7007 int isl_band_member_is_coincident(
7008 __isl_keep isl_band *band, int pos);
7010 int isl_band_list_foreach_band(
7011 __isl_keep isl_band_list *list,
7012 int (*fn)(__isl_keep isl_band *band, void *user),
7015 Note that a scheduling dimension is considered to be ``coincident''
7016 if it satisfies the coincidence constraints within its band.
7017 That is, if the dependence distances of the coincidence
7018 constraints are all zero in that direction (for fixed
7019 iterations of outer bands).
7020 Like C<isl_schedule_foreach_band>,
7021 the function C<isl_band_list_foreach_band> calls C<fn> on the bands
7022 in depth-first post-order.
7024 A band can be tiled using the following function.
7026 #include <isl/band.h>
7027 int isl_band_tile(__isl_keep isl_band *band,
7028 __isl_take isl_vec *sizes);
7030 int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
7032 int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
7033 int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
7035 int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
7037 The C<isl_band_tile> function tiles the band using the given tile sizes
7038 inside its schedule.
7039 A new child band is created to represent the point loops and it is
7040 inserted between the modified band and its children.
7041 The C<tile_scale_tile_loops> option specifies whether the tile
7042 loops iterators should be scaled by the tile sizes.
7043 If the C<tile_shift_point_loops> option is set, then the point loops
7044 are shifted to start at zero.
7046 A band can be split into two nested bands using the following function.
7048 int isl_band_split(__isl_keep isl_band *band, int pos);
7050 The resulting outer band contains the first C<pos> dimensions of C<band>
7051 while the inner band contains the remaining dimensions.
7053 A representation of the band can be printed using
7055 #include <isl/band.h>
7056 __isl_give isl_printer *isl_printer_print_band(
7057 __isl_take isl_printer *p,
7058 __isl_keep isl_band *band);
7062 #include <isl/schedule.h>
7063 int isl_options_set_schedule_max_coefficient(
7064 isl_ctx *ctx, int val);
7065 int isl_options_get_schedule_max_coefficient(
7067 int isl_options_set_schedule_max_constant_term(
7068 isl_ctx *ctx, int val);
7069 int isl_options_get_schedule_max_constant_term(
7071 int isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
7072 int isl_options_get_schedule_fuse(isl_ctx *ctx);
7073 int isl_options_set_schedule_maximize_band_depth(
7074 isl_ctx *ctx, int val);
7075 int isl_options_get_schedule_maximize_band_depth(
7077 int isl_options_set_schedule_outer_coincidence(
7078 isl_ctx *ctx, int val);
7079 int isl_options_get_schedule_outer_coincidence(
7081 int isl_options_set_schedule_split_scaled(
7082 isl_ctx *ctx, int val);
7083 int isl_options_get_schedule_split_scaled(
7085 int isl_options_set_schedule_algorithm(
7086 isl_ctx *ctx, int val);
7087 int isl_options_get_schedule_algorithm(
7089 int isl_options_set_schedule_separate_components(
7090 isl_ctx *ctx, int val);
7091 int isl_options_get_schedule_separate_components(
7096 =item * schedule_max_coefficient
7098 This option enforces that the coefficients for variable and parameter
7099 dimensions in the calculated schedule are not larger than the specified value.
7100 This option can significantly increase the speed of the scheduling calculation
7101 and may also prevent fusing of unrelated dimensions. A value of -1 means that
7102 this option does not introduce bounds on the variable or parameter
7105 =item * schedule_max_constant_term
7107 This option enforces that the constant coefficients in the calculated schedule
7108 are not larger than the maximal constant term. This option can significantly
7109 increase the speed of the scheduling calculation and may also prevent fusing of
7110 unrelated dimensions. A value of -1 means that this option does not introduce
7111 bounds on the constant coefficients.
7113 =item * schedule_fuse
7115 This option controls the level of fusion.
7116 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
7117 resulting schedule will be distributed as much as possible.
7118 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
7119 try to fuse loops in the resulting schedule.
7121 =item * schedule_maximize_band_depth
7123 If this option is set, we do not split bands at the point
7124 where we detect splitting is necessary. Instead, we
7125 backtrack and split bands as early as possible. This
7126 reduces the number of splits and maximizes the width of
7127 the bands. Wider bands give more possibilities for tiling.
7128 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
7129 then bands will be split as early as possible, even if there is no need.
7130 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
7132 =item * schedule_outer_coincidence
7134 If this option is set, then we try to construct schedules
7135 where the outermost scheduling dimension in each band
7136 satisfies the coincidence constraints.
7138 =item * schedule_split_scaled
7140 If this option is set, then we try to construct schedules in which the
7141 constant term is split off from the linear part if the linear parts of
7142 the scheduling rows for all nodes in the graphs have a common non-trivial
7144 The constant term is then placed in a separate band and the linear
7147 =item * schedule_algorithm
7149 Selects the scheduling algorithm to be used.
7150 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
7151 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
7153 =item * schedule_separate_components
7155 If at any point the dependence graph contains any (weakly connected) components,
7156 then these components are scheduled separately.
7157 If this option is not set, then some iterations of the domains
7158 in these components may be scheduled together.
7159 If this option is set, then the components are given consecutive
7164 =head2 AST Generation
7166 This section describes the C<isl> functionality for generating
7167 ASTs that visit all the elements
7168 in a domain in an order specified by a schedule.
7169 In particular, given a C<isl_union_map>, an AST is generated
7170 that visits all the elements in the domain of the C<isl_union_map>
7171 according to the lexicographic order of the corresponding image
7172 element(s). If the range of the C<isl_union_map> consists of
7173 elements in more than one space, then each of these spaces is handled
7174 separately in an arbitrary order.
7175 It should be noted that the image elements only specify the I<order>
7176 in which the corresponding domain elements should be visited.
7177 No direct relation between the image elements and the loop iterators
7178 in the generated AST should be assumed.
7180 Each AST is generated within a build. The initial build
7181 simply specifies the constraints on the parameters (if any)
7182 and can be created, inspected, copied and freed using the following functions.
7184 #include <isl/ast_build.h>
7185 __isl_give isl_ast_build *isl_ast_build_from_context(
7186 __isl_take isl_set *set);
7187 __isl_give isl_ast_build *isl_ast_build_copy(
7188 __isl_keep isl_ast_build *build);
7189 __isl_null isl_ast_build *isl_ast_build_free(
7190 __isl_take isl_ast_build *build);
7192 The C<set> argument is usually a parameter set with zero or more parameters.
7193 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
7194 and L</"Fine-grained Control over AST Generation">.
7195 Finally, the AST itself can be constructed using the following
7198 #include <isl/ast_build.h>
7199 __isl_give isl_ast_node *isl_ast_build_ast_from_schedule(
7200 __isl_keep isl_ast_build *build,
7201 __isl_take isl_union_map *schedule);
7203 =head3 Inspecting the AST
7205 The basic properties of an AST node can be obtained as follows.
7207 #include <isl/ast.h>
7208 enum isl_ast_node_type isl_ast_node_get_type(
7209 __isl_keep isl_ast_node *node);
7211 The type of an AST node is one of
7212 C<isl_ast_node_for>,
7214 C<isl_ast_node_block> or
7215 C<isl_ast_node_user>.
7216 An C<isl_ast_node_for> represents a for node.
7217 An C<isl_ast_node_if> represents an if node.
7218 An C<isl_ast_node_block> represents a compound node.
7219 An C<isl_ast_node_user> represents an expression statement.
7220 An expression statement typically corresponds to a domain element, i.e.,
7221 one of the elements that is visited by the AST.
7223 Each type of node has its own additional properties.
7225 #include <isl/ast.h>
7226 __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
7227 __isl_keep isl_ast_node *node);
7228 __isl_give isl_ast_expr *isl_ast_node_for_get_init(
7229 __isl_keep isl_ast_node *node);
7230 __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
7231 __isl_keep isl_ast_node *node);
7232 __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
7233 __isl_keep isl_ast_node *node);
7234 __isl_give isl_ast_node *isl_ast_node_for_get_body(
7235 __isl_keep isl_ast_node *node);
7236 int isl_ast_node_for_is_degenerate(
7237 __isl_keep isl_ast_node *node);
7239 An C<isl_ast_for> is considered degenerate if it is known to execute
7242 #include <isl/ast.h>
7243 __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
7244 __isl_keep isl_ast_node *node);
7245 __isl_give isl_ast_node *isl_ast_node_if_get_then(
7246 __isl_keep isl_ast_node *node);
7247 int isl_ast_node_if_has_else(
7248 __isl_keep isl_ast_node *node);
7249 __isl_give isl_ast_node *isl_ast_node_if_get_else(
7250 __isl_keep isl_ast_node *node);
7252 __isl_give isl_ast_node_list *
7253 isl_ast_node_block_get_children(
7254 __isl_keep isl_ast_node *node);
7256 __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
7257 __isl_keep isl_ast_node *node);
7259 Each of the returned C<isl_ast_expr>s can in turn be inspected using
7260 the following functions.
7262 #include <isl/ast.h>
7263 enum isl_ast_expr_type isl_ast_expr_get_type(
7264 __isl_keep isl_ast_expr *expr);
7266 The type of an AST expression is one of
7268 C<isl_ast_expr_id> or
7269 C<isl_ast_expr_int>.
7270 An C<isl_ast_expr_op> represents the result of an operation.
7271 An C<isl_ast_expr_id> represents an identifier.
7272 An C<isl_ast_expr_int> represents an integer value.
7274 Each type of expression has its own additional properties.
7276 #include <isl/ast.h>
7277 enum isl_ast_op_type isl_ast_expr_get_op_type(
7278 __isl_keep isl_ast_expr *expr);
7279 int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
7280 __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
7281 __isl_keep isl_ast_expr *expr, int pos);
7282 int isl_ast_node_foreach_ast_op_type(
7283 __isl_keep isl_ast_node *node,
7284 int (*fn)(enum isl_ast_op_type type, void *user),
7287 C<isl_ast_expr_get_op_type> returns the type of the operation
7288 performed. C<isl_ast_expr_get_op_n_arg> returns the number of
7289 arguments. C<isl_ast_expr_get_op_arg> returns the specified
7291 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
7292 C<isl_ast_op_type> that appears in C<node>.
7293 The operation type is one of the following.
7297 =item C<isl_ast_op_and>
7299 Logical I<and> of two arguments.
7300 Both arguments can be evaluated.
7302 =item C<isl_ast_op_and_then>
7304 Logical I<and> of two arguments.
7305 The second argument can only be evaluated if the first evaluates to true.
7307 =item C<isl_ast_op_or>
7309 Logical I<or> of two arguments.
7310 Both arguments can be evaluated.
7312 =item C<isl_ast_op_or_else>
7314 Logical I<or> of two arguments.
7315 The second argument can only be evaluated if the first evaluates to false.
7317 =item C<isl_ast_op_max>
7319 Maximum of two or more arguments.
7321 =item C<isl_ast_op_min>
7323 Minimum of two or more arguments.
7325 =item C<isl_ast_op_minus>
7329 =item C<isl_ast_op_add>
7331 Sum of two arguments.
7333 =item C<isl_ast_op_sub>
7335 Difference of two arguments.
7337 =item C<isl_ast_op_mul>
7339 Product of two arguments.
7341 =item C<isl_ast_op_div>
7343 Exact division. That is, the result is known to be an integer.
7345 =item C<isl_ast_op_fdiv_q>
7347 Result of integer division, rounded towards negative
7350 =item C<isl_ast_op_pdiv_q>
7352 Result of integer division, where dividend is known to be non-negative.
7354 =item C<isl_ast_op_pdiv_r>
7356 Remainder of integer division, where dividend is known to be non-negative.
7358 =item C<isl_ast_op_zdiv_r>
7360 Equal to zero iff the remainder on integer division is zero.
7362 =item C<isl_ast_op_cond>
7364 Conditional operator defined on three arguments.
7365 If the first argument evaluates to true, then the result
7366 is equal to the second argument. Otherwise, the result
7367 is equal to the third argument.
7368 The second and third argument may only be evaluated if
7369 the first argument evaluates to true and false, respectively.
7370 Corresponds to C<a ? b : c> in C.
7372 =item C<isl_ast_op_select>
7374 Conditional operator defined on three arguments.
7375 If the first argument evaluates to true, then the result
7376 is equal to the second argument. Otherwise, the result
7377 is equal to the third argument.
7378 The second and third argument may be evaluated independently
7379 of the value of the first argument.
7380 Corresponds to C<a * b + (1 - a) * c> in C.
7382 =item C<isl_ast_op_eq>
7386 =item C<isl_ast_op_le>
7388 Less than or equal relation.
7390 =item C<isl_ast_op_lt>
7394 =item C<isl_ast_op_ge>
7396 Greater than or equal relation.
7398 =item C<isl_ast_op_gt>
7400 Greater than relation.
7402 =item C<isl_ast_op_call>
7405 The number of arguments of the C<isl_ast_expr> is one more than
7406 the number of arguments in the function call, the first argument
7407 representing the function being called.
7409 =item C<isl_ast_op_access>
7412 The number of arguments of the C<isl_ast_expr> is one more than
7413 the number of index expressions in the array access, the first argument
7414 representing the array being accessed.
7416 =item C<isl_ast_op_member>
7419 This operation has two arguments, a structure and the name of
7420 the member of the structure being accessed.
7424 #include <isl/ast.h>
7425 __isl_give isl_id *isl_ast_expr_get_id(
7426 __isl_keep isl_ast_expr *expr);
7428 Return the identifier represented by the AST expression.
7430 #include <isl/ast.h>
7431 __isl_give isl_val *isl_ast_expr_get_val(
7432 __isl_keep isl_ast_expr *expr);
7434 Return the integer represented by the AST expression.
7436 =head3 Properties of ASTs
7438 #include <isl/ast.h>
7439 int isl_ast_expr_is_equal(__isl_keep isl_ast_expr *expr1,
7440 __isl_keep isl_ast_expr *expr2);
7442 Check if two C<isl_ast_expr>s are equal to each other.
7444 =head3 Manipulating and printing the AST
7446 AST nodes can be copied and freed using the following functions.
7448 #include <isl/ast.h>
7449 __isl_give isl_ast_node *isl_ast_node_copy(
7450 __isl_keep isl_ast_node *node);
7451 __isl_null isl_ast_node *isl_ast_node_free(
7452 __isl_take isl_ast_node *node);
7454 AST expressions can be copied and freed using the following functions.
7456 #include <isl/ast.h>
7457 __isl_give isl_ast_expr *isl_ast_expr_copy(
7458 __isl_keep isl_ast_expr *expr);
7459 __isl_null isl_ast_expr *isl_ast_expr_free(
7460 __isl_take isl_ast_expr *expr);
7462 New AST expressions can be created either directly or within
7463 the context of an C<isl_ast_build>.
7465 #include <isl/ast.h>
7466 __isl_give isl_ast_expr *isl_ast_expr_from_val(
7467 __isl_take isl_val *v);
7468 __isl_give isl_ast_expr *isl_ast_expr_from_id(
7469 __isl_take isl_id *id);
7470 __isl_give isl_ast_expr *isl_ast_expr_neg(
7471 __isl_take isl_ast_expr *expr);
7472 __isl_give isl_ast_expr *isl_ast_expr_address_of(
7473 __isl_take isl_ast_expr *expr);
7474 __isl_give isl_ast_expr *isl_ast_expr_add(
7475 __isl_take isl_ast_expr *expr1,
7476 __isl_take isl_ast_expr *expr2);
7477 __isl_give isl_ast_expr *isl_ast_expr_sub(
7478 __isl_take isl_ast_expr *expr1,
7479 __isl_take isl_ast_expr *expr2);
7480 __isl_give isl_ast_expr *isl_ast_expr_mul(
7481 __isl_take isl_ast_expr *expr1,
7482 __isl_take isl_ast_expr *expr2);
7483 __isl_give isl_ast_expr *isl_ast_expr_div(
7484 __isl_take isl_ast_expr *expr1,
7485 __isl_take isl_ast_expr *expr2);
7486 __isl_give isl_ast_expr *isl_ast_expr_and(
7487 __isl_take isl_ast_expr *expr1,
7488 __isl_take isl_ast_expr *expr2)
7489 __isl_give isl_ast_expr *isl_ast_expr_or(
7490 __isl_take isl_ast_expr *expr1,
7491 __isl_take isl_ast_expr *expr2)
7492 __isl_give isl_ast_expr *isl_ast_expr_eq(
7493 __isl_take isl_ast_expr *expr1,
7494 __isl_take isl_ast_expr *expr2);
7495 __isl_give isl_ast_expr *isl_ast_expr_le(
7496 __isl_take isl_ast_expr *expr1,
7497 __isl_take isl_ast_expr *expr2);
7498 __isl_give isl_ast_expr *isl_ast_expr_lt(
7499 __isl_take isl_ast_expr *expr1,
7500 __isl_take isl_ast_expr *expr2);
7501 __isl_give isl_ast_expr *isl_ast_expr_ge(
7502 __isl_take isl_ast_expr *expr1,
7503 __isl_take isl_ast_expr *expr2);
7504 __isl_give isl_ast_expr *isl_ast_expr_gt(
7505 __isl_take isl_ast_expr *expr1,
7506 __isl_take isl_ast_expr *expr2);
7507 __isl_give isl_ast_expr *isl_ast_expr_access(
7508 __isl_take isl_ast_expr *array,
7509 __isl_take isl_ast_expr_list *indices);
7511 The function C<isl_ast_expr_address_of> can be applied to an
7512 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
7513 to represent the address of the C<isl_ast_expr_access>.
7515 #include <isl/ast_build.h>
7516 __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
7517 __isl_keep isl_ast_build *build,
7518 __isl_take isl_pw_aff *pa);
7519 __isl_give isl_ast_expr *
7520 isl_ast_build_access_from_pw_multi_aff(
7521 __isl_keep isl_ast_build *build,
7522 __isl_take isl_pw_multi_aff *pma);
7523 __isl_give isl_ast_expr *
7524 isl_ast_build_access_from_multi_pw_aff(
7525 __isl_keep isl_ast_build *build,
7526 __isl_take isl_multi_pw_aff *mpa);
7527 __isl_give isl_ast_expr *
7528 isl_ast_build_call_from_pw_multi_aff(
7529 __isl_keep isl_ast_build *build,
7530 __isl_take isl_pw_multi_aff *pma);
7531 __isl_give isl_ast_expr *
7532 isl_ast_build_call_from_multi_pw_aff(
7533 __isl_keep isl_ast_build *build,
7534 __isl_take isl_multi_pw_aff *mpa);
7536 The domains of C<pa>, C<mpa> and C<pma> should correspond
7537 to the schedule space of C<build>.
7538 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
7539 the function being called.
7540 If the accessed space is a nested relation, then it is taken
7541 to represent an access of the member specified by the range
7542 of this nested relation of the structure specified by the domain
7543 of the nested relation.
7545 The following functions can be used to modify an C<isl_ast_expr>.
7547 #include <isl/ast.h>
7548 __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
7549 __isl_take isl_ast_expr *expr, int pos,
7550 __isl_take isl_ast_expr *arg);
7552 Replace the argument of C<expr> at position C<pos> by C<arg>.
7554 #include <isl/ast.h>
7555 __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
7556 __isl_take isl_ast_expr *expr,
7557 __isl_take isl_id_to_ast_expr *id2expr);
7559 The function C<isl_ast_expr_substitute_ids> replaces the
7560 subexpressions of C<expr> of type C<isl_ast_expr_id>
7561 by the corresponding expression in C<id2expr>, if there is any.
7564 User specified data can be attached to an C<isl_ast_node> and obtained
7565 from the same C<isl_ast_node> using the following functions.
7567 #include <isl/ast.h>
7568 __isl_give isl_ast_node *isl_ast_node_set_annotation(
7569 __isl_take isl_ast_node *node,
7570 __isl_take isl_id *annotation);
7571 __isl_give isl_id *isl_ast_node_get_annotation(
7572 __isl_keep isl_ast_node *node);
7574 Basic printing can be performed using the following functions.
7576 #include <isl/ast.h>
7577 __isl_give isl_printer *isl_printer_print_ast_expr(
7578 __isl_take isl_printer *p,
7579 __isl_keep isl_ast_expr *expr);
7580 __isl_give isl_printer *isl_printer_print_ast_node(
7581 __isl_take isl_printer *p,
7582 __isl_keep isl_ast_node *node);
7583 __isl_give char *isl_ast_expr_to_str(
7584 __isl_keep isl_ast_expr *expr);
7586 More advanced printing can be performed using the following functions.
7588 #include <isl/ast.h>
7589 __isl_give isl_printer *isl_ast_op_type_print_macro(
7590 enum isl_ast_op_type type,
7591 __isl_take isl_printer *p);
7592 __isl_give isl_printer *isl_ast_node_print_macros(
7593 __isl_keep isl_ast_node *node,
7594 __isl_take isl_printer *p);
7595 __isl_give isl_printer *isl_ast_node_print(
7596 __isl_keep isl_ast_node *node,
7597 __isl_take isl_printer *p,
7598 __isl_take isl_ast_print_options *options);
7599 __isl_give isl_printer *isl_ast_node_for_print(
7600 __isl_keep isl_ast_node *node,
7601 __isl_take isl_printer *p,
7602 __isl_take isl_ast_print_options *options);
7603 __isl_give isl_printer *isl_ast_node_if_print(
7604 __isl_keep isl_ast_node *node,
7605 __isl_take isl_printer *p,
7606 __isl_take isl_ast_print_options *options);
7608 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
7609 C<isl> may print out an AST that makes use of macros such
7610 as C<floord>, C<min> and C<max>.
7611 C<isl_ast_op_type_print_macro> prints out the macro
7612 corresponding to a specific C<isl_ast_op_type>.
7613 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
7614 for expressions where these macros would be used and prints
7615 out the required macro definitions.
7616 Essentially, C<isl_ast_node_print_macros> calls
7617 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
7618 as function argument.
7619 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
7620 C<isl_ast_node_if_print> print an C<isl_ast_node>
7621 in C<ISL_FORMAT_C>, but allow for some extra control
7622 through an C<isl_ast_print_options> object.
7623 This object can be created using the following functions.
7625 #include <isl/ast.h>
7626 __isl_give isl_ast_print_options *
7627 isl_ast_print_options_alloc(isl_ctx *ctx);
7628 __isl_give isl_ast_print_options *
7629 isl_ast_print_options_copy(
7630 __isl_keep isl_ast_print_options *options);
7631 __isl_null isl_ast_print_options *
7632 isl_ast_print_options_free(
7633 __isl_take isl_ast_print_options *options);
7635 __isl_give isl_ast_print_options *
7636 isl_ast_print_options_set_print_user(
7637 __isl_take isl_ast_print_options *options,
7638 __isl_give isl_printer *(*print_user)(
7639 __isl_take isl_printer *p,
7640 __isl_take isl_ast_print_options *options,
7641 __isl_keep isl_ast_node *node, void *user),
7643 __isl_give isl_ast_print_options *
7644 isl_ast_print_options_set_print_for(
7645 __isl_take isl_ast_print_options *options,
7646 __isl_give isl_printer *(*print_for)(
7647 __isl_take isl_printer *p,
7648 __isl_take isl_ast_print_options *options,
7649 __isl_keep isl_ast_node *node, void *user),
7652 The callback set by C<isl_ast_print_options_set_print_user>
7653 is called whenever a node of type C<isl_ast_node_user> needs to
7655 The callback set by C<isl_ast_print_options_set_print_for>
7656 is called whenever a node of type C<isl_ast_node_for> needs to
7658 Note that C<isl_ast_node_for_print> will I<not> call the
7659 callback set by C<isl_ast_print_options_set_print_for> on the node
7660 on which C<isl_ast_node_for_print> is called, but only on nested
7661 nodes of type C<isl_ast_node_for>. It is therefore safe to
7662 call C<isl_ast_node_for_print> from within the callback set by
7663 C<isl_ast_print_options_set_print_for>.
7665 The following option determines the type to be used for iterators
7666 while printing the AST.
7668 int isl_options_set_ast_iterator_type(
7669 isl_ctx *ctx, const char *val);
7670 const char *isl_options_get_ast_iterator_type(
7673 The AST printer only prints body nodes as blocks if these
7674 blocks cannot be safely omitted.
7675 For example, a C<for> node with one body node will not be
7676 surrounded with braces in C<ISL_FORMAT_C>.
7677 A block will always be printed by setting the following option.
7679 int isl_options_set_ast_always_print_block(isl_ctx *ctx,
7681 int isl_options_get_ast_always_print_block(isl_ctx *ctx);
7685 #include <isl/ast_build.h>
7686 int isl_options_set_ast_build_atomic_upper_bound(
7687 isl_ctx *ctx, int val);
7688 int isl_options_get_ast_build_atomic_upper_bound(
7690 int isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
7692 int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
7693 int isl_options_set_ast_build_exploit_nested_bounds(
7694 isl_ctx *ctx, int val);
7695 int isl_options_get_ast_build_exploit_nested_bounds(
7697 int isl_options_set_ast_build_group_coscheduled(
7698 isl_ctx *ctx, int val);
7699 int isl_options_get_ast_build_group_coscheduled(
7701 int isl_options_set_ast_build_scale_strides(
7702 isl_ctx *ctx, int val);
7703 int isl_options_get_ast_build_scale_strides(
7705 int isl_options_set_ast_build_allow_else(isl_ctx *ctx,
7707 int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
7708 int isl_options_set_ast_build_allow_or(isl_ctx *ctx,
7710 int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
7714 =item * ast_build_atomic_upper_bound
7716 Generate loop upper bounds that consist of the current loop iterator,
7717 an operator and an expression not involving the iterator.
7718 If this option is not set, then the current loop iterator may appear
7719 several times in the upper bound.
7720 For example, when this option is turned off, AST generation
7723 [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
7727 for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
7730 When the option is turned on, the following AST is generated
7732 for (int c0 = 0; c0 <= min(100, n); c0 += 1)
7735 =item * ast_build_prefer_pdiv
7737 If this option is turned off, then the AST generation will
7738 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
7739 operators, but no C<isl_ast_op_pdiv_q> or
7740 C<isl_ast_op_pdiv_r> operators.
7741 If this options is turned on, then C<isl> will try to convert
7742 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
7743 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
7745 =item * ast_build_exploit_nested_bounds
7747 Simplify conditions based on bounds of nested for loops.
7748 In particular, remove conditions that are implied by the fact
7749 that one or more nested loops have at least one iteration,
7750 meaning that the upper bound is at least as large as the lower bound.
7751 For example, when this option is turned off, AST generation
7754 [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
7760 for (int c0 = 0; c0 <= N; c0 += 1)
7761 for (int c1 = 0; c1 <= M; c1 += 1)
7764 When the option is turned on, the following AST is generated
7766 for (int c0 = 0; c0 <= N; c0 += 1)
7767 for (int c1 = 0; c1 <= M; c1 += 1)
7770 =item * ast_build_group_coscheduled
7772 If two domain elements are assigned the same schedule point, then
7773 they may be executed in any order and they may even appear in different
7774 loops. If this options is set, then the AST generator will make
7775 sure that coscheduled domain elements do not appear in separate parts
7776 of the AST. This is useful in case of nested AST generation
7777 if the outer AST generation is given only part of a schedule
7778 and the inner AST generation should handle the domains that are
7779 coscheduled by this initial part of the schedule together.
7780 For example if an AST is generated for a schedule
7782 { A[i] -> [0]; B[i] -> [0] }
7784 then the C<isl_ast_build_set_create_leaf> callback described
7785 below may get called twice, once for each domain.
7786 Setting this option ensures that the callback is only called once
7787 on both domains together.
7789 =item * ast_build_separation_bounds
7791 This option specifies which bounds to use during separation.
7792 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
7793 then all (possibly implicit) bounds on the current dimension will
7794 be used during separation.
7795 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
7796 then only those bounds that are explicitly available will
7797 be used during separation.
7799 =item * ast_build_scale_strides
7801 This option specifies whether the AST generator is allowed
7802 to scale down iterators of strided loops.
7804 =item * ast_build_allow_else
7806 This option specifies whether the AST generator is allowed
7807 to construct if statements with else branches.
7809 =item * ast_build_allow_or
7811 This option specifies whether the AST generator is allowed
7812 to construct if conditions with disjunctions.
7816 =head3 Fine-grained Control over AST Generation
7818 Besides specifying the constraints on the parameters,
7819 an C<isl_ast_build> object can be used to control
7820 various aspects of the AST generation process.
7821 The most prominent way of control is through ``options'',
7822 which can be set using the following function.
7824 #include <isl/ast_build.h>
7825 __isl_give isl_ast_build *
7826 isl_ast_build_set_options(
7827 __isl_take isl_ast_build *control,
7828 __isl_take isl_union_map *options);
7830 The options are encoded in an C<isl_union_map>.
7831 The domain of this union relation refers to the schedule domain,
7832 i.e., the range of the schedule passed to C<isl_ast_build_ast_from_schedule>.
7833 In the case of nested AST generation (see L</"Nested AST Generation">),
7834 the domain of C<options> should refer to the extra piece of the schedule.
7835 That is, it should be equal to the range of the wrapped relation in the
7836 range of the schedule.
7837 The range of the options can consist of elements in one or more spaces,
7838 the names of which determine the effect of the option.
7839 The values of the range typically also refer to the schedule dimension
7840 to which the option applies. In case of nested AST generation
7841 (see L</"Nested AST Generation">), these values refer to the position
7842 of the schedule dimension within the innermost AST generation.
7843 The constraints on the domain elements of
7844 the option should only refer to this dimension and earlier dimensions.
7845 We consider the following spaces.
7849 =item C<separation_class>
7851 This space is a wrapped relation between two one dimensional spaces.
7852 The input space represents the schedule dimension to which the option
7853 applies and the output space represents the separation class.
7854 While constructing a loop corresponding to the specified schedule
7855 dimension(s), the AST generator will try to generate separate loops
7856 for domain elements that are assigned different classes.
7857 If only some of the elements are assigned a class, then those elements
7858 that are not assigned any class will be treated as belonging to a class
7859 that is separate from the explicitly assigned classes.
7860 The typical use case for this option is to separate full tiles from
7862 The other options, described below, are applied after the separation
7865 As an example, consider the separation into full and partial tiles
7866 of a tiling of a triangular domain.
7867 Take, for example, the domain
7869 { A[i,j] : 0 <= i,j and i + j <= 100 }
7871 and a tiling into tiles of 10 by 10. The input to the AST generator
7872 is then the schedule
7874 { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
7877 Without any options, the following AST is generated
7879 for (int c0 = 0; c0 <= 10; c0 += 1)
7880 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
7881 for (int c2 = 10 * c0;
7882 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
7884 for (int c3 = 10 * c1;
7885 c3 <= min(10 * c1 + 9, -c2 + 100);
7889 Separation into full and partial tiles can be obtained by assigning
7890 a class, say C<0>, to the full tiles. The full tiles are represented by those
7891 values of the first and second schedule dimensions for which there are
7892 values of the third and fourth dimensions to cover an entire tile.
7893 That is, we need to specify the following option
7895 { [a,b,c,d] -> separation_class[[0]->[0]] :
7896 exists b': 0 <= 10a,10b' and
7897 10a+9+10b'+9 <= 100;
7898 [a,b,c,d] -> separation_class[[1]->[0]] :
7899 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
7903 { [a, b, c, d] -> separation_class[[1] -> [0]] :
7904 a >= 0 and b >= 0 and b <= 8 - a;
7905 [a, b, c, d] -> separation_class[[0] -> [0]] :
7908 With this option, the generated AST is as follows
7911 for (int c0 = 0; c0 <= 8; c0 += 1) {
7912 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
7913 for (int c2 = 10 * c0;
7914 c2 <= 10 * c0 + 9; c2 += 1)
7915 for (int c3 = 10 * c1;
7916 c3 <= 10 * c1 + 9; c3 += 1)
7918 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
7919 for (int c2 = 10 * c0;
7920 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
7922 for (int c3 = 10 * c1;
7923 c3 <= min(-c2 + 100, 10 * c1 + 9);
7927 for (int c0 = 9; c0 <= 10; c0 += 1)
7928 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
7929 for (int c2 = 10 * c0;
7930 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
7932 for (int c3 = 10 * c1;
7933 c3 <= min(10 * c1 + 9, -c2 + 100);
7940 This is a single-dimensional space representing the schedule dimension(s)
7941 to which ``separation'' should be applied. Separation tries to split
7942 a loop into several pieces if this can avoid the generation of guards
7944 See also the C<atomic> option.
7948 This is a single-dimensional space representing the schedule dimension(s)
7949 for which the domains should be considered ``atomic''. That is, the
7950 AST generator will make sure that any given domain space will only appear
7951 in a single loop at the specified level.
7953 Consider the following schedule
7955 { a[i] -> [i] : 0 <= i < 10;
7956 b[i] -> [i+1] : 0 <= i < 10 }
7958 If the following option is specified
7960 { [i] -> separate[x] }
7962 then the following AST will be generated
7966 for (int c0 = 1; c0 <= 9; c0 += 1) {
7973 If, on the other hand, the following option is specified
7975 { [i] -> atomic[x] }
7977 then the following AST will be generated
7979 for (int c0 = 0; c0 <= 10; c0 += 1) {
7986 If neither C<atomic> nor C<separate> is specified, then the AST generator
7987 may produce either of these two results or some intermediate form.
7991 This is a single-dimensional space representing the schedule dimension(s)
7992 that should be I<completely> unrolled.
7993 To obtain a partial unrolling, the user should apply an additional
7994 strip-mining to the schedule and fully unroll the inner loop.
7998 Additional control is available through the following functions.
8000 #include <isl/ast_build.h>
8001 __isl_give isl_ast_build *
8002 isl_ast_build_set_iterators(
8003 __isl_take isl_ast_build *control,
8004 __isl_take isl_id_list *iterators);
8006 The function C<isl_ast_build_set_iterators> allows the user to
8007 specify a list of iterator C<isl_id>s to be used as iterators.
8008 If the input schedule is injective, then
8009 the number of elements in this list should be as large as the dimension
8010 of the schedule space, but no direct correspondence should be assumed
8011 between dimensions and elements.
8012 If the input schedule is not injective, then an additional number
8013 of C<isl_id>s equal to the largest dimension of the input domains
8015 If the number of provided C<isl_id>s is insufficient, then additional
8016 names are automatically generated.
8018 #include <isl/ast_build.h>
8019 __isl_give isl_ast_build *
8020 isl_ast_build_set_create_leaf(
8021 __isl_take isl_ast_build *control,
8022 __isl_give isl_ast_node *(*fn)(
8023 __isl_take isl_ast_build *build,
8024 void *user), void *user);
8027 C<isl_ast_build_set_create_leaf> function allows for the
8028 specification of a callback that should be called whenever the AST
8029 generator arrives at an element of the schedule domain.
8030 The callback should return an AST node that should be inserted
8031 at the corresponding position of the AST. The default action (when
8032 the callback is not set) is to continue generating parts of the AST to scan
8033 all the domain elements associated to the schedule domain element
8034 and to insert user nodes, ``calling'' the domain element, for each of them.
8035 The C<build> argument contains the current state of the C<isl_ast_build>.
8036 To ease nested AST generation (see L</"Nested AST Generation">),
8037 all control information that is
8038 specific to the current AST generation such as the options and
8039 the callbacks has been removed from this C<isl_ast_build>.
8040 The callback would typically return the result of a nested
8042 user defined node created using the following function.
8044 #include <isl/ast.h>
8045 __isl_give isl_ast_node *isl_ast_node_alloc_user(
8046 __isl_take isl_ast_expr *expr);
8048 #include <isl/ast_build.h>
8049 __isl_give isl_ast_build *
8050 isl_ast_build_set_at_each_domain(
8051 __isl_take isl_ast_build *build,
8052 __isl_give isl_ast_node *(*fn)(
8053 __isl_take isl_ast_node *node,
8054 __isl_keep isl_ast_build *build,
8055 void *user), void *user);
8056 __isl_give isl_ast_build *
8057 isl_ast_build_set_before_each_for(
8058 __isl_take isl_ast_build *build,
8059 __isl_give isl_id *(*fn)(
8060 __isl_keep isl_ast_build *build,
8061 void *user), void *user);
8062 __isl_give isl_ast_build *
8063 isl_ast_build_set_after_each_for(
8064 __isl_take isl_ast_build *build,
8065 __isl_give isl_ast_node *(*fn)(
8066 __isl_take isl_ast_node *node,
8067 __isl_keep isl_ast_build *build,
8068 void *user), void *user);
8070 The callback set by C<isl_ast_build_set_at_each_domain> will
8071 be called for each domain AST node.
8072 The callbacks set by C<isl_ast_build_set_before_each_for>
8073 and C<isl_ast_build_set_after_each_for> will be called
8074 for each for AST node. The first will be called in depth-first
8075 pre-order, while the second will be called in depth-first post-order.
8076 Since C<isl_ast_build_set_before_each_for> is called before the for
8077 node is actually constructed, it is only passed an C<isl_ast_build>.
8078 The returned C<isl_id> will be added as an annotation (using
8079 C<isl_ast_node_set_annotation>) to the constructed for node.
8080 In particular, if the user has also specified an C<after_each_for>
8081 callback, then the annotation can be retrieved from the node passed to
8082 that callback using C<isl_ast_node_get_annotation>.
8083 All callbacks should C<NULL> on failure.
8084 The given C<isl_ast_build> can be used to create new
8085 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
8086 or C<isl_ast_build_call_from_pw_multi_aff>.
8088 =head3 Nested AST Generation
8090 C<isl> allows the user to create an AST within the context
8091 of another AST. These nested ASTs are created using the
8092 same C<isl_ast_build_ast_from_schedule> function that is used to create the
8093 outer AST. The C<build> argument should be an C<isl_ast_build>
8094 passed to a callback set by
8095 C<isl_ast_build_set_create_leaf>.
8096 The space of the range of the C<schedule> argument should refer
8097 to this build. In particular, the space should be a wrapped
8098 relation and the domain of this wrapped relation should be the
8099 same as that of the range of the schedule returned by
8100 C<isl_ast_build_get_schedule> below.
8101 In practice, the new schedule is typically
8102 created by calling C<isl_union_map_range_product> on the old schedule
8103 and some extra piece of the schedule.
8104 The space of the schedule domain is also available from
8105 the C<isl_ast_build>.
8107 #include <isl/ast_build.h>
8108 __isl_give isl_union_map *isl_ast_build_get_schedule(
8109 __isl_keep isl_ast_build *build);
8110 __isl_give isl_space *isl_ast_build_get_schedule_space(
8111 __isl_keep isl_ast_build *build);
8112 __isl_give isl_ast_build *isl_ast_build_restrict(
8113 __isl_take isl_ast_build *build,
8114 __isl_take isl_set *set);
8116 The C<isl_ast_build_get_schedule> function returns a (partial)
8117 schedule for the domains elements for which part of the AST still needs to
8118 be generated in the current build.
8119 In particular, the domain elements are mapped to those iterations of the loops
8120 enclosing the current point of the AST generation inside which
8121 the domain elements are executed.
8122 No direct correspondence between
8123 the input schedule and this schedule should be assumed.
8124 The space obtained from C<isl_ast_build_get_schedule_space> can be used
8125 to create a set for C<isl_ast_build_restrict> to intersect
8126 with the current build. In particular, the set passed to
8127 C<isl_ast_build_restrict> can have additional parameters.
8128 The ids of the set dimensions in the space returned by
8129 C<isl_ast_build_get_schedule_space> correspond to the
8130 iterators of the already generated loops.
8131 The user should not rely on the ids of the output dimensions
8132 of the relations in the union relation returned by
8133 C<isl_ast_build_get_schedule> having any particular value.
8137 Although C<isl> is mainly meant to be used as a library,
8138 it also contains some basic applications that use some
8139 of the functionality of C<isl>.
8140 The input may be specified in either the L<isl format>
8141 or the L<PolyLib format>.
8143 =head2 C<isl_polyhedron_sample>
8145 C<isl_polyhedron_sample> takes a polyhedron as input and prints
8146 an integer element of the polyhedron, if there is any.
8147 The first column in the output is the denominator and is always
8148 equal to 1. If the polyhedron contains no integer points,
8149 then a vector of length zero is printed.
8153 C<isl_pip> takes the same input as the C<example> program
8154 from the C<piplib> distribution, i.e., a set of constraints
8155 on the parameters, a line containing only -1 and finally a set
8156 of constraints on a parametric polyhedron.
8157 The coefficients of the parameters appear in the last columns
8158 (but before the final constant column).
8159 The output is the lexicographic minimum of the parametric polyhedron.
8160 As C<isl> currently does not have its own output format, the output
8161 is just a dump of the internal state.
8163 =head2 C<isl_polyhedron_minimize>
8165 C<isl_polyhedron_minimize> computes the minimum of some linear
8166 or affine objective function over the integer points in a polyhedron.
8167 If an affine objective function
8168 is given, then the constant should appear in the last column.
8170 =head2 C<isl_polytope_scan>
8172 Given a polytope, C<isl_polytope_scan> prints
8173 all integer points in the polytope.
8175 =head2 C<isl_codegen>
8177 Given a schedule, a context set and an options relation,
8178 C<isl_codegen> prints out an AST that scans the domain elements
8179 of the schedule in the order of their image(s) taking into account
8180 the constraints in the context set.