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_aff_get_ctx(
496 __isl_keep isl_union_pw_aff *upa);
497 isl_ctx *isl_union_pw_multi_aff_get_ctx(
498 __isl_keep isl_union_pw_multi_aff *upma);
500 #include <isl/id_to_ast_expr.h>
501 isl_ctx *isl_id_to_ast_expr_get_ctx(
502 __isl_keep id_to_ast_expr *id2expr);
504 #include <isl/point.h>
505 isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
508 isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
511 isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
513 #include <isl/vertices.h>
514 isl_ctx *isl_vertices_get_ctx(
515 __isl_keep isl_vertices *vertices);
516 isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
517 isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
519 #include <isl/flow.h>
520 isl_ctx *isl_restriction_get_ctx(
521 __isl_keep isl_restriction *restr);
523 #include <isl/schedule.h>
524 isl_ctx *isl_schedule_constraints_get_ctx(
525 __isl_keep isl_schedule_constraints *sc);
527 #include <isl/band.h>
528 isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
530 #include <isl/ast_build.h>
531 isl_ctx *isl_ast_build_get_ctx(
532 __isl_keep isl_ast_build *build);
535 isl_ctx *isl_ast_expr_get_ctx(
536 __isl_keep isl_ast_expr *expr);
537 isl_ctx *isl_ast_node_get_ctx(
538 __isl_keep isl_ast_node *node);
542 An C<isl_val> represents an integer value, a rational value
543 or one of three special values, infinity, negative infinity and NaN.
544 Some predefined values can be created using the following functions.
547 __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
548 __isl_give isl_val *isl_val_one(isl_ctx *ctx);
549 __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
550 __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
551 __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
552 __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
554 Specific integer values can be created using the following functions.
557 __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
559 __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
561 __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
562 size_t n, size_t size, const void *chunks);
564 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
565 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
566 The least significant digit is assumed to be stored first.
568 Value objects can be copied and freed using the following functions.
571 __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
572 __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
574 They can be inspected using the following functions.
577 long isl_val_get_num_si(__isl_keep isl_val *v);
578 long isl_val_get_den_si(__isl_keep isl_val *v);
579 double isl_val_get_d(__isl_keep isl_val *v);
580 size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
582 int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
583 size_t size, void *chunks);
585 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
586 of C<size> bytes needed to store the absolute value of the
588 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
589 which is assumed to have been preallocated by the caller.
590 The least significant digit is stored first.
591 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
592 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
593 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
595 An C<isl_val> can be modified using the following function.
598 __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
601 The following unary properties are defined on C<isl_val>s.
604 int isl_val_sgn(__isl_keep isl_val *v);
605 int isl_val_is_zero(__isl_keep isl_val *v);
606 int isl_val_is_one(__isl_keep isl_val *v);
607 int isl_val_is_negone(__isl_keep isl_val *v);
608 int isl_val_is_nonneg(__isl_keep isl_val *v);
609 int isl_val_is_nonpos(__isl_keep isl_val *v);
610 int isl_val_is_pos(__isl_keep isl_val *v);
611 int isl_val_is_neg(__isl_keep isl_val *v);
612 int isl_val_is_int(__isl_keep isl_val *v);
613 int isl_val_is_rat(__isl_keep isl_val *v);
614 int isl_val_is_nan(__isl_keep isl_val *v);
615 int isl_val_is_infty(__isl_keep isl_val *v);
616 int isl_val_is_neginfty(__isl_keep isl_val *v);
618 Note that the sign of NaN is undefined.
620 The following binary properties are defined on pairs of C<isl_val>s.
623 int isl_val_lt(__isl_keep isl_val *v1,
624 __isl_keep isl_val *v2);
625 int isl_val_le(__isl_keep isl_val *v1,
626 __isl_keep isl_val *v2);
627 int isl_val_gt(__isl_keep isl_val *v1,
628 __isl_keep isl_val *v2);
629 int isl_val_ge(__isl_keep isl_val *v1,
630 __isl_keep isl_val *v2);
631 int isl_val_eq(__isl_keep isl_val *v1,
632 __isl_keep isl_val *v2);
633 int isl_val_ne(__isl_keep isl_val *v1,
634 __isl_keep isl_val *v2);
635 int isl_val_abs_eq(__isl_keep isl_val *v1,
636 __isl_keep isl_val *v2);
638 The function C<isl_val_abs_eq> checks whether its two arguments
639 are equal in absolute value.
641 For integer C<isl_val>s we additionally have the following binary property.
644 int isl_val_is_divisible_by(__isl_keep isl_val *v1,
645 __isl_keep isl_val *v2);
647 An C<isl_val> can also be compared to an integer using the following
648 function. The result is undefined for NaN.
651 int isl_val_cmp_si(__isl_keep isl_val *v, long i);
653 The following unary operations are available on C<isl_val>s.
656 __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
657 __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
658 __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
659 __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
660 __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
661 __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
662 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
664 The following binary operations are available on C<isl_val>s.
667 __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
668 __isl_take isl_val *v2);
669 __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
670 __isl_take isl_val *v2);
671 __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
672 __isl_take isl_val *v2);
673 __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
675 __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
676 __isl_take isl_val *v2);
677 __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
679 __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
680 __isl_take isl_val *v2);
681 __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
683 __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
684 __isl_take isl_val *v2);
686 On integer values, we additionally have the following operations.
689 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
690 __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
691 __isl_take isl_val *v2);
692 __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
693 __isl_take isl_val *v2);
694 __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
695 __isl_take isl_val *v2, __isl_give isl_val **x,
696 __isl_give isl_val **y);
698 The function C<isl_val_gcdext> returns the greatest common divisor g
699 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
700 that C<*x> * C<v1> + C<*y> * C<v2> = g.
702 =head3 GMP specific functions
704 These functions are only available if C<isl> has been compiled with C<GMP>
707 Specific integer and rational values can be created from C<GMP> values using
708 the following functions.
710 #include <isl/val_gmp.h>
711 __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
713 __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
714 const mpz_t n, const mpz_t d);
716 The numerator and denominator of a rational value can be extracted as
717 C<GMP> values using the following functions.
719 #include <isl/val_gmp.h>
720 int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
721 int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
723 =head2 Sets and Relations
725 C<isl> uses six types of objects for representing sets and relations,
726 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
727 C<isl_union_set> and C<isl_union_map>.
728 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
729 can be described as a conjunction of affine constraints, while
730 C<isl_set> and C<isl_map> represent unions of
731 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
732 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
733 to live in the same space. C<isl_union_set>s and C<isl_union_map>s
734 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
735 where spaces are considered different if they have a different number
736 of dimensions and/or different names (see L<"Spaces">).
737 The difference between sets and relations (maps) is that sets have
738 one set of variables, while relations have two sets of variables,
739 input variables and output variables.
741 =head2 Error Handling
743 C<isl> supports different ways to react in case a runtime error is triggered.
744 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
745 with two maps that have incompatible spaces. There are three possible ways
746 to react on error: to warn, to continue or to abort.
748 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
749 the last error in the corresponding C<isl_ctx> and the function in which the
750 error was triggered returns C<NULL>. An error does not corrupt internal state,
751 such that isl can continue to be used. C<isl> also provides functions to
752 read the last error and to reset the memory that stores the last error. The
753 last error is only stored for information purposes. Its presence does not
754 change the behavior of C<isl>. Hence, resetting an error is not required to
755 continue to use isl, but only to observe new errors.
758 enum isl_error isl_ctx_last_error(isl_ctx *ctx);
759 void isl_ctx_reset_error(isl_ctx *ctx);
761 Another option is to continue on error. This is similar to warn on error mode,
762 except that C<isl> does not print any warning. This allows a program to
763 implement its own error reporting.
765 The last option is to directly abort the execution of the program from within
766 the isl library. This makes it obviously impossible to recover from an error,
767 but it allows to directly spot the error location. By aborting on error,
768 debuggers break at the location the error occurred and can provide a stack
769 trace. Other tools that automatically provide stack traces on abort or that do
770 not want to continue execution after an error was triggered may also prefer to
773 The on error behavior of isl can be specified by calling
774 C<isl_options_set_on_error> or by setting the command line option
775 C<--isl-on-error>. Valid arguments for the function call are
776 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
777 choices for the command line option are C<warn>, C<continue> and C<abort>.
778 It is also possible to query the current error mode.
780 #include <isl/options.h>
781 int isl_options_set_on_error(isl_ctx *ctx, int val);
782 int isl_options_get_on_error(isl_ctx *ctx);
786 Identifiers are used to identify both individual dimensions
787 and tuples of dimensions. They consist of an optional name and an optional
788 user pointer. The name and the user pointer cannot both be C<NULL>, however.
789 Identifiers with the same name but different pointer values
790 are considered to be distinct.
791 Similarly, identifiers with different names but the same pointer value
792 are also considered to be distinct.
793 Equal identifiers are represented using the same object.
794 Pairs of identifiers can therefore be tested for equality using the
796 Identifiers can be constructed, copied, freed, inspected and printed
797 using the following functions.
800 __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
801 __isl_keep const char *name, void *user);
802 __isl_give isl_id *isl_id_set_free_user(
803 __isl_take isl_id *id,
804 __isl_give void (*free_user)(void *user));
805 __isl_give isl_id *isl_id_copy(isl_id *id);
806 __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
808 void *isl_id_get_user(__isl_keep isl_id *id);
809 __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
811 __isl_give isl_printer *isl_printer_print_id(
812 __isl_take isl_printer *p, __isl_keep isl_id *id);
814 The callback set by C<isl_id_set_free_user> is called on the user
815 pointer when the last reference to the C<isl_id> is freed.
816 Note that C<isl_id_get_name> returns a pointer to some internal
817 data structure, so the result can only be used while the
818 corresponding C<isl_id> is alive.
822 Whenever a new set, relation or similar object is created from scratch,
823 the space in which it lives needs to be specified using an C<isl_space>.
824 Each space involves zero or more parameters and zero, one or two
825 tuples of set or input/output dimensions. The parameters and dimensions
826 are identified by an C<isl_dim_type> and a position.
827 The type C<isl_dim_param> refers to parameters,
828 the type C<isl_dim_set> refers to set dimensions (for spaces
829 with a single tuple of dimensions) and the types C<isl_dim_in>
830 and C<isl_dim_out> refer to input and output dimensions
831 (for spaces with two tuples of dimensions).
832 Local spaces (see L</"Local Spaces">) also contain dimensions
833 of type C<isl_dim_div>.
834 Note that parameters are only identified by their position within
835 a given object. Across different objects, parameters are (usually)
836 identified by their names or identifiers. Only unnamed parameters
837 are identified by their positions across objects. The use of unnamed
838 parameters is discouraged.
840 #include <isl/space.h>
841 __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
842 unsigned nparam, unsigned n_in, unsigned n_out);
843 __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
845 __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
846 unsigned nparam, unsigned dim);
847 __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
848 __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
850 The space used for creating a parameter domain
851 needs to be created using C<isl_space_params_alloc>.
852 For other sets, the space
853 needs to be created using C<isl_space_set_alloc>, while
854 for a relation, the space
855 needs to be created using C<isl_space_alloc>.
857 To check whether a given space is that of a set or a map
858 or whether it is a parameter space, use these functions:
860 #include <isl/space.h>
861 int isl_space_is_params(__isl_keep isl_space *space);
862 int isl_space_is_set(__isl_keep isl_space *space);
863 int isl_space_is_map(__isl_keep isl_space *space);
865 Spaces can be compared using the following functions:
867 #include <isl/space.h>
868 int isl_space_is_equal(__isl_keep isl_space *space1,
869 __isl_keep isl_space *space2);
870 int isl_space_is_domain(__isl_keep isl_space *space1,
871 __isl_keep isl_space *space2);
872 int isl_space_is_range(__isl_keep isl_space *space1,
873 __isl_keep isl_space *space2);
874 int isl_space_tuple_is_equal(
875 __isl_keep isl_space *space1,
876 enum isl_dim_type type1,
877 __isl_keep isl_space *space2,
878 enum isl_dim_type type2);
880 C<isl_space_is_domain> checks whether the first argument is equal
881 to the domain of the second argument. This requires in particular that
882 the first argument is a set space and that the second argument
883 is a map space. C<isl_space_tuple_is_equal> checks whether the given
884 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
885 spaces are the same. That is, it checks if they have the same
886 identifier (if any), the same dimension and the same internal structure
889 It is often useful to create objects that live in the
890 same space as some other object. This can be accomplished
891 by creating the new objects
892 (see L</"Creating New Sets and Relations"> or
893 L</"Functions">) based on the space
894 of the original object.
897 __isl_give isl_space *isl_basic_set_get_space(
898 __isl_keep isl_basic_set *bset);
899 __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
901 #include <isl/union_set.h>
902 __isl_give isl_space *isl_union_set_get_space(
903 __isl_keep isl_union_set *uset);
906 __isl_give isl_space *isl_basic_map_get_space(
907 __isl_keep isl_basic_map *bmap);
908 __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
910 #include <isl/union_map.h>
911 __isl_give isl_space *isl_union_map_get_space(
912 __isl_keep isl_union_map *umap);
914 #include <isl/constraint.h>
915 __isl_give isl_space *isl_constraint_get_space(
916 __isl_keep isl_constraint *constraint);
918 #include <isl/polynomial.h>
919 __isl_give isl_space *isl_qpolynomial_get_domain_space(
920 __isl_keep isl_qpolynomial *qp);
921 __isl_give isl_space *isl_qpolynomial_get_space(
922 __isl_keep isl_qpolynomial *qp);
923 __isl_give isl_space *isl_qpolynomial_fold_get_space(
924 __isl_keep isl_qpolynomial_fold *fold);
925 __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
926 __isl_keep isl_pw_qpolynomial *pwqp);
927 __isl_give isl_space *isl_pw_qpolynomial_get_space(
928 __isl_keep isl_pw_qpolynomial *pwqp);
929 __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
930 __isl_keep isl_pw_qpolynomial_fold *pwf);
931 __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
932 __isl_keep isl_pw_qpolynomial_fold *pwf);
933 __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
934 __isl_keep isl_union_pw_qpolynomial *upwqp);
935 __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
936 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
939 __isl_give isl_space *isl_multi_val_get_space(
940 __isl_keep isl_multi_val *mv);
943 __isl_give isl_space *isl_aff_get_domain_space(
944 __isl_keep isl_aff *aff);
945 __isl_give isl_space *isl_aff_get_space(
946 __isl_keep isl_aff *aff);
947 __isl_give isl_space *isl_pw_aff_get_domain_space(
948 __isl_keep isl_pw_aff *pwaff);
949 __isl_give isl_space *isl_pw_aff_get_space(
950 __isl_keep isl_pw_aff *pwaff);
951 __isl_give isl_space *isl_multi_aff_get_domain_space(
952 __isl_keep isl_multi_aff *maff);
953 __isl_give isl_space *isl_multi_aff_get_space(
954 __isl_keep isl_multi_aff *maff);
955 __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
956 __isl_keep isl_pw_multi_aff *pma);
957 __isl_give isl_space *isl_pw_multi_aff_get_space(
958 __isl_keep isl_pw_multi_aff *pma);
959 __isl_give isl_space *isl_union_pw_aff_get_space(
960 __isl_keep isl_union_pw_aff *upa);
961 __isl_give isl_space *isl_union_pw_multi_aff_get_space(
962 __isl_keep isl_union_pw_multi_aff *upma);
963 __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
964 __isl_keep isl_multi_pw_aff *mpa);
965 __isl_give isl_space *isl_multi_pw_aff_get_space(
966 __isl_keep isl_multi_pw_aff *mpa);
968 #include <isl/point.h>
969 __isl_give isl_space *isl_point_get_space(
970 __isl_keep isl_point *pnt);
972 The number of dimensions of a given type of space
973 may be read off from a space or an object that lives
974 in a space using the following functions.
975 In case of C<isl_space_dim>, type may be
976 C<isl_dim_param>, C<isl_dim_in> (only for relations),
977 C<isl_dim_out> (only for relations), C<isl_dim_set>
978 (only for sets) or C<isl_dim_all>.
980 #include <isl/space.h>
981 unsigned isl_space_dim(__isl_keep isl_space *space,
982 enum isl_dim_type type);
984 #include <isl/local_space.h>
985 int isl_local_space_dim(__isl_keep isl_local_space *ls,
986 enum isl_dim_type type);
989 unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
990 enum isl_dim_type type);
991 unsigned isl_set_dim(__isl_keep isl_set *set,
992 enum isl_dim_type type);
994 #include <isl/union_set.h>
995 unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
996 enum isl_dim_type type);
999 unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1000 enum isl_dim_type type);
1001 unsigned isl_map_dim(__isl_keep isl_map *map,
1002 enum isl_dim_type type);
1004 #include <isl/union_map.h>
1005 unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1006 enum isl_dim_type type);
1008 #include <isl/val.h>
1009 unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1010 enum isl_dim_type type);
1012 #include <isl/aff.h>
1013 int isl_aff_dim(__isl_keep isl_aff *aff,
1014 enum isl_dim_type type);
1015 unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1016 enum isl_dim_type type);
1017 unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1018 enum isl_dim_type type);
1019 unsigned isl_pw_multi_aff_dim(
1020 __isl_keep isl_pw_multi_aff *pma,
1021 enum isl_dim_type type);
1022 unsigned isl_multi_pw_aff_dim(
1023 __isl_keep isl_multi_pw_aff *mpa,
1024 enum isl_dim_type type);
1025 unsigned isl_union_pw_aff_dim(
1026 __isl_keep isl_union_pw_aff *upa,
1027 enum isl_dim_type type);
1028 unsigned isl_union_pw_multi_aff_dim(
1029 __isl_keep isl_union_pw_multi_aff *upma,
1030 enum isl_dim_type type);
1032 #include <isl/polynomial.h>
1033 unsigned isl_union_pw_qpolynomial_dim(
1034 __isl_keep isl_union_pw_qpolynomial *upwqp,
1035 enum isl_dim_type type);
1036 unsigned isl_union_pw_qpolynomial_fold_dim(
1037 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1038 enum isl_dim_type type);
1040 Note that an C<isl_union_set>, an C<isl_union_map>,
1041 an C<isl_union_pw_multi_aff>,
1042 an C<isl_union_pw_qpolynomial> and
1043 an C<isl_union_pw_qpolynomial_fold>
1044 only have parameters.
1046 The identifiers or names of the individual dimensions of spaces
1047 may be set or read off using the following functions on spaces
1048 or objects that live in spaces.
1049 These functions are mostly useful to obtain the identifiers, positions
1050 or names of the parameters. Identifiers of individual dimensions are
1051 essentially only useful for printing. They are ignored by all other
1052 operations and may not be preserved across those operations.
1054 #include <isl/space.h>
1055 __isl_give isl_space *isl_space_set_dim_id(
1056 __isl_take isl_space *space,
1057 enum isl_dim_type type, unsigned pos,
1058 __isl_take isl_id *id);
1059 int isl_space_has_dim_id(__isl_keep isl_space *space,
1060 enum isl_dim_type type, unsigned pos);
1061 __isl_give isl_id *isl_space_get_dim_id(
1062 __isl_keep isl_space *space,
1063 enum isl_dim_type type, unsigned pos);
1064 __isl_give isl_space *isl_space_set_dim_name(
1065 __isl_take isl_space *space,
1066 enum isl_dim_type type, unsigned pos,
1067 __isl_keep const char *name);
1068 int isl_space_has_dim_name(__isl_keep isl_space *space,
1069 enum isl_dim_type type, unsigned pos);
1070 __isl_keep const char *isl_space_get_dim_name(
1071 __isl_keep isl_space *space,
1072 enum isl_dim_type type, unsigned pos);
1074 #include <isl/local_space.h>
1075 __isl_give isl_local_space *isl_local_space_set_dim_id(
1076 __isl_take isl_local_space *ls,
1077 enum isl_dim_type type, unsigned pos,
1078 __isl_take isl_id *id);
1079 int isl_local_space_has_dim_id(
1080 __isl_keep isl_local_space *ls,
1081 enum isl_dim_type type, unsigned pos);
1082 __isl_give isl_id *isl_local_space_get_dim_id(
1083 __isl_keep isl_local_space *ls,
1084 enum isl_dim_type type, unsigned pos);
1085 __isl_give isl_local_space *isl_local_space_set_dim_name(
1086 __isl_take isl_local_space *ls,
1087 enum isl_dim_type type, unsigned pos, const char *s);
1088 int isl_local_space_has_dim_name(
1089 __isl_keep isl_local_space *ls,
1090 enum isl_dim_type type, unsigned pos)
1091 const char *isl_local_space_get_dim_name(
1092 __isl_keep isl_local_space *ls,
1093 enum isl_dim_type type, unsigned pos);
1095 #include <isl/constraint.h>
1096 const char *isl_constraint_get_dim_name(
1097 __isl_keep isl_constraint *constraint,
1098 enum isl_dim_type type, unsigned pos);
1100 #include <isl/set.h>
1101 __isl_give isl_id *isl_basic_set_get_dim_id(
1102 __isl_keep isl_basic_set *bset,
1103 enum isl_dim_type type, unsigned pos);
1104 __isl_give isl_set *isl_set_set_dim_id(
1105 __isl_take isl_set *set, enum isl_dim_type type,
1106 unsigned pos, __isl_take isl_id *id);
1107 int isl_set_has_dim_id(__isl_keep isl_set *set,
1108 enum isl_dim_type type, unsigned pos);
1109 __isl_give isl_id *isl_set_get_dim_id(
1110 __isl_keep isl_set *set, enum isl_dim_type type,
1112 const char *isl_basic_set_get_dim_name(
1113 __isl_keep isl_basic_set *bset,
1114 enum isl_dim_type type, unsigned pos);
1115 int isl_set_has_dim_name(__isl_keep isl_set *set,
1116 enum isl_dim_type type, unsigned pos);
1117 const char *isl_set_get_dim_name(
1118 __isl_keep isl_set *set,
1119 enum isl_dim_type type, unsigned pos);
1121 #include <isl/map.h>
1122 __isl_give isl_map *isl_map_set_dim_id(
1123 __isl_take isl_map *map, enum isl_dim_type type,
1124 unsigned pos, __isl_take isl_id *id);
1125 int isl_basic_map_has_dim_id(
1126 __isl_keep isl_basic_map *bmap,
1127 enum isl_dim_type type, unsigned pos);
1128 int isl_map_has_dim_id(__isl_keep isl_map *map,
1129 enum isl_dim_type type, unsigned pos);
1130 __isl_give isl_id *isl_map_get_dim_id(
1131 __isl_keep isl_map *map, enum isl_dim_type type,
1133 __isl_give isl_id *isl_union_map_get_dim_id(
1134 __isl_keep isl_union_map *umap,
1135 enum isl_dim_type type, unsigned pos);
1136 const char *isl_basic_map_get_dim_name(
1137 __isl_keep isl_basic_map *bmap,
1138 enum isl_dim_type type, unsigned pos);
1139 int isl_map_has_dim_name(__isl_keep isl_map *map,
1140 enum isl_dim_type type, unsigned pos);
1141 const char *isl_map_get_dim_name(
1142 __isl_keep isl_map *map,
1143 enum isl_dim_type type, unsigned pos);
1145 #include <isl/val.h>
1146 __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1147 __isl_take isl_multi_val *mv,
1148 enum isl_dim_type type, unsigned pos,
1149 __isl_take isl_id *id);
1150 __isl_give isl_id *isl_multi_val_get_dim_id(
1151 __isl_keep isl_multi_val *mv,
1152 enum isl_dim_type type, unsigned pos);
1153 __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1154 __isl_take isl_multi_val *mv,
1155 enum isl_dim_type type, unsigned pos, const char *s);
1157 #include <isl/aff.h>
1158 __isl_give isl_aff *isl_aff_set_dim_id(
1159 __isl_take isl_aff *aff, enum isl_dim_type type,
1160 unsigned pos, __isl_take isl_id *id);
1161 __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1162 __isl_take isl_multi_aff *maff,
1163 enum isl_dim_type type, unsigned pos,
1164 __isl_take isl_id *id);
1165 __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1166 __isl_take isl_pw_aff *pma,
1167 enum isl_dim_type type, unsigned pos,
1168 __isl_take isl_id *id);
1169 __isl_give isl_multi_pw_aff *
1170 isl_multi_pw_aff_set_dim_id(
1171 __isl_take isl_multi_pw_aff *mpa,
1172 enum isl_dim_type type, unsigned pos,
1173 __isl_take isl_id *id);
1174 __isl_give isl_id *isl_multi_aff_get_dim_id(
1175 __isl_keep isl_multi_aff *ma,
1176 enum isl_dim_type type, unsigned pos);
1177 int isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1178 enum isl_dim_type type, unsigned pos);
1179 __isl_give isl_id *isl_pw_aff_get_dim_id(
1180 __isl_keep isl_pw_aff *pa,
1181 enum isl_dim_type type, unsigned pos);
1182 __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1183 __isl_keep isl_pw_multi_aff *pma,
1184 enum isl_dim_type type, unsigned pos);
1185 __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1186 __isl_keep isl_multi_pw_aff *mpa,
1187 enum isl_dim_type type, unsigned pos);
1188 __isl_give isl_aff *isl_aff_set_dim_name(
1189 __isl_take isl_aff *aff, enum isl_dim_type type,
1190 unsigned pos, const char *s);
1191 __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1192 __isl_take isl_multi_aff *maff,
1193 enum isl_dim_type type, unsigned pos, const char *s);
1194 __isl_give isl_multi_pw_aff *
1195 isl_multi_pw_aff_set_dim_name(
1196 __isl_take isl_multi_pw_aff *mpa,
1197 enum isl_dim_type type, unsigned pos, const char *s);
1198 __isl_give isl_union_pw_aff *
1199 isl_union_pw_aff_set_dim_name(
1200 __isl_take isl_union_pw_aff *upa,
1201 enum isl_dim_type type, unsigned pos,
1203 __isl_give isl_union_pw_multi_aff *
1204 isl_union_pw_multi_aff_set_dim_name(
1205 __isl_take isl_union_pw_multi_aff *upma,
1206 enum isl_dim_type type, unsigned pos,
1208 const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1209 enum isl_dim_type type, unsigned pos);
1210 const char *isl_pw_aff_get_dim_name(
1211 __isl_keep isl_pw_aff *pa,
1212 enum isl_dim_type type, unsigned pos);
1213 const char *isl_pw_multi_aff_get_dim_name(
1214 __isl_keep isl_pw_multi_aff *pma,
1215 enum isl_dim_type type, unsigned pos);
1217 #include <isl/polynomial.h>
1218 __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1219 __isl_take isl_qpolynomial *qp,
1220 enum isl_dim_type type, unsigned pos,
1222 __isl_give isl_pw_qpolynomial *
1223 isl_pw_qpolynomial_set_dim_name(
1224 __isl_take isl_pw_qpolynomial *pwqp,
1225 enum isl_dim_type type, unsigned pos,
1227 __isl_give isl_pw_qpolynomial_fold *
1228 isl_pw_qpolynomial_fold_set_dim_name(
1229 __isl_take isl_pw_qpolynomial_fold *pwf,
1230 enum isl_dim_type type, unsigned pos,
1232 __isl_give isl_union_pw_qpolynomial *
1233 isl_union_pw_qpolynomial_set_dim_name(
1234 __isl_take isl_union_pw_qpolynomial *upwqp,
1235 enum isl_dim_type type, unsigned pos,
1237 __isl_give isl_union_pw_qpolynomial_fold *
1238 isl_union_pw_qpolynomial_fold_set_dim_name(
1239 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1240 enum isl_dim_type type, unsigned pos,
1243 Note that C<isl_space_get_name> returns a pointer to some internal
1244 data structure, so the result can only be used while the
1245 corresponding C<isl_space> is alive.
1246 Also note that every function that operates on two sets or relations
1247 requires that both arguments have the same parameters. This also
1248 means that if one of the arguments has named parameters, then the
1249 other needs to have named parameters too and the names need to match.
1250 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1251 arguments may have different parameters (as long as they are named),
1252 in which case the result will have as parameters the union of the parameters of
1255 Given the identifier or name of a dimension (typically a parameter),
1256 its position can be obtained from the following functions.
1258 #include <isl/space.h>
1259 int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1260 enum isl_dim_type type, __isl_keep isl_id *id);
1261 int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1262 enum isl_dim_type type, const char *name);
1264 #include <isl/local_space.h>
1265 int isl_local_space_find_dim_by_name(
1266 __isl_keep isl_local_space *ls,
1267 enum isl_dim_type type, const char *name);
1269 #include <isl/val.h>
1270 int isl_multi_val_find_dim_by_id(
1271 __isl_keep isl_multi_val *mv,
1272 enum isl_dim_type type, __isl_keep isl_id *id);
1273 int isl_multi_val_find_dim_by_name(
1274 __isl_keep isl_multi_val *mv,
1275 enum isl_dim_type type, const char *name);
1277 #include <isl/set.h>
1278 int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1279 enum isl_dim_type type, __isl_keep isl_id *id);
1280 int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1281 enum isl_dim_type type, const char *name);
1283 #include <isl/map.h>
1284 int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1285 enum isl_dim_type type, __isl_keep isl_id *id);
1286 int isl_basic_map_find_dim_by_name(
1287 __isl_keep isl_basic_map *bmap,
1288 enum isl_dim_type type, const char *name);
1289 int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1290 enum isl_dim_type type, const char *name);
1291 int isl_union_map_find_dim_by_name(
1292 __isl_keep isl_union_map *umap,
1293 enum isl_dim_type type, const char *name);
1295 #include <isl/aff.h>
1296 int isl_multi_aff_find_dim_by_id(
1297 __isl_keep isl_multi_aff *ma,
1298 enum isl_dim_type type, __isl_keep isl_id *id);
1299 int isl_multi_pw_aff_find_dim_by_id(
1300 __isl_keep isl_multi_pw_aff *mpa,
1301 enum isl_dim_type type, __isl_keep isl_id *id);
1302 int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1303 enum isl_dim_type type, const char *name);
1304 int isl_multi_aff_find_dim_by_name(
1305 __isl_keep isl_multi_aff *ma,
1306 enum isl_dim_type type, const char *name);
1307 int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1308 enum isl_dim_type type, const char *name);
1309 int isl_multi_pw_aff_find_dim_by_name(
1310 __isl_keep isl_multi_pw_aff *mpa,
1311 enum isl_dim_type type, const char *name);
1312 int isl_pw_multi_aff_find_dim_by_name(
1313 __isl_keep isl_pw_multi_aff *pma,
1314 enum isl_dim_type type, const char *name);
1315 int isl_union_pw_aff_find_dim_by_name(
1316 __isl_keep isl_union_pw_aff *upa,
1317 enum isl_dim_type type, const char *name);
1318 int isl_union_pw_multi_aff_find_dim_by_name(
1319 __isl_keep isl_union_pw_multi_aff *upma,
1320 enum isl_dim_type type, const char *name);
1322 #include <isl/polynomial.h>
1323 int isl_pw_qpolynomial_find_dim_by_name(
1324 __isl_keep isl_pw_qpolynomial *pwqp,
1325 enum isl_dim_type type, const char *name);
1326 int isl_pw_qpolynomial_fold_find_dim_by_name(
1327 __isl_keep isl_pw_qpolynomial_fold *pwf,
1328 enum isl_dim_type type, const char *name);
1329 int isl_union_pw_qpolynomial_find_dim_by_name(
1330 __isl_keep isl_union_pw_qpolynomial *upwqp,
1331 enum isl_dim_type type, const char *name);
1332 int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1333 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1334 enum isl_dim_type type, const char *name);
1336 The identifiers or names of entire spaces may be set or read off
1337 using the following functions.
1339 #include <isl/space.h>
1340 __isl_give isl_space *isl_space_set_tuple_id(
1341 __isl_take isl_space *space,
1342 enum isl_dim_type type, __isl_take isl_id *id);
1343 __isl_give isl_space *isl_space_reset_tuple_id(
1344 __isl_take isl_space *space, enum isl_dim_type type);
1345 int isl_space_has_tuple_id(__isl_keep isl_space *space,
1346 enum isl_dim_type type);
1347 __isl_give isl_id *isl_space_get_tuple_id(
1348 __isl_keep isl_space *space, enum isl_dim_type type);
1349 __isl_give isl_space *isl_space_set_tuple_name(
1350 __isl_take isl_space *space,
1351 enum isl_dim_type type, const char *s);
1352 int isl_space_has_tuple_name(__isl_keep isl_space *space,
1353 enum isl_dim_type type);
1354 const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1355 enum isl_dim_type type);
1357 #include <isl/local_space.h>
1358 __isl_give isl_local_space *isl_local_space_set_tuple_id(
1359 __isl_take isl_local_space *ls,
1360 enum isl_dim_type type, __isl_take isl_id *id);
1362 #include <isl/set.h>
1363 __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1364 __isl_take isl_basic_set *bset,
1365 __isl_take isl_id *id);
1366 __isl_give isl_set *isl_set_set_tuple_id(
1367 __isl_take isl_set *set, __isl_take isl_id *id);
1368 __isl_give isl_set *isl_set_reset_tuple_id(
1369 __isl_take isl_set *set);
1370 int isl_set_has_tuple_id(__isl_keep isl_set *set);
1371 __isl_give isl_id *isl_set_get_tuple_id(
1372 __isl_keep isl_set *set);
1373 __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1374 __isl_take isl_basic_set *set, const char *s);
1375 __isl_give isl_set *isl_set_set_tuple_name(
1376 __isl_take isl_set *set, const char *s);
1377 const char *isl_basic_set_get_tuple_name(
1378 __isl_keep isl_basic_set *bset);
1379 int isl_set_has_tuple_name(__isl_keep isl_set *set);
1380 const char *isl_set_get_tuple_name(
1381 __isl_keep isl_set *set);
1383 #include <isl/map.h>
1384 __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1385 __isl_take isl_basic_map *bmap,
1386 enum isl_dim_type type, __isl_take isl_id *id);
1387 __isl_give isl_map *isl_map_set_tuple_id(
1388 __isl_take isl_map *map, enum isl_dim_type type,
1389 __isl_take isl_id *id);
1390 __isl_give isl_map *isl_map_reset_tuple_id(
1391 __isl_take isl_map *map, enum isl_dim_type type);
1392 int isl_map_has_tuple_id(__isl_keep isl_map *map,
1393 enum isl_dim_type type);
1394 __isl_give isl_id *isl_map_get_tuple_id(
1395 __isl_keep isl_map *map, enum isl_dim_type type);
1396 __isl_give isl_map *isl_map_set_tuple_name(
1397 __isl_take isl_map *map,
1398 enum isl_dim_type type, const char *s);
1399 const char *isl_basic_map_get_tuple_name(
1400 __isl_keep isl_basic_map *bmap,
1401 enum isl_dim_type type);
1402 __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1403 __isl_take isl_basic_map *bmap,
1404 enum isl_dim_type type, const char *s);
1405 int isl_map_has_tuple_name(__isl_keep isl_map *map,
1406 enum isl_dim_type type);
1407 const char *isl_map_get_tuple_name(
1408 __isl_keep isl_map *map,
1409 enum isl_dim_type type);
1411 #include <isl/val.h>
1412 __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1413 __isl_take isl_multi_val *mv,
1414 enum isl_dim_type type, __isl_take isl_id *id);
1415 __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1416 __isl_take isl_multi_val *mv,
1417 enum isl_dim_type type);
1418 int isl_multi_val_has_tuple_id(__isl_keep isl_multi_val *mv,
1419 enum isl_dim_type type);
1420 __isl_give isl_id *isl_multi_val_get_tuple_id(
1421 __isl_keep isl_multi_val *mv,
1422 enum isl_dim_type type);
1423 __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1424 __isl_take isl_multi_val *mv,
1425 enum isl_dim_type type, const char *s);
1426 const char *isl_multi_val_get_tuple_name(
1427 __isl_keep isl_multi_val *mv,
1428 enum isl_dim_type type);
1430 #include <isl/aff.h>
1431 __isl_give isl_aff *isl_aff_set_tuple_id(
1432 __isl_take isl_aff *aff,
1433 enum isl_dim_type type, __isl_take isl_id *id);
1434 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1435 __isl_take isl_multi_aff *maff,
1436 enum isl_dim_type type, __isl_take isl_id *id);
1437 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1438 __isl_take isl_pw_aff *pwaff,
1439 enum isl_dim_type type, __isl_take isl_id *id);
1440 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1441 __isl_take isl_pw_multi_aff *pma,
1442 enum isl_dim_type type, __isl_take isl_id *id);
1443 __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1444 __isl_take isl_multi_aff *ma,
1445 enum isl_dim_type type);
1446 __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1447 __isl_take isl_pw_aff *pa,
1448 enum isl_dim_type type);
1449 __isl_give isl_multi_pw_aff *
1450 isl_multi_pw_aff_reset_tuple_id(
1451 __isl_take isl_multi_pw_aff *mpa,
1452 enum isl_dim_type type);
1453 __isl_give isl_pw_multi_aff *
1454 isl_pw_multi_aff_reset_tuple_id(
1455 __isl_take isl_pw_multi_aff *pma,
1456 enum isl_dim_type type);
1457 int isl_multi_aff_has_tuple_id(__isl_keep isl_multi_aff *ma,
1458 enum isl_dim_type type);
1459 __isl_give isl_id *isl_multi_aff_get_tuple_id(
1460 __isl_keep isl_multi_aff *ma,
1461 enum isl_dim_type type);
1462 int isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1463 enum isl_dim_type type);
1464 __isl_give isl_id *isl_pw_aff_get_tuple_id(
1465 __isl_keep isl_pw_aff *pa,
1466 enum isl_dim_type type);
1467 int isl_pw_multi_aff_has_tuple_id(
1468 __isl_keep isl_pw_multi_aff *pma,
1469 enum isl_dim_type type);
1470 __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1471 __isl_keep isl_pw_multi_aff *pma,
1472 enum isl_dim_type type);
1473 int isl_multi_pw_aff_has_tuple_id(
1474 __isl_keep isl_multi_pw_aff *mpa,
1475 enum isl_dim_type type);
1476 __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1477 __isl_keep isl_multi_pw_aff *mpa,
1478 enum isl_dim_type type);
1479 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1480 __isl_take isl_multi_aff *maff,
1481 enum isl_dim_type type, const char *s);
1482 __isl_give isl_multi_pw_aff *
1483 isl_multi_pw_aff_set_tuple_name(
1484 __isl_take isl_multi_pw_aff *mpa,
1485 enum isl_dim_type type, const char *s);
1486 const char *isl_multi_aff_get_tuple_name(
1487 __isl_keep isl_multi_aff *multi,
1488 enum isl_dim_type type);
1489 int isl_pw_multi_aff_has_tuple_name(
1490 __isl_keep isl_pw_multi_aff *pma,
1491 enum isl_dim_type type);
1492 const char *isl_pw_multi_aff_get_tuple_name(
1493 __isl_keep isl_pw_multi_aff *pma,
1494 enum isl_dim_type type);
1496 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1497 or C<isl_dim_set>. As with C<isl_space_get_name>,
1498 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1500 Binary operations require the corresponding spaces of their arguments
1501 to have the same name.
1503 To keep the names of all parameters and tuples, but reset the user pointers
1504 of all the corresponding identifiers, use the following function.
1506 #include <isl/space.h>
1507 __isl_give isl_space *isl_space_reset_user(
1508 __isl_take isl_space *space);
1510 #include <isl/set.h>
1511 __isl_give isl_set *isl_set_reset_user(
1512 __isl_take isl_set *set);
1514 #include <isl/map.h>
1515 __isl_give isl_map *isl_map_reset_user(
1516 __isl_take isl_map *map);
1518 #include <isl/union_set.h>
1519 __isl_give isl_union_set *isl_union_set_reset_user(
1520 __isl_take isl_union_set *uset);
1522 #include <isl/union_map.h>
1523 __isl_give isl_union_map *isl_union_map_reset_user(
1524 __isl_take isl_union_map *umap);
1526 #include <isl/val.h>
1527 __isl_give isl_multi_val *isl_multi_val_reset_user(
1528 __isl_take isl_multi_val *mv);
1530 #include <isl/aff.h>
1531 __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1532 __isl_take isl_multi_aff *ma);
1533 __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1534 __isl_take isl_pw_aff *pa);
1535 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1536 __isl_take isl_multi_pw_aff *mpa);
1537 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1538 __isl_take isl_pw_multi_aff *pma);
1539 __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1540 __isl_take isl_union_pw_aff *upa);
1541 __isl_give isl_union_pw_multi_aff *
1542 isl_union_pw_multi_aff_reset_user(
1543 __isl_take isl_union_pw_multi_aff *upma);
1545 #include <isl/polynomial.h>
1546 __isl_give isl_pw_qpolynomial *
1547 isl_pw_qpolynomial_reset_user(
1548 __isl_take isl_pw_qpolynomial *pwqp);
1549 __isl_give isl_union_pw_qpolynomial *
1550 isl_union_pw_qpolynomial_reset_user(
1551 __isl_take isl_union_pw_qpolynomial *upwqp);
1552 __isl_give isl_pw_qpolynomial_fold *
1553 isl_pw_qpolynomial_fold_reset_user(
1554 __isl_take isl_pw_qpolynomial_fold *pwf);
1555 __isl_give isl_union_pw_qpolynomial_fold *
1556 isl_union_pw_qpolynomial_fold_reset_user(
1557 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1559 Spaces can be nested. In particular, the domain of a set or
1560 the domain or range of a relation can be a nested relation.
1561 This process is also called I<wrapping>.
1562 The functions for detecting, constructing and deconstructing
1563 such nested spaces can be found in the wrapping properties
1564 of L</"Unary Properties">, the wrapping operations
1565 of L</"Unary Operations"> and the Cartesian product operations
1566 of L</"Basic Operations">.
1568 Spaces can be created from other spaces
1569 using the functions described in L</"Unary Operations">
1570 and L</"Binary Operations">.
1574 A local space is essentially a space with
1575 zero or more existentially quantified variables.
1576 The local space of various objects can be obtained
1577 using the following functions.
1579 #include <isl/constraint.h>
1580 __isl_give isl_local_space *isl_constraint_get_local_space(
1581 __isl_keep isl_constraint *constraint);
1583 #include <isl/set.h>
1584 __isl_give isl_local_space *isl_basic_set_get_local_space(
1585 __isl_keep isl_basic_set *bset);
1587 #include <isl/map.h>
1588 __isl_give isl_local_space *isl_basic_map_get_local_space(
1589 __isl_keep isl_basic_map *bmap);
1591 #include <isl/aff.h>
1592 __isl_give isl_local_space *isl_aff_get_domain_local_space(
1593 __isl_keep isl_aff *aff);
1594 __isl_give isl_local_space *isl_aff_get_local_space(
1595 __isl_keep isl_aff *aff);
1597 A new local space can be created from a space using
1599 #include <isl/local_space.h>
1600 __isl_give isl_local_space *isl_local_space_from_space(
1601 __isl_take isl_space *space);
1603 They can be inspected, modified, copied and freed using the following functions.
1605 #include <isl/local_space.h>
1606 int isl_local_space_is_params(
1607 __isl_keep isl_local_space *ls);
1608 int isl_local_space_is_set(__isl_keep isl_local_space *ls);
1609 __isl_give isl_space *isl_local_space_get_space(
1610 __isl_keep isl_local_space *ls);
1611 __isl_give isl_aff *isl_local_space_get_div(
1612 __isl_keep isl_local_space *ls, int pos);
1613 __isl_give isl_local_space *isl_local_space_copy(
1614 __isl_keep isl_local_space *ls);
1615 __isl_null isl_local_space *isl_local_space_free(
1616 __isl_take isl_local_space *ls);
1618 Note that C<isl_local_space_get_div> can only be used on local spaces
1621 Two local spaces can be compared using
1623 int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
1624 __isl_keep isl_local_space *ls2);
1626 Local spaces can be created from other local spaces
1627 using the functions described in L</"Unary Operations">
1628 and L</"Binary Operations">.
1630 =head2 Creating New Sets and Relations
1632 C<isl> has functions for creating some standard sets and relations.
1636 =item * Empty sets and relations
1638 __isl_give isl_basic_set *isl_basic_set_empty(
1639 __isl_take isl_space *space);
1640 __isl_give isl_basic_map *isl_basic_map_empty(
1641 __isl_take isl_space *space);
1642 __isl_give isl_set *isl_set_empty(
1643 __isl_take isl_space *space);
1644 __isl_give isl_map *isl_map_empty(
1645 __isl_take isl_space *space);
1646 __isl_give isl_union_set *isl_union_set_empty(
1647 __isl_take isl_space *space);
1648 __isl_give isl_union_map *isl_union_map_empty(
1649 __isl_take isl_space *space);
1651 For C<isl_union_set>s and C<isl_union_map>s, the space
1652 is only used to specify the parameters.
1654 =item * Universe sets and relations
1656 __isl_give isl_basic_set *isl_basic_set_universe(
1657 __isl_take isl_space *space);
1658 __isl_give isl_basic_map *isl_basic_map_universe(
1659 __isl_take isl_space *space);
1660 __isl_give isl_set *isl_set_universe(
1661 __isl_take isl_space *space);
1662 __isl_give isl_map *isl_map_universe(
1663 __isl_take isl_space *space);
1664 __isl_give isl_union_set *isl_union_set_universe(
1665 __isl_take isl_union_set *uset);
1666 __isl_give isl_union_map *isl_union_map_universe(
1667 __isl_take isl_union_map *umap);
1669 The sets and relations constructed by the functions above
1670 contain all integer values, while those constructed by the
1671 functions below only contain non-negative values.
1673 __isl_give isl_basic_set *isl_basic_set_nat_universe(
1674 __isl_take isl_space *space);
1675 __isl_give isl_basic_map *isl_basic_map_nat_universe(
1676 __isl_take isl_space *space);
1677 __isl_give isl_set *isl_set_nat_universe(
1678 __isl_take isl_space *space);
1679 __isl_give isl_map *isl_map_nat_universe(
1680 __isl_take isl_space *space);
1682 =item * Identity relations
1684 __isl_give isl_basic_map *isl_basic_map_identity(
1685 __isl_take isl_space *space);
1686 __isl_give isl_map *isl_map_identity(
1687 __isl_take isl_space *space);
1689 The number of input and output dimensions in C<space> needs
1692 =item * Lexicographic order
1694 __isl_give isl_map *isl_map_lex_lt(
1695 __isl_take isl_space *set_space);
1696 __isl_give isl_map *isl_map_lex_le(
1697 __isl_take isl_space *set_space);
1698 __isl_give isl_map *isl_map_lex_gt(
1699 __isl_take isl_space *set_space);
1700 __isl_give isl_map *isl_map_lex_ge(
1701 __isl_take isl_space *set_space);
1702 __isl_give isl_map *isl_map_lex_lt_first(
1703 __isl_take isl_space *space, unsigned n);
1704 __isl_give isl_map *isl_map_lex_le_first(
1705 __isl_take isl_space *space, unsigned n);
1706 __isl_give isl_map *isl_map_lex_gt_first(
1707 __isl_take isl_space *space, unsigned n);
1708 __isl_give isl_map *isl_map_lex_ge_first(
1709 __isl_take isl_space *space, unsigned n);
1711 The first four functions take a space for a B<set>
1712 and return relations that express that the elements in the domain
1713 are lexicographically less
1714 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1715 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1716 than the elements in the range.
1717 The last four functions take a space for a map
1718 and return relations that express that the first C<n> dimensions
1719 in the domain are lexicographically less
1720 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1721 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1722 than the first C<n> dimensions in the range.
1726 A basic set or relation can be converted to a set or relation
1727 using the following functions.
1729 __isl_give isl_set *isl_set_from_basic_set(
1730 __isl_take isl_basic_set *bset);
1731 __isl_give isl_map *isl_map_from_basic_map(
1732 __isl_take isl_basic_map *bmap);
1734 Sets and relations can be converted to union sets and relations
1735 using the following functions.
1737 __isl_give isl_union_set *isl_union_set_from_basic_set(
1738 __isl_take isl_basic_set *bset);
1739 __isl_give isl_union_map *isl_union_map_from_basic_map(
1740 __isl_take isl_basic_map *bmap);
1741 __isl_give isl_union_set *isl_union_set_from_set(
1742 __isl_take isl_set *set);
1743 __isl_give isl_union_map *isl_union_map_from_map(
1744 __isl_take isl_map *map);
1746 The inverse conversions below can only be used if the input
1747 union set or relation is known to contain elements in exactly one
1750 __isl_give isl_set *isl_set_from_union_set(
1751 __isl_take isl_union_set *uset);
1752 __isl_give isl_map *isl_map_from_union_map(
1753 __isl_take isl_union_map *umap);
1755 Sets and relations can be copied and freed again using the following
1758 __isl_give isl_basic_set *isl_basic_set_copy(
1759 __isl_keep isl_basic_set *bset);
1760 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1761 __isl_give isl_union_set *isl_union_set_copy(
1762 __isl_keep isl_union_set *uset);
1763 __isl_give isl_basic_map *isl_basic_map_copy(
1764 __isl_keep isl_basic_map *bmap);
1765 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1766 __isl_give isl_union_map *isl_union_map_copy(
1767 __isl_keep isl_union_map *umap);
1768 __isl_null isl_basic_set *isl_basic_set_free(
1769 __isl_take isl_basic_set *bset);
1770 __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1771 __isl_null isl_union_set *isl_union_set_free(
1772 __isl_take isl_union_set *uset);
1773 __isl_null isl_basic_map *isl_basic_map_free(
1774 __isl_take isl_basic_map *bmap);
1775 __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1776 __isl_null isl_union_map *isl_union_map_free(
1777 __isl_take isl_union_map *umap);
1779 Other sets and relations can be constructed by starting
1780 from a universe set or relation, adding equality and/or
1781 inequality constraints and then projecting out the
1782 existentially quantified variables, if any.
1783 Constraints can be constructed, manipulated and
1784 added to (or removed from) (basic) sets and relations
1785 using the following functions.
1787 #include <isl/constraint.h>
1788 __isl_give isl_constraint *isl_equality_alloc(
1789 __isl_take isl_local_space *ls);
1790 __isl_give isl_constraint *isl_inequality_alloc(
1791 __isl_take isl_local_space *ls);
1792 __isl_give isl_constraint *isl_constraint_set_constant_si(
1793 __isl_take isl_constraint *constraint, int v);
1794 __isl_give isl_constraint *isl_constraint_set_constant_val(
1795 __isl_take isl_constraint *constraint,
1796 __isl_take isl_val *v);
1797 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1798 __isl_take isl_constraint *constraint,
1799 enum isl_dim_type type, int pos, int v);
1800 __isl_give isl_constraint *
1801 isl_constraint_set_coefficient_val(
1802 __isl_take isl_constraint *constraint,
1803 enum isl_dim_type type, int pos,
1804 __isl_take isl_val *v);
1805 __isl_give isl_basic_map *isl_basic_map_add_constraint(
1806 __isl_take isl_basic_map *bmap,
1807 __isl_take isl_constraint *constraint);
1808 __isl_give isl_basic_set *isl_basic_set_add_constraint(
1809 __isl_take isl_basic_set *bset,
1810 __isl_take isl_constraint *constraint);
1811 __isl_give isl_map *isl_map_add_constraint(
1812 __isl_take isl_map *map,
1813 __isl_take isl_constraint *constraint);
1814 __isl_give isl_set *isl_set_add_constraint(
1815 __isl_take isl_set *set,
1816 __isl_take isl_constraint *constraint);
1817 __isl_give isl_basic_set *isl_basic_set_drop_constraint(
1818 __isl_take isl_basic_set *bset,
1819 __isl_take isl_constraint *constraint);
1821 For example, to create a set containing the even integers
1822 between 10 and 42, you would use the following code.
1825 isl_local_space *ls;
1827 isl_basic_set *bset;
1829 space = isl_space_set_alloc(ctx, 0, 2);
1830 bset = isl_basic_set_universe(isl_space_copy(space));
1831 ls = isl_local_space_from_space(space);
1833 c = isl_equality_alloc(isl_local_space_copy(ls));
1834 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1835 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1836 bset = isl_basic_set_add_constraint(bset, c);
1838 c = isl_inequality_alloc(isl_local_space_copy(ls));
1839 c = isl_constraint_set_constant_si(c, -10);
1840 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1841 bset = isl_basic_set_add_constraint(bset, c);
1843 c = isl_inequality_alloc(ls);
1844 c = isl_constraint_set_constant_si(c, 42);
1845 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1846 bset = isl_basic_set_add_constraint(bset, c);
1848 bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1852 isl_basic_set *bset;
1853 bset = isl_basic_set_read_from_str(ctx,
1854 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1856 A basic set or relation can also be constructed from two matrices
1857 describing the equalities and the inequalities.
1859 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1860 __isl_take isl_space *space,
1861 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1862 enum isl_dim_type c1,
1863 enum isl_dim_type c2, enum isl_dim_type c3,
1864 enum isl_dim_type c4);
1865 __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1866 __isl_take isl_space *space,
1867 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1868 enum isl_dim_type c1,
1869 enum isl_dim_type c2, enum isl_dim_type c3,
1870 enum isl_dim_type c4, enum isl_dim_type c5);
1872 The C<isl_dim_type> arguments indicate the order in which
1873 different kinds of variables appear in the input matrices
1874 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1875 C<isl_dim_set> and C<isl_dim_div> for sets and
1876 of C<isl_dim_cst>, C<isl_dim_param>,
1877 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1879 A (basic or union) set or relation can also be constructed from a
1880 (union) (piecewise) (multiple) affine expression
1881 or a list of affine expressions
1882 (See L</"Functions">).
1884 __isl_give isl_basic_map *isl_basic_map_from_aff(
1885 __isl_take isl_aff *aff);
1886 __isl_give isl_map *isl_map_from_aff(
1887 __isl_take isl_aff *aff);
1888 __isl_give isl_set *isl_set_from_pw_aff(
1889 __isl_take isl_pw_aff *pwaff);
1890 __isl_give isl_map *isl_map_from_pw_aff(
1891 __isl_take isl_pw_aff *pwaff);
1892 __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1893 __isl_take isl_space *domain_space,
1894 __isl_take isl_aff_list *list);
1895 __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
1896 __isl_take isl_multi_aff *maff)
1897 __isl_give isl_map *isl_map_from_multi_aff(
1898 __isl_take isl_multi_aff *maff)
1899 __isl_give isl_set *isl_set_from_pw_multi_aff(
1900 __isl_take isl_pw_multi_aff *pma);
1901 __isl_give isl_map *isl_map_from_pw_multi_aff(
1902 __isl_take isl_pw_multi_aff *pma);
1903 __isl_give isl_set *isl_set_from_multi_pw_aff(
1904 __isl_take isl_multi_pw_aff *mpa);
1905 __isl_give isl_map *isl_map_from_multi_pw_aff(
1906 __isl_take isl_multi_pw_aff *mpa);
1907 __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
1908 __isl_take isl_union_pw_aff *upa);
1909 __isl_give isl_union_map *
1910 isl_union_map_from_union_pw_multi_aff(
1911 __isl_take isl_union_pw_multi_aff *upma);
1913 The C<domain_space> argument describes the domain of the resulting
1914 basic relation. It is required because the C<list> may consist
1915 of zero affine expressions.
1917 =head2 Inspecting Sets and Relations
1919 Usually, the user should not have to care about the actual constraints
1920 of the sets and maps, but should instead apply the abstract operations
1921 explained in the following sections.
1922 Occasionally, however, it may be required to inspect the individual
1923 coefficients of the constraints. This section explains how to do so.
1924 In these cases, it may also be useful to have C<isl> compute
1925 an explicit representation of the existentially quantified variables.
1927 __isl_give isl_set *isl_set_compute_divs(
1928 __isl_take isl_set *set);
1929 __isl_give isl_map *isl_map_compute_divs(
1930 __isl_take isl_map *map);
1931 __isl_give isl_union_set *isl_union_set_compute_divs(
1932 __isl_take isl_union_set *uset);
1933 __isl_give isl_union_map *isl_union_map_compute_divs(
1934 __isl_take isl_union_map *umap);
1936 This explicit representation defines the existentially quantified
1937 variables as integer divisions of the other variables, possibly
1938 including earlier existentially quantified variables.
1939 An explicitly represented existentially quantified variable therefore
1940 has a unique value when the values of the other variables are known.
1941 If, furthermore, the same existentials, i.e., existentials
1942 with the same explicit representations, should appear in the
1943 same order in each of the disjuncts of a set or map, then the user should call
1944 either of the following functions.
1946 __isl_give isl_set *isl_set_align_divs(
1947 __isl_take isl_set *set);
1948 __isl_give isl_map *isl_map_align_divs(
1949 __isl_take isl_map *map);
1951 Alternatively, the existentially quantified variables can be removed
1952 using the following functions, which compute an overapproximation.
1954 __isl_give isl_basic_set *isl_basic_set_remove_divs(
1955 __isl_take isl_basic_set *bset);
1956 __isl_give isl_basic_map *isl_basic_map_remove_divs(
1957 __isl_take isl_basic_map *bmap);
1958 __isl_give isl_set *isl_set_remove_divs(
1959 __isl_take isl_set *set);
1960 __isl_give isl_map *isl_map_remove_divs(
1961 __isl_take isl_map *map);
1963 It is also possible to only remove those divs that are defined
1964 in terms of a given range of dimensions or only those for which
1965 no explicit representation is known.
1967 __isl_give isl_basic_set *
1968 isl_basic_set_remove_divs_involving_dims(
1969 __isl_take isl_basic_set *bset,
1970 enum isl_dim_type type,
1971 unsigned first, unsigned n);
1972 __isl_give isl_basic_map *
1973 isl_basic_map_remove_divs_involving_dims(
1974 __isl_take isl_basic_map *bmap,
1975 enum isl_dim_type type,
1976 unsigned first, unsigned n);
1977 __isl_give isl_set *isl_set_remove_divs_involving_dims(
1978 __isl_take isl_set *set, enum isl_dim_type type,
1979 unsigned first, unsigned n);
1980 __isl_give isl_map *isl_map_remove_divs_involving_dims(
1981 __isl_take isl_map *map, enum isl_dim_type type,
1982 unsigned first, unsigned n);
1984 __isl_give isl_basic_set *
1985 isl_basic_set_remove_unknown_divs(
1986 __isl_take isl_basic_set *bset);
1987 __isl_give isl_set *isl_set_remove_unknown_divs(
1988 __isl_take isl_set *set);
1989 __isl_give isl_map *isl_map_remove_unknown_divs(
1990 __isl_take isl_map *map);
1992 To iterate over all the sets or maps in a union set or map, use
1994 int isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
1995 int (*fn)(__isl_take isl_set *set, void *user),
1997 int isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
1998 int (*fn)(__isl_take isl_map *map, void *user),
2001 The number of sets or maps in a union set or map can be obtained
2004 int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2005 int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2007 To extract the set or map in a given space from a union, use
2009 __isl_give isl_set *isl_union_set_extract_set(
2010 __isl_keep isl_union_set *uset,
2011 __isl_take isl_space *space);
2012 __isl_give isl_map *isl_union_map_extract_map(
2013 __isl_keep isl_union_map *umap,
2014 __isl_take isl_space *space);
2016 To iterate over all the basic sets or maps in a set or map, use
2018 int isl_set_foreach_basic_set(__isl_keep isl_set *set,
2019 int (*fn)(__isl_take isl_basic_set *bset, void *user),
2021 int isl_map_foreach_basic_map(__isl_keep isl_map *map,
2022 int (*fn)(__isl_take isl_basic_map *bmap, void *user),
2025 The callback function C<fn> should return 0 if successful and
2026 -1 if an error occurs. In the latter case, or if any other error
2027 occurs, the above functions will return -1.
2029 It should be noted that C<isl> does not guarantee that
2030 the basic sets or maps passed to C<fn> are disjoint.
2031 If this is required, then the user should call one of
2032 the following functions first.
2034 __isl_give isl_set *isl_set_make_disjoint(
2035 __isl_take isl_set *set);
2036 __isl_give isl_map *isl_map_make_disjoint(
2037 __isl_take isl_map *map);
2039 The number of basic sets in a set can be obtained
2040 or the number of basic maps in a map can be obtained
2043 #include <isl/set.h>
2044 int isl_set_n_basic_set(__isl_keep isl_set *set);
2046 #include <isl/map.h>
2047 int isl_map_n_basic_map(__isl_keep isl_map *map);
2049 To iterate over the constraints of a basic set or map, use
2051 #include <isl/constraint.h>
2053 int isl_basic_set_n_constraint(
2054 __isl_keep isl_basic_set *bset);
2055 int isl_basic_set_foreach_constraint(
2056 __isl_keep isl_basic_set *bset,
2057 int (*fn)(__isl_take isl_constraint *c, void *user),
2059 int isl_basic_map_n_constraint(
2060 __isl_keep isl_basic_map *bmap);
2061 int isl_basic_map_foreach_constraint(
2062 __isl_keep isl_basic_map *bmap,
2063 int (*fn)(__isl_take isl_constraint *c, void *user),
2065 __isl_null isl_constraint *isl_constraint_free(
2066 __isl_take isl_constraint *c);
2068 Again, the callback function C<fn> should return 0 if successful and
2069 -1 if an error occurs. In the latter case, or if any other error
2070 occurs, the above functions will return -1.
2071 The constraint C<c> represents either an equality or an inequality.
2072 Use the following function to find out whether a constraint
2073 represents an equality. If not, it represents an inequality.
2075 int isl_constraint_is_equality(
2076 __isl_keep isl_constraint *constraint);
2078 It is also possible to obtain a list of constraints from a basic
2081 #include <isl/constraint.h>
2082 __isl_give isl_constraint_list *
2083 isl_basic_map_get_constraint_list(
2084 __isl_keep isl_basic_map *bmap);
2085 __isl_give isl_constraint_list *
2086 isl_basic_set_get_constraint_list(
2087 __isl_keep isl_basic_set *bset);
2089 These functions require that all existentially quantified variables
2090 have an explicit representation.
2091 The returned list can be manipulated using the functions in L<"Lists">.
2093 The coefficients of the constraints can be inspected using
2094 the following functions.
2096 int isl_constraint_is_lower_bound(
2097 __isl_keep isl_constraint *constraint,
2098 enum isl_dim_type type, unsigned pos);
2099 int isl_constraint_is_upper_bound(
2100 __isl_keep isl_constraint *constraint,
2101 enum isl_dim_type type, unsigned pos);
2102 __isl_give isl_val *isl_constraint_get_constant_val(
2103 __isl_keep isl_constraint *constraint);
2104 __isl_give isl_val *isl_constraint_get_coefficient_val(
2105 __isl_keep isl_constraint *constraint,
2106 enum isl_dim_type type, int pos);
2108 The explicit representations of the existentially quantified
2109 variables can be inspected using the following function.
2110 Note that the user is only allowed to use this function
2111 if the inspected set or map is the result of a call
2112 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2113 The existentially quantified variable is equal to the floor
2114 of the returned affine expression. The affine expression
2115 itself can be inspected using the functions in
2118 __isl_give isl_aff *isl_constraint_get_div(
2119 __isl_keep isl_constraint *constraint, int pos);
2121 To obtain the constraints of a basic set or map in matrix
2122 form, use the following functions.
2124 __isl_give isl_mat *isl_basic_set_equalities_matrix(
2125 __isl_keep isl_basic_set *bset,
2126 enum isl_dim_type c1, enum isl_dim_type c2,
2127 enum isl_dim_type c3, enum isl_dim_type c4);
2128 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2129 __isl_keep isl_basic_set *bset,
2130 enum isl_dim_type c1, enum isl_dim_type c2,
2131 enum isl_dim_type c3, enum isl_dim_type c4);
2132 __isl_give isl_mat *isl_basic_map_equalities_matrix(
2133 __isl_keep isl_basic_map *bmap,
2134 enum isl_dim_type c1,
2135 enum isl_dim_type c2, enum isl_dim_type c3,
2136 enum isl_dim_type c4, enum isl_dim_type c5);
2137 __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2138 __isl_keep isl_basic_map *bmap,
2139 enum isl_dim_type c1,
2140 enum isl_dim_type c2, enum isl_dim_type c3,
2141 enum isl_dim_type c4, enum isl_dim_type c5);
2143 The C<isl_dim_type> arguments dictate the order in which
2144 different kinds of variables appear in the resulting matrix.
2145 For set inputs, they should be a permutation of
2146 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2147 For map inputs, they should be a permutation of
2148 C<isl_dim_cst>, C<isl_dim_param>,
2149 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2153 Points are elements of a set. They can be used to construct
2154 simple sets (boxes) or they can be used to represent the
2155 individual elements of a set.
2156 The zero point (the origin) can be created using
2158 __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2160 The coordinates of a point can be inspected, set and changed
2163 __isl_give isl_val *isl_point_get_coordinate_val(
2164 __isl_keep isl_point *pnt,
2165 enum isl_dim_type type, int pos);
2166 __isl_give isl_point *isl_point_set_coordinate_val(
2167 __isl_take isl_point *pnt,
2168 enum isl_dim_type type, int pos,
2169 __isl_take isl_val *v);
2171 __isl_give isl_point *isl_point_add_ui(
2172 __isl_take isl_point *pnt,
2173 enum isl_dim_type type, int pos, unsigned val);
2174 __isl_give isl_point *isl_point_sub_ui(
2175 __isl_take isl_point *pnt,
2176 enum isl_dim_type type, int pos, unsigned val);
2178 Points can be copied or freed using
2180 __isl_give isl_point *isl_point_copy(
2181 __isl_keep isl_point *pnt);
2182 void isl_point_free(__isl_take isl_point *pnt);
2184 A singleton set can be created from a point using
2186 __isl_give isl_basic_set *isl_basic_set_from_point(
2187 __isl_take isl_point *pnt);
2188 __isl_give isl_set *isl_set_from_point(
2189 __isl_take isl_point *pnt);
2191 and a box can be created from two opposite extremal points using
2193 __isl_give isl_basic_set *isl_basic_set_box_from_points(
2194 __isl_take isl_point *pnt1,
2195 __isl_take isl_point *pnt2);
2196 __isl_give isl_set *isl_set_box_from_points(
2197 __isl_take isl_point *pnt1,
2198 __isl_take isl_point *pnt2);
2200 All elements of a B<bounded> (union) set can be enumerated using
2201 the following functions.
2203 int isl_set_foreach_point(__isl_keep isl_set *set,
2204 int (*fn)(__isl_take isl_point *pnt, void *user),
2206 int isl_union_set_foreach_point(__isl_keep isl_union_set *uset,
2207 int (*fn)(__isl_take isl_point *pnt, void *user),
2210 The function C<fn> is called for each integer point in
2211 C<set> with as second argument the last argument of
2212 the C<isl_set_foreach_point> call. The function C<fn>
2213 should return C<0> on success and C<-1> on failure.
2214 In the latter case, C<isl_set_foreach_point> will stop
2215 enumerating and return C<-1> as well.
2216 If the enumeration is performed successfully and to completion,
2217 then C<isl_set_foreach_point> returns C<0>.
2219 To obtain a single point of a (basic) set, use
2221 __isl_give isl_point *isl_basic_set_sample_point(
2222 __isl_take isl_basic_set *bset);
2223 __isl_give isl_point *isl_set_sample_point(
2224 __isl_take isl_set *set);
2226 If C<set> does not contain any (integer) points, then the
2227 resulting point will be ``void'', a property that can be
2230 int isl_point_is_void(__isl_keep isl_point *pnt);
2234 Besides sets and relation, C<isl> also supports various types of functions.
2235 Each of these types is derived from the value type (see L</"Values">)
2236 or from one of two primitive function types
2237 through the application of zero or more type constructors.
2238 We first describe the primitive type and then we describe
2239 the types derived from these primitive types.
2241 =head3 Primitive Functions
2243 C<isl> support two primitive function types, quasi-affine
2244 expressions and quasipolynomials.
2245 A quasi-affine expression is defined either over a parameter
2246 space or over a set and is composed of integer constants,
2247 parameters and set variables, addition, subtraction and
2248 integer division by an integer constant.
2249 For example, the quasi-affine expression
2251 [n] -> { [x] -> [2*floor((4 n + x)/9] }
2253 maps C<x> to C<2*floor((4 n + x)/9>.
2254 A quasipolynomial is a polynomial expression in quasi-affine
2255 expression. That is, it additionally allows for multiplication.
2256 Note, though, that it is not allowed to construct an integer
2257 division of an expression involving multiplications.
2258 Here is an example of a quasipolynomial that is not
2259 quasi-affine expression
2261 [n] -> { [x] -> (n*floor((4 n + x)/9) }
2263 Note that the external representations of quasi-affine expressions
2264 and quasipolynomials are different. Quasi-affine expressions
2265 use a notation with square brackets just like binary relations,
2266 while quasipolynomials do not. This might change at some point.
2268 If a primitive function is defined over a parameter space,
2269 then the space of the function itself is that of a set.
2270 If it is defined over a set, then the space of the function
2271 is that of a relation. In both cases, the set space (or
2272 the output space) is single-dimensional, anonymous and unstructured.
2273 To create functions with multiple dimensions or with other kinds
2274 of set or output spaces, use multiple expressions
2275 (see L</"Multiple Expressions">).
2279 =item * Quasi-affine Expressions
2281 Besides the expressions described above, a quasi-affine
2282 expression can also be set to NaN. Such expressions
2283 typically represent a failure to represent a result
2284 as a quasi-affine expression.
2286 The zero quasi affine expression or the quasi affine expression
2287 that is equal to a given value or
2288 a specified dimension on a given domain can be created using
2290 #include <isl/aff.h>
2291 __isl_give isl_aff *isl_aff_zero_on_domain(
2292 __isl_take isl_local_space *ls);
2293 __isl_give isl_aff *isl_aff_val_on_domain(
2294 __isl_take isl_local_space *ls,
2295 __isl_take isl_val *val);
2296 __isl_give isl_aff *isl_aff_var_on_domain(
2297 __isl_take isl_local_space *ls,
2298 enum isl_dim_type type, unsigned pos);
2299 __isl_give isl_aff *isl_aff_nan_on_domain(
2300 __isl_take isl_local_space *ls);
2302 Quasi affine expressions can be copied and freed using
2304 #include <isl/aff.h>
2305 __isl_give isl_aff *isl_aff_copy(
2306 __isl_keep isl_aff *aff);
2307 __isl_null isl_aff *isl_aff_free(
2308 __isl_take isl_aff *aff);
2310 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2311 using the following function. The constraint is required to have
2312 a non-zero coefficient for the specified dimension.
2314 #include <isl/constraint.h>
2315 __isl_give isl_aff *isl_constraint_get_bound(
2316 __isl_keep isl_constraint *constraint,
2317 enum isl_dim_type type, int pos);
2319 The entire affine expression of the constraint can also be extracted
2320 using the following function.
2322 #include <isl/constraint.h>
2323 __isl_give isl_aff *isl_constraint_get_aff(
2324 __isl_keep isl_constraint *constraint);
2326 Conversely, an equality constraint equating
2327 the affine expression to zero or an inequality constraint enforcing
2328 the affine expression to be non-negative, can be constructed using
2330 __isl_give isl_constraint *isl_equality_from_aff(
2331 __isl_take isl_aff *aff);
2332 __isl_give isl_constraint *isl_inequality_from_aff(
2333 __isl_take isl_aff *aff);
2335 The coefficients and the integer divisions of an affine expression
2336 can be inspected using the following functions.
2338 #include <isl/aff.h>
2339 __isl_give isl_val *isl_aff_get_constant_val(
2340 __isl_keep isl_aff *aff);
2341 __isl_give isl_val *isl_aff_get_coefficient_val(
2342 __isl_keep isl_aff *aff,
2343 enum isl_dim_type type, int pos);
2344 int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2345 enum isl_dim_type type, int pos);
2346 __isl_give isl_val *isl_aff_get_denominator_val(
2347 __isl_keep isl_aff *aff);
2348 __isl_give isl_aff *isl_aff_get_div(
2349 __isl_keep isl_aff *aff, int pos);
2351 They can be modified using the following functions.
2353 #include <isl/aff.h>
2354 __isl_give isl_aff *isl_aff_set_constant_si(
2355 __isl_take isl_aff *aff, int v);
2356 __isl_give isl_aff *isl_aff_set_constant_val(
2357 __isl_take isl_aff *aff, __isl_take isl_val *v);
2358 __isl_give isl_aff *isl_aff_set_coefficient_si(
2359 __isl_take isl_aff *aff,
2360 enum isl_dim_type type, int pos, int v);
2361 __isl_give isl_aff *isl_aff_set_coefficient_val(
2362 __isl_take isl_aff *aff,
2363 enum isl_dim_type type, int pos,
2364 __isl_take isl_val *v);
2366 __isl_give isl_aff *isl_aff_add_constant_si(
2367 __isl_take isl_aff *aff, int v);
2368 __isl_give isl_aff *isl_aff_add_constant_val(
2369 __isl_take isl_aff *aff, __isl_take isl_val *v);
2370 __isl_give isl_aff *isl_aff_add_constant_num_si(
2371 __isl_take isl_aff *aff, int v);
2372 __isl_give isl_aff *isl_aff_add_coefficient_si(
2373 __isl_take isl_aff *aff,
2374 enum isl_dim_type type, int pos, int v);
2375 __isl_give isl_aff *isl_aff_add_coefficient_val(
2376 __isl_take isl_aff *aff,
2377 enum isl_dim_type type, int pos,
2378 __isl_take isl_val *v);
2380 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2381 set the I<numerator> of the constant or coefficient, while
2382 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2383 the constant or coefficient as a whole.
2384 The C<add_constant> and C<add_coefficient> functions add an integer
2385 or rational value to
2386 the possibly rational constant or coefficient.
2387 The C<add_constant_num> functions add an integer value to
2390 =item * Quasipolynomials
2392 Some simple quasipolynomials can be created using the following functions.
2394 #include <isl/polynomial.h>
2395 __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2396 __isl_take isl_space *domain);
2397 __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2398 __isl_take isl_space *domain);
2399 __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2400 __isl_take isl_space *domain);
2401 __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2402 __isl_take isl_space *domain);
2403 __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2404 __isl_take isl_space *domain);
2405 __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2406 __isl_take isl_space *domain,
2407 __isl_take isl_val *val);
2408 __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2409 __isl_take isl_space *domain,
2410 enum isl_dim_type type, unsigned pos);
2411 __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2412 __isl_take isl_aff *aff);
2414 Recall that the space in which a quasipolynomial lives is a map space
2415 with a one-dimensional range. The C<domain> argument in some of
2416 the functions above corresponds to the domain of this map space.
2418 Quasipolynomials can be copied and freed again using the following
2421 #include <isl/polynomial.h>
2422 __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2423 __isl_keep isl_qpolynomial *qp);
2424 __isl_null isl_qpolynomial *isl_qpolynomial_free(
2425 __isl_take isl_qpolynomial *qp);
2427 The constant term of a quasipolynomial can be extracted using
2429 __isl_give isl_val *isl_qpolynomial_get_constant_val(
2430 __isl_keep isl_qpolynomial *qp);
2432 To iterate over all terms in a quasipolynomial,
2435 int isl_qpolynomial_foreach_term(
2436 __isl_keep isl_qpolynomial *qp,
2437 int (*fn)(__isl_take isl_term *term,
2438 void *user), void *user);
2440 The terms themselves can be inspected and freed using
2443 unsigned isl_term_dim(__isl_keep isl_term *term,
2444 enum isl_dim_type type);
2445 __isl_give isl_val *isl_term_get_coefficient_val(
2446 __isl_keep isl_term *term);
2447 int isl_term_get_exp(__isl_keep isl_term *term,
2448 enum isl_dim_type type, unsigned pos);
2449 __isl_give isl_aff *isl_term_get_div(
2450 __isl_keep isl_term *term, unsigned pos);
2451 void isl_term_free(__isl_take isl_term *term);
2453 Each term is a product of parameters, set variables and
2454 integer divisions. The function C<isl_term_get_exp>
2455 returns the exponent of a given dimensions in the given term.
2461 A reduction represents a maximum or a minimum of its
2463 The only reduction type defined by C<isl> is
2464 C<isl_qpolynomial_fold>.
2466 There are currently no functions to directly create such
2467 objects, but they do appear in the piecewise quasipolynomial
2468 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2470 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2472 Reductions can be copied and freed using
2473 the following functions.
2475 #include <isl/polynomial.h>
2476 __isl_give isl_qpolynomial_fold *
2477 isl_qpolynomial_fold_copy(
2478 __isl_keep isl_qpolynomial_fold *fold);
2479 void isl_qpolynomial_fold_free(
2480 __isl_take isl_qpolynomial_fold *fold);
2482 To iterate over all quasipolynomials in a reduction, use
2484 int isl_qpolynomial_fold_foreach_qpolynomial(
2485 __isl_keep isl_qpolynomial_fold *fold,
2486 int (*fn)(__isl_take isl_qpolynomial *qp,
2487 void *user), void *user);
2489 =head3 Multiple Expressions
2491 A multiple expression represents a sequence of zero or
2492 more base expressions, all defined on the same domain space.
2493 The domain space of the multiple expression is the same
2494 as that of the base expressions, but the range space
2495 can be any space. In case the base expressions have
2496 a set space, the corresponding multiple expression
2497 also has a set space.
2498 Objects of the value type do not have an associated space.
2499 The space of a multiple value is therefore always a set space.
2501 The multiple expression types defined by C<isl>
2502 are C<isl_multi_val>, C<isl_multi_aff> and C<isl_multi_pw_aff>.
2504 A multiple expression with the value zero for
2505 each output (or set) dimension can be created
2506 using the following functions.
2508 #include <isl/val.h>
2509 __isl_give isl_multi_val *isl_multi_val_zero(
2510 __isl_take isl_space *space);
2512 #include <isl/aff.h>
2513 __isl_give isl_multi_aff *isl_multi_aff_zero(
2514 __isl_take isl_space *space);
2515 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2516 __isl_take isl_space *space);
2518 An identity function can be created using the following
2519 functions. The space needs to be that of a relation
2520 with the same number of input and output dimensions.
2522 #include <isl/aff.h>
2523 __isl_give isl_multi_aff *isl_multi_aff_identity(
2524 __isl_take isl_space *space);
2525 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2526 __isl_take isl_space *space);
2528 A function that performs a projection on a universe
2529 relation or set can be created using the following functions.
2530 See also the corresponding
2531 projection operations in L</"Unary Operations">.
2533 #include <isl/aff.h>
2534 __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2535 __isl_take isl_space *space);
2536 __isl_give isl_multi_aff *isl_multi_aff_range_map(
2537 __isl_take isl_space *space);
2538 __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2539 __isl_take isl_space *space,
2540 enum isl_dim_type type,
2541 unsigned first, unsigned n);
2543 A multiple expression can be created from a single
2544 base expression using the following functions.
2545 The space of the created multiple expression is the same
2546 as that of the base expression.
2548 #include <isl/aff.h>
2549 __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2550 __isl_take isl_aff *aff);
2551 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2552 __isl_take isl_pw_aff *pa);
2554 A multiple expression can be created from a list
2555 of base expression in a specified space.
2556 The domain of this space needs to be the same
2557 as the domains of the base expressions in the list.
2558 If the base expressions have a set space (or no associated space),
2559 then this space also needs to be a set space.
2561 #include <isl/val.h>
2562 __isl_give isl_multi_val *isl_multi_val_from_val_list(
2563 __isl_take isl_space *space,
2564 __isl_take isl_val_list *list);
2566 #include <isl/aff.h>
2567 __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2568 __isl_take isl_space *space,
2569 __isl_take isl_aff_list *list);
2571 As a convenience, a multiple piecewise expression can
2572 also be created from a multiple expression.
2573 Each piecewise expression in the result has a single
2576 #include <isl/aff.h>
2577 __isl_give isl_multi_pw_aff *
2578 isl_multi_pw_aff_from_multi_aff(
2579 __isl_take isl_multi_aff *ma);
2581 A multiple quasi-affine expression can be created from
2582 a multiple value with a given domain space using the following
2585 #include <isl/aff.h>
2586 __isl_give isl_multi_aff *
2587 isl_multi_aff_multi_val_on_space(
2588 __isl_take isl_space *space,
2589 __isl_take isl_multi_val *mv);
2591 Multiple expressions can be copied and freed using
2592 the following functions.
2594 #include <isl/val.h>
2595 __isl_give isl_multi_val *isl_multi_val_copy(
2596 __isl_keep isl_multi_val *mv);
2597 __isl_null isl_multi_val *isl_multi_val_free(
2598 __isl_take isl_multi_val *mv);
2600 #include <isl/aff.h>
2601 __isl_give isl_multi_aff *isl_multi_aff_copy(
2602 __isl_keep isl_multi_aff *maff);
2603 __isl_null isl_multi_aff *isl_multi_aff_free(
2604 __isl_take isl_multi_aff *maff);
2605 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2606 __isl_keep isl_multi_pw_aff *mpa);
2607 __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2608 __isl_take isl_multi_pw_aff *mpa);
2610 The base expression at a given position of a multiple
2611 expression can be extracted using the following functions.
2613 #include <isl/val.h>
2614 __isl_give isl_val *isl_multi_val_get_val(
2615 __isl_keep isl_multi_val *mv, int pos);
2617 #include <isl/aff.h>
2618 __isl_give isl_aff *isl_multi_aff_get_aff(
2619 __isl_keep isl_multi_aff *multi, int pos);
2620 __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2621 __isl_keep isl_multi_pw_aff *mpa, int pos);
2623 It can be replaced using the following functions.
2625 #include <isl/val.h>
2626 __isl_give isl_multi_val *isl_multi_val_set_val(
2627 __isl_take isl_multi_val *mv, int pos,
2628 __isl_take isl_val *val);
2630 #include <isl/aff.h>
2631 __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2632 __isl_take isl_multi_aff *multi, int pos,
2633 __isl_take isl_aff *aff);
2635 =head3 Piecewise Expressions
2637 A piecewise expression is an expression that is described
2638 using zero or more base expression defined over the same
2639 number of cells in the domain space of the base expressions.
2640 All base expressions are defined over the same
2641 domain space and the cells are disjoint.
2642 The space of a piecewise expression is the same as
2643 that of the base expressions.
2644 If the union of the cells is a strict subset of the domain
2645 space, then the value of the piecewise expression outside
2646 this union is different for types derived from quasi-affine
2647 expressions and those derived from quasipolynomials.
2648 Piecewise expressions derived from quasi-affine expressions
2649 are considered to be undefined outside the union of their cells.
2650 Piecewise expressions derived from quasipolynomials
2651 are considered to be zero outside the union of their cells.
2653 Piecewise quasipolynomials are mainly used by the C<barvinok>
2654 library for representing the number of elements in a parametric set or map.
2655 For example, the piecewise quasipolynomial
2657 [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2659 represents the number of points in the map
2661 [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2663 The piecewise expression types defined by C<isl>
2664 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2665 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2667 A piecewise expression with no cells can be created using
2668 the following functions.
2670 #include <isl/aff.h>
2671 __isl_give isl_pw_aff *isl_pw_aff_empty(
2672 __isl_take isl_space *space);
2673 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2674 __isl_take isl_space *space);
2676 A piecewise expression with a single universe cell can be
2677 created using the following functions.
2679 #include <isl/aff.h>
2680 __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2681 __isl_take isl_aff *aff);
2682 __isl_give isl_pw_multi_aff *
2683 isl_pw_multi_aff_from_multi_aff(
2684 __isl_take isl_multi_aff *ma);
2686 #include <isl/polynomial.h>
2687 __isl_give isl_pw_qpolynomial *
2688 isl_pw_qpolynomial_from_qpolynomial(
2689 __isl_take isl_qpolynomial *qp);
2691 A piecewise expression with a single specified cell can be
2692 created using the following functions.
2694 #include <isl/aff.h>
2695 __isl_give isl_pw_aff *isl_pw_aff_alloc(
2696 __isl_take isl_set *set, __isl_take isl_aff *aff);
2697 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2698 __isl_take isl_set *set,
2699 __isl_take isl_multi_aff *maff);
2701 #include <isl/polynomial.h>
2702 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2703 __isl_take isl_set *set,
2704 __isl_take isl_qpolynomial *qp);
2706 The following convenience functions first create a base expression and
2707 then create a piecewise expression over a universe domain.
2709 #include <isl/aff.h>
2710 __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2711 __isl_take isl_local_space *ls);
2712 __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2713 __isl_take isl_local_space *ls,
2714 enum isl_dim_type type, unsigned pos);
2715 __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2716 __isl_take isl_local_space *ls);
2717 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2718 __isl_take isl_space *space);
2719 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2720 __isl_take isl_space *space);
2721 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2722 __isl_take isl_space *space);
2723 __isl_give isl_pw_multi_aff *
2724 isl_pw_multi_aff_project_out_map(
2725 __isl_take isl_space *space,
2726 enum isl_dim_type type,
2727 unsigned first, unsigned n);
2729 #include <isl/polynomial.h>
2730 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2731 __isl_take isl_space *space);
2733 The following convenience functions first create a base expression and
2734 then create a piecewise expression over a given domain.
2736 #include <isl/aff.h>
2737 __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2738 __isl_take isl_set *domain,
2739 __isl_take isl_val *v);
2740 __isl_give isl_pw_multi_aff *
2741 isl_pw_multi_aff_multi_val_on_domain(
2742 __isl_take isl_set *domain,
2743 __isl_take isl_multi_val *mv);
2745 As a convenience, a piecewise multiple expression can
2746 also be created from a piecewise expression.
2747 Each multiple expression in the result is derived
2748 from the corresponding base expression.
2750 #include <isl/aff.h>
2751 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2752 __isl_take isl_pw_aff *pa);
2754 Similarly, a piecewise quasipolynomial can be
2755 created from a piecewise quasi-affine expression using
2756 the following function.
2758 #include <isl/polynomial.h>
2759 __isl_give isl_pw_qpolynomial *
2760 isl_pw_qpolynomial_from_pw_aff(
2761 __isl_take isl_pw_aff *pwaff);
2763 Piecewise expressions can be copied and freed using the following functions.
2765 #include <isl/aff.h>
2766 __isl_give isl_pw_aff *isl_pw_aff_copy(
2767 __isl_keep isl_pw_aff *pwaff);
2768 __isl_null isl_pw_aff *isl_pw_aff_free(
2769 __isl_take isl_pw_aff *pwaff);
2770 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
2771 __isl_keep isl_pw_multi_aff *pma);
2772 __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
2773 __isl_take isl_pw_multi_aff *pma);
2775 #include <isl/polynomial.h>
2776 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
2777 __isl_keep isl_pw_qpolynomial *pwqp);
2778 __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
2779 __isl_take isl_pw_qpolynomial *pwqp);
2780 __isl_give isl_pw_qpolynomial_fold *
2781 isl_pw_qpolynomial_fold_copy(
2782 __isl_keep isl_pw_qpolynomial_fold *pwf);
2783 __isl_null isl_pw_qpolynomial_fold *
2784 isl_pw_qpolynomial_fold_free(
2785 __isl_take isl_pw_qpolynomial_fold *pwf);
2787 To iterate over the different cells of a piecewise expression,
2788 use the following functions.
2790 #include <isl/aff.h>
2791 int isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
2792 int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
2793 int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
2794 int (*fn)(__isl_take isl_set *set,
2795 __isl_take isl_aff *aff,
2796 void *user), void *user);
2797 int isl_pw_multi_aff_foreach_piece(
2798 __isl_keep isl_pw_multi_aff *pma,
2799 int (*fn)(__isl_take isl_set *set,
2800 __isl_take isl_multi_aff *maff,
2801 void *user), void *user);
2803 #include <isl/polynomial.h>
2804 int isl_pw_qpolynomial_foreach_piece(
2805 __isl_keep isl_pw_qpolynomial *pwqp,
2806 int (*fn)(__isl_take isl_set *set,
2807 __isl_take isl_qpolynomial *qp,
2808 void *user), void *user);
2809 int isl_pw_qpolynomial_foreach_lifted_piece(
2810 __isl_keep isl_pw_qpolynomial *pwqp,
2811 int (*fn)(__isl_take isl_set *set,
2812 __isl_take isl_qpolynomial *qp,
2813 void *user), void *user);
2814 int isl_pw_qpolynomial_fold_foreach_piece(
2815 __isl_keep isl_pw_qpolynomial_fold *pwf,
2816 int (*fn)(__isl_take isl_set *set,
2817 __isl_take isl_qpolynomial_fold *fold,
2818 void *user), void *user);
2819 int isl_pw_qpolynomial_fold_foreach_lifted_piece(
2820 __isl_keep isl_pw_qpolynomial_fold *pwf,
2821 int (*fn)(__isl_take isl_set *set,
2822 __isl_take isl_qpolynomial_fold *fold,
2823 void *user), void *user);
2825 As usual, the function C<fn> should return C<0> on success
2826 and C<-1> on failure. The difference between
2827 C<isl_pw_qpolynomial_foreach_piece> and
2828 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
2829 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
2830 compute unique representations for all existentially quantified
2831 variables and then turn these existentially quantified variables
2832 into extra set variables, adapting the associated quasipolynomial
2833 accordingly. This means that the C<set> passed to C<fn>
2834 will not have any existentially quantified variables, but that
2835 the dimensions of the sets may be different for different
2836 invocations of C<fn>.
2837 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
2838 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
2840 A piecewise expression consisting of the expressions at a given
2841 position of a piecewise multiple expression can be extracted
2842 using the following function.
2844 #include <isl/aff.h>
2845 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
2846 __isl_keep isl_pw_multi_aff *pma, int pos);
2848 These expressions can be replaced using the following function.
2850 #include <isl/aff.h>
2851 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
2852 __isl_take isl_pw_multi_aff *pma, unsigned pos,
2853 __isl_take isl_pw_aff *pa);
2855 Note that there is a difference between C<isl_multi_pw_aff> and
2856 C<isl_pw_multi_aff> objects. The first is a sequence of piecewise
2857 affine expressions, while the second is a piecewise sequence
2858 of affine expressions. In particular, each of the piecewise
2859 affine expressions in an C<isl_multi_pw_aff> may have a different
2860 domain, while all multiple expressions associated to a cell
2861 in an C<isl_pw_multi_aff> have the same domain.
2862 It is possible to convert between the two, but when converting
2863 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
2864 of the result is the intersection of the domains of the input.
2865 The reverse conversion is exact.
2867 #include <isl/aff.h>
2868 __isl_give isl_pw_multi_aff *
2869 isl_pw_multi_aff_from_multi_pw_aff(
2870 __isl_take isl_multi_pw_aff *mpa);
2871 __isl_give isl_multi_pw_aff *
2872 isl_multi_pw_aff_from_pw_multi_aff(
2873 __isl_take isl_pw_multi_aff *pma);
2875 =head3 Union Expressions
2877 A union expression collects base expressions defined
2878 over different domains. The space of a union expression
2879 is that of the shared parameter space.
2881 The union expression types defined by C<isl>
2882 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
2883 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
2885 An empty union expression can be created using the following functions.
2887 #include <isl/aff.h>
2888 __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
2889 __isl_take isl_space *space);
2890 __isl_give isl_union_pw_multi_aff *
2891 isl_union_pw_multi_aff_empty(
2892 __isl_take isl_space *space);
2894 #include <isl/polynomial.h>
2895 __isl_give isl_union_pw_qpolynomial *
2896 isl_union_pw_qpolynomial_zero(
2897 __isl_take isl_space *space);
2899 A union expression containing a single base expression
2900 can be created using the following functions.
2902 #include <isl/aff.h>
2903 __isl_give isl_union_pw_aff *
2904 isl_union_pw_aff_from_pw_aff(
2905 __isl_take isl_pw_aff *pa);
2906 __isl_give isl_union_pw_multi_aff *
2907 isl_union_pw_multi_aff_from_aff(
2908 __isl_take isl_aff *aff);
2909 __isl_give isl_union_pw_multi_aff *
2910 isl_union_pw_multi_aff_from_pw_multi_aff(
2911 __isl_take isl_pw_multi_aff *pma);
2913 #include <isl/polynomial.h>
2914 __isl_give isl_union_pw_qpolynomial *
2915 isl_union_pw_qpolynomial_from_pw_qpolynomial(
2916 __isl_take isl_pw_qpolynomial *pwqp);
2918 The following functions create a base expression on each
2919 of the sets in the union set and collect the results.
2921 #include <isl/aff.h>
2922 __isl_give isl_union_pw_multi_aff *
2923 isl_union_pw_multi_aff_from_union_pw_aff(
2924 __isl_take isl_union_pw_aff *upa);
2925 __isl_give isl_union_pw_aff *
2926 isl_union_pw_multi_aff_get_union_pw_aff(
2927 __isl_keep isl_union_pw_multi_aff *upma, int pos);
2928 __isl_give isl_union_pw_aff *
2929 isl_union_pw_aff_val_on_domain(
2930 __isl_take isl_union_set *domain,
2931 __isl_take isl_val *v);
2932 __isl_give isl_union_pw_multi_aff *
2933 isl_union_pw_multi_aff_multi_val_on_domain(
2934 __isl_take isl_union_set *domain,
2935 __isl_take isl_multi_val *mv);
2937 An C<isl_union_pw_aff> that is equal to a (parametric) affine
2938 expression on a given domain can be created using the following
2941 #include <isl/aff.h>
2942 __isl_give isl_union_pw_aff *
2943 isl_union_pw_aff_aff_on_domain(
2944 __isl_take isl_union_set *domain,
2945 __isl_take isl_aff *aff);
2947 A base expression can be added to a union expression using
2948 the following functions.
2950 #include <isl/aff.h>
2951 __isl_give isl_union_pw_aff *
2952 isl_union_pw_aff_add_pw_aff(
2953 __isl_take isl_union_pw_aff *upa,
2954 __isl_take isl_pw_aff *pa);
2955 __isl_give isl_union_pw_multi_aff *
2956 isl_union_pw_multi_aff_add_pw_multi_aff(
2957 __isl_take isl_union_pw_multi_aff *upma,
2958 __isl_take isl_pw_multi_aff *pma);
2960 #include <isl/polynomial.h>
2961 __isl_give isl_union_pw_qpolynomial *
2962 isl_union_pw_qpolynomial_add_pw_qpolynomial(
2963 __isl_take isl_union_pw_qpolynomial *upwqp,
2964 __isl_take isl_pw_qpolynomial *pwqp);
2966 Union expressions can be copied and freed using
2967 the following functions.
2969 #include <isl/aff.h>
2970 __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
2971 __isl_keep isl_union_pw_aff *upa);
2972 __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
2973 __isl_take isl_union_pw_aff *upa);
2974 __isl_give isl_union_pw_multi_aff *
2975 isl_union_pw_multi_aff_copy(
2976 __isl_keep isl_union_pw_multi_aff *upma);
2977 __isl_null isl_union_pw_multi_aff *
2978 isl_union_pw_multi_aff_free(
2979 __isl_take isl_union_pw_multi_aff *upma);
2981 #include <isl/polynomial.h>
2982 __isl_give isl_union_pw_qpolynomial *
2983 isl_union_pw_qpolynomial_copy(
2984 __isl_keep isl_union_pw_qpolynomial *upwqp);
2985 __isl_null isl_union_pw_qpolynomial *
2986 isl_union_pw_qpolynomial_free(
2987 __isl_take isl_union_pw_qpolynomial *upwqp);
2988 __isl_give isl_union_pw_qpolynomial_fold *
2989 isl_union_pw_qpolynomial_fold_copy(
2990 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
2991 __isl_null isl_union_pw_qpolynomial_fold *
2992 isl_union_pw_qpolynomial_fold_free(
2993 __isl_take isl_union_pw_qpolynomial_fold *upwf);
2995 To iterate over the base expressions in a union expression,
2996 use the following functions.
2998 #include <isl/aff.h>
2999 int isl_union_pw_aff_n_pw_multi_aff(
3000 __isl_keep isl_union_pw_aff *upa);
3001 int isl_union_pw_aff_foreach_pw_aff(
3002 __isl_keep isl_union_pw_aff *upa,
3003 int (*fn)(__isl_take isl_pw_aff *ma, void *user),
3005 int isl_union_pw_multi_aff_n_pw_multi_aff(
3006 __isl_keep isl_union_pw_multi_aff *upma);
3007 int isl_union_pw_multi_aff_foreach_pw_multi_aff(
3008 __isl_keep isl_union_pw_multi_aff *upma,
3009 int (*fn)(__isl_take isl_pw_multi_aff *pma,
3010 void *user), void *user);
3012 #include <isl/polynomial.h>
3013 int isl_union_pw_qplynomial_n_pw_qpolynomial(
3014 __isl_keep isl_union_pw_qpolynomial *upwqp);
3015 int isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3016 __isl_keep isl_union_pw_qpolynomial *upwqp,
3017 int (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3018 void *user), void *user);
3019 int isl_union_pw_qplynomial_fold_n_pw_qpolynomial_fold(
3020 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3021 int isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3022 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3023 int (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3024 void *user), void *user);
3026 To extract the base expression in a given space from a union, use
3027 the following functions.
3029 #include <isl/aff.h>
3030 __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3031 __isl_keep isl_union_pw_aff *upa,
3032 __isl_take isl_space *space);
3033 __isl_give isl_pw_multi_aff *
3034 isl_union_pw_multi_aff_extract_pw_multi_aff(
3035 __isl_keep isl_union_pw_multi_aff *upma,
3036 __isl_take isl_space *space);
3038 #include <isl/polynomial.h>
3039 __isl_give isl_pw_qpolynomial *
3040 isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3041 __isl_keep isl_union_pw_qpolynomial *upwqp,
3042 __isl_take isl_space *space);
3044 =head2 Input and Output
3046 For set and relation,
3047 C<isl> supports its own input/output format, which is similar
3048 to the C<Omega> format, but also supports the C<PolyLib> format
3050 For other object types, typically only an C<isl> format is supported.
3052 =head3 C<isl> format
3054 The C<isl> format is similar to that of C<Omega>, but has a different
3055 syntax for describing the parameters and allows for the definition
3056 of an existentially quantified variable as the integer division
3057 of an affine expression.
3058 For example, the set of integers C<i> between C<0> and C<n>
3059 such that C<i % 10 <= 6> can be described as
3061 [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3064 A set or relation can have several disjuncts, separated
3065 by the keyword C<or>. Each disjunct is either a conjunction
3066 of constraints or a projection (C<exists>) of a conjunction
3067 of constraints. The constraints are separated by the keyword
3070 =head3 C<PolyLib> format
3072 If the represented set is a union, then the first line
3073 contains a single number representing the number of disjuncts.
3074 Otherwise, a line containing the number C<1> is optional.
3076 Each disjunct is represented by a matrix of constraints.
3077 The first line contains two numbers representing
3078 the number of rows and columns,
3079 where the number of rows is equal to the number of constraints
3080 and the number of columns is equal to two plus the number of variables.
3081 The following lines contain the actual rows of the constraint matrix.
3082 In each row, the first column indicates whether the constraint
3083 is an equality (C<0>) or inequality (C<1>). The final column
3084 corresponds to the constant term.
3086 If the set is parametric, then the coefficients of the parameters
3087 appear in the last columns before the constant column.
3088 The coefficients of any existentially quantified variables appear
3089 between those of the set variables and those of the parameters.
3091 =head3 Extended C<PolyLib> format
3093 The extended C<PolyLib> format is nearly identical to the
3094 C<PolyLib> format. The only difference is that the line
3095 containing the number of rows and columns of a constraint matrix
3096 also contains four additional numbers:
3097 the number of output dimensions, the number of input dimensions,
3098 the number of local dimensions (i.e., the number of existentially
3099 quantified variables) and the number of parameters.
3100 For sets, the number of ``output'' dimensions is equal
3101 to the number of set dimensions, while the number of ``input''
3106 Objects can be read from input using the following functions.
3108 #include <isl/val.h>
3109 __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3111 __isl_give isl_multi_val *isl_multi_val_read_from_str(
3112 isl_ctx *ctx, const char *str);
3114 #include <isl/set.h>
3115 __isl_give isl_basic_set *isl_basic_set_read_from_file(
3116 isl_ctx *ctx, FILE *input);
3117 __isl_give isl_basic_set *isl_basic_set_read_from_str(
3118 isl_ctx *ctx, const char *str);
3119 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3121 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3124 #include <isl/map.h>
3125 __isl_give isl_basic_map *isl_basic_map_read_from_file(
3126 isl_ctx *ctx, FILE *input);
3127 __isl_give isl_basic_map *isl_basic_map_read_from_str(
3128 isl_ctx *ctx, const char *str);
3129 __isl_give isl_map *isl_map_read_from_file(
3130 isl_ctx *ctx, FILE *input);
3131 __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3134 #include <isl/union_set.h>
3135 __isl_give isl_union_set *isl_union_set_read_from_file(
3136 isl_ctx *ctx, FILE *input);
3137 __isl_give isl_union_set *isl_union_set_read_from_str(
3138 isl_ctx *ctx, const char *str);
3140 #include <isl/union_map.h>
3141 __isl_give isl_union_map *isl_union_map_read_from_file(
3142 isl_ctx *ctx, FILE *input);
3143 __isl_give isl_union_map *isl_union_map_read_from_str(
3144 isl_ctx *ctx, const char *str);
3146 #include <isl/aff.h>
3147 __isl_give isl_aff *isl_aff_read_from_str(
3148 isl_ctx *ctx, const char *str);
3149 __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3150 isl_ctx *ctx, const char *str);
3151 __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3152 isl_ctx *ctx, const char *str);
3153 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3154 isl_ctx *ctx, const char *str);
3155 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3156 isl_ctx *ctx, const char *str);
3157 __isl_give isl_union_pw_multi_aff *
3158 isl_union_pw_multi_aff_read_from_str(
3159 isl_ctx *ctx, const char *str);
3161 #include <isl/polynomial.h>
3162 __isl_give isl_union_pw_qpolynomial *
3163 isl_union_pw_qpolynomial_read_from_str(
3164 isl_ctx *ctx, const char *str);
3166 For sets and relations,
3167 the input format is autodetected and may be either the C<PolyLib> format
3168 or the C<isl> format.
3172 Before anything can be printed, an C<isl_printer> needs to
3175 __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3177 __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3178 __isl_null isl_printer *isl_printer_free(
3179 __isl_take isl_printer *printer);
3180 __isl_give char *isl_printer_get_str(
3181 __isl_keep isl_printer *printer);
3183 The printer can be inspected using the following functions.
3185 FILE *isl_printer_get_file(
3186 __isl_keep isl_printer *printer);
3187 int isl_printer_get_output_format(
3188 __isl_keep isl_printer *p);
3190 The behavior of the printer can be modified in various ways
3192 __isl_give isl_printer *isl_printer_set_output_format(
3193 __isl_take isl_printer *p, int output_format);
3194 __isl_give isl_printer *isl_printer_set_indent(
3195 __isl_take isl_printer *p, int indent);
3196 __isl_give isl_printer *isl_printer_set_indent_prefix(
3197 __isl_take isl_printer *p, const char *prefix);
3198 __isl_give isl_printer *isl_printer_indent(
3199 __isl_take isl_printer *p, int indent);
3200 __isl_give isl_printer *isl_printer_set_prefix(
3201 __isl_take isl_printer *p, const char *prefix);
3202 __isl_give isl_printer *isl_printer_set_suffix(
3203 __isl_take isl_printer *p, const char *suffix);
3205 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3206 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3207 and defaults to C<ISL_FORMAT_ISL>.
3208 Each line in the output is prefixed by C<indent_prefix>,
3209 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3210 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3211 In the C<PolyLib> format output,
3212 the coefficients of the existentially quantified variables
3213 appear between those of the set variables and those
3215 The function C<isl_printer_indent> increases the indentation
3216 by the specified amount (which may be negative).
3218 To actually print something, use
3220 #include <isl/printer.h>
3221 __isl_give isl_printer *isl_printer_print_double(
3222 __isl_take isl_printer *p, double d);
3224 #include <isl/val.h>
3225 __isl_give isl_printer *isl_printer_print_val(
3226 __isl_take isl_printer *p, __isl_keep isl_val *v);
3228 #include <isl/set.h>
3229 __isl_give isl_printer *isl_printer_print_basic_set(
3230 __isl_take isl_printer *printer,
3231 __isl_keep isl_basic_set *bset);
3232 __isl_give isl_printer *isl_printer_print_set(
3233 __isl_take isl_printer *printer,
3234 __isl_keep isl_set *set);
3236 #include <isl/map.h>
3237 __isl_give isl_printer *isl_printer_print_basic_map(
3238 __isl_take isl_printer *printer,
3239 __isl_keep isl_basic_map *bmap);
3240 __isl_give isl_printer *isl_printer_print_map(
3241 __isl_take isl_printer *printer,
3242 __isl_keep isl_map *map);
3244 #include <isl/union_set.h>
3245 __isl_give isl_printer *isl_printer_print_union_set(
3246 __isl_take isl_printer *p,
3247 __isl_keep isl_union_set *uset);
3249 #include <isl/union_map.h>
3250 __isl_give isl_printer *isl_printer_print_union_map(
3251 __isl_take isl_printer *p,
3252 __isl_keep isl_union_map *umap);
3254 #include <isl/val.h>
3255 __isl_give isl_printer *isl_printer_print_multi_val(
3256 __isl_take isl_printer *p,
3257 __isl_keep isl_multi_val *mv);
3259 #include <isl/aff.h>
3260 __isl_give isl_printer *isl_printer_print_aff(
3261 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3262 __isl_give isl_printer *isl_printer_print_multi_aff(
3263 __isl_take isl_printer *p,
3264 __isl_keep isl_multi_aff *maff);
3265 __isl_give isl_printer *isl_printer_print_pw_aff(
3266 __isl_take isl_printer *p,
3267 __isl_keep isl_pw_aff *pwaff);
3268 __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3269 __isl_take isl_printer *p,
3270 __isl_keep isl_pw_multi_aff *pma);
3271 __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3272 __isl_take isl_printer *p,
3273 __isl_keep isl_multi_pw_aff *mpa);
3274 __isl_give isl_printer *isl_printer_print_union_pw_aff(
3275 __isl_take isl_printer *p,
3276 __isl_keep isl_union_pw_aff *upa);
3277 __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3278 __isl_take isl_printer *p,
3279 __isl_keep isl_union_pw_multi_aff *upma);
3281 #include <isl/polynomial.h>
3282 __isl_give isl_printer *isl_printer_print_qpolynomial(
3283 __isl_take isl_printer *p,
3284 __isl_keep isl_qpolynomial *qp);
3285 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3286 __isl_take isl_printer *p,
3287 __isl_keep isl_pw_qpolynomial *pwqp);
3288 __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3289 __isl_take isl_printer *p,
3290 __isl_keep isl_union_pw_qpolynomial *upwqp);
3292 __isl_give isl_printer *
3293 isl_printer_print_pw_qpolynomial_fold(
3294 __isl_take isl_printer *p,
3295 __isl_keep isl_pw_qpolynomial_fold *pwf);
3296 __isl_give isl_printer *
3297 isl_printer_print_union_pw_qpolynomial_fold(
3298 __isl_take isl_printer *p,
3299 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3301 For C<isl_printer_print_qpolynomial>,
3302 C<isl_printer_print_pw_qpolynomial> and
3303 C<isl_printer_print_pw_qpolynomial_fold>,
3304 the output format of the printer
3305 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3306 For C<isl_printer_print_union_pw_qpolynomial> and
3307 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3309 In case of printing in C<ISL_FORMAT_C>, the user may want
3310 to set the names of all dimensions first.
3312 When called on a file printer, the following function flushes
3313 the file. When called on a string printer, the buffer is cleared.
3315 __isl_give isl_printer *isl_printer_flush(
3316 __isl_take isl_printer *p);
3318 Alternatively, a string representation can be obtained
3319 directly using the following functions, which always print
3322 #include <isl/space.h>
3323 __isl_give char *isl_space_to_str(
3324 __isl_keep isl_space *space);
3326 #include <isl/val.h>
3327 __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3328 __isl_give char *isl_multi_val_to_str(
3329 __isl_keep isl_multi_val *mv);
3331 #include <isl/set.h>
3332 __isl_give char *isl_set_to_str(
3333 __isl_keep isl_set *set);
3335 #include <isl/union_set.h>
3336 __isl_give char *isl_union_set_to_str(
3337 __isl_keep isl_union_set *uset);
3339 #include <isl/map.h>
3340 __isl_give char *isl_map_to_str(
3341 __isl_keep isl_map *map);
3343 #include <isl/union_map.h>
3344 __isl_give char *isl_union_map_to_str(
3345 __isl_keep isl_union_map *umap);
3347 #include <isl/aff.h>
3348 __isl_give char *isl_multi_aff_to_str(
3349 __isl_keep isl_multi_aff *aff);
3350 __isl_give char *isl_union_pw_aff_to_str(
3351 __isl_keep isl_union_pw_aff *upa);
3352 __isl_give char *isl_union_pw_multi_aff_to_str(
3353 __isl_keep isl_union_pw_multi_aff *upma);
3357 =head3 Unary Properties
3363 The following functions test whether the given set or relation
3364 contains any integer points. The ``plain'' variants do not perform
3365 any computations, but simply check if the given set or relation
3366 is already known to be empty.
3368 int isl_basic_set_plain_is_empty(__isl_keep isl_basic_set *bset);
3369 int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
3370 int isl_set_plain_is_empty(__isl_keep isl_set *set);
3371 int isl_set_is_empty(__isl_keep isl_set *set);
3372 int isl_union_set_is_empty(__isl_keep isl_union_set *uset);
3373 int isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
3374 int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
3375 int isl_map_plain_is_empty(__isl_keep isl_map *map);
3376 int isl_map_is_empty(__isl_keep isl_map *map);
3377 int isl_union_map_is_empty(__isl_keep isl_union_map *umap);
3379 =item * Universality
3381 int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
3382 int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
3383 int isl_set_plain_is_universe(__isl_keep isl_set *set);
3385 =item * Single-valuedness
3387 #include <isl/set.h>
3388 int isl_set_is_singleton(__isl_keep isl_set *set);
3390 #include <isl/map.h>
3391 int isl_basic_map_is_single_valued(
3392 __isl_keep isl_basic_map *bmap);
3393 int isl_map_plain_is_single_valued(
3394 __isl_keep isl_map *map);
3395 int isl_map_is_single_valued(__isl_keep isl_map *map);
3397 #include <isl/union_map.h>
3398 int isl_union_map_is_single_valued(__isl_keep isl_union_map *umap);
3402 int isl_map_plain_is_injective(__isl_keep isl_map *map);
3403 int isl_map_is_injective(__isl_keep isl_map *map);
3404 int isl_union_map_plain_is_injective(
3405 __isl_keep isl_union_map *umap);
3406 int isl_union_map_is_injective(
3407 __isl_keep isl_union_map *umap);
3411 int isl_map_is_bijective(__isl_keep isl_map *map);
3412 int isl_union_map_is_bijective(__isl_keep isl_union_map *umap);
3416 __isl_give isl_val *
3417 isl_basic_map_plain_get_val_if_fixed(
3418 __isl_keep isl_basic_map *bmap,
3419 enum isl_dim_type type, unsigned pos);
3420 __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3421 __isl_keep isl_set *set,
3422 enum isl_dim_type type, unsigned pos);
3423 __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3424 __isl_keep isl_map *map,
3425 enum isl_dim_type type, unsigned pos);
3427 If the set or relation obviously lies on a hyperplane where the given dimension
3428 has a fixed value, then return that value.
3429 Otherwise return NaN.
3433 int isl_set_dim_residue_class_val(
3434 __isl_keep isl_set *set,
3435 int pos, __isl_give isl_val **modulo,
3436 __isl_give isl_val **residue);
3438 Check if the values of the given set dimension are equal to a fixed
3439 value modulo some integer value. If so, assign the modulo to C<*modulo>
3440 and the fixed value to C<*residue>. If the given dimension attains only
3441 a single value, then assign C<0> to C<*modulo> and the fixed value to
3443 If the dimension does not attain only a single value and if no modulo
3444 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3448 To check whether the description of a set, relation or function depends
3449 on one or more given dimensions,
3450 the following functions can be used.
3452 #include <isl/constraint.h>
3453 int isl_constraint_involves_dims(
3454 __isl_keep isl_constraint *constraint,
3455 enum isl_dim_type type, unsigned first, unsigned n);
3457 #include <isl/set.h>
3458 int isl_basic_set_involves_dims(
3459 __isl_keep isl_basic_set *bset,
3460 enum isl_dim_type type, unsigned first, unsigned n);
3461 int isl_set_involves_dims(__isl_keep isl_set *set,
3462 enum isl_dim_type type, unsigned first, unsigned n);
3464 #include <isl/map.h>
3465 int isl_basic_map_involves_dims(
3466 __isl_keep isl_basic_map *bmap,
3467 enum isl_dim_type type, unsigned first, unsigned n);
3468 int isl_map_involves_dims(__isl_keep isl_map *map,
3469 enum isl_dim_type type, unsigned first, unsigned n);
3471 #include <isl/union_map.h>
3472 int isl_union_map_involves_dims(
3473 __isl_keep isl_union_map *umap,
3474 enum isl_dim_type type, unsigned first, unsigned n);
3476 #include <isl/aff.h>
3477 int isl_aff_involves_dims(__isl_keep isl_aff *aff,
3478 enum isl_dim_type type, unsigned first, unsigned n);
3479 int isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff,
3480 enum isl_dim_type type, unsigned first, unsigned n);
3481 int isl_multi_aff_involves_dims(
3482 __isl_keep isl_multi_aff *ma,
3483 enum isl_dim_type type, unsigned first, unsigned n);
3484 int isl_multi_pw_aff_involves_dims(
3485 __isl_keep isl_multi_pw_aff *mpa,
3486 enum isl_dim_type type, unsigned first, unsigned n);
3488 Similarly, the following functions can be used to check whether
3489 a given dimension is involved in any lower or upper bound.
3491 #include <isl/set.h>
3492 int isl_set_dim_has_any_lower_bound(__isl_keep isl_set *set,
3493 enum isl_dim_type type, unsigned pos);
3494 int isl_set_dim_has_any_upper_bound(__isl_keep isl_set *set,
3495 enum isl_dim_type type, unsigned pos);
3497 Note that these functions return true even if there is a bound on
3498 the dimension on only some of the basic sets of C<set>.
3499 To check if they have a bound for all of the basic sets in C<set>,
3500 use the following functions instead.
3502 #include <isl/set.h>
3503 int isl_set_dim_has_lower_bound(__isl_keep isl_set *set,
3504 enum isl_dim_type type, unsigned pos);
3505 int isl_set_dim_has_upper_bound(__isl_keep isl_set *set,
3506 enum isl_dim_type type, unsigned pos);
3510 To check whether a set is a parameter domain, use this function:
3512 int isl_set_is_params(__isl_keep isl_set *set);
3513 int isl_union_set_is_params(
3514 __isl_keep isl_union_set *uset);
3518 The following functions check whether the space of the given
3519 (basic) set or relation range is a wrapped relation.
3521 #include <isl/space.h>
3522 int isl_space_is_wrapping(
3523 __isl_keep isl_space *space);
3524 int isl_space_domain_is_wrapping(
3525 __isl_keep isl_space *space);
3526 int isl_space_range_is_wrapping(
3527 __isl_keep isl_space *space);
3529 #include <isl/set.h>
3530 int isl_basic_set_is_wrapping(
3531 __isl_keep isl_basic_set *bset);
3532 int isl_set_is_wrapping(__isl_keep isl_set *set);
3534 #include <isl/map.h>
3535 int isl_map_domain_is_wrapping(
3536 __isl_keep isl_map *map);
3537 int isl_map_range_is_wrapping(
3538 __isl_keep isl_map *map);
3540 #include <isl/val.h>
3541 int isl_multi_val_range_is_wrapping(
3542 __isl_keep isl_multi_val *mv);
3544 #include <isl/aff.h>
3545 int isl_multi_aff_range_is_wrapping(
3546 __isl_keep isl_multi_aff *ma);
3547 int isl_multi_pw_aff_range_is_wrapping(
3548 __isl_keep isl_multi_pw_aff *mpa);
3550 The input to C<isl_space_is_wrapping> should
3551 be the space of a set, while that of
3552 C<isl_space_domain_is_wrapping> and
3553 C<isl_space_range_is_wrapping> should be the space of a relation.
3555 =item * Internal Product
3557 int isl_basic_map_can_zip(
3558 __isl_keep isl_basic_map *bmap);
3559 int isl_map_can_zip(__isl_keep isl_map *map);
3561 Check whether the product of domain and range of the given relation
3563 i.e., whether both domain and range are nested relations.
3567 int isl_basic_map_can_curry(
3568 __isl_keep isl_basic_map *bmap);
3569 int isl_map_can_curry(__isl_keep isl_map *map);
3571 Check whether the domain of the (basic) relation is a wrapped relation.
3573 int isl_basic_map_can_uncurry(
3574 __isl_keep isl_basic_map *bmap);
3575 int isl_map_can_uncurry(__isl_keep isl_map *map);
3577 Check whether the range of the (basic) relation is a wrapped relation.
3579 =item * Special Values
3581 #include <isl/aff.h>
3582 int isl_aff_is_cst(__isl_keep isl_aff *aff);
3583 int isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3585 Check whether the given expression is a constant.
3587 #include <isl/aff.h>
3588 int isl_aff_is_nan(__isl_keep isl_aff *aff);
3589 int isl_pw_aff_involves_nan(__isl_keep isl_pw_aff *pa);
3591 Check whether the given expression is equal to or involves NaN.
3593 #include <isl/aff.h>
3594 int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
3596 Check whether the affine expression is obviously zero.
3600 =head3 Binary Properties
3606 The following functions check whether two objects
3607 represent the same set, relation or function.
3608 The C<plain> variants only return true if the objects
3609 are obviously the same. That is, they may return false
3610 even if the objects are the same, but they will never
3611 return true if the objects are not the same.
3613 #include <isl/set.h>
3614 int isl_basic_set_plain_is_equal(
3615 __isl_keep isl_basic_set *bset1,
3616 __isl_keep isl_basic_set *bset2);
3617 int isl_set_plain_is_equal(__isl_keep isl_set *set1,
3618 __isl_keep isl_set *set2);
3619 int isl_set_is_equal(__isl_keep isl_set *set1,
3620 __isl_keep isl_set *set2);
3622 #include <isl/map.h>
3623 int isl_basic_map_is_equal(
3624 __isl_keep isl_basic_map *bmap1,
3625 __isl_keep isl_basic_map *bmap2);
3626 int isl_map_is_equal(__isl_keep isl_map *map1,
3627 __isl_keep isl_map *map2);
3628 int isl_map_plain_is_equal(__isl_keep isl_map *map1,
3629 __isl_keep isl_map *map2);
3631 #include <isl/union_set.h>
3632 int isl_union_set_is_equal(
3633 __isl_keep isl_union_set *uset1,
3634 __isl_keep isl_union_set *uset2);
3636 #include <isl/union_map.h>
3637 int isl_union_map_is_equal(
3638 __isl_keep isl_union_map *umap1,
3639 __isl_keep isl_union_map *umap2);
3641 #include <isl/aff.h>
3642 int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1,
3643 __isl_keep isl_aff *aff2);
3644 int isl_multi_aff_plain_is_equal(
3645 __isl_keep isl_multi_aff *maff1,
3646 __isl_keep isl_multi_aff *maff2);
3647 int isl_pw_aff_plain_is_equal(
3648 __isl_keep isl_pw_aff *pwaff1,
3649 __isl_keep isl_pw_aff *pwaff2);
3650 int isl_pw_multi_aff_plain_is_equal(
3651 __isl_keep isl_pw_multi_aff *pma1,
3652 __isl_keep isl_pw_multi_aff *pma2);
3653 int isl_multi_pw_aff_plain_is_equal(
3654 __isl_keep isl_multi_pw_aff *mpa1,
3655 __isl_keep isl_multi_pw_aff *mpa2);
3656 int isl_multi_pw_aff_is_equal(
3657 __isl_keep isl_multi_pw_aff *mpa1,
3658 __isl_keep isl_multi_pw_aff *mpa2);
3659 int isl_union_pw_aff_plain_is_equal(
3660 __isl_keep isl_union_pw_aff *upa1,
3661 __isl_keep isl_union_pw_aff *upa2);
3662 int isl_union_pw_multi_aff_plain_is_equal(
3663 __isl_keep isl_union_pw_multi_aff *upma1,
3664 __isl_keep isl_union_pw_multi_aff *upma2);
3666 #include <isl/polynomial.h>
3667 int isl_union_pw_qpolynomial_plain_is_equal(
3668 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3669 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3670 int isl_union_pw_qpolynomial_fold_plain_is_equal(
3671 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3672 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3674 =item * Disjointness
3676 #include <isl/set.h>
3677 int isl_basic_set_is_disjoint(
3678 __isl_keep isl_basic_set *bset1,
3679 __isl_keep isl_basic_set *bset2);
3680 int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
3681 __isl_keep isl_set *set2);
3682 int isl_set_is_disjoint(__isl_keep isl_set *set1,
3683 __isl_keep isl_set *set2);
3685 #include <isl/map.h>
3686 int isl_basic_map_is_disjoint(
3687 __isl_keep isl_basic_map *bmap1,
3688 __isl_keep isl_basic_map *bmap2);
3689 int isl_map_is_disjoint(__isl_keep isl_map *map1,
3690 __isl_keep isl_map *map2);
3692 #include <isl/union_set.h>
3693 int isl_union_set_is_disjoint(
3694 __isl_keep isl_union_set *uset1,
3695 __isl_keep isl_union_set *uset2);
3697 #include <isl/union_map.h>
3698 int isl_union_map_is_disjoint(
3699 __isl_keep isl_union_map *umap1,
3700 __isl_keep isl_union_map *umap2);
3704 int isl_basic_set_is_subset(
3705 __isl_keep isl_basic_set *bset1,
3706 __isl_keep isl_basic_set *bset2);
3707 int isl_set_is_subset(__isl_keep isl_set *set1,
3708 __isl_keep isl_set *set2);
3709 int isl_set_is_strict_subset(
3710 __isl_keep isl_set *set1,
3711 __isl_keep isl_set *set2);
3712 int isl_union_set_is_subset(
3713 __isl_keep isl_union_set *uset1,
3714 __isl_keep isl_union_set *uset2);
3715 int isl_union_set_is_strict_subset(
3716 __isl_keep isl_union_set *uset1,
3717 __isl_keep isl_union_set *uset2);
3718 int isl_basic_map_is_subset(
3719 __isl_keep isl_basic_map *bmap1,
3720 __isl_keep isl_basic_map *bmap2);
3721 int isl_basic_map_is_strict_subset(
3722 __isl_keep isl_basic_map *bmap1,
3723 __isl_keep isl_basic_map *bmap2);
3724 int isl_map_is_subset(
3725 __isl_keep isl_map *map1,
3726 __isl_keep isl_map *map2);
3727 int isl_map_is_strict_subset(
3728 __isl_keep isl_map *map1,
3729 __isl_keep isl_map *map2);
3730 int isl_union_map_is_subset(
3731 __isl_keep isl_union_map *umap1,
3732 __isl_keep isl_union_map *umap2);
3733 int isl_union_map_is_strict_subset(
3734 __isl_keep isl_union_map *umap1,
3735 __isl_keep isl_union_map *umap2);
3737 Check whether the first argument is a (strict) subset of the
3742 Every comparison function returns a negative value if the first
3743 argument is considered smaller than the second, a positive value
3744 if the first argument is considered greater and zero if the two
3745 constraints are considered the same by the comparison criterion.
3747 #include <isl/constraint.h>
3748 int isl_constraint_plain_cmp(
3749 __isl_keep isl_constraint *c1,
3750 __isl_keep isl_constraint *c2);
3752 This function is useful for sorting C<isl_constraint>s.
3753 The order depends on the internal representation of the inputs.
3754 The order is fixed over different calls to the function (assuming
3755 the internal representation of the inputs has not changed), but may
3756 change over different versions of C<isl>.
3758 #include <isl/constraint.h>
3759 int isl_constraint_cmp_last_non_zero(
3760 __isl_keep isl_constraint *c1,
3761 __isl_keep isl_constraint *c2);
3763 This function can be used to sort constraints that live in the same
3764 local space. Constraints that involve ``earlier'' dimensions or
3765 that have a smaller coefficient for the shared latest dimension
3766 are considered smaller than other constraints.
3767 This function only defines a B<partial> order.
3769 #include <isl/set.h>
3770 int isl_set_plain_cmp(__isl_keep isl_set *set1,
3771 __isl_keep isl_set *set2);
3773 This function is useful for sorting C<isl_set>s.
3774 The order depends on the internal representation of the inputs.
3775 The order is fixed over different calls to the function (assuming
3776 the internal representation of the inputs has not changed), but may
3777 change over different versions of C<isl>.
3779 #include <isl/aff.h>
3780 int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
3781 __isl_keep isl_pw_aff *pa2);
3783 The function C<isl_pw_aff_plain_cmp> can be used to sort
3784 C<isl_pw_aff>s. The order is not strictly defined.
3785 The current order sorts expressions that only involve
3786 earlier dimensions before those that involve later dimensions.
3790 =head2 Unary Operations
3796 __isl_give isl_set *isl_set_complement(
3797 __isl_take isl_set *set);
3798 __isl_give isl_map *isl_map_complement(
3799 __isl_take isl_map *map);
3803 #include <isl/space.h>
3804 __isl_give isl_space *isl_space_reverse(
3805 __isl_take isl_space *space);
3807 #include <isl/map.h>
3808 __isl_give isl_basic_map *isl_basic_map_reverse(
3809 __isl_take isl_basic_map *bmap);
3810 __isl_give isl_map *isl_map_reverse(
3811 __isl_take isl_map *map);
3813 #include <isl/union_map.h>
3814 __isl_give isl_union_map *isl_union_map_reverse(
3815 __isl_take isl_union_map *umap);
3819 #include <isl/space.h>
3820 __isl_give isl_space *isl_space_domain(
3821 __isl_take isl_space *space);
3822 __isl_give isl_space *isl_space_range(
3823 __isl_take isl_space *space);
3824 __isl_give isl_space *isl_space_params(
3825 __isl_take isl_space *space);
3827 #include <isl/local_space.h>
3828 __isl_give isl_local_space *isl_local_space_domain(
3829 __isl_take isl_local_space *ls);
3830 __isl_give isl_local_space *isl_local_space_range(
3831 __isl_take isl_local_space *ls);
3833 #include <isl/set.h>
3834 __isl_give isl_basic_set *isl_basic_set_project_out(
3835 __isl_take isl_basic_set *bset,
3836 enum isl_dim_type type, unsigned first, unsigned n);
3837 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
3838 enum isl_dim_type type, unsigned first, unsigned n);
3839 __isl_give isl_basic_set *isl_basic_set_params(
3840 __isl_take isl_basic_set *bset);
3841 __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
3843 #include <isl/map.h>
3844 __isl_give isl_basic_map *isl_basic_map_project_out(
3845 __isl_take isl_basic_map *bmap,
3846 enum isl_dim_type type, unsigned first, unsigned n);
3847 __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
3848 enum isl_dim_type type, unsigned first, unsigned n);
3849 __isl_give isl_basic_set *isl_basic_map_domain(
3850 __isl_take isl_basic_map *bmap);
3851 __isl_give isl_basic_set *isl_basic_map_range(
3852 __isl_take isl_basic_map *bmap);
3853 __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
3854 __isl_give isl_set *isl_map_domain(
3855 __isl_take isl_map *bmap);
3856 __isl_give isl_set *isl_map_range(
3857 __isl_take isl_map *map);
3859 #include <isl/union_set.h>
3860 __isl_give isl_union_set *isl_union_set_project_out(
3861 __isl_take isl_union_set *uset,
3862 enum isl_dim_type type,
3863 unsigned first, unsigned n);
3864 __isl_give isl_set *isl_union_set_params(
3865 __isl_take isl_union_set *uset);
3867 The function C<isl_union_set_project_out> can only project out
3870 #include <isl/union_map.h>
3871 __isl_give isl_union_map *isl_union_map_project_out(
3872 __isl_take isl_union_map *umap,
3873 enum isl_dim_type type, unsigned first, unsigned n);
3874 __isl_give isl_set *isl_union_map_params(
3875 __isl_take isl_union_map *umap);
3876 __isl_give isl_union_set *isl_union_map_domain(
3877 __isl_take isl_union_map *umap);
3878 __isl_give isl_union_set *isl_union_map_range(
3879 __isl_take isl_union_map *umap);
3881 The function C<isl_union_map_project_out> can only project out
3884 #include <isl/aff.h>
3885 __isl_give isl_aff *isl_aff_project_domain_on_params(
3886 __isl_take isl_aff *aff);
3887 __isl_give isl_pw_multi_aff *
3888 isl_pw_multi_aff_project_domain_on_params(
3889 __isl_take isl_pw_multi_aff *pma);
3890 __isl_give isl_set *isl_pw_aff_domain(
3891 __isl_take isl_pw_aff *pwaff);
3892 __isl_give isl_set *isl_pw_multi_aff_domain(
3893 __isl_take isl_pw_multi_aff *pma);
3894 __isl_give isl_set *isl_multi_pw_aff_domain(
3895 __isl_take isl_multi_pw_aff *mpa);
3896 __isl_give isl_union_set *isl_union_pw_aff_domain(
3897 __isl_take isl_union_pw_aff *upa);
3898 __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
3899 __isl_take isl_union_pw_multi_aff *upma);
3900 __isl_give isl_set *isl_pw_aff_params(
3901 __isl_take isl_pw_aff *pwa);
3903 #include <isl/polynomial.h>
3904 __isl_give isl_qpolynomial *
3905 isl_qpolynomial_project_domain_on_params(
3906 __isl_take isl_qpolynomial *qp);
3907 __isl_give isl_pw_qpolynomial *
3908 isl_pw_qpolynomial_project_domain_on_params(
3909 __isl_take isl_pw_qpolynomial *pwqp);
3910 __isl_give isl_pw_qpolynomial_fold *
3911 isl_pw_qpolynomial_fold_project_domain_on_params(
3912 __isl_take isl_pw_qpolynomial_fold *pwf);
3913 __isl_give isl_set *isl_pw_qpolynomial_domain(
3914 __isl_take isl_pw_qpolynomial *pwqp);
3915 __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
3916 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3917 __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
3918 __isl_take isl_union_pw_qpolynomial *upwqp);
3920 #include <isl/space.h>
3921 __isl_give isl_space *isl_space_domain_map(
3922 __isl_take isl_space *space);
3923 __isl_give isl_space *isl_space_range_map(
3924 __isl_take isl_space *space);
3926 #include <isl/map.h>
3927 __isl_give isl_map *isl_set_wrapped_domain_map(
3928 __isl_take isl_set *set);
3929 __isl_give isl_basic_map *isl_basic_map_domain_map(
3930 __isl_take isl_basic_map *bmap);
3931 __isl_give isl_basic_map *isl_basic_map_range_map(
3932 __isl_take isl_basic_map *bmap);
3933 __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
3934 __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
3936 #include <isl/union_map.h>
3937 __isl_give isl_union_map *isl_union_map_domain_map(
3938 __isl_take isl_union_map *umap);
3939 __isl_give isl_union_pw_multi_aff *
3940 isl_union_map_domain_map_union_pw_multi_aff(
3941 __isl_take isl_union_map *umap);
3942 __isl_give isl_union_map *isl_union_map_range_map(
3943 __isl_take isl_union_map *umap);
3944 __isl_give isl_union_map *
3945 isl_union_set_wrapped_domain_map(
3946 __isl_take isl_union_set *uset);
3948 The functions above construct a (basic, regular or union) relation
3949 that maps (a wrapped version of) the input relation to its domain or range.
3950 C<isl_set_wrapped_domain_map> maps the input set to the domain
3951 of its wrapped relation.
3955 __isl_give isl_basic_set *isl_basic_set_eliminate(
3956 __isl_take isl_basic_set *bset,
3957 enum isl_dim_type type,
3958 unsigned first, unsigned n);
3959 __isl_give isl_set *isl_set_eliminate(
3960 __isl_take isl_set *set, enum isl_dim_type type,
3961 unsigned first, unsigned n);
3962 __isl_give isl_basic_map *isl_basic_map_eliminate(
3963 __isl_take isl_basic_map *bmap,
3964 enum isl_dim_type type,
3965 unsigned first, unsigned n);
3966 __isl_give isl_map *isl_map_eliminate(
3967 __isl_take isl_map *map, enum isl_dim_type type,
3968 unsigned first, unsigned n);
3970 Eliminate the coefficients for the given dimensions from the constraints,
3971 without removing the dimensions.
3973 =item * Constructing a set from a parameter domain
3975 A zero-dimensional space or (basic) set can be constructed
3976 on a given parameter domain using the following functions.
3978 #include <isl/space.h>
3979 __isl_give isl_space *isl_space_set_from_params(
3980 __isl_take isl_space *space);
3982 #include <isl/set.h>
3983 __isl_give isl_basic_set *isl_basic_set_from_params(
3984 __isl_take isl_basic_set *bset);
3985 __isl_give isl_set *isl_set_from_params(
3986 __isl_take isl_set *set);
3988 =item * Constructing a relation from a set
3990 Create a relation with the given set as domain or range.
3991 The range or domain of the created relation is a zero-dimensional
3992 flat anonymous space.
3994 #include <isl/space.h>
3995 __isl_give isl_space *isl_space_from_domain(
3996 __isl_take isl_space *space);
3997 __isl_give isl_space *isl_space_from_range(
3998 __isl_take isl_space *space);
3999 __isl_give isl_space *isl_space_map_from_set(
4000 __isl_take isl_space *space);
4001 __isl_give isl_space *isl_space_map_from_domain_and_range(
4002 __isl_take isl_space *domain,
4003 __isl_take isl_space *range);
4005 #include <isl/local_space.h>
4006 __isl_give isl_local_space *isl_local_space_from_domain(
4007 __isl_take isl_local_space *ls);
4009 #include <isl/map.h>
4010 __isl_give isl_map *isl_map_from_domain(
4011 __isl_take isl_set *set);
4012 __isl_give isl_map *isl_map_from_range(
4013 __isl_take isl_set *set);
4015 #include <isl/val.h>
4016 __isl_give isl_multi_val *isl_multi_val_from_range(
4017 __isl_take isl_multi_val *mv);
4019 #include <isl/aff.h>
4020 __isl_give isl_multi_aff *isl_multi_aff_from_range(
4021 __isl_take isl_multi_aff *ma);
4022 __isl_give isl_pw_aff *isl_pw_aff_from_range(
4023 __isl_take isl_pw_aff *pwa);
4024 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4025 __isl_take isl_multi_pw_aff *mpa);
4026 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4027 __isl_take isl_set *set);
4028 __isl_give isl_union_pw_multi_aff *
4029 isl_union_pw_multi_aff_from_domain(
4030 __isl_take isl_union_set *uset);
4034 #include <isl/set.h>
4035 __isl_give isl_basic_set *isl_basic_set_fix_si(
4036 __isl_take isl_basic_set *bset,
4037 enum isl_dim_type type, unsigned pos, int value);
4038 __isl_give isl_basic_set *isl_basic_set_fix_val(
4039 __isl_take isl_basic_set *bset,
4040 enum isl_dim_type type, unsigned pos,
4041 __isl_take isl_val *v);
4042 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4043 enum isl_dim_type type, unsigned pos, int value);
4044 __isl_give isl_set *isl_set_fix_val(
4045 __isl_take isl_set *set,
4046 enum isl_dim_type type, unsigned pos,
4047 __isl_take isl_val *v);
4049 #include <isl/map.h>
4050 __isl_give isl_basic_map *isl_basic_map_fix_si(
4051 __isl_take isl_basic_map *bmap,
4052 enum isl_dim_type type, unsigned pos, int value);
4053 __isl_give isl_basic_map *isl_basic_map_fix_val(
4054 __isl_take isl_basic_map *bmap,
4055 enum isl_dim_type type, unsigned pos,
4056 __isl_take isl_val *v);
4057 __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4058 enum isl_dim_type type, unsigned pos, int value);
4059 __isl_give isl_map *isl_map_fix_val(
4060 __isl_take isl_map *map,
4061 enum isl_dim_type type, unsigned pos,
4062 __isl_take isl_val *v);
4064 #include <isl/aff.h>
4065 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4066 __isl_take isl_pw_multi_aff *pma,
4067 enum isl_dim_type type, unsigned pos, int value);
4069 #include <isl/polynomial.h>
4070 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4071 __isl_take isl_pw_qpolynomial *pwqp,
4072 enum isl_dim_type type, unsigned n,
4073 __isl_take isl_val *v);
4075 Intersect the set, relation or function domain
4076 with the hyperplane where the given
4077 dimension has the fixed given value.
4079 __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4080 __isl_take isl_basic_map *bmap,
4081 enum isl_dim_type type, unsigned pos, int value);
4082 __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4083 __isl_take isl_basic_map *bmap,
4084 enum isl_dim_type type, unsigned pos, int value);
4085 __isl_give isl_set *isl_set_lower_bound_si(
4086 __isl_take isl_set *set,
4087 enum isl_dim_type type, unsigned pos, int value);
4088 __isl_give isl_set *isl_set_lower_bound_val(
4089 __isl_take isl_set *set,
4090 enum isl_dim_type type, unsigned pos,
4091 __isl_take isl_val *value);
4092 __isl_give isl_map *isl_map_lower_bound_si(
4093 __isl_take isl_map *map,
4094 enum isl_dim_type type, unsigned pos, int value);
4095 __isl_give isl_set *isl_set_upper_bound_si(
4096 __isl_take isl_set *set,
4097 enum isl_dim_type type, unsigned pos, int value);
4098 __isl_give isl_set *isl_set_upper_bound_val(
4099 __isl_take isl_set *set,
4100 enum isl_dim_type type, unsigned pos,
4101 __isl_take isl_val *value);
4102 __isl_give isl_map *isl_map_upper_bound_si(
4103 __isl_take isl_map *map,
4104 enum isl_dim_type type, unsigned pos, int value);
4106 Intersect the set or relation with the half-space where the given
4107 dimension has a value bounded by the fixed given integer value.
4109 __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4110 enum isl_dim_type type1, int pos1,
4111 enum isl_dim_type type2, int pos2);
4112 __isl_give isl_basic_map *isl_basic_map_equate(
4113 __isl_take isl_basic_map *bmap,
4114 enum isl_dim_type type1, int pos1,
4115 enum isl_dim_type type2, int pos2);
4116 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4117 enum isl_dim_type type1, int pos1,
4118 enum isl_dim_type type2, int pos2);
4120 Intersect the set or relation with the hyperplane where the given
4121 dimensions are equal to each other.
4123 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4124 enum isl_dim_type type1, int pos1,
4125 enum isl_dim_type type2, int pos2);
4127 Intersect the relation with the hyperplane where the given
4128 dimensions have opposite values.
4130 __isl_give isl_map *isl_map_order_le(
4131 __isl_take isl_map *map,
4132 enum isl_dim_type type1, int pos1,
4133 enum isl_dim_type type2, int pos2);
4134 __isl_give isl_basic_map *isl_basic_map_order_ge(
4135 __isl_take isl_basic_map *bmap,
4136 enum isl_dim_type type1, int pos1,
4137 enum isl_dim_type type2, int pos2);
4138 __isl_give isl_map *isl_map_order_ge(
4139 __isl_take isl_map *map,
4140 enum isl_dim_type type1, int pos1,
4141 enum isl_dim_type type2, int pos2);
4142 __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4143 enum isl_dim_type type1, int pos1,
4144 enum isl_dim_type type2, int pos2);
4145 __isl_give isl_basic_map *isl_basic_map_order_gt(
4146 __isl_take isl_basic_map *bmap,
4147 enum isl_dim_type type1, int pos1,
4148 enum isl_dim_type type2, int pos2);
4149 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4150 enum isl_dim_type type1, int pos1,
4151 enum isl_dim_type type2, int pos2);
4153 Intersect the relation with the half-space where the given
4154 dimensions satisfy the given ordering.
4158 #include <isl/aff.h>
4159 __isl_give isl_basic_set *isl_aff_zero_basic_set(
4160 __isl_take isl_aff *aff);
4161 __isl_give isl_basic_set *isl_aff_neg_basic_set(
4162 __isl_take isl_aff *aff);
4163 __isl_give isl_set *isl_pw_aff_pos_set(
4164 __isl_take isl_pw_aff *pa);
4165 __isl_give isl_set *isl_pw_aff_nonneg_set(
4166 __isl_take isl_pw_aff *pwaff);
4167 __isl_give isl_set *isl_pw_aff_zero_set(
4168 __isl_take isl_pw_aff *pwaff);
4169 __isl_give isl_set *isl_pw_aff_non_zero_set(
4170 __isl_take isl_pw_aff *pwaff);
4171 __isl_give isl_union_set *
4172 isl_union_pw_aff_zero_union_set(
4173 __isl_take isl_union_pw_aff *upa);
4175 The function C<isl_aff_neg_basic_set> returns a basic set
4176 containing those elements in the domain space
4177 of C<aff> where C<aff> is negative.
4178 The function C<isl_pw_aff_nonneg_set> returns a set
4179 containing those elements in the domain
4180 of C<pwaff> where C<pwaff> is non-negative.
4184 __isl_give isl_map *isl_set_identity(
4185 __isl_take isl_set *set);
4186 __isl_give isl_union_map *isl_union_set_identity(
4187 __isl_take isl_union_set *uset);
4188 __isl_give isl_union_pw_multi_aff *
4189 isl_union_set_identity_union_pw_multi_aff(
4190 __isl_take isl_union_set *uset);
4192 Construct an identity relation on the given (union) set.
4194 =item * Function Extraction
4196 A piecewise quasi affine expression that is equal to 1 on a set
4197 and 0 outside the set can be created using the following function.
4199 #include <isl/aff.h>
4200 __isl_give isl_pw_aff *isl_set_indicator_function(
4201 __isl_take isl_set *set);
4203 A piecewise multiple quasi affine expression can be extracted
4204 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4205 and the C<isl_map> is single-valued.
4206 In case of a conversion from an C<isl_union_map>
4207 to an C<isl_union_pw_multi_aff>, these properties need to hold
4208 in each domain space.
4210 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4211 __isl_take isl_set *set);
4212 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4213 __isl_take isl_map *map);
4215 __isl_give isl_union_pw_multi_aff *
4216 isl_union_pw_multi_aff_from_union_set(
4217 __isl_take isl_union_set *uset);
4218 __isl_give isl_union_pw_multi_aff *
4219 isl_union_pw_multi_aff_from_union_map(
4220 __isl_take isl_union_map *umap);
4224 __isl_give isl_basic_set *isl_basic_map_deltas(
4225 __isl_take isl_basic_map *bmap);
4226 __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4227 __isl_give isl_union_set *isl_union_map_deltas(
4228 __isl_take isl_union_map *umap);
4230 These functions return a (basic) set containing the differences
4231 between image elements and corresponding domain elements in the input.
4233 __isl_give isl_basic_map *isl_basic_map_deltas_map(
4234 __isl_take isl_basic_map *bmap);
4235 __isl_give isl_map *isl_map_deltas_map(
4236 __isl_take isl_map *map);
4237 __isl_give isl_union_map *isl_union_map_deltas_map(
4238 __isl_take isl_union_map *umap);
4240 The functions above construct a (basic, regular or union) relation
4241 that maps (a wrapped version of) the input relation to its delta set.
4245 Simplify the representation of a set, relation or functions by trying
4246 to combine pairs of basic sets or relations into a single
4247 basic set or relation.
4249 #include <isl/set.h>
4250 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4252 #include <isl/map.h>
4253 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4255 #include <isl/union_set.h>
4256 __isl_give isl_union_set *isl_union_set_coalesce(
4257 __isl_take isl_union_set *uset);
4259 #include <isl/union_map.h>
4260 __isl_give isl_union_map *isl_union_map_coalesce(
4261 __isl_take isl_union_map *umap);
4263 #include <isl/aff.h>
4264 __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4265 __isl_take isl_pw_aff *pwqp);
4266 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4267 __isl_take isl_pw_multi_aff *pma);
4268 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4269 __isl_take isl_multi_pw_aff *mpa);
4270 __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4271 __isl_take isl_union_pw_aff *upa);
4272 __isl_give isl_union_pw_multi_aff *
4273 isl_union_pw_multi_aff_coalesce(
4274 __isl_take isl_union_pw_multi_aff *upma);
4276 #include <isl/polynomial.h>
4277 __isl_give isl_pw_qpolynomial_fold *
4278 isl_pw_qpolynomial_fold_coalesce(
4279 __isl_take isl_pw_qpolynomial_fold *pwf);
4280 __isl_give isl_union_pw_qpolynomial *
4281 isl_union_pw_qpolynomial_coalesce(
4282 __isl_take isl_union_pw_qpolynomial *upwqp);
4283 __isl_give isl_union_pw_qpolynomial_fold *
4284 isl_union_pw_qpolynomial_fold_coalesce(
4285 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4287 One of the methods for combining pairs of basic sets or relations
4288 can result in coefficients that are much larger than those that appear
4289 in the constraints of the input. By default, the coefficients are
4290 not allowed to grow larger, but this can be changed by unsetting
4291 the following option.
4293 int isl_options_set_coalesce_bounded_wrapping(
4294 isl_ctx *ctx, int val);
4295 int isl_options_get_coalesce_bounded_wrapping(
4298 =item * Detecting equalities
4300 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4301 __isl_take isl_basic_set *bset);
4302 __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4303 __isl_take isl_basic_map *bmap);
4304 __isl_give isl_set *isl_set_detect_equalities(
4305 __isl_take isl_set *set);
4306 __isl_give isl_map *isl_map_detect_equalities(
4307 __isl_take isl_map *map);
4308 __isl_give isl_union_set *isl_union_set_detect_equalities(
4309 __isl_take isl_union_set *uset);
4310 __isl_give isl_union_map *isl_union_map_detect_equalities(
4311 __isl_take isl_union_map *umap);
4313 Simplify the representation of a set or relation by detecting implicit
4316 =item * Removing redundant constraints
4318 #include <isl/set.h>
4319 __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4320 __isl_take isl_basic_set *bset);
4321 __isl_give isl_set *isl_set_remove_redundancies(
4322 __isl_take isl_set *set);
4324 #include <isl/union_set.h>
4325 __isl_give isl_union_set *
4326 isl_union_set_remove_redundancies(
4327 __isl_take isl_union_set *uset);
4329 #include <isl/map.h>
4330 __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4331 __isl_take isl_basic_map *bmap);
4332 __isl_give isl_map *isl_map_remove_redundancies(
4333 __isl_take isl_map *map);
4335 #include <isl/union_map.h>
4336 __isl_give isl_union_map *
4337 isl_union_map_remove_redundancies(
4338 __isl_take isl_union_map *umap);
4342 __isl_give isl_basic_set *isl_set_convex_hull(
4343 __isl_take isl_set *set);
4344 __isl_give isl_basic_map *isl_map_convex_hull(
4345 __isl_take isl_map *map);
4347 If the input set or relation has any existentially quantified
4348 variables, then the result of these operations is currently undefined.
4352 #include <isl/set.h>
4353 __isl_give isl_basic_set *
4354 isl_set_unshifted_simple_hull(
4355 __isl_take isl_set *set);
4356 __isl_give isl_basic_set *isl_set_simple_hull(
4357 __isl_take isl_set *set);
4358 __isl_give isl_basic_set *
4359 isl_set_unshifted_simple_hull_from_set_list(
4360 __isl_take isl_set *set,
4361 __isl_take isl_set_list *list);
4363 #include <isl/map.h>
4364 __isl_give isl_basic_map *
4365 isl_map_unshifted_simple_hull(
4366 __isl_take isl_map *map);
4367 __isl_give isl_basic_map *isl_map_simple_hull(
4368 __isl_take isl_map *map);
4369 __isl_give isl_basic_map *
4370 isl_map_unshifted_simple_hull_from_map_list(
4371 __isl_take isl_map *map,
4372 __isl_take isl_map_list *list);
4374 #include <isl/union_map.h>
4375 __isl_give isl_union_map *isl_union_map_simple_hull(
4376 __isl_take isl_union_map *umap);
4378 These functions compute a single basic set or relation
4379 that contains the whole input set or relation.
4380 In particular, the output is described by translates
4381 of the constraints describing the basic sets or relations in the input.
4382 In case of C<isl_set_unshifted_simple_hull>, only the original
4383 constraints are used, without any translation.
4384 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4385 C<isl_map_unshifted_simple_hull_from_map_list>, the
4386 constraints are taken from the elements of the second argument.
4390 (See \autoref{s:simple hull}.)
4396 __isl_give isl_basic_set *isl_basic_set_affine_hull(
4397 __isl_take isl_basic_set *bset);
4398 __isl_give isl_basic_set *isl_set_affine_hull(
4399 __isl_take isl_set *set);
4400 __isl_give isl_union_set *isl_union_set_affine_hull(
4401 __isl_take isl_union_set *uset);
4402 __isl_give isl_basic_map *isl_basic_map_affine_hull(
4403 __isl_take isl_basic_map *bmap);
4404 __isl_give isl_basic_map *isl_map_affine_hull(
4405 __isl_take isl_map *map);
4406 __isl_give isl_union_map *isl_union_map_affine_hull(
4407 __isl_take isl_union_map *umap);
4409 In case of union sets and relations, the affine hull is computed
4412 =item * Polyhedral hull
4414 __isl_give isl_basic_set *isl_set_polyhedral_hull(
4415 __isl_take isl_set *set);
4416 __isl_give isl_basic_map *isl_map_polyhedral_hull(
4417 __isl_take isl_map *map);
4418 __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4419 __isl_take isl_union_set *uset);
4420 __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4421 __isl_take isl_union_map *umap);
4423 These functions compute a single basic set or relation
4424 not involving any existentially quantified variables
4425 that contains the whole input set or relation.
4426 In case of union sets and relations, the polyhedral hull is computed
4429 =item * Other approximations
4431 #include <isl/set.h>
4432 __isl_give isl_basic_set *
4433 isl_basic_set_drop_constraints_involving_dims(
4434 __isl_take isl_basic_set *bset,
4435 enum isl_dim_type type,
4436 unsigned first, unsigned n);
4437 __isl_give isl_basic_set *
4438 isl_basic_set_drop_constraints_not_involving_dims(
4439 __isl_take isl_basic_set *bset,
4440 enum isl_dim_type type,
4441 unsigned first, unsigned n);
4442 __isl_give isl_set *
4443 isl_set_drop_constraints_involving_dims(
4444 __isl_take isl_set *set,
4445 enum isl_dim_type type,
4446 unsigned first, unsigned n);
4448 #include <isl/map.h>
4449 __isl_give isl_basic_map *
4450 isl_basic_map_drop_constraints_involving_dims(
4451 __isl_take isl_basic_map *bmap,
4452 enum isl_dim_type type,
4453 unsigned first, unsigned n);
4454 __isl_give isl_map *
4455 isl_map_drop_constraints_involving_dims(
4456 __isl_take isl_map *map,
4457 enum isl_dim_type type,
4458 unsigned first, unsigned n);
4460 These functions drop any constraints (not) involving the specified dimensions.
4461 Note that the result depends on the representation of the input.
4463 #include <isl/polynomial.h>
4464 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4465 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4466 __isl_give isl_union_pw_qpolynomial *
4467 isl_union_pw_qpolynomial_to_polynomial(
4468 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4470 Approximate each quasipolynomial by a polynomial. If C<sign> is positive,
4471 the polynomial will be an overapproximation. If C<sign> is negative,
4472 it will be an underapproximation. If C<sign> is zero, the approximation
4473 will lie somewhere in between.
4477 __isl_give isl_basic_set *isl_basic_set_sample(
4478 __isl_take isl_basic_set *bset);
4479 __isl_give isl_basic_set *isl_set_sample(
4480 __isl_take isl_set *set);
4481 __isl_give isl_basic_map *isl_basic_map_sample(
4482 __isl_take isl_basic_map *bmap);
4483 __isl_give isl_basic_map *isl_map_sample(
4484 __isl_take isl_map *map);
4486 If the input (basic) set or relation is non-empty, then return
4487 a singleton subset of the input. Otherwise, return an empty set.
4489 =item * Optimization
4491 #include <isl/ilp.h>
4492 __isl_give isl_val *isl_basic_set_max_val(
4493 __isl_keep isl_basic_set *bset,
4494 __isl_keep isl_aff *obj);
4495 __isl_give isl_val *isl_set_min_val(
4496 __isl_keep isl_set *set,
4497 __isl_keep isl_aff *obj);
4498 __isl_give isl_val *isl_set_max_val(
4499 __isl_keep isl_set *set,
4500 __isl_keep isl_aff *obj);
4502 Compute the minimum or maximum of the integer affine expression C<obj>
4503 over the points in C<set>, returning the result in C<opt>.
4504 The result is C<NULL> in case of an error, the optimal value in case
4505 there is one, negative infinity or infinity if the problem is unbounded and
4506 NaN if the problem is empty.
4508 =item * Parametric optimization
4510 __isl_give isl_pw_aff *isl_set_dim_min(
4511 __isl_take isl_set *set, int pos);
4512 __isl_give isl_pw_aff *isl_set_dim_max(
4513 __isl_take isl_set *set, int pos);
4514 __isl_give isl_pw_aff *isl_map_dim_max(
4515 __isl_take isl_map *map, int pos);
4517 Compute the minimum or maximum of the given set or output dimension
4518 as a function of the parameters (and input dimensions), but independently
4519 of the other set or output dimensions.
4520 For lexicographic optimization, see L<"Lexicographic Optimization">.
4524 The following functions compute either the set of (rational) coefficient
4525 values of valid constraints for the given set or the set of (rational)
4526 values satisfying the constraints with coefficients from the given set.
4527 Internally, these two sets of functions perform essentially the
4528 same operations, except that the set of coefficients is assumed to
4529 be a cone, while the set of values may be any polyhedron.
4530 The current implementation is based on the Farkas lemma and
4531 Fourier-Motzkin elimination, but this may change or be made optional
4532 in future. In particular, future implementations may use different
4533 dualization algorithms or skip the elimination step.
4535 __isl_give isl_basic_set *isl_basic_set_coefficients(
4536 __isl_take isl_basic_set *bset);
4537 __isl_give isl_basic_set *isl_set_coefficients(
4538 __isl_take isl_set *set);
4539 __isl_give isl_union_set *isl_union_set_coefficients(
4540 __isl_take isl_union_set *bset);
4541 __isl_give isl_basic_set *isl_basic_set_solutions(
4542 __isl_take isl_basic_set *bset);
4543 __isl_give isl_basic_set *isl_set_solutions(
4544 __isl_take isl_set *set);
4545 __isl_give isl_union_set *isl_union_set_solutions(
4546 __isl_take isl_union_set *bset);
4550 __isl_give isl_map *isl_map_fixed_power_val(
4551 __isl_take isl_map *map,
4552 __isl_take isl_val *exp);
4553 __isl_give isl_union_map *
4554 isl_union_map_fixed_power_val(
4555 __isl_take isl_union_map *umap,
4556 __isl_take isl_val *exp);
4558 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4559 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4560 of C<map> is computed.
4562 __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4564 __isl_give isl_union_map *isl_union_map_power(
4565 __isl_take isl_union_map *umap, int *exact);
4567 Compute a parametric representation for all positive powers I<k> of C<map>.
4568 The result maps I<k> to a nested relation corresponding to the
4569 I<k>th power of C<map>.
4570 The result may be an overapproximation. If the result is known to be exact,
4571 then C<*exact> is set to C<1>.
4573 =item * Transitive closure
4575 __isl_give isl_map *isl_map_transitive_closure(
4576 __isl_take isl_map *map, int *exact);
4577 __isl_give isl_union_map *isl_union_map_transitive_closure(
4578 __isl_take isl_union_map *umap, int *exact);
4580 Compute the transitive closure of C<map>.
4581 The result may be an overapproximation. If the result is known to be exact,
4582 then C<*exact> is set to C<1>.
4584 =item * Reaching path lengths
4586 __isl_give isl_map *isl_map_reaching_path_lengths(
4587 __isl_take isl_map *map, int *exact);
4589 Compute a relation that maps each element in the range of C<map>
4590 to the lengths of all paths composed of edges in C<map> that
4591 end up in the given element.
4592 The result may be an overapproximation. If the result is known to be exact,
4593 then C<*exact> is set to C<1>.
4594 To compute the I<maximal> path length, the resulting relation
4595 should be postprocessed by C<isl_map_lexmax>.
4596 In particular, if the input relation is a dependence relation
4597 (mapping sources to sinks), then the maximal path length corresponds
4598 to the free schedule.
4599 Note, however, that C<isl_map_lexmax> expects the maximum to be
4600 finite, so if the path lengths are unbounded (possibly due to
4601 the overapproximation), then you will get an error message.
4605 #include <isl/space.h>
4606 __isl_give isl_space *isl_space_wrap(
4607 __isl_take isl_space *space);
4608 __isl_give isl_space *isl_space_unwrap(
4609 __isl_take isl_space *space);
4611 #include <isl/local_space.h>
4612 __isl_give isl_local_space *isl_local_space_wrap(
4613 __isl_take isl_local_space *ls);
4615 #include <isl/set.h>
4616 __isl_give isl_basic_map *isl_basic_set_unwrap(
4617 __isl_take isl_basic_set *bset);
4618 __isl_give isl_map *isl_set_unwrap(
4619 __isl_take isl_set *set);
4621 #include <isl/map.h>
4622 __isl_give isl_basic_set *isl_basic_map_wrap(
4623 __isl_take isl_basic_map *bmap);
4624 __isl_give isl_set *isl_map_wrap(
4625 __isl_take isl_map *map);
4627 #include <isl/union_set.h>
4628 __isl_give isl_union_map *isl_union_set_unwrap(
4629 __isl_take isl_union_set *uset);
4631 #include <isl/union_map.h>
4632 __isl_give isl_union_set *isl_union_map_wrap(
4633 __isl_take isl_union_map *umap);
4635 The input to C<isl_space_unwrap> should
4636 be the space of a set, while that of
4637 C<isl_space_wrap> should be the space of a relation.
4638 Conversely, the output of C<isl_space_unwrap> is the space
4639 of a relation, while that of C<isl_space_wrap> is the space of a set.
4643 Remove any internal structure of domain (and range) of the given
4644 set or relation. If there is any such internal structure in the input,
4645 then the name of the space is also removed.
4647 #include <isl/local_space.h>
4648 __isl_give isl_local_space *
4649 isl_local_space_flatten_domain(
4650 __isl_take isl_local_space *ls);
4651 __isl_give isl_local_space *
4652 isl_local_space_flatten_range(
4653 __isl_take isl_local_space *ls);
4655 #include <isl/set.h>
4656 __isl_give isl_basic_set *isl_basic_set_flatten(
4657 __isl_take isl_basic_set *bset);
4658 __isl_give isl_set *isl_set_flatten(
4659 __isl_take isl_set *set);
4661 #include <isl/map.h>
4662 __isl_give isl_basic_map *isl_basic_map_flatten_domain(
4663 __isl_take isl_basic_map *bmap);
4664 __isl_give isl_basic_map *isl_basic_map_flatten_range(
4665 __isl_take isl_basic_map *bmap);
4666 __isl_give isl_map *isl_map_flatten_range(
4667 __isl_take isl_map *map);
4668 __isl_give isl_map *isl_map_flatten_domain(
4669 __isl_take isl_map *map);
4670 __isl_give isl_basic_map *isl_basic_map_flatten(
4671 __isl_take isl_basic_map *bmap);
4672 __isl_give isl_map *isl_map_flatten(
4673 __isl_take isl_map *map);
4675 #include <isl/val.h>
4676 __isl_give isl_multi_val *isl_multi_val_flatten_range(
4677 __isl_take isl_multi_val *mv);
4679 #include <isl/aff.h>
4680 __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
4681 __isl_take isl_multi_aff *ma);
4682 __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
4683 __isl_take isl_multi_aff *ma);
4684 __isl_give isl_multi_pw_aff *
4685 isl_multi_pw_aff_flatten_range(
4686 __isl_take isl_multi_pw_aff *mpa);
4688 #include <isl/map.h>
4689 __isl_give isl_map *isl_set_flatten_map(
4690 __isl_take isl_set *set);
4692 The function above constructs a relation
4693 that maps the input set to a flattened version of the set.
4697 Lift the input set to a space with extra dimensions corresponding
4698 to the existentially quantified variables in the input.
4699 In particular, the result lives in a wrapped map where the domain
4700 is the original space and the range corresponds to the original
4701 existentially quantified variables.
4703 #include <isl/set.h>
4704 __isl_give isl_basic_set *isl_basic_set_lift(
4705 __isl_take isl_basic_set *bset);
4706 __isl_give isl_set *isl_set_lift(
4707 __isl_take isl_set *set);
4708 __isl_give isl_union_set *isl_union_set_lift(
4709 __isl_take isl_union_set *uset);
4711 Given a local space that contains the existentially quantified
4712 variables of a set, a basic relation that, when applied to
4713 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
4714 can be constructed using the following function.
4716 #include <isl/local_space.h>
4717 __isl_give isl_basic_map *isl_local_space_lifting(
4718 __isl_take isl_local_space *ls);
4720 #include <isl/aff.h>
4721 __isl_give isl_multi_aff *isl_multi_aff_lift(
4722 __isl_take isl_multi_aff *maff,
4723 __isl_give isl_local_space **ls);
4725 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
4726 then it is assigned the local space that lies at the basis of
4727 the lifting applied.
4729 =item * Internal Product
4731 #include <isl/space.h>
4732 __isl_give isl_space *isl_space_zip(
4733 __isl_take isl_space *space);
4735 #include <isl/map.h>
4736 __isl_give isl_basic_map *isl_basic_map_zip(
4737 __isl_take isl_basic_map *bmap);
4738 __isl_give isl_map *isl_map_zip(
4739 __isl_take isl_map *map);
4741 #include <isl/union_map.h>
4742 __isl_give isl_union_map *isl_union_map_zip(
4743 __isl_take isl_union_map *umap);
4745 Given a relation with nested relations for domain and range,
4746 interchange the range of the domain with the domain of the range.
4750 #include <isl/space.h>
4751 __isl_give isl_space *isl_space_curry(
4752 __isl_take isl_space *space);
4753 __isl_give isl_space *isl_space_uncurry(
4754 __isl_take isl_space *space);
4756 #include <isl/map.h>
4757 __isl_give isl_basic_map *isl_basic_map_curry(
4758 __isl_take isl_basic_map *bmap);
4759 __isl_give isl_basic_map *isl_basic_map_uncurry(
4760 __isl_take isl_basic_map *bmap);
4761 __isl_give isl_map *isl_map_curry(
4762 __isl_take isl_map *map);
4763 __isl_give isl_map *isl_map_uncurry(
4764 __isl_take isl_map *map);
4766 #include <isl/union_map.h>
4767 __isl_give isl_union_map *isl_union_map_curry(
4768 __isl_take isl_union_map *umap);
4769 __isl_give isl_union_map *isl_union_map_uncurry(
4770 __isl_take isl_union_map *umap);
4772 Given a relation with a nested relation for domain,
4773 the C<curry> functions
4774 move the range of the nested relation out of the domain
4775 and use it as the domain of a nested relation in the range,
4776 with the original range as range of this nested relation.
4777 The C<uncurry> functions perform the inverse operation.
4779 =item * Aligning parameters
4781 Change the order of the parameters of the given set, relation
4783 such that the first parameters match those of C<model>.
4784 This may involve the introduction of extra parameters.
4785 All parameters need to be named.
4787 #include <isl/space.h>
4788 __isl_give isl_space *isl_space_align_params(
4789 __isl_take isl_space *space1,
4790 __isl_take isl_space *space2)
4792 #include <isl/set.h>
4793 __isl_give isl_basic_set *isl_basic_set_align_params(
4794 __isl_take isl_basic_set *bset,
4795 __isl_take isl_space *model);
4796 __isl_give isl_set *isl_set_align_params(
4797 __isl_take isl_set *set,
4798 __isl_take isl_space *model);
4800 #include <isl/map.h>
4801 __isl_give isl_basic_map *isl_basic_map_align_params(
4802 __isl_take isl_basic_map *bmap,
4803 __isl_take isl_space *model);
4804 __isl_give isl_map *isl_map_align_params(
4805 __isl_take isl_map *map,
4806 __isl_take isl_space *model);
4808 #include <isl/val.h>
4809 __isl_give isl_multi_val *isl_multi_val_align_params(
4810 __isl_take isl_multi_val *mv,
4811 __isl_take isl_space *model);
4813 #include <isl/aff.h>
4814 __isl_give isl_aff *isl_aff_align_params(
4815 __isl_take isl_aff *aff,
4816 __isl_take isl_space *model);
4817 __isl_give isl_multi_aff *isl_multi_aff_align_params(
4818 __isl_take isl_multi_aff *multi,
4819 __isl_take isl_space *model);
4820 __isl_give isl_pw_aff *isl_pw_aff_align_params(
4821 __isl_take isl_pw_aff *pwaff,
4822 __isl_take isl_space *model);
4823 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
4824 __isl_take isl_pw_multi_aff *pma,
4825 __isl_take isl_space *model);
4826 __isl_give isl_union_pw_aff *
4827 isl_union_pw_aff_align_params(
4828 __isl_take isl_union_pw_aff *upa,
4829 __isl_take isl_space *model);
4830 __isl_give isl_union_pw_multi_aff *
4831 isl_union_pw_multi_aff_align_params(
4832 __isl_take isl_union_pw_multi_aff *upma,
4833 __isl_take isl_space *model);
4835 #include <isl/polynomial.h>
4836 __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
4837 __isl_take isl_qpolynomial *qp,
4838 __isl_take isl_space *model);
4840 =item * Unary Arithmethic Operations
4842 #include <isl/val.h>
4843 __isl_give isl_multi_val *isl_multi_val_neg(
4844 __isl_take isl_multi_val *mv);
4846 #include <isl/aff.h>
4847 __isl_give isl_aff *isl_aff_neg(
4848 __isl_take isl_aff *aff);
4849 __isl_give isl_multi_aff *isl_multi_aff_neg(
4850 __isl_take isl_multi_aff *ma);
4851 __isl_give isl_pw_aff *isl_pw_aff_neg(
4852 __isl_take isl_pw_aff *pwaff);
4853 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
4854 __isl_take isl_pw_multi_aff *pma);
4855 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
4856 __isl_take isl_multi_pw_aff *mpa);
4857 __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
4858 __isl_take isl_union_pw_aff *upa);
4859 __isl_give isl_union_pw_multi_aff *
4860 isl_union_pw_multi_aff_neg(
4861 __isl_take isl_union_pw_multi_aff *upma);
4862 __isl_give isl_aff *isl_aff_ceil(
4863 __isl_take isl_aff *aff);
4864 __isl_give isl_pw_aff *isl_pw_aff_ceil(
4865 __isl_take isl_pw_aff *pwaff);
4866 __isl_give isl_aff *isl_aff_floor(
4867 __isl_take isl_aff *aff);
4868 __isl_give isl_multi_aff *isl_multi_aff_floor(
4869 __isl_take isl_multi_aff *ma);
4870 __isl_give isl_pw_aff *isl_pw_aff_floor(
4871 __isl_take isl_pw_aff *pwaff);
4872 __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
4873 __isl_take isl_union_pw_aff *upa);
4875 #include <isl/aff.h>
4876 __isl_give isl_pw_aff *isl_pw_aff_list_min(
4877 __isl_take isl_pw_aff_list *list);
4878 __isl_give isl_pw_aff *isl_pw_aff_list_max(
4879 __isl_take isl_pw_aff_list *list);
4881 #include <isl/polynomial.h>
4882 __isl_give isl_qpolynomial *isl_qpolynomial_neg(
4883 __isl_take isl_qpolynomial *qp);
4884 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
4885 __isl_take isl_pw_qpolynomial *pwqp);
4886 __isl_give isl_union_pw_qpolynomial *
4887 isl_union_pw_qpolynomial_neg(
4888 __isl_take isl_union_pw_qpolynomial *upwqp);
4889 __isl_give isl_qpolynomial *isl_qpolynomial_pow(
4890 __isl_take isl_qpolynomial *qp,
4892 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
4893 __isl_take isl_pw_qpolynomial *pwqp,
4898 The following functions evaluate a function in a point.
4900 #include <isl/polynomial.h>
4901 __isl_give isl_val *isl_pw_qpolynomial_eval(
4902 __isl_take isl_pw_qpolynomial *pwqp,
4903 __isl_take isl_point *pnt);
4904 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
4905 __isl_take isl_pw_qpolynomial_fold *pwf,
4906 __isl_take isl_point *pnt);
4907 __isl_give isl_val *isl_union_pw_qpolynomial_eval(
4908 __isl_take isl_union_pw_qpolynomial *upwqp,
4909 __isl_take isl_point *pnt);
4910 __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
4911 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4912 __isl_take isl_point *pnt);
4914 =item * Dimension manipulation
4916 It is usually not advisable to directly change the (input or output)
4917 space of a set or a relation as this removes the name and the internal
4918 structure of the space. However, the functions below can be useful
4919 to add new parameters, assuming
4920 C<isl_set_align_params> and C<isl_map_align_params>
4923 #include <isl/space.h>
4924 __isl_give isl_space *isl_space_add_dims(
4925 __isl_take isl_space *space,
4926 enum isl_dim_type type, unsigned n);
4927 __isl_give isl_space *isl_space_insert_dims(
4928 __isl_take isl_space *space,
4929 enum isl_dim_type type, unsigned pos, unsigned n);
4930 __isl_give isl_space *isl_space_drop_dims(
4931 __isl_take isl_space *space,
4932 enum isl_dim_type type, unsigned first, unsigned n);
4933 __isl_give isl_space *isl_space_move_dims(
4934 __isl_take isl_space *space,
4935 enum isl_dim_type dst_type, unsigned dst_pos,
4936 enum isl_dim_type src_type, unsigned src_pos,
4939 #include <isl/local_space.h>
4940 __isl_give isl_local_space *isl_local_space_add_dims(
4941 __isl_take isl_local_space *ls,
4942 enum isl_dim_type type, unsigned n);
4943 __isl_give isl_local_space *isl_local_space_insert_dims(
4944 __isl_take isl_local_space *ls,
4945 enum isl_dim_type type, unsigned first, unsigned n);
4946 __isl_give isl_local_space *isl_local_space_drop_dims(
4947 __isl_take isl_local_space *ls,
4948 enum isl_dim_type type, unsigned first, unsigned n);
4950 #include <isl/set.h>
4951 __isl_give isl_basic_set *isl_basic_set_add_dims(
4952 __isl_take isl_basic_set *bset,
4953 enum isl_dim_type type, unsigned n);
4954 __isl_give isl_set *isl_set_add_dims(
4955 __isl_take isl_set *set,
4956 enum isl_dim_type type, unsigned n);
4957 __isl_give isl_basic_set *isl_basic_set_insert_dims(
4958 __isl_take isl_basic_set *bset,
4959 enum isl_dim_type type, unsigned pos,
4961 __isl_give isl_set *isl_set_insert_dims(
4962 __isl_take isl_set *set,
4963 enum isl_dim_type type, unsigned pos, unsigned n);
4964 __isl_give isl_basic_set *isl_basic_set_move_dims(
4965 __isl_take isl_basic_set *bset,
4966 enum isl_dim_type dst_type, unsigned dst_pos,
4967 enum isl_dim_type src_type, unsigned src_pos,
4969 __isl_give isl_set *isl_set_move_dims(
4970 __isl_take isl_set *set,
4971 enum isl_dim_type dst_type, unsigned dst_pos,
4972 enum isl_dim_type src_type, unsigned src_pos,
4975 #include <isl/map.h>
4976 __isl_give isl_map *isl_map_add_dims(
4977 __isl_take isl_map *map,
4978 enum isl_dim_type type, unsigned n);
4979 __isl_give isl_basic_map *isl_basic_map_insert_dims(
4980 __isl_take isl_basic_map *bmap,
4981 enum isl_dim_type type, unsigned pos,
4983 __isl_give isl_map *isl_map_insert_dims(
4984 __isl_take isl_map *map,
4985 enum isl_dim_type type, unsigned pos, unsigned n);
4986 __isl_give isl_basic_map *isl_basic_map_move_dims(
4987 __isl_take isl_basic_map *bmap,
4988 enum isl_dim_type dst_type, unsigned dst_pos,
4989 enum isl_dim_type src_type, unsigned src_pos,
4991 __isl_give isl_map *isl_map_move_dims(
4992 __isl_take isl_map *map,
4993 enum isl_dim_type dst_type, unsigned dst_pos,
4994 enum isl_dim_type src_type, unsigned src_pos,
4997 #include <isl/val.h>
4998 __isl_give isl_multi_val *isl_multi_val_insert_dims(
4999 __isl_take isl_multi_val *mv,
5000 enum isl_dim_type type, unsigned first, unsigned n);
5001 __isl_give isl_multi_val *isl_multi_val_add_dims(
5002 __isl_take isl_multi_val *mv,
5003 enum isl_dim_type type, unsigned n);
5004 __isl_give isl_multi_val *isl_multi_val_drop_dims(
5005 __isl_take isl_multi_val *mv,
5006 enum isl_dim_type type, unsigned first, unsigned n);
5008 #include <isl/aff.h>
5009 __isl_give isl_aff *isl_aff_insert_dims(
5010 __isl_take isl_aff *aff,
5011 enum isl_dim_type type, unsigned first, unsigned n);
5012 __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5013 __isl_take isl_multi_aff *ma,
5014 enum isl_dim_type type, unsigned first, unsigned n);
5015 __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5016 __isl_take isl_pw_aff *pwaff,
5017 enum isl_dim_type type, unsigned first, unsigned n);
5018 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5019 __isl_take isl_multi_pw_aff *mpa,
5020 enum isl_dim_type type, unsigned first, unsigned n);
5021 __isl_give isl_aff *isl_aff_add_dims(
5022 __isl_take isl_aff *aff,
5023 enum isl_dim_type type, unsigned n);
5024 __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5025 __isl_take isl_multi_aff *ma,
5026 enum isl_dim_type type, unsigned n);
5027 __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5028 __isl_take isl_pw_aff *pwaff,
5029 enum isl_dim_type type, unsigned n);
5030 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5031 __isl_take isl_multi_pw_aff *mpa,
5032 enum isl_dim_type type, unsigned n);
5033 __isl_give isl_aff *isl_aff_drop_dims(
5034 __isl_take isl_aff *aff,
5035 enum isl_dim_type type, unsigned first, unsigned n);
5036 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5037 __isl_take isl_multi_aff *maff,
5038 enum isl_dim_type type, unsigned first, unsigned n);
5039 __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5040 __isl_take isl_pw_aff *pwaff,
5041 enum isl_dim_type type, unsigned first, unsigned n);
5042 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5043 __isl_take isl_pw_multi_aff *pma,
5044 enum isl_dim_type type, unsigned first, unsigned n);
5045 __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5046 __isl_take isl_union_pw_aff *upa,
5047 enum isl_dim_type type, unsigned first, unsigned n);
5048 __isl_give isl_union_pw_multi_aff *
5049 isl_union_pw_multi_aff_drop_dims(
5050 __isl_take isl_union_pw_multi_aff *upma,
5051 enum isl_dim_type type,
5052 unsigned first, unsigned n);
5053 __isl_give isl_aff *isl_aff_move_dims(
5054 __isl_take isl_aff *aff,
5055 enum isl_dim_type dst_type, unsigned dst_pos,
5056 enum isl_dim_type src_type, unsigned src_pos,
5058 __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5059 __isl_take isl_multi_aff *ma,
5060 enum isl_dim_type dst_type, unsigned dst_pos,
5061 enum isl_dim_type src_type, unsigned src_pos,
5063 __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5064 __isl_take isl_pw_aff *pa,
5065 enum isl_dim_type dst_type, unsigned dst_pos,
5066 enum isl_dim_type src_type, unsigned src_pos,
5068 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5069 __isl_take isl_multi_pw_aff *pma,
5070 enum isl_dim_type dst_type, unsigned dst_pos,
5071 enum isl_dim_type src_type, unsigned src_pos,
5074 #include <isl/polynomial.h>
5075 __isl_give isl_union_pw_qpolynomial *
5076 isl_union_pw_qpolynomial_drop_dims(
5077 __isl_take isl_union_pw_qpolynomial *upwqp,
5078 enum isl_dim_type type,
5079 unsigned first, unsigned n);
5080 __isl_give isl_union_pw_qpolynomial_fold *
5081 isl_union_pw_qpolynomial_fold_drop_dims(
5082 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5083 enum isl_dim_type type,
5084 unsigned first, unsigned n);
5086 The operations on union expressions can only manipulate parameters.
5090 =head2 Binary Operations
5092 The two arguments of a binary operation not only need to live
5093 in the same C<isl_ctx>, they currently also need to have
5094 the same (number of) parameters.
5096 =head3 Basic Operations
5100 =item * Intersection
5102 #include <isl/local_space.h>
5103 __isl_give isl_local_space *isl_local_space_intersect(
5104 __isl_take isl_local_space *ls1,
5105 __isl_take isl_local_space *ls2);
5107 #include <isl/set.h>
5108 __isl_give isl_basic_set *isl_basic_set_intersect_params(
5109 __isl_take isl_basic_set *bset1,
5110 __isl_take isl_basic_set *bset2);
5111 __isl_give isl_basic_set *isl_basic_set_intersect(
5112 __isl_take isl_basic_set *bset1,
5113 __isl_take isl_basic_set *bset2);
5114 __isl_give isl_basic_set *isl_basic_set_list_intersect(
5115 __isl_take struct isl_basic_set_list *list);
5116 __isl_give isl_set *isl_set_intersect_params(
5117 __isl_take isl_set *set,
5118 __isl_take isl_set *params);
5119 __isl_give isl_set *isl_set_intersect(
5120 __isl_take isl_set *set1,
5121 __isl_take isl_set *set2);
5123 #include <isl/map.h>
5124 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5125 __isl_take isl_basic_map *bmap,
5126 __isl_take isl_basic_set *bset);
5127 __isl_give isl_basic_map *isl_basic_map_intersect_range(
5128 __isl_take isl_basic_map *bmap,
5129 __isl_take isl_basic_set *bset);
5130 __isl_give isl_basic_map *isl_basic_map_intersect(
5131 __isl_take isl_basic_map *bmap1,
5132 __isl_take isl_basic_map *bmap2);
5133 __isl_give isl_basic_map *isl_basic_map_list_intersect(
5134 __isl_take isl_basic_map_list *list);
5135 __isl_give isl_map *isl_map_intersect_params(
5136 __isl_take isl_map *map,
5137 __isl_take isl_set *params);
5138 __isl_give isl_map *isl_map_intersect_domain(
5139 __isl_take isl_map *map,
5140 __isl_take isl_set *set);
5141 __isl_give isl_map *isl_map_intersect_range(
5142 __isl_take isl_map *map,
5143 __isl_take isl_set *set);
5144 __isl_give isl_map *isl_map_intersect(
5145 __isl_take isl_map *map1,
5146 __isl_take isl_map *map2);
5148 #include <isl/union_set.h>
5149 __isl_give isl_union_set *isl_union_set_intersect_params(
5150 __isl_take isl_union_set *uset,
5151 __isl_take isl_set *set);
5152 __isl_give isl_union_set *isl_union_set_intersect(
5153 __isl_take isl_union_set *uset1,
5154 __isl_take isl_union_set *uset2);
5156 #include <isl/union_map.h>
5157 __isl_give isl_union_map *isl_union_map_intersect_params(
5158 __isl_take isl_union_map *umap,
5159 __isl_take isl_set *set);
5160 __isl_give isl_union_map *isl_union_map_intersect_domain(
5161 __isl_take isl_union_map *umap,
5162 __isl_take isl_union_set *uset);
5163 __isl_give isl_union_map *isl_union_map_intersect_range(
5164 __isl_take isl_union_map *umap,
5165 __isl_take isl_union_set *uset);
5166 __isl_give isl_union_map *isl_union_map_intersect(
5167 __isl_take isl_union_map *umap1,
5168 __isl_take isl_union_map *umap2);
5170 #include <isl/aff.h>
5171 __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5172 __isl_take isl_pw_aff *pa,
5173 __isl_take isl_set *set);
5174 __isl_give isl_multi_pw_aff *
5175 isl_multi_pw_aff_intersect_domain(
5176 __isl_take isl_multi_pw_aff *mpa,
5177 __isl_take isl_set *domain);
5178 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5179 __isl_take isl_pw_multi_aff *pma,
5180 __isl_take isl_set *set);
5181 __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5182 __isl_take isl_union_pw_aff *upa,
5183 __isl_take isl_union_set *uset);
5184 __isl_give isl_union_pw_multi_aff *
5185 isl_union_pw_multi_aff_intersect_domain(
5186 __isl_take isl_union_pw_multi_aff *upma,
5187 __isl_take isl_union_set *uset);
5188 __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5189 __isl_take isl_pw_aff *pa,
5190 __isl_take isl_set *set);
5191 __isl_give isl_multi_pw_aff *
5192 isl_multi_pw_aff_intersect_params(
5193 __isl_take isl_multi_pw_aff *mpa,
5194 __isl_take isl_set *set);
5195 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5196 __isl_take isl_pw_multi_aff *pma,
5197 __isl_take isl_set *set);
5198 __isl_give isl_union_pw_aff *
5199 isl_union_pw_aff_intersect_params(
5200 __isl_take isl_union_pw_aff *upa,
5201 __isl_give isl_union_pw_multi_aff *
5202 isl_union_pw_multi_aff_intersect_params(
5203 __isl_take isl_union_pw_multi_aff *upma,
5204 __isl_take isl_set *set);
5206 #include <isl/polynomial.h>
5207 __isl_give isl_pw_qpolynomial *
5208 isl_pw_qpolynomial_intersect_domain(
5209 __isl_take isl_pw_qpolynomial *pwpq,
5210 __isl_take isl_set *set);
5211 __isl_give isl_union_pw_qpolynomial *
5212 isl_union_pw_qpolynomial_intersect_domain(
5213 __isl_take isl_union_pw_qpolynomial *upwpq,
5214 __isl_take isl_union_set *uset);
5215 __isl_give isl_union_pw_qpolynomial_fold *
5216 isl_union_pw_qpolynomial_fold_intersect_domain(
5217 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5218 __isl_take isl_union_set *uset);
5219 __isl_give isl_pw_qpolynomial *
5220 isl_pw_qpolynomial_intersect_params(
5221 __isl_take isl_pw_qpolynomial *pwpq,
5222 __isl_take isl_set *set);
5223 __isl_give isl_pw_qpolynomial_fold *
5224 isl_pw_qpolynomial_fold_intersect_params(
5225 __isl_take isl_pw_qpolynomial_fold *pwf,
5226 __isl_take isl_set *set);
5227 __isl_give isl_union_pw_qpolynomial *
5228 isl_union_pw_qpolynomial_intersect_params(
5229 __isl_take isl_union_pw_qpolynomial *upwpq,
5230 __isl_take isl_set *set);
5231 __isl_give isl_union_pw_qpolynomial_fold *
5232 isl_union_pw_qpolynomial_fold_intersect_params(
5233 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5234 __isl_take isl_set *set);
5236 The second argument to the C<_params> functions needs to be
5237 a parametric (basic) set. For the other functions, a parametric set
5238 for either argument is only allowed if the other argument is
5239 a parametric set as well.
5240 The list passed to C<isl_basic_set_list_intersect> needs to have
5241 at least one element and all elements need to live in the same space.
5245 #include <isl/set.h>
5246 __isl_give isl_set *isl_basic_set_union(
5247 __isl_take isl_basic_set *bset1,
5248 __isl_take isl_basic_set *bset2);
5249 __isl_give isl_set *isl_set_union(
5250 __isl_take isl_set *set1,
5251 __isl_take isl_set *set2);
5253 #include <isl/map.h>
5254 __isl_give isl_map *isl_basic_map_union(
5255 __isl_take isl_basic_map *bmap1,
5256 __isl_take isl_basic_map *bmap2);
5257 __isl_give isl_map *isl_map_union(
5258 __isl_take isl_map *map1,
5259 __isl_take isl_map *map2);
5261 #include <isl/union_set.h>
5262 __isl_give isl_union_set *isl_union_set_union(
5263 __isl_take isl_union_set *uset1,
5264 __isl_take isl_union_set *uset2);
5265 __isl_give isl_union_set *isl_union_set_list_union(
5266 __isl_take isl_union_set_list *list);
5268 #include <isl/union_map.h>
5269 __isl_give isl_union_map *isl_union_map_union(
5270 __isl_take isl_union_map *umap1,
5271 __isl_take isl_union_map *umap2);
5273 =item * Set difference
5275 #include <isl/set.h>
5276 __isl_give isl_set *isl_set_subtract(
5277 __isl_take isl_set *set1,
5278 __isl_take isl_set *set2);
5280 #include <isl/map.h>
5281 __isl_give isl_map *isl_map_subtract(
5282 __isl_take isl_map *map1,
5283 __isl_take isl_map *map2);
5284 __isl_give isl_map *isl_map_subtract_domain(
5285 __isl_take isl_map *map,
5286 __isl_take isl_set *dom);
5287 __isl_give isl_map *isl_map_subtract_range(
5288 __isl_take isl_map *map,
5289 __isl_take isl_set *dom);
5291 #include <isl/union_set.h>
5292 __isl_give isl_union_set *isl_union_set_subtract(
5293 __isl_take isl_union_set *uset1,
5294 __isl_take isl_union_set *uset2);
5296 #include <isl/union_map.h>
5297 __isl_give isl_union_map *isl_union_map_subtract(
5298 __isl_take isl_union_map *umap1,
5299 __isl_take isl_union_map *umap2);
5300 __isl_give isl_union_map *isl_union_map_subtract_domain(
5301 __isl_take isl_union_map *umap,
5302 __isl_take isl_union_set *dom);
5303 __isl_give isl_union_map *isl_union_map_subtract_range(
5304 __isl_take isl_union_map *umap,
5305 __isl_take isl_union_set *dom);
5307 #include <isl/aff.h>
5308 __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5309 __isl_take isl_pw_aff *pa,
5310 __isl_take isl_set *set);
5311 __isl_give isl_pw_multi_aff *
5312 isl_pw_multi_aff_subtract_domain(
5313 __isl_take isl_pw_multi_aff *pma,
5314 __isl_take isl_set *set);
5315 __isl_give isl_union_pw_aff *
5316 isl_union_pw_aff_subtract_domain(
5317 __isl_take isl_union_pw_aff *upa,
5318 __isl_take isl_union_set *uset);
5319 __isl_give isl_union_pw_multi_aff *
5320 isl_union_pw_multi_aff_subtract_domain(
5321 __isl_take isl_union_pw_multi_aff *upma,
5322 __isl_take isl_set *set);
5324 #include <isl/polynomial.h>
5325 __isl_give isl_pw_qpolynomial *
5326 isl_pw_qpolynomial_subtract_domain(
5327 __isl_take isl_pw_qpolynomial *pwpq,
5328 __isl_take isl_set *set);
5329 __isl_give isl_pw_qpolynomial_fold *
5330 isl_pw_qpolynomial_fold_subtract_domain(
5331 __isl_take isl_pw_qpolynomial_fold *pwf,
5332 __isl_take isl_set *set);
5333 __isl_give isl_union_pw_qpolynomial *
5334 isl_union_pw_qpolynomial_subtract_domain(
5335 __isl_take isl_union_pw_qpolynomial *upwpq,
5336 __isl_take isl_union_set *uset);
5337 __isl_give isl_union_pw_qpolynomial_fold *
5338 isl_union_pw_qpolynomial_fold_subtract_domain(
5339 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5340 __isl_take isl_union_set *uset);
5344 #include <isl/space.h>
5345 __isl_give isl_space *isl_space_join(
5346 __isl_take isl_space *left,
5347 __isl_take isl_space *right);
5349 #include <isl/map.h>
5350 __isl_give isl_basic_set *isl_basic_set_apply(
5351 __isl_take isl_basic_set *bset,
5352 __isl_take isl_basic_map *bmap);
5353 __isl_give isl_set *isl_set_apply(
5354 __isl_take isl_set *set,
5355 __isl_take isl_map *map);
5356 __isl_give isl_union_set *isl_union_set_apply(
5357 __isl_take isl_union_set *uset,
5358 __isl_take isl_union_map *umap);
5359 __isl_give isl_basic_map *isl_basic_map_apply_domain(
5360 __isl_take isl_basic_map *bmap1,
5361 __isl_take isl_basic_map *bmap2);
5362 __isl_give isl_basic_map *isl_basic_map_apply_range(
5363 __isl_take isl_basic_map *bmap1,
5364 __isl_take isl_basic_map *bmap2);
5365 __isl_give isl_map *isl_map_apply_domain(
5366 __isl_take isl_map *map1,
5367 __isl_take isl_map *map2);
5368 __isl_give isl_map *isl_map_apply_range(
5369 __isl_take isl_map *map1,
5370 __isl_take isl_map *map2);
5372 #include <isl/union_map.h>
5373 __isl_give isl_union_map *isl_union_map_apply_domain(
5374 __isl_take isl_union_map *umap1,
5375 __isl_take isl_union_map *umap2);
5376 __isl_give isl_union_map *isl_union_map_apply_range(
5377 __isl_take isl_union_map *umap1,
5378 __isl_take isl_union_map *umap2);
5380 #include <isl/polynomial.h>
5381 __isl_give isl_pw_qpolynomial_fold *
5382 isl_set_apply_pw_qpolynomial_fold(
5383 __isl_take isl_set *set,
5384 __isl_take isl_pw_qpolynomial_fold *pwf,
5386 __isl_give isl_pw_qpolynomial_fold *
5387 isl_map_apply_pw_qpolynomial_fold(
5388 __isl_take isl_map *map,
5389 __isl_take isl_pw_qpolynomial_fold *pwf,
5391 __isl_give isl_union_pw_qpolynomial_fold *
5392 isl_union_set_apply_union_pw_qpolynomial_fold(
5393 __isl_take isl_union_set *uset,
5394 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5396 __isl_give isl_union_pw_qpolynomial_fold *
5397 isl_union_map_apply_union_pw_qpolynomial_fold(
5398 __isl_take isl_union_map *umap,
5399 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5402 The functions taking a map
5403 compose the given map with the given piecewise quasipolynomial reduction.
5404 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5405 over all elements in the intersection of the range of the map
5406 and the domain of the piecewise quasipolynomial reduction
5407 as a function of an element in the domain of the map.
5408 The functions taking a set compute a bound over all elements in the
5409 intersection of the set and the domain of the
5410 piecewise quasipolynomial reduction.
5414 #include <isl/set.h>
5415 __isl_give isl_basic_set *
5416 isl_basic_set_preimage_multi_aff(
5417 __isl_take isl_basic_set *bset,
5418 __isl_take isl_multi_aff *ma);
5419 __isl_give isl_set *isl_set_preimage_multi_aff(
5420 __isl_take isl_set *set,
5421 __isl_take isl_multi_aff *ma);
5422 __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5423 __isl_take isl_set *set,
5424 __isl_take isl_pw_multi_aff *pma);
5425 __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5426 __isl_take isl_set *set,
5427 __isl_take isl_multi_pw_aff *mpa);
5429 #include <isl/union_set.h>
5430 __isl_give isl_union_set *
5431 isl_union_set_preimage_multi_aff(
5432 __isl_take isl_union_set *uset,
5433 __isl_take isl_multi_aff *ma);
5434 __isl_give isl_union_set *
5435 isl_union_set_preimage_pw_multi_aff(
5436 __isl_take isl_union_set *uset,
5437 __isl_take isl_pw_multi_aff *pma);
5438 __isl_give isl_union_set *
5439 isl_union_set_preimage_union_pw_multi_aff(
5440 __isl_take isl_union_set *uset,
5441 __isl_take isl_union_pw_multi_aff *upma);
5443 #include <isl/map.h>
5444 __isl_give isl_basic_map *
5445 isl_basic_map_preimage_domain_multi_aff(
5446 __isl_take isl_basic_map *bmap,
5447 __isl_take isl_multi_aff *ma);
5448 __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5449 __isl_take isl_map *map,
5450 __isl_take isl_multi_aff *ma);
5451 __isl_give isl_map *isl_map_preimage_range_multi_aff(
5452 __isl_take isl_map *map,
5453 __isl_take isl_multi_aff *ma);
5454 __isl_give isl_map *
5455 isl_map_preimage_domain_pw_multi_aff(
5456 __isl_take isl_map *map,
5457 __isl_take isl_pw_multi_aff *pma);
5458 __isl_give isl_map *
5459 isl_map_preimage_range_pw_multi_aff(
5460 __isl_take isl_map *map,
5461 __isl_take isl_pw_multi_aff *pma);
5462 __isl_give isl_map *
5463 isl_map_preimage_domain_multi_pw_aff(
5464 __isl_take isl_map *map,
5465 __isl_take isl_multi_pw_aff *mpa);
5466 __isl_give isl_basic_map *
5467 isl_basic_map_preimage_range_multi_aff(
5468 __isl_take isl_basic_map *bmap,
5469 __isl_take isl_multi_aff *ma);
5471 #include <isl/union_map.h>
5472 __isl_give isl_union_map *
5473 isl_union_map_preimage_domain_multi_aff(
5474 __isl_take isl_union_map *umap,
5475 __isl_take isl_multi_aff *ma);
5476 __isl_give isl_union_map *
5477 isl_union_map_preimage_range_multi_aff(
5478 __isl_take isl_union_map *umap,
5479 __isl_take isl_multi_aff *ma);
5480 __isl_give isl_union_map *
5481 isl_union_map_preimage_domain_pw_multi_aff(
5482 __isl_take isl_union_map *umap,
5483 __isl_take isl_pw_multi_aff *pma);
5484 __isl_give isl_union_map *
5485 isl_union_map_preimage_range_pw_multi_aff(
5486 __isl_take isl_union_map *umap,
5487 __isl_take isl_pw_multi_aff *pma);
5488 __isl_give isl_union_map *
5489 isl_union_map_preimage_domain_union_pw_multi_aff(
5490 __isl_take isl_union_map *umap,
5491 __isl_take isl_union_pw_multi_aff *upma);
5492 __isl_give isl_union_map *
5493 isl_union_map_preimage_range_union_pw_multi_aff(
5494 __isl_take isl_union_map *umap,
5495 __isl_take isl_union_pw_multi_aff *upma);
5497 These functions compute the preimage of the given set or map domain/range under
5498 the given function. In other words, the expression is plugged
5499 into the set description or into the domain/range of the map.
5503 #include <isl/aff.h>
5504 __isl_give isl_aff *isl_aff_pullback_aff(
5505 __isl_take isl_aff *aff1,
5506 __isl_take isl_aff *aff2);
5507 __isl_give isl_aff *isl_aff_pullback_multi_aff(
5508 __isl_take isl_aff *aff,
5509 __isl_take isl_multi_aff *ma);
5510 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5511 __isl_take isl_pw_aff *pa,
5512 __isl_take isl_multi_aff *ma);
5513 __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5514 __isl_take isl_pw_aff *pa,
5515 __isl_take isl_pw_multi_aff *pma);
5516 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5517 __isl_take isl_pw_aff *pa,
5518 __isl_take isl_multi_pw_aff *mpa);
5519 __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5520 __isl_take isl_multi_aff *ma1,
5521 __isl_take isl_multi_aff *ma2);
5522 __isl_give isl_pw_multi_aff *
5523 isl_pw_multi_aff_pullback_multi_aff(
5524 __isl_take isl_pw_multi_aff *pma,
5525 __isl_take isl_multi_aff *ma);
5526 __isl_give isl_multi_pw_aff *
5527 isl_multi_pw_aff_pullback_multi_aff(
5528 __isl_take isl_multi_pw_aff *mpa,
5529 __isl_take isl_multi_aff *ma);
5530 __isl_give isl_pw_multi_aff *
5531 isl_pw_multi_aff_pullback_pw_multi_aff(
5532 __isl_take isl_pw_multi_aff *pma1,
5533 __isl_take isl_pw_multi_aff *pma2);
5534 __isl_give isl_multi_pw_aff *
5535 isl_multi_pw_aff_pullback_pw_multi_aff(
5536 __isl_take isl_multi_pw_aff *mpa,
5537 __isl_take isl_pw_multi_aff *pma);
5538 __isl_give isl_multi_pw_aff *
5539 isl_multi_pw_aff_pullback_multi_pw_aff(
5540 __isl_take isl_multi_pw_aff *mpa1,
5541 __isl_take isl_multi_pw_aff *mpa2);
5542 __isl_give isl_union_pw_aff *
5543 isl_union_pw_aff_pullback_union_pw_multi_aff(
5544 __isl_take isl_union_pw_aff *upa,
5545 __isl_take isl_union_pw_multi_aff *upma);
5546 __isl_give isl_union_pw_multi_aff *
5547 isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
5548 __isl_take isl_union_pw_multi_aff *upma1,
5549 __isl_take isl_union_pw_multi_aff *upma2);
5551 These functions precompose the first expression by the second function.
5552 In other words, the second function is plugged
5553 into the first expression.
5557 #include <isl/aff.h>
5558 __isl_give isl_basic_set *isl_aff_le_basic_set(
5559 __isl_take isl_aff *aff1,
5560 __isl_take isl_aff *aff2);
5561 __isl_give isl_basic_set *isl_aff_ge_basic_set(
5562 __isl_take isl_aff *aff1,
5563 __isl_take isl_aff *aff2);
5564 __isl_give isl_set *isl_pw_aff_eq_set(
5565 __isl_take isl_pw_aff *pwaff1,
5566 __isl_take isl_pw_aff *pwaff2);
5567 __isl_give isl_set *isl_pw_aff_ne_set(
5568 __isl_take isl_pw_aff *pwaff1,
5569 __isl_take isl_pw_aff *pwaff2);
5570 __isl_give isl_set *isl_pw_aff_le_set(
5571 __isl_take isl_pw_aff *pwaff1,
5572 __isl_take isl_pw_aff *pwaff2);
5573 __isl_give isl_set *isl_pw_aff_lt_set(
5574 __isl_take isl_pw_aff *pwaff1,
5575 __isl_take isl_pw_aff *pwaff2);
5576 __isl_give isl_set *isl_pw_aff_ge_set(
5577 __isl_take isl_pw_aff *pwaff1,
5578 __isl_take isl_pw_aff *pwaff2);
5579 __isl_give isl_set *isl_pw_aff_gt_set(
5580 __isl_take isl_pw_aff *pwaff1,
5581 __isl_take isl_pw_aff *pwaff2);
5583 __isl_give isl_set *isl_multi_aff_lex_le_set(
5584 __isl_take isl_multi_aff *ma1,
5585 __isl_take isl_multi_aff *ma2);
5586 __isl_give isl_set *isl_multi_aff_lex_ge_set(
5587 __isl_take isl_multi_aff *ma1,
5588 __isl_take isl_multi_aff *ma2);
5590 __isl_give isl_set *isl_pw_aff_list_eq_set(
5591 __isl_take isl_pw_aff_list *list1,
5592 __isl_take isl_pw_aff_list *list2);
5593 __isl_give isl_set *isl_pw_aff_list_ne_set(
5594 __isl_take isl_pw_aff_list *list1,
5595 __isl_take isl_pw_aff_list *list2);
5596 __isl_give isl_set *isl_pw_aff_list_le_set(
5597 __isl_take isl_pw_aff_list *list1,
5598 __isl_take isl_pw_aff_list *list2);
5599 __isl_give isl_set *isl_pw_aff_list_lt_set(
5600 __isl_take isl_pw_aff_list *list1,
5601 __isl_take isl_pw_aff_list *list2);
5602 __isl_give isl_set *isl_pw_aff_list_ge_set(
5603 __isl_take isl_pw_aff_list *list1,
5604 __isl_take isl_pw_aff_list *list2);
5605 __isl_give isl_set *isl_pw_aff_list_gt_set(
5606 __isl_take isl_pw_aff_list *list1,
5607 __isl_take isl_pw_aff_list *list2);
5609 The function C<isl_aff_ge_basic_set> returns a basic set
5610 containing those elements in the shared space
5611 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
5612 The function C<isl_pw_aff_ge_set> returns a set
5613 containing those elements in the shared domain
5614 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
5615 greater than or equal to C<pwaff2>.
5616 The function C<isl_multi_aff_lex_le_set> returns a set
5617 containing those elements in the shared domain space
5618 where C<ma1> is lexicographically smaller than or
5620 The functions operating on C<isl_pw_aff_list> apply the corresponding
5621 C<isl_pw_aff> function to each pair of elements in the two lists.
5623 =item * Cartesian Product
5625 #include <isl/space.h>
5626 __isl_give isl_space *isl_space_product(
5627 __isl_take isl_space *space1,
5628 __isl_take isl_space *space2);
5629 __isl_give isl_space *isl_space_domain_product(
5630 __isl_take isl_space *space1,
5631 __isl_take isl_space *space2);
5632 __isl_give isl_space *isl_space_range_product(
5633 __isl_take isl_space *space1,
5634 __isl_take isl_space *space2);
5637 C<isl_space_product>, C<isl_space_domain_product>
5638 and C<isl_space_range_product> take pairs or relation spaces and
5639 produce a single relations space, where either the domain, the range
5640 or both domain and range are wrapped spaces of relations between
5641 the domains and/or ranges of the input spaces.
5642 If the product is only constructed over the domain or the range
5643 then the ranges or the domains of the inputs should be the same.
5644 The function C<isl_space_product> also accepts a pair of set spaces,
5645 in which case it returns a wrapped space of a relation between the
5648 #include <isl/set.h>
5649 __isl_give isl_set *isl_set_product(
5650 __isl_take isl_set *set1,
5651 __isl_take isl_set *set2);
5653 #include <isl/map.h>
5654 __isl_give isl_basic_map *isl_basic_map_domain_product(
5655 __isl_take isl_basic_map *bmap1,
5656 __isl_take isl_basic_map *bmap2);
5657 __isl_give isl_basic_map *isl_basic_map_range_product(
5658 __isl_take isl_basic_map *bmap1,
5659 __isl_take isl_basic_map *bmap2);
5660 __isl_give isl_basic_map *isl_basic_map_product(
5661 __isl_take isl_basic_map *bmap1,
5662 __isl_take isl_basic_map *bmap2);
5663 __isl_give isl_map *isl_map_domain_product(
5664 __isl_take isl_map *map1,
5665 __isl_take isl_map *map2);
5666 __isl_give isl_map *isl_map_range_product(
5667 __isl_take isl_map *map1,
5668 __isl_take isl_map *map2);
5669 __isl_give isl_map *isl_map_product(
5670 __isl_take isl_map *map1,
5671 __isl_take isl_map *map2);
5673 #include <isl/union_set.h>
5674 __isl_give isl_union_set *isl_union_set_product(
5675 __isl_take isl_union_set *uset1,
5676 __isl_take isl_union_set *uset2);
5678 #include <isl/union_map.h>
5679 __isl_give isl_union_map *isl_union_map_domain_product(
5680 __isl_take isl_union_map *umap1,
5681 __isl_take isl_union_map *umap2);
5682 __isl_give isl_union_map *isl_union_map_range_product(
5683 __isl_take isl_union_map *umap1,
5684 __isl_take isl_union_map *umap2);
5685 __isl_give isl_union_map *isl_union_map_product(
5686 __isl_take isl_union_map *umap1,
5687 __isl_take isl_union_map *umap2);
5689 #include <isl/val.h>
5690 __isl_give isl_multi_val *isl_multi_val_range_product(
5691 __isl_take isl_multi_val *mv1,
5692 __isl_take isl_multi_val *mv2);
5693 __isl_give isl_multi_val *isl_multi_val_product(
5694 __isl_take isl_multi_val *mv1,
5695 __isl_take isl_multi_val *mv2);
5697 #include <isl/aff.h>
5698 __isl_give isl_multi_aff *isl_multi_aff_range_product(
5699 __isl_take isl_multi_aff *ma1,
5700 __isl_take isl_multi_aff *ma2);
5701 __isl_give isl_multi_aff *isl_multi_aff_product(
5702 __isl_take isl_multi_aff *ma1,
5703 __isl_take isl_multi_aff *ma2);
5704 __isl_give isl_multi_pw_aff *
5705 isl_multi_pw_aff_range_product(
5706 __isl_take isl_multi_pw_aff *mpa1,
5707 __isl_take isl_multi_pw_aff *mpa2);
5708 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
5709 __isl_take isl_multi_pw_aff *mpa1,
5710 __isl_take isl_multi_pw_aff *mpa2);
5711 __isl_give isl_pw_multi_aff *
5712 isl_pw_multi_aff_range_product(
5713 __isl_take isl_pw_multi_aff *pma1,
5714 __isl_take isl_pw_multi_aff *pma2);
5715 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
5716 __isl_take isl_pw_multi_aff *pma1,
5717 __isl_take isl_pw_multi_aff *pma2);
5719 The above functions compute the cross product of the given
5720 sets, relations or functions. The domains and ranges of the results
5721 are wrapped maps between domains and ranges of the inputs.
5722 To obtain a ``flat'' product, use the following functions
5725 #include <isl/set.h>
5726 __isl_give isl_basic_set *isl_basic_set_flat_product(
5727 __isl_take isl_basic_set *bset1,
5728 __isl_take isl_basic_set *bset2);
5729 __isl_give isl_set *isl_set_flat_product(
5730 __isl_take isl_set *set1,
5731 __isl_take isl_set *set2);
5733 #include <isl/map.h>
5734 __isl_give isl_basic_map *isl_basic_map_flat_range_product(
5735 __isl_take isl_basic_map *bmap1,
5736 __isl_take isl_basic_map *bmap2);
5737 __isl_give isl_map *isl_map_flat_domain_product(
5738 __isl_take isl_map *map1,
5739 __isl_take isl_map *map2);
5740 __isl_give isl_map *isl_map_flat_range_product(
5741 __isl_take isl_map *map1,
5742 __isl_take isl_map *map2);
5743 __isl_give isl_basic_map *isl_basic_map_flat_product(
5744 __isl_take isl_basic_map *bmap1,
5745 __isl_take isl_basic_map *bmap2);
5746 __isl_give isl_map *isl_map_flat_product(
5747 __isl_take isl_map *map1,
5748 __isl_take isl_map *map2);
5750 #include <isl/union_map.h>
5751 __isl_give isl_union_map *
5752 isl_union_map_flat_domain_product(
5753 __isl_take isl_union_map *umap1,
5754 __isl_take isl_union_map *umap2);
5755 __isl_give isl_union_map *
5756 isl_union_map_flat_range_product(
5757 __isl_take isl_union_map *umap1,
5758 __isl_take isl_union_map *umap2);
5760 #include <isl/val.h>
5761 __isl_give isl_multi_val *isl_multi_val_flat_range_product(
5762 __isl_take isl_multi_val *mv1,
5763 __isl_take isl_multi_aff *mv2);
5765 #include <isl/aff.h>
5766 __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
5767 __isl_take isl_multi_aff *ma1,
5768 __isl_take isl_multi_aff *ma2);
5769 __isl_give isl_pw_multi_aff *
5770 isl_pw_multi_aff_flat_range_product(
5771 __isl_take isl_pw_multi_aff *pma1,
5772 __isl_take isl_pw_multi_aff *pma2);
5773 __isl_give isl_multi_pw_aff *
5774 isl_multi_pw_aff_flat_range_product(
5775 __isl_take isl_multi_pw_aff *mpa1,
5776 __isl_take isl_multi_pw_aff *mpa2);
5777 __isl_give isl_union_pw_multi_aff *
5778 isl_union_pw_multi_aff_flat_range_product(
5779 __isl_take isl_union_pw_multi_aff *upma1,
5780 __isl_take isl_union_pw_multi_aff *upma2);
5782 #include <isl/space.h>
5783 __isl_give isl_space *isl_space_factor_domain(
5784 __isl_take isl_space *space);
5785 __isl_give isl_space *isl_space_factor_range(
5786 __isl_take isl_space *space);
5787 __isl_give isl_space *isl_space_domain_factor_domain(
5788 __isl_take isl_space *space);
5789 __isl_give isl_space *isl_space_domain_factor_range(
5790 __isl_take isl_space *space);
5791 __isl_give isl_space *isl_space_range_factor_domain(
5792 __isl_take isl_space *space);
5793 __isl_give isl_space *isl_space_range_factor_range(
5794 __isl_take isl_space *space);
5796 The functions C<isl_space_range_factor_domain> and
5797 C<isl_space_range_factor_range> extract the two arguments from
5798 the result of a call to C<isl_space_range_product>.
5800 The arguments of a call to C<isl_map_range_product> can be extracted
5801 from the result using the following functions.
5803 #include <isl/map.h>
5804 __isl_give isl_map *isl_map_factor_domain(
5805 __isl_take isl_map *map);
5806 __isl_give isl_map *isl_map_factor_range(
5807 __isl_take isl_map *map);
5808 __isl_give isl_map *isl_map_domain_factor_domain(
5809 __isl_take isl_map *map);
5810 __isl_give isl_map *isl_map_domain_factor_range(
5811 __isl_take isl_map *map);
5812 __isl_give isl_map *isl_map_range_factor_domain(
5813 __isl_take isl_map *map);
5814 __isl_give isl_map *isl_map_range_factor_range(
5815 __isl_take isl_map *map);
5817 #include <isl/union_map.h>
5818 __isl_give isl_union_map *isl_union_map_factor_domain(
5819 __isl_take isl_union_map *umap);
5820 __isl_give isl_union_map *isl_union_map_factor_range(
5821 __isl_take isl_union_map *umap);
5822 __isl_give isl_union_map *
5823 isl_union_map_domain_factor_domain(
5824 __isl_take isl_union_map *umap);
5825 __isl_give isl_union_map *
5826 isl_union_map_domain_factor_range(
5827 __isl_take isl_union_map *umap);
5828 __isl_give isl_union_map *
5829 isl_union_map_range_factor_range(
5830 __isl_take isl_union_map *umap);
5832 #include <isl/val.h>
5833 __isl_give isl_multi_val *
5834 isl_multi_val_range_factor_domain(
5835 __isl_take isl_multi_val *mv);
5836 __isl_give isl_multi_val *
5837 isl_multi_val_range_factor_range(
5838 __isl_take isl_multi_val *mv);
5840 #include <isl/aff.h>
5841 __isl_give isl_multi_aff *
5842 isl_multi_aff_range_factor_domain(
5843 __isl_take isl_multi_aff *ma);
5844 __isl_give isl_multi_aff *
5845 isl_multi_aff_range_factor_range(
5846 __isl_take isl_multi_aff *ma);
5847 __isl_give isl_multi_pw_aff *
5848 isl_multi_pw_aff_range_factor_domain(
5849 __isl_take isl_multi_pw_aff *mpa);
5850 __isl_give isl_multi_pw_aff *
5851 isl_multi_pw_aff_range_factor_range(
5852 __isl_take isl_multi_pw_aff *mpa);
5854 The splice functions are a generalization of the flat product functions,
5855 where the second argument may be inserted at any position inside
5856 the first argument rather than being placed at the end.
5858 #include <isl/val.h>
5859 __isl_give isl_multi_val *isl_multi_val_range_splice(
5860 __isl_take isl_multi_val *mv1, unsigned pos,
5861 __isl_take isl_multi_val *mv2);
5863 #include <isl/aff.h>
5864 __isl_give isl_multi_aff *isl_multi_aff_range_splice(
5865 __isl_take isl_multi_aff *ma1, unsigned pos,
5866 __isl_take isl_multi_aff *ma2);
5867 __isl_give isl_multi_aff *isl_multi_aff_splice(
5868 __isl_take isl_multi_aff *ma1,
5869 unsigned in_pos, unsigned out_pos,
5870 __isl_take isl_multi_aff *ma2);
5871 __isl_give isl_multi_pw_aff *
5872 isl_multi_pw_aff_range_splice(
5873 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
5874 __isl_take isl_multi_pw_aff *mpa2);
5875 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
5876 __isl_take isl_multi_pw_aff *mpa1,
5877 unsigned in_pos, unsigned out_pos,
5878 __isl_take isl_multi_pw_aff *mpa2);
5880 =item * Simplification
5882 When applied to a set or relation,
5883 the gist operation returns a set or relation that has the
5884 same intersection with the context as the input set or relation.
5885 Any implicit equality in the intersection is made explicit in the result,
5886 while all inequalities that are redundant with respect to the intersection
5888 In case of union sets and relations, the gist operation is performed
5891 When applied to a function,
5892 the gist operation applies the set gist operation to each of
5893 the cells in the domain of the input piecewise expression.
5894 The context is also exploited
5895 to simplify the expression associated to each cell.
5897 #include <isl/set.h>
5898 __isl_give isl_basic_set *isl_basic_set_gist(
5899 __isl_take isl_basic_set *bset,
5900 __isl_take isl_basic_set *context);
5901 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
5902 __isl_take isl_set *context);
5903 __isl_give isl_set *isl_set_gist_params(
5904 __isl_take isl_set *set,
5905 __isl_take isl_set *context);
5907 #include <isl/map.h>
5908 __isl_give isl_basic_map *isl_basic_map_gist(
5909 __isl_take isl_basic_map *bmap,
5910 __isl_take isl_basic_map *context);
5911 __isl_give isl_basic_map *isl_basic_map_gist_domain(
5912 __isl_take isl_basic_map *bmap,
5913 __isl_take isl_basic_set *context);
5914 __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
5915 __isl_take isl_map *context);
5916 __isl_give isl_map *isl_map_gist_params(
5917 __isl_take isl_map *map,
5918 __isl_take isl_set *context);
5919 __isl_give isl_map *isl_map_gist_domain(
5920 __isl_take isl_map *map,
5921 __isl_take isl_set *context);
5922 __isl_give isl_map *isl_map_gist_range(
5923 __isl_take isl_map *map,
5924 __isl_take isl_set *context);
5926 #include <isl/union_set.h>
5927 __isl_give isl_union_set *isl_union_set_gist(
5928 __isl_take isl_union_set *uset,
5929 __isl_take isl_union_set *context);
5930 __isl_give isl_union_set *isl_union_set_gist_params(
5931 __isl_take isl_union_set *uset,
5932 __isl_take isl_set *set);
5934 #include <isl/union_map.h>
5935 __isl_give isl_union_map *isl_union_map_gist(
5936 __isl_take isl_union_map *umap,
5937 __isl_take isl_union_map *context);
5938 __isl_give isl_union_map *isl_union_map_gist_params(
5939 __isl_take isl_union_map *umap,
5940 __isl_take isl_set *set);
5941 __isl_give isl_union_map *isl_union_map_gist_domain(
5942 __isl_take isl_union_map *umap,
5943 __isl_take isl_union_set *uset);
5944 __isl_give isl_union_map *isl_union_map_gist_range(
5945 __isl_take isl_union_map *umap,
5946 __isl_take isl_union_set *uset);
5948 #include <isl/aff.h>
5949 __isl_give isl_aff *isl_aff_gist_params(
5950 __isl_take isl_aff *aff,
5951 __isl_take isl_set *context);
5952 __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
5953 __isl_take isl_set *context);
5954 __isl_give isl_multi_aff *isl_multi_aff_gist_params(
5955 __isl_take isl_multi_aff *maff,
5956 __isl_take isl_set *context);
5957 __isl_give isl_multi_aff *isl_multi_aff_gist(
5958 __isl_take isl_multi_aff *maff,
5959 __isl_take isl_set *context);
5960 __isl_give isl_pw_aff *isl_pw_aff_gist_params(
5961 __isl_take isl_pw_aff *pwaff,
5962 __isl_take isl_set *context);
5963 __isl_give isl_pw_aff *isl_pw_aff_gist(
5964 __isl_take isl_pw_aff *pwaff,
5965 __isl_take isl_set *context);
5966 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
5967 __isl_take isl_pw_multi_aff *pma,
5968 __isl_take isl_set *set);
5969 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
5970 __isl_take isl_pw_multi_aff *pma,
5971 __isl_take isl_set *set);
5972 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
5973 __isl_take isl_multi_pw_aff *mpa,
5974 __isl_take isl_set *set);
5975 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
5976 __isl_take isl_multi_pw_aff *mpa,
5977 __isl_take isl_set *set);
5978 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
5979 __isl_take isl_union_pw_aff *upa,
5980 __isl_take isl_union_set *context);
5981 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
5982 __isl_take isl_union_pw_aff *upa,
5983 __isl_take isl_set *context);
5984 __isl_give isl_union_pw_multi_aff *
5985 isl_union_pw_multi_aff_gist_params(
5986 __isl_take isl_union_pw_multi_aff *upma,
5987 __isl_take isl_set *context);
5988 __isl_give isl_union_pw_multi_aff *
5989 isl_union_pw_multi_aff_gist(
5990 __isl_take isl_union_pw_multi_aff *upma,
5991 __isl_take isl_union_set *context);
5993 #include <isl/polynomial.h>
5994 __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
5995 __isl_take isl_qpolynomial *qp,
5996 __isl_take isl_set *context);
5997 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
5998 __isl_take isl_qpolynomial *qp,
5999 __isl_take isl_set *context);
6000 __isl_give isl_qpolynomial_fold *
6001 isl_qpolynomial_fold_gist_params(
6002 __isl_take isl_qpolynomial_fold *fold,
6003 __isl_take isl_set *context);
6004 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6005 __isl_take isl_qpolynomial_fold *fold,
6006 __isl_take isl_set *context);
6007 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6008 __isl_take isl_pw_qpolynomial *pwqp,
6009 __isl_take isl_set *context);
6010 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6011 __isl_take isl_pw_qpolynomial *pwqp,
6012 __isl_take isl_set *context);
6013 __isl_give isl_pw_qpolynomial_fold *
6014 isl_pw_qpolynomial_fold_gist(
6015 __isl_take isl_pw_qpolynomial_fold *pwf,
6016 __isl_take isl_set *context);
6017 __isl_give isl_pw_qpolynomial_fold *
6018 isl_pw_qpolynomial_fold_gist_params(
6019 __isl_take isl_pw_qpolynomial_fold *pwf,
6020 __isl_take isl_set *context);
6021 __isl_give isl_union_pw_qpolynomial *
6022 isl_union_pw_qpolynomial_gist_params(
6023 __isl_take isl_union_pw_qpolynomial *upwqp,
6024 __isl_take isl_set *context);
6025 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6026 __isl_take isl_union_pw_qpolynomial *upwqp,
6027 __isl_take isl_union_set *context);
6028 __isl_give isl_union_pw_qpolynomial_fold *
6029 isl_union_pw_qpolynomial_fold_gist(
6030 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6031 __isl_take isl_union_set *context);
6032 __isl_give isl_union_pw_qpolynomial_fold *
6033 isl_union_pw_qpolynomial_fold_gist_params(
6034 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6035 __isl_take isl_set *context);
6037 =item * Binary Arithmethic Operations
6039 #include <isl/val.h>
6040 __isl_give isl_multi_val *isl_multi_val_sub(
6041 __isl_take isl_multi_val *mv1,
6042 __isl_take isl_multi_val *mv2);
6044 #include <isl/aff.h>
6045 __isl_give isl_aff *isl_aff_add(
6046 __isl_take isl_aff *aff1,
6047 __isl_take isl_aff *aff2);
6048 __isl_give isl_multi_aff *isl_multi_aff_add(
6049 __isl_take isl_multi_aff *maff1,
6050 __isl_take isl_multi_aff *maff2);
6051 __isl_give isl_pw_aff *isl_pw_aff_add(
6052 __isl_take isl_pw_aff *pwaff1,
6053 __isl_take isl_pw_aff *pwaff2);
6054 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6055 __isl_take isl_pw_multi_aff *pma1,
6056 __isl_take isl_pw_multi_aff *pma2);
6057 __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6058 __isl_take isl_union_pw_aff *upa1,
6059 __isl_take isl_union_pw_aff *upa2);
6060 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6061 __isl_take isl_union_pw_multi_aff *upma1,
6062 __isl_take isl_union_pw_multi_aff *upma2);
6063 __isl_give isl_pw_aff *isl_pw_aff_min(
6064 __isl_take isl_pw_aff *pwaff1,
6065 __isl_take isl_pw_aff *pwaff2);
6066 __isl_give isl_pw_aff *isl_pw_aff_max(
6067 __isl_take isl_pw_aff *pwaff1,
6068 __isl_take isl_pw_aff *pwaff2);
6069 __isl_give isl_aff *isl_aff_sub(
6070 __isl_take isl_aff *aff1,
6071 __isl_take isl_aff *aff2);
6072 __isl_give isl_multi_aff *isl_multi_aff_sub(
6073 __isl_take isl_multi_aff *ma1,
6074 __isl_take isl_multi_aff *ma2);
6075 __isl_give isl_pw_aff *isl_pw_aff_sub(
6076 __isl_take isl_pw_aff *pwaff1,
6077 __isl_take isl_pw_aff *pwaff2);
6078 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6079 __isl_take isl_multi_pw_aff *mpa1,
6080 __isl_take isl_multi_pw_aff *mpa2);
6081 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6082 __isl_take isl_pw_multi_aff *pma1,
6083 __isl_take isl_pw_multi_aff *pma2);
6084 __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6085 __isl_take isl_union_pw_aff *upa1,
6086 __isl_take isl_union_pw_aff *upa2);
6087 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6088 __isl_take isl_union_pw_multi_aff *upma1,
6089 __isl_take isl_union_pw_multi_aff *upma2);
6091 C<isl_aff_sub> subtracts the second argument from the first.
6093 #include <isl/polynomial.h>
6094 __isl_give isl_qpolynomial *isl_qpolynomial_add(
6095 __isl_take isl_qpolynomial *qp1,
6096 __isl_take isl_qpolynomial *qp2);
6097 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6098 __isl_take isl_pw_qpolynomial *pwqp1,
6099 __isl_take isl_pw_qpolynomial *pwqp2);
6100 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6101 __isl_take isl_pw_qpolynomial *pwqp1,
6102 __isl_take isl_pw_qpolynomial *pwqp2);
6103 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6104 __isl_take isl_pw_qpolynomial_fold *pwf1,
6105 __isl_take isl_pw_qpolynomial_fold *pwf2);
6106 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6107 __isl_take isl_union_pw_qpolynomial *upwqp1,
6108 __isl_take isl_union_pw_qpolynomial *upwqp2);
6109 __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6110 __isl_take isl_qpolynomial *qp1,
6111 __isl_take isl_qpolynomial *qp2);
6112 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6113 __isl_take isl_pw_qpolynomial *pwqp1,
6114 __isl_take isl_pw_qpolynomial *pwqp2);
6115 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6116 __isl_take isl_union_pw_qpolynomial *upwqp1,
6117 __isl_take isl_union_pw_qpolynomial *upwqp2);
6118 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6119 __isl_take isl_pw_qpolynomial_fold *pwf1,
6120 __isl_take isl_pw_qpolynomial_fold *pwf2);
6121 __isl_give isl_union_pw_qpolynomial_fold *
6122 isl_union_pw_qpolynomial_fold_fold(
6123 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6124 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6126 #include <isl/aff.h>
6127 __isl_give isl_pw_aff *isl_pw_aff_union_add(
6128 __isl_take isl_pw_aff *pwaff1,
6129 __isl_take isl_pw_aff *pwaff2);
6130 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6131 __isl_take isl_pw_multi_aff *pma1,
6132 __isl_take isl_pw_multi_aff *pma2);
6133 __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6134 __isl_take isl_union_pw_aff *upa1,
6135 __isl_take isl_union_pw_aff *upa2);
6136 __isl_give isl_union_pw_multi_aff *
6137 isl_union_pw_multi_aff_union_add(
6138 __isl_take isl_union_pw_multi_aff *upma1,
6139 __isl_take isl_union_pw_multi_aff *upma2);
6140 __isl_give isl_pw_aff *isl_pw_aff_union_min(
6141 __isl_take isl_pw_aff *pwaff1,
6142 __isl_take isl_pw_aff *pwaff2);
6143 __isl_give isl_pw_aff *isl_pw_aff_union_max(
6144 __isl_take isl_pw_aff *pwaff1,
6145 __isl_take isl_pw_aff *pwaff2);
6147 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6148 expression with a domain that is the union of those of C<pwaff1> and
6149 C<pwaff2> and such that on each cell, the quasi-affine expression is
6150 the maximum of those of C<pwaff1> and C<pwaff2>. If only one of
6151 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6152 associated expression is the defined one.
6153 This in contrast to the C<isl_pw_aff_max> function, which is
6154 only defined on the shared definition domain of the arguments.
6156 #include <isl/val.h>
6157 __isl_give isl_multi_val *isl_multi_val_add_val(
6158 __isl_take isl_multi_val *mv,
6159 __isl_take isl_val *v);
6160 __isl_give isl_multi_val *isl_multi_val_mod_val(
6161 __isl_take isl_multi_val *mv,
6162 __isl_take isl_val *v);
6163 __isl_give isl_multi_val *isl_multi_val_scale_val(
6164 __isl_take isl_multi_val *mv,
6165 __isl_take isl_val *v);
6166 __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6167 __isl_take isl_multi_val *mv,
6168 __isl_take isl_val *v);
6170 #include <isl/aff.h>
6171 __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6172 __isl_take isl_val *mod);
6173 __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6174 __isl_take isl_pw_aff *pa,
6175 __isl_take isl_val *mod);
6176 __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6177 __isl_take isl_union_pw_aff *upa,
6178 __isl_take isl_val *f);
6179 __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6180 __isl_take isl_val *v);
6181 __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6182 __isl_take isl_multi_aff *ma,
6183 __isl_take isl_val *v);
6184 __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6185 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6186 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6187 __isl_take isl_multi_pw_aff *mpa,
6188 __isl_take isl_val *v);
6189 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6190 __isl_take isl_pw_multi_aff *pma,
6191 __isl_take isl_val *v);
6192 __isl_give isl_union_pw_multi_aff *
6193 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6194 __isl_take isl_union_pw_aff *upa,
6195 __isl_take isl_val *f);
6196 isl_union_pw_multi_aff_scale_val(
6197 __isl_take isl_union_pw_multi_aff *upma,
6198 __isl_take isl_val *val);
6199 __isl_give isl_aff *isl_aff_scale_down_ui(
6200 __isl_take isl_aff *aff, unsigned f);
6201 __isl_give isl_aff *isl_aff_scale_down_val(
6202 __isl_take isl_aff *aff, __isl_take isl_val *v);
6203 __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6204 __isl_take isl_multi_aff *ma,
6205 __isl_take isl_val *v);
6206 __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6207 __isl_take isl_pw_aff *pa,
6208 __isl_take isl_val *f);
6209 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6210 __isl_take isl_multi_pw_aff *mpa,
6211 __isl_take isl_val *v);
6212 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6213 __isl_take isl_pw_multi_aff *pma,
6214 __isl_take isl_val *v);
6215 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6216 __isl_take isl_union_pw_aff *upa,
6217 __isl_take isl_val *v);
6218 __isl_give isl_union_pw_multi_aff *
6219 isl_union_pw_multi_aff_scale_down_val(
6220 __isl_take isl_union_pw_multi_aff *upma,
6221 __isl_take isl_val *val);
6223 #include <isl/polynomial.h>
6224 __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6225 __isl_take isl_qpolynomial *qp,
6226 __isl_take isl_val *v);
6227 __isl_give isl_qpolynomial_fold *
6228 isl_qpolynomial_fold_scale_val(
6229 __isl_take isl_qpolynomial_fold *fold,
6230 __isl_take isl_val *v);
6231 __isl_give isl_pw_qpolynomial *
6232 isl_pw_qpolynomial_scale_val(
6233 __isl_take isl_pw_qpolynomial *pwqp,
6234 __isl_take isl_val *v);
6235 __isl_give isl_pw_qpolynomial_fold *
6236 isl_pw_qpolynomial_fold_scale_val(
6237 __isl_take isl_pw_qpolynomial_fold *pwf,
6238 __isl_take isl_val *v);
6239 __isl_give isl_union_pw_qpolynomial *
6240 isl_union_pw_qpolynomial_scale_val(
6241 __isl_take isl_union_pw_qpolynomial *upwqp,
6242 __isl_take isl_val *v);
6243 __isl_give isl_union_pw_qpolynomial_fold *
6244 isl_union_pw_qpolynomial_fold_scale_val(
6245 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6246 __isl_take isl_val *v);
6247 __isl_give isl_qpolynomial *
6248 isl_qpolynomial_scale_down_val(
6249 __isl_take isl_qpolynomial *qp,
6250 __isl_take isl_val *v);
6251 __isl_give isl_qpolynomial_fold *
6252 isl_qpolynomial_fold_scale_down_val(
6253 __isl_take isl_qpolynomial_fold *fold,
6254 __isl_take isl_val *v);
6255 __isl_give isl_pw_qpolynomial *
6256 isl_pw_qpolynomial_scale_down_val(
6257 __isl_take isl_pw_qpolynomial *pwqp,
6258 __isl_take isl_val *v);
6259 __isl_give isl_pw_qpolynomial_fold *
6260 isl_pw_qpolynomial_fold_scale_down_val(
6261 __isl_take isl_pw_qpolynomial_fold *pwf,
6262 __isl_take isl_val *v);
6263 __isl_give isl_union_pw_qpolynomial *
6264 isl_union_pw_qpolynomial_scale_down_val(
6265 __isl_take isl_union_pw_qpolynomial *upwqp,
6266 __isl_take isl_val *v);
6267 __isl_give isl_union_pw_qpolynomial_fold *
6268 isl_union_pw_qpolynomial_fold_scale_down_val(
6269 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6270 __isl_take isl_val *v);
6272 #include <isl/val.h>
6273 __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6274 __isl_take isl_multi_val *mv1,
6275 __isl_take isl_multi_val *mv2);
6276 __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6277 __isl_take isl_multi_val *mv1,
6278 __isl_take isl_multi_val *mv2);
6279 __isl_give isl_multi_val *
6280 isl_multi_val_scale_down_multi_val(
6281 __isl_take isl_multi_val *mv1,
6282 __isl_take isl_multi_val *mv2);
6284 #include <isl/aff.h>
6285 __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6286 __isl_take isl_multi_aff *ma,
6287 __isl_take isl_multi_val *mv);
6288 __isl_give isl_multi_pw_aff *
6289 isl_multi_pw_aff_mod_multi_val(
6290 __isl_take isl_multi_pw_aff *mpa,
6291 __isl_take isl_multi_val *mv);
6292 __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6293 __isl_take isl_multi_aff *ma,
6294 __isl_take isl_multi_val *mv);
6295 __isl_give isl_pw_multi_aff *
6296 isl_pw_multi_aff_scale_multi_val(
6297 __isl_take isl_pw_multi_aff *pma,
6298 __isl_take isl_multi_val *mv);
6299 __isl_give isl_multi_pw_aff *
6300 isl_multi_pw_aff_scale_multi_val(
6301 __isl_take isl_multi_pw_aff *mpa,
6302 __isl_take isl_multi_val *mv);
6303 __isl_give isl_union_pw_multi_aff *
6304 isl_union_pw_multi_aff_scale_multi_val(
6305 __isl_take isl_union_pw_multi_aff *upma,
6306 __isl_take isl_multi_val *mv);
6307 __isl_give isl_multi_aff *
6308 isl_multi_aff_scale_down_multi_val(
6309 __isl_take isl_multi_aff *ma,
6310 __isl_take isl_multi_val *mv);
6311 __isl_give isl_multi_pw_aff *
6312 isl_multi_pw_aff_scale_down_multi_val(
6313 __isl_take isl_multi_pw_aff *mpa,
6314 __isl_take isl_multi_val *mv);
6316 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6317 by the corresponding elements of C<mv>.
6319 #include <isl/aff.h>
6320 __isl_give isl_aff *isl_aff_mul(
6321 __isl_take isl_aff *aff1,
6322 __isl_take isl_aff *aff2);
6323 __isl_give isl_aff *isl_aff_div(
6324 __isl_take isl_aff *aff1,
6325 __isl_take isl_aff *aff2);
6326 __isl_give isl_pw_aff *isl_pw_aff_mul(
6327 __isl_take isl_pw_aff *pwaff1,
6328 __isl_take isl_pw_aff *pwaff2);
6329 __isl_give isl_pw_aff *isl_pw_aff_div(
6330 __isl_take isl_pw_aff *pa1,
6331 __isl_take isl_pw_aff *pa2);
6332 __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6333 __isl_take isl_pw_aff *pa1,
6334 __isl_take isl_pw_aff *pa2);
6335 __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6336 __isl_take isl_pw_aff *pa1,
6337 __isl_take isl_pw_aff *pa2);
6339 When multiplying two affine expressions, at least one of the two needs
6340 to be a constant. Similarly, when dividing an affine expression by another,
6341 the second expression needs to be a constant.
6342 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6343 rounding towards zero. C<isl_pw_aff_tdiv_r> computes the corresponding
6346 #include <isl/polynomial.h>
6347 __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6348 __isl_take isl_qpolynomial *qp1,
6349 __isl_take isl_qpolynomial *qp2);
6350 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6351 __isl_take isl_pw_qpolynomial *pwqp1,
6352 __isl_take isl_pw_qpolynomial *pwqp2);
6353 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6354 __isl_take isl_union_pw_qpolynomial *upwqp1,
6355 __isl_take isl_union_pw_qpolynomial *upwqp2);
6359 =head3 Lexicographic Optimization
6361 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6362 the following functions
6363 compute a set that contains the lexicographic minimum or maximum
6364 of the elements in C<set> (or C<bset>) for those values of the parameters
6365 that satisfy C<dom>.
6366 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6367 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6369 In other words, the union of the parameter values
6370 for which the result is non-empty and of C<*empty>
6373 #include <isl/set.h>
6374 __isl_give isl_set *isl_basic_set_partial_lexmin(
6375 __isl_take isl_basic_set *bset,
6376 __isl_take isl_basic_set *dom,
6377 __isl_give isl_set **empty);
6378 __isl_give isl_set *isl_basic_set_partial_lexmax(
6379 __isl_take isl_basic_set *bset,
6380 __isl_take isl_basic_set *dom,
6381 __isl_give isl_set **empty);
6382 __isl_give isl_set *isl_set_partial_lexmin(
6383 __isl_take isl_set *set, __isl_take isl_set *dom,
6384 __isl_give isl_set **empty);
6385 __isl_give isl_set *isl_set_partial_lexmax(
6386 __isl_take isl_set *set, __isl_take isl_set *dom,
6387 __isl_give isl_set **empty);
6389 Given a (basic) set C<set> (or C<bset>), the following functions simply
6390 return a set containing the lexicographic minimum or maximum
6391 of the elements in C<set> (or C<bset>).
6392 In case of union sets, the optimum is computed per space.
6394 #include <isl/set.h>
6395 __isl_give isl_set *isl_basic_set_lexmin(
6396 __isl_take isl_basic_set *bset);
6397 __isl_give isl_set *isl_basic_set_lexmax(
6398 __isl_take isl_basic_set *bset);
6399 __isl_give isl_set *isl_set_lexmin(
6400 __isl_take isl_set *set);
6401 __isl_give isl_set *isl_set_lexmax(
6402 __isl_take isl_set *set);
6403 __isl_give isl_union_set *isl_union_set_lexmin(
6404 __isl_take isl_union_set *uset);
6405 __isl_give isl_union_set *isl_union_set_lexmax(
6406 __isl_take isl_union_set *uset);
6408 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6409 the following functions
6410 compute a relation that maps each element of C<dom>
6411 to the single lexicographic minimum or maximum
6412 of the elements that are associated to that same
6413 element in C<map> (or C<bmap>).
6414 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6415 that contains the elements in C<dom> that do not map
6416 to any elements in C<map> (or C<bmap>).
6417 In other words, the union of the domain of the result and of C<*empty>
6420 #include <isl/map.h>
6421 __isl_give isl_map *isl_basic_map_partial_lexmax(
6422 __isl_take isl_basic_map *bmap,
6423 __isl_take isl_basic_set *dom,
6424 __isl_give isl_set **empty);
6425 __isl_give isl_map *isl_basic_map_partial_lexmin(
6426 __isl_take isl_basic_map *bmap,
6427 __isl_take isl_basic_set *dom,
6428 __isl_give isl_set **empty);
6429 __isl_give isl_map *isl_map_partial_lexmax(
6430 __isl_take isl_map *map, __isl_take isl_set *dom,
6431 __isl_give isl_set **empty);
6432 __isl_give isl_map *isl_map_partial_lexmin(
6433 __isl_take isl_map *map, __isl_take isl_set *dom,
6434 __isl_give isl_set **empty);
6436 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6437 return a map mapping each element in the domain of
6438 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6439 of all elements associated to that element.
6440 In case of union relations, the optimum is computed per space.
6442 #include <isl/map.h>
6443 __isl_give isl_map *isl_basic_map_lexmin(
6444 __isl_take isl_basic_map *bmap);
6445 __isl_give isl_map *isl_basic_map_lexmax(
6446 __isl_take isl_basic_map *bmap);
6447 __isl_give isl_map *isl_map_lexmin(
6448 __isl_take isl_map *map);
6449 __isl_give isl_map *isl_map_lexmax(
6450 __isl_take isl_map *map);
6451 __isl_give isl_union_map *isl_union_map_lexmin(
6452 __isl_take isl_union_map *umap);
6453 __isl_give isl_union_map *isl_union_map_lexmax(
6454 __isl_take isl_union_map *umap);
6456 The following functions return their result in the form of
6457 a piecewise multi-affine expression,
6458 but are otherwise equivalent to the corresponding functions
6459 returning a basic set or relation.
6461 #include <isl/set.h>
6462 __isl_give isl_pw_multi_aff *
6463 isl_basic_set_partial_lexmin_pw_multi_aff(
6464 __isl_take isl_basic_set *bset,
6465 __isl_take isl_basic_set *dom,
6466 __isl_give isl_set **empty);
6467 __isl_give isl_pw_multi_aff *
6468 isl_basic_set_partial_lexmax_pw_multi_aff(
6469 __isl_take isl_basic_set *bset,
6470 __isl_take isl_basic_set *dom,
6471 __isl_give isl_set **empty);
6472 __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6473 __isl_take isl_set *set);
6474 __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6475 __isl_take isl_set *set);
6477 #include <isl/map.h>
6478 __isl_give isl_pw_multi_aff *
6479 isl_basic_map_lexmin_pw_multi_aff(
6480 __isl_take isl_basic_map *bmap);
6481 __isl_give isl_pw_multi_aff *
6482 isl_basic_map_partial_lexmin_pw_multi_aff(
6483 __isl_take isl_basic_map *bmap,
6484 __isl_take isl_basic_set *dom,
6485 __isl_give isl_set **empty);
6486 __isl_give isl_pw_multi_aff *
6487 isl_basic_map_partial_lexmax_pw_multi_aff(
6488 __isl_take isl_basic_map *bmap,
6489 __isl_take isl_basic_set *dom,
6490 __isl_give isl_set **empty);
6491 __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
6492 __isl_take isl_map *map);
6493 __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
6494 __isl_take isl_map *map);
6496 The following functions return the lexicographic minimum or maximum
6497 on the shared domain of the inputs and the single defined function
6498 on those parts of the domain where only a single function is defined.
6500 #include <isl/aff.h>
6501 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
6502 __isl_take isl_pw_multi_aff *pma1,
6503 __isl_take isl_pw_multi_aff *pma2);
6504 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
6505 __isl_take isl_pw_multi_aff *pma1,
6506 __isl_take isl_pw_multi_aff *pma2);
6508 =head2 Ternary Operations
6510 #include <isl/aff.h>
6511 __isl_give isl_pw_aff *isl_pw_aff_cond(
6512 __isl_take isl_pw_aff *cond,
6513 __isl_take isl_pw_aff *pwaff_true,
6514 __isl_take isl_pw_aff *pwaff_false);
6516 The function C<isl_pw_aff_cond> performs a conditional operator
6517 and returns an expression that is equal to C<pwaff_true>
6518 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
6519 where C<cond> is zero.
6523 Lists are defined over several element types, including
6524 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
6525 C<isl_union_pw_multi_aff>, C<isl_constraint>,
6526 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
6527 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
6528 Here we take lists of C<isl_set>s as an example.
6529 Lists can be created, copied, modified and freed using the following functions.
6531 #include <isl/set.h>
6532 __isl_give isl_set_list *isl_set_list_from_set(
6533 __isl_take isl_set *el);
6534 __isl_give isl_set_list *isl_set_list_alloc(
6535 isl_ctx *ctx, int n);
6536 __isl_give isl_set_list *isl_set_list_copy(
6537 __isl_keep isl_set_list *list);
6538 __isl_give isl_set_list *isl_set_list_insert(
6539 __isl_take isl_set_list *list, unsigned pos,
6540 __isl_take isl_set *el);
6541 __isl_give isl_set_list *isl_set_list_add(
6542 __isl_take isl_set_list *list,
6543 __isl_take isl_set *el);
6544 __isl_give isl_set_list *isl_set_list_drop(
6545 __isl_take isl_set_list *list,
6546 unsigned first, unsigned n);
6547 __isl_give isl_set_list *isl_set_list_set_set(
6548 __isl_take isl_set_list *list, int index,
6549 __isl_take isl_set *set);
6550 __isl_give isl_set_list *isl_set_list_concat(
6551 __isl_take isl_set_list *list1,
6552 __isl_take isl_set_list *list2);
6553 __isl_give isl_set_list *isl_set_list_sort(
6554 __isl_take isl_set_list *list,
6555 int (*cmp)(__isl_keep isl_set *a,
6556 __isl_keep isl_set *b, void *user),
6558 __isl_null isl_set_list *isl_set_list_free(
6559 __isl_take isl_set_list *list);
6561 C<isl_set_list_alloc> creates an empty list with an initial capacity
6562 for C<n> elements. C<isl_set_list_insert> and C<isl_set_list_add>
6563 add elements to a list, increasing its capacity as needed.
6564 C<isl_set_list_from_set> creates a list with a single element.
6566 Lists can be inspected using the following functions.
6568 #include <isl/set.h>
6569 int isl_set_list_n_set(__isl_keep isl_set_list *list);
6570 __isl_give isl_set *isl_set_list_get_set(
6571 __isl_keep isl_set_list *list, int index);
6572 int isl_set_list_foreach(__isl_keep isl_set_list *list,
6573 int (*fn)(__isl_take isl_set *el, void *user),
6575 int isl_set_list_foreach_scc(__isl_keep isl_set_list *list,
6576 int (*follows)(__isl_keep isl_set *a,
6577 __isl_keep isl_set *b, void *user),
6579 int (*fn)(__isl_take isl_set *el, void *user),
6582 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
6583 strongly connected components of the graph with as vertices the elements
6584 of C<list> and a directed edge from vertex C<b> to vertex C<a>
6585 iff C<follows(a, b)> returns C<1>. The callbacks C<follows> and C<fn>
6586 should return C<-1> on error.
6588 Lists can be printed using
6590 #include <isl/set.h>
6591 __isl_give isl_printer *isl_printer_print_set_list(
6592 __isl_take isl_printer *p,
6593 __isl_keep isl_set_list *list);
6595 =head2 Associative arrays
6597 Associative arrays map isl objects of a specific type to isl objects
6598 of some (other) specific type. They are defined for several pairs
6599 of types, including (C<isl_map>, C<isl_basic_set>),
6600 (C<isl_id>, C<isl_ast_expr>) and.
6601 (C<isl_id>, C<isl_pw_aff>).
6602 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
6605 Associative arrays can be created, copied and freed using
6606 the following functions.
6608 #include <isl/id_to_ast_expr.h>
6609 __isl_give id_to_ast_expr *isl_id_to_ast_expr_alloc(
6610 isl_ctx *ctx, int min_size);
6611 __isl_give id_to_ast_expr *isl_id_to_ast_expr_copy(
6612 __isl_keep id_to_ast_expr *id2expr);
6613 __isl_null id_to_ast_expr *isl_id_to_ast_expr_free(
6614 __isl_take id_to_ast_expr *id2expr);
6616 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
6617 to specify the expected size of the associative array.
6618 The associative array will be grown automatically as needed.
6620 Associative arrays can be inspected using the following functions.
6622 #include <isl/id_to_ast_expr.h>
6623 int isl_id_to_ast_expr_has(
6624 __isl_keep id_to_ast_expr *id2expr,
6625 __isl_keep isl_id *key);
6626 __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
6627 __isl_keep id_to_ast_expr *id2expr,
6628 __isl_take isl_id *key);
6629 int isl_id_to_ast_expr_foreach(
6630 __isl_keep id_to_ast_expr *id2expr,
6631 int (*fn)(__isl_take isl_id *key,
6632 __isl_take isl_ast_expr *val, void *user),
6635 They can be modified using the following function.
6637 #include <isl/id_to_ast_expr.h>
6638 __isl_give id_to_ast_expr *isl_id_to_ast_expr_set(
6639 __isl_take id_to_ast_expr *id2expr,
6640 __isl_take isl_id *key,
6641 __isl_take isl_ast_expr *val);
6642 __isl_give id_to_ast_expr *isl_id_to_ast_expr_drop(
6643 __isl_take id_to_ast_expr *id2expr,
6644 __isl_take isl_id *key);
6646 Associative arrays can be printed using the following function.
6648 #include <isl/id_to_ast_expr.h>
6649 __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
6650 __isl_take isl_printer *p,
6651 __isl_keep id_to_ast_expr *id2expr);
6655 Vectors can be created, copied and freed using the following functions.
6657 #include <isl/vec.h>
6658 __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
6660 __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
6661 __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
6663 Note that the elements of a newly created vector may have arbitrary values.
6664 The elements can be changed and inspected using the following functions.
6666 int isl_vec_size(__isl_keep isl_vec *vec);
6667 __isl_give isl_val *isl_vec_get_element_val(
6668 __isl_keep isl_vec *vec, int pos);
6669 __isl_give isl_vec *isl_vec_set_element_si(
6670 __isl_take isl_vec *vec, int pos, int v);
6671 __isl_give isl_vec *isl_vec_set_element_val(
6672 __isl_take isl_vec *vec, int pos,
6673 __isl_take isl_val *v);
6674 __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
6676 __isl_give isl_vec *isl_vec_set_val(
6677 __isl_take isl_vec *vec, __isl_take isl_val *v);
6678 int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
6679 __isl_keep isl_vec *vec2, int pos);
6681 C<isl_vec_get_element> will return a negative value if anything went wrong.
6682 In that case, the value of C<*v> is undefined.
6684 The following function can be used to concatenate two vectors.
6686 __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
6687 __isl_take isl_vec *vec2);
6691 Matrices can be created, copied and freed using the following functions.
6693 #include <isl/mat.h>
6694 __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
6695 unsigned n_row, unsigned n_col);
6696 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
6697 __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
6699 Note that the elements of a newly created matrix may have arbitrary values.
6700 The elements can be changed and inspected using the following functions.
6702 int isl_mat_rows(__isl_keep isl_mat *mat);
6703 int isl_mat_cols(__isl_keep isl_mat *mat);
6704 __isl_give isl_val *isl_mat_get_element_val(
6705 __isl_keep isl_mat *mat, int row, int col);
6706 __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
6707 int row, int col, int v);
6708 __isl_give isl_mat *isl_mat_set_element_val(
6709 __isl_take isl_mat *mat, int row, int col,
6710 __isl_take isl_val *v);
6712 C<isl_mat_get_element> will return a negative value if anything went wrong.
6713 In that case, the value of C<*v> is undefined.
6715 The following function can be used to compute the (right) inverse
6716 of a matrix, i.e., a matrix such that the product of the original
6717 and the inverse (in that order) is a multiple of the identity matrix.
6718 The input matrix is assumed to be of full row-rank.
6720 __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
6722 The following function can be used to compute the (right) kernel
6723 (or null space) of a matrix, i.e., a matrix such that the product of
6724 the original and the kernel (in that order) is the zero matrix.
6726 __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
6728 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
6730 The following functions determine
6731 an upper or lower bound on a quasipolynomial over its domain.
6733 __isl_give isl_pw_qpolynomial_fold *
6734 isl_pw_qpolynomial_bound(
6735 __isl_take isl_pw_qpolynomial *pwqp,
6736 enum isl_fold type, int *tight);
6738 __isl_give isl_union_pw_qpolynomial_fold *
6739 isl_union_pw_qpolynomial_bound(
6740 __isl_take isl_union_pw_qpolynomial *upwqp,
6741 enum isl_fold type, int *tight);
6743 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
6744 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
6745 is the returned bound is known be tight, i.e., for each value
6746 of the parameters there is at least
6747 one element in the domain that reaches the bound.
6748 If the domain of C<pwqp> is not wrapping, then the bound is computed
6749 over all elements in that domain and the result has a purely parametric
6750 domain. If the domain of C<pwqp> is wrapping, then the bound is
6751 computed over the range of the wrapped relation. The domain of the
6752 wrapped relation becomes the domain of the result.
6754 =head2 Parametric Vertex Enumeration
6756 The parametric vertex enumeration described in this section
6757 is mainly intended to be used internally and by the C<barvinok>
6760 #include <isl/vertices.h>
6761 __isl_give isl_vertices *isl_basic_set_compute_vertices(
6762 __isl_keep isl_basic_set *bset);
6764 The function C<isl_basic_set_compute_vertices> performs the
6765 actual computation of the parametric vertices and the chamber
6766 decomposition and store the result in an C<isl_vertices> object.
6767 This information can be queried by either iterating over all
6768 the vertices or iterating over all the chambers or cells
6769 and then iterating over all vertices that are active on the chamber.
6771 int isl_vertices_foreach_vertex(
6772 __isl_keep isl_vertices *vertices,
6773 int (*fn)(__isl_take isl_vertex *vertex, void *user),
6776 int isl_vertices_foreach_cell(
6777 __isl_keep isl_vertices *vertices,
6778 int (*fn)(__isl_take isl_cell *cell, void *user),
6780 int isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
6781 int (*fn)(__isl_take isl_vertex *vertex, void *user),
6784 Other operations that can be performed on an C<isl_vertices> object are
6787 int isl_vertices_get_n_vertices(
6788 __isl_keep isl_vertices *vertices);
6789 void isl_vertices_free(__isl_take isl_vertices *vertices);
6791 Vertices can be inspected and destroyed using the following functions.
6793 int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
6794 __isl_give isl_basic_set *isl_vertex_get_domain(
6795 __isl_keep isl_vertex *vertex);
6796 __isl_give isl_multi_aff *isl_vertex_get_expr(
6797 __isl_keep isl_vertex *vertex);
6798 void isl_vertex_free(__isl_take isl_vertex *vertex);
6800 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
6801 describing the vertex in terms of the parameters,
6802 while C<isl_vertex_get_domain> returns the activity domain
6805 Chambers can be inspected and destroyed using the following functions.
6807 __isl_give isl_basic_set *isl_cell_get_domain(
6808 __isl_keep isl_cell *cell);
6809 void isl_cell_free(__isl_take isl_cell *cell);
6811 =head1 Polyhedral Compilation Library
6813 This section collects functionality in C<isl> that has been specifically
6814 designed for use during polyhedral compilation.
6816 =head2 Dependence Analysis
6818 C<isl> contains specialized functionality for performing
6819 array dataflow analysis. That is, given a I<sink> access relation
6820 and a collection of possible I<source> access relations,
6821 C<isl> can compute relations that describe
6822 for each iteration of the sink access, which iteration
6823 of which of the source access relations was the last
6824 to access the same data element before the given iteration
6826 The resulting dependence relations map source iterations
6827 to the corresponding sink iterations.
6828 To compute standard flow dependences, the sink should be
6829 a read, while the sources should be writes.
6830 If any of the source accesses are marked as being I<may>
6831 accesses, then there will be a dependence from the last
6832 I<must> access B<and> from any I<may> access that follows
6833 this last I<must> access.
6834 In particular, if I<all> sources are I<may> accesses,
6835 then memory based dependence analysis is performed.
6836 If, on the other hand, all sources are I<must> accesses,
6837 then value based dependence analysis is performed.
6839 #include <isl/flow.h>
6841 typedef int (*isl_access_level_before)(void *first, void *second);
6843 __isl_give isl_access_info *isl_access_info_alloc(
6844 __isl_take isl_map *sink,
6845 void *sink_user, isl_access_level_before fn,
6847 __isl_give isl_access_info *isl_access_info_add_source(
6848 __isl_take isl_access_info *acc,
6849 __isl_take isl_map *source, int must,
6851 __isl_null isl_access_info *isl_access_info_free(
6852 __isl_take isl_access_info *acc);
6854 __isl_give isl_flow *isl_access_info_compute_flow(
6855 __isl_take isl_access_info *acc);
6857 int isl_flow_foreach(__isl_keep isl_flow *deps,
6858 int (*fn)(__isl_take isl_map *dep, int must,
6859 void *dep_user, void *user),
6861 __isl_give isl_map *isl_flow_get_no_source(
6862 __isl_keep isl_flow *deps, int must);
6863 void isl_flow_free(__isl_take isl_flow *deps);
6865 The function C<isl_access_info_compute_flow> performs the actual
6866 dependence analysis. The other functions are used to construct
6867 the input for this function or to read off the output.
6869 The input is collected in an C<isl_access_info>, which can
6870 be created through a call to C<isl_access_info_alloc>.
6871 The arguments to this functions are the sink access relation
6872 C<sink>, a token C<sink_user> used to identify the sink
6873 access to the user, a callback function for specifying the
6874 relative order of source and sink accesses, and the number
6875 of source access relations that will be added.
6876 The callback function has type C<int (*)(void *first, void *second)>.
6877 The function is called with two user supplied tokens identifying
6878 either a source or the sink and it should return the shared nesting
6879 level and the relative order of the two accesses.
6880 In particular, let I<n> be the number of loops shared by
6881 the two accesses. If C<first> precedes C<second> textually,
6882 then the function should return I<2 * n + 1>; otherwise,
6883 it should return I<2 * n>.
6884 The sources can be added to the C<isl_access_info> by performing
6885 (at most) C<max_source> calls to C<isl_access_info_add_source>.
6886 C<must> indicates whether the source is a I<must> access
6887 or a I<may> access. Note that a multi-valued access relation
6888 should only be marked I<must> if every iteration in the domain
6889 of the relation accesses I<all> elements in its image.
6890 The C<source_user> token is again used to identify
6891 the source access. The range of the source access relation
6892 C<source> should have the same dimension as the range
6893 of the sink access relation.
6894 The C<isl_access_info_free> function should usually not be
6895 called explicitly, because it is called implicitly by
6896 C<isl_access_info_compute_flow>.
6898 The result of the dependence analysis is collected in an
6899 C<isl_flow>. There may be elements of
6900 the sink access for which no preceding source access could be
6901 found or for which all preceding sources are I<may> accesses.
6902 The relations containing these elements can be obtained through
6903 calls to C<isl_flow_get_no_source>, the first with C<must> set
6904 and the second with C<must> unset.
6905 In the case of standard flow dependence analysis,
6906 with the sink a read and the sources I<must> writes,
6907 the first relation corresponds to the reads from uninitialized
6908 array elements and the second relation is empty.
6909 The actual flow dependences can be extracted using
6910 C<isl_flow_foreach>. This function will call the user-specified
6911 callback function C<fn> for each B<non-empty> dependence between
6912 a source and the sink. The callback function is called
6913 with four arguments, the actual flow dependence relation
6914 mapping source iterations to sink iterations, a boolean that
6915 indicates whether it is a I<must> or I<may> dependence, a token
6916 identifying the source and an additional C<void *> with value
6917 equal to the third argument of the C<isl_flow_foreach> call.
6918 A dependence is marked I<must> if it originates from a I<must>
6919 source and if it is not followed by any I<may> sources.
6921 After finishing with an C<isl_flow>, the user should call
6922 C<isl_flow_free> to free all associated memory.
6924 A higher-level interface to dependence analysis is provided
6925 by the following function.
6927 #include <isl/flow.h>
6929 int isl_union_map_compute_flow(__isl_take isl_union_map *sink,
6930 __isl_take isl_union_map *must_source,
6931 __isl_take isl_union_map *may_source,
6932 __isl_take isl_union_map *schedule,
6933 __isl_give isl_union_map **must_dep,
6934 __isl_give isl_union_map **may_dep,
6935 __isl_give isl_union_map **must_no_source,
6936 __isl_give isl_union_map **may_no_source);
6938 The arrays are identified by the tuple names of the ranges
6939 of the accesses. The iteration domains by the tuple names
6940 of the domains of the accesses and of the schedule.
6941 The relative order of the iteration domains is given by the
6942 schedule. The relations returned through C<must_no_source>
6943 and C<may_no_source> are subsets of C<sink>.
6944 Any of C<must_dep>, C<may_dep>, C<must_no_source>
6945 or C<may_no_source> may be C<NULL>, but a C<NULL> value for
6946 any of the other arguments is treated as an error.
6948 =head3 Interaction with Dependence Analysis
6950 During the dependence analysis, we frequently need to perform
6951 the following operation. Given a relation between sink iterations
6952 and potential source iterations from a particular source domain,
6953 what is the last potential source iteration corresponding to each
6954 sink iteration. It can sometimes be convenient to adjust
6955 the set of potential source iterations before or after each such operation.
6956 The prototypical example is fuzzy array dataflow analysis,
6957 where we need to analyze if, based on data-dependent constraints,
6958 the sink iteration can ever be executed without one or more of
6959 the corresponding potential source iterations being executed.
6960 If so, we can introduce extra parameters and select an unknown
6961 but fixed source iteration from the potential source iterations.
6962 To be able to perform such manipulations, C<isl> provides the following
6965 #include <isl/flow.h>
6967 typedef __isl_give isl_restriction *(*isl_access_restrict)(
6968 __isl_keep isl_map *source_map,
6969 __isl_keep isl_set *sink, void *source_user,
6971 __isl_give isl_access_info *isl_access_info_set_restrict(
6972 __isl_take isl_access_info *acc,
6973 isl_access_restrict fn, void *user);
6975 The function C<isl_access_info_set_restrict> should be called
6976 before calling C<isl_access_info_compute_flow> and registers a callback function
6977 that will be called any time C<isl> is about to compute the last
6978 potential source. The first argument is the (reverse) proto-dependence,
6979 mapping sink iterations to potential source iterations.
6980 The second argument represents the sink iterations for which
6981 we want to compute the last source iteration.
6982 The third argument is the token corresponding to the source
6983 and the final argument is the token passed to C<isl_access_info_set_restrict>.
6984 The callback is expected to return a restriction on either the input or
6985 the output of the operation computing the last potential source.
6986 If the input needs to be restricted then restrictions are needed
6987 for both the source and the sink iterations. The sink iterations
6988 and the potential source iterations will be intersected with these sets.
6989 If the output needs to be restricted then only a restriction on the source
6990 iterations is required.
6991 If any error occurs, the callback should return C<NULL>.
6992 An C<isl_restriction> object can be created, freed and inspected
6993 using the following functions.
6995 #include <isl/flow.h>
6997 __isl_give isl_restriction *isl_restriction_input(
6998 __isl_take isl_set *source_restr,
6999 __isl_take isl_set *sink_restr);
7000 __isl_give isl_restriction *isl_restriction_output(
7001 __isl_take isl_set *source_restr);
7002 __isl_give isl_restriction *isl_restriction_none(
7003 __isl_take isl_map *source_map);
7004 __isl_give isl_restriction *isl_restriction_empty(
7005 __isl_take isl_map *source_map);
7006 __isl_null isl_restriction *isl_restriction_free(
7007 __isl_take isl_restriction *restr);
7009 C<isl_restriction_none> and C<isl_restriction_empty> are special
7010 cases of C<isl_restriction_input>. C<isl_restriction_none>
7011 is essentially equivalent to
7013 isl_restriction_input(isl_set_universe(
7014 isl_space_range(isl_map_get_space(source_map))),
7016 isl_space_domain(isl_map_get_space(source_map))));
7018 whereas C<isl_restriction_empty> is essentially equivalent to
7020 isl_restriction_input(isl_set_empty(
7021 isl_space_range(isl_map_get_space(source_map))),
7023 isl_space_domain(isl_map_get_space(source_map))));
7027 B<The functionality described in this section is fairly new
7028 and may be subject to change.>
7030 #include <isl/schedule.h>
7031 __isl_give isl_schedule *
7032 isl_schedule_constraints_compute_schedule(
7033 __isl_take isl_schedule_constraints *sc);
7034 __isl_null isl_schedule *isl_schedule_free(
7035 __isl_take isl_schedule *sched);
7037 The function C<isl_schedule_constraints_compute_schedule> can be
7038 used to compute a schedule that satisfies the given schedule constraints.
7039 These schedule constraints include the iteration domain for which
7040 a schedule should be computed and dependences between pairs of
7041 iterations. In particular, these dependences include
7042 I<validity> dependences and I<proximity> dependences.
7043 By default, the algorithm used to construct the schedule is similar
7044 to that of C<Pluto>.
7045 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
7047 The generated schedule respects all validity dependences.
7048 That is, all dependence distances over these dependences in the
7049 scheduled space are lexicographically positive.
7050 The default algorithm tries to ensure that the dependence distances
7051 over coincidence constraints are zero and to minimize the
7052 dependence distances over proximity dependences.
7053 Moreover, it tries to obtain sequences (bands) of schedule dimensions
7054 for groups of domains where the dependence distances over validity
7055 dependences have only non-negative values.
7056 When using Feautrier's algorithm, the coincidence and proximity constraints
7057 are only taken into account during the extension to a
7058 full-dimensional schedule.
7060 An C<isl_schedule_constraints> object can be constructed
7061 and manipulated using the following functions.
7063 #include <isl/schedule.h>
7064 __isl_give isl_schedule_constraints *
7065 isl_schedule_constraints_copy(
7066 __isl_keep isl_schedule_constraints *sc);
7067 __isl_give isl_schedule_constraints *
7068 isl_schedule_constraints_on_domain(
7069 __isl_take isl_union_set *domain);
7070 __isl_give isl_schedule_constraints *
7071 isl_schedule_constraints_set_validity(
7072 __isl_take isl_schedule_constraints *sc,
7073 __isl_take isl_union_map *validity);
7074 __isl_give isl_schedule_constraints *
7075 isl_schedule_constraints_set_coincidence(
7076 __isl_take isl_schedule_constraints *sc,
7077 __isl_take isl_union_map *coincidence);
7078 __isl_give isl_schedule_constraints *
7079 isl_schedule_constraints_set_proximity(
7080 __isl_take isl_schedule_constraints *sc,
7081 __isl_take isl_union_map *proximity);
7082 __isl_give isl_schedule_constraints *
7083 isl_schedule_constraints_set_conditional_validity(
7084 __isl_take isl_schedule_constraints *sc,
7085 __isl_take isl_union_map *condition,
7086 __isl_take isl_union_map *validity);
7087 __isl_null isl_schedule_constraints *
7088 isl_schedule_constraints_free(
7089 __isl_take isl_schedule_constraints *sc);
7091 The initial C<isl_schedule_constraints> object created by
7092 C<isl_schedule_constraints_on_domain> does not impose any constraints.
7093 That is, it has an empty set of dependences.
7094 The function C<isl_schedule_constraints_set_validity> replaces the
7095 validity dependences, mapping domain elements I<i> to domain
7096 elements that should be scheduled after I<i>.
7097 The function C<isl_schedule_constraints_set_coincidence> replaces the
7098 coincidence dependences, mapping domain elements I<i> to domain
7099 elements that should be scheduled together with I<I>, if possible.
7100 The function C<isl_schedule_constraints_set_proximity> replaces the
7101 proximity dependences, mapping domain elements I<i> to domain
7102 elements that should be scheduled either before I<I>
7103 or as early as possible after I<i>.
7105 The function C<isl_schedule_constraints_set_conditional_validity>
7106 replaces the conditional validity constraints.
7107 A conditional validity constraint is only imposed when any of the corresponding
7108 conditions is satisfied, i.e., when any of them is non-zero.
7109 That is, the scheduler ensures that within each band if the dependence
7110 distances over the condition constraints are not all zero
7111 then all corresponding conditional validity constraints are respected.
7112 A conditional validity constraint corresponds to a condition
7113 if the two are adjacent, i.e., if the domain of one relation intersect
7114 the range of the other relation.
7115 The typical use case of conditional validity constraints is
7116 to allow order constraints between live ranges to be violated
7117 as long as the live ranges themselves are local to the band.
7118 To allow more fine-grained control over which conditions correspond
7119 to which conditional validity constraints, the domains and ranges
7120 of these relations may include I<tags>. That is, the domains and
7121 ranges of those relation may themselves be wrapped relations
7122 where the iteration domain appears in the domain of those wrapped relations
7123 and the range of the wrapped relations can be arbitrarily chosen
7124 by the user. Conditions and conditional validity constraints are only
7125 considered adjacent to each other if the entire wrapped relation matches.
7126 In particular, a relation with a tag will never be considered adjacent
7127 to a relation without a tag.
7129 The following function computes a schedule directly from
7130 an iteration domain and validity and proximity dependences
7131 and is implemented in terms of the functions described above.
7132 The use of C<isl_union_set_compute_schedule> is discouraged.
7134 #include <isl/schedule.h>
7135 __isl_give isl_schedule *isl_union_set_compute_schedule(
7136 __isl_take isl_union_set *domain,
7137 __isl_take isl_union_map *validity,
7138 __isl_take isl_union_map *proximity);
7140 A mapping from the domains to the scheduled space can be obtained
7141 from an C<isl_schedule> using the following function.
7143 __isl_give isl_union_map *isl_schedule_get_map(
7144 __isl_keep isl_schedule *sched);
7146 A representation of the schedule can be printed using
7148 __isl_give isl_printer *isl_printer_print_schedule(
7149 __isl_take isl_printer *p,
7150 __isl_keep isl_schedule *schedule);
7152 A representation of the schedule as a forest of bands can be obtained
7153 using the following function.
7155 __isl_give isl_band_list *isl_schedule_get_band_forest(
7156 __isl_keep isl_schedule *schedule);
7158 The individual bands can be visited in depth-first post-order
7159 using the following function.
7161 #include <isl/schedule.h>
7162 int isl_schedule_foreach_band(
7163 __isl_keep isl_schedule *sched,
7164 int (*fn)(__isl_keep isl_band *band, void *user),
7167 The list can be manipulated as explained in L<"Lists">.
7168 The bands inside the list can be copied and freed using the following
7171 #include <isl/band.h>
7172 __isl_give isl_band *isl_band_copy(
7173 __isl_keep isl_band *band);
7174 __isl_null isl_band *isl_band_free(
7175 __isl_take isl_band *band);
7177 Each band contains zero or more scheduling dimensions.
7178 These are referred to as the members of the band.
7179 The section of the schedule that corresponds to the band is
7180 referred to as the partial schedule of the band.
7181 For those nodes that participate in a band, the outer scheduling
7182 dimensions form the prefix schedule, while the inner scheduling
7183 dimensions form the suffix schedule.
7184 That is, if we take a cut of the band forest, then the union of
7185 the concatenations of the prefix, partial and suffix schedules of
7186 each band in the cut is equal to the entire schedule (modulo
7187 some possible padding at the end with zero scheduling dimensions).
7188 The properties of a band can be inspected using the following functions.
7190 #include <isl/band.h>
7191 int isl_band_has_children(__isl_keep isl_band *band);
7192 __isl_give isl_band_list *isl_band_get_children(
7193 __isl_keep isl_band *band);
7195 __isl_give isl_union_map *isl_band_get_prefix_schedule(
7196 __isl_keep isl_band *band);
7197 __isl_give isl_union_map *isl_band_get_partial_schedule(
7198 __isl_keep isl_band *band);
7199 __isl_give isl_union_map *isl_band_get_suffix_schedule(
7200 __isl_keep isl_band *band);
7202 int isl_band_n_member(__isl_keep isl_band *band);
7203 int isl_band_member_is_coincident(
7204 __isl_keep isl_band *band, int pos);
7206 int isl_band_list_foreach_band(
7207 __isl_keep isl_band_list *list,
7208 int (*fn)(__isl_keep isl_band *band, void *user),
7211 Note that a scheduling dimension is considered to be ``coincident''
7212 if it satisfies the coincidence constraints within its band.
7213 That is, if the dependence distances of the coincidence
7214 constraints are all zero in that direction (for fixed
7215 iterations of outer bands).
7216 Like C<isl_schedule_foreach_band>,
7217 the function C<isl_band_list_foreach_band> calls C<fn> on the bands
7218 in depth-first post-order.
7220 A band can be tiled using the following function.
7222 #include <isl/band.h>
7223 int isl_band_tile(__isl_keep isl_band *band,
7224 __isl_take isl_vec *sizes);
7226 int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
7228 int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
7229 int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
7231 int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
7233 The C<isl_band_tile> function tiles the band using the given tile sizes
7234 inside its schedule.
7235 A new child band is created to represent the point loops and it is
7236 inserted between the modified band and its children.
7237 The C<tile_scale_tile_loops> option specifies whether the tile
7238 loops iterators should be scaled by the tile sizes.
7239 If the C<tile_shift_point_loops> option is set, then the point loops
7240 are shifted to start at zero.
7242 A band can be split into two nested bands using the following function.
7244 int isl_band_split(__isl_keep isl_band *band, int pos);
7246 The resulting outer band contains the first C<pos> dimensions of C<band>
7247 while the inner band contains the remaining dimensions.
7249 A representation of the band can be printed using
7251 #include <isl/band.h>
7252 __isl_give isl_printer *isl_printer_print_band(
7253 __isl_take isl_printer *p,
7254 __isl_keep isl_band *band);
7258 #include <isl/schedule.h>
7259 int isl_options_set_schedule_max_coefficient(
7260 isl_ctx *ctx, int val);
7261 int isl_options_get_schedule_max_coefficient(
7263 int isl_options_set_schedule_max_constant_term(
7264 isl_ctx *ctx, int val);
7265 int isl_options_get_schedule_max_constant_term(
7267 int isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
7268 int isl_options_get_schedule_fuse(isl_ctx *ctx);
7269 int isl_options_set_schedule_maximize_band_depth(
7270 isl_ctx *ctx, int val);
7271 int isl_options_get_schedule_maximize_band_depth(
7273 int isl_options_set_schedule_outer_coincidence(
7274 isl_ctx *ctx, int val);
7275 int isl_options_get_schedule_outer_coincidence(
7277 int isl_options_set_schedule_split_scaled(
7278 isl_ctx *ctx, int val);
7279 int isl_options_get_schedule_split_scaled(
7281 int isl_options_set_schedule_algorithm(
7282 isl_ctx *ctx, int val);
7283 int isl_options_get_schedule_algorithm(
7285 int isl_options_set_schedule_separate_components(
7286 isl_ctx *ctx, int val);
7287 int isl_options_get_schedule_separate_components(
7292 =item * schedule_max_coefficient
7294 This option enforces that the coefficients for variable and parameter
7295 dimensions in the calculated schedule are not larger than the specified value.
7296 This option can significantly increase the speed of the scheduling calculation
7297 and may also prevent fusing of unrelated dimensions. A value of -1 means that
7298 this option does not introduce bounds on the variable or parameter
7301 =item * schedule_max_constant_term
7303 This option enforces that the constant coefficients in the calculated schedule
7304 are not larger than the maximal constant term. This option can significantly
7305 increase the speed of the scheduling calculation and may also prevent fusing of
7306 unrelated dimensions. A value of -1 means that this option does not introduce
7307 bounds on the constant coefficients.
7309 =item * schedule_fuse
7311 This option controls the level of fusion.
7312 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
7313 resulting schedule will be distributed as much as possible.
7314 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
7315 try to fuse loops in the resulting schedule.
7317 =item * schedule_maximize_band_depth
7319 If this option is set, we do not split bands at the point
7320 where we detect splitting is necessary. Instead, we
7321 backtrack and split bands as early as possible. This
7322 reduces the number of splits and maximizes the width of
7323 the bands. Wider bands give more possibilities for tiling.
7324 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
7325 then bands will be split as early as possible, even if there is no need.
7326 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
7328 =item * schedule_outer_coincidence
7330 If this option is set, then we try to construct schedules
7331 where the outermost scheduling dimension in each band
7332 satisfies the coincidence constraints.
7334 =item * schedule_split_scaled
7336 If this option is set, then we try to construct schedules in which the
7337 constant term is split off from the linear part if the linear parts of
7338 the scheduling rows for all nodes in the graphs have a common non-trivial
7340 The constant term is then placed in a separate band and the linear
7343 =item * schedule_algorithm
7345 Selects the scheduling algorithm to be used.
7346 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
7347 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
7349 =item * schedule_separate_components
7351 If at any point the dependence graph contains any (weakly connected) components,
7352 then these components are scheduled separately.
7353 If this option is not set, then some iterations of the domains
7354 in these components may be scheduled together.
7355 If this option is set, then the components are given consecutive
7360 =head2 AST Generation
7362 This section describes the C<isl> functionality for generating
7363 ASTs that visit all the elements
7364 in a domain in an order specified by a schedule.
7365 In particular, given a C<isl_union_map>, an AST is generated
7366 that visits all the elements in the domain of the C<isl_union_map>
7367 according to the lexicographic order of the corresponding image
7368 element(s). If the range of the C<isl_union_map> consists of
7369 elements in more than one space, then each of these spaces is handled
7370 separately in an arbitrary order.
7371 It should be noted that the image elements only specify the I<order>
7372 in which the corresponding domain elements should be visited.
7373 No direct relation between the image elements and the loop iterators
7374 in the generated AST should be assumed.
7376 Each AST is generated within a build. The initial build
7377 simply specifies the constraints on the parameters (if any)
7378 and can be created, inspected, copied and freed using the following functions.
7380 #include <isl/ast_build.h>
7381 __isl_give isl_ast_build *isl_ast_build_from_context(
7382 __isl_take isl_set *set);
7383 __isl_give isl_ast_build *isl_ast_build_copy(
7384 __isl_keep isl_ast_build *build);
7385 __isl_null isl_ast_build *isl_ast_build_free(
7386 __isl_take isl_ast_build *build);
7388 The C<set> argument is usually a parameter set with zero or more parameters.
7389 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
7390 and L</"Fine-grained Control over AST Generation">.
7391 Finally, the AST itself can be constructed using the following
7394 #include <isl/ast_build.h>
7395 __isl_give isl_ast_node *isl_ast_build_ast_from_schedule(
7396 __isl_keep isl_ast_build *build,
7397 __isl_take isl_union_map *schedule);
7399 =head3 Inspecting the AST
7401 The basic properties of an AST node can be obtained as follows.
7403 #include <isl/ast.h>
7404 enum isl_ast_node_type isl_ast_node_get_type(
7405 __isl_keep isl_ast_node *node);
7407 The type of an AST node is one of
7408 C<isl_ast_node_for>,
7410 C<isl_ast_node_block> or
7411 C<isl_ast_node_user>.
7412 An C<isl_ast_node_for> represents a for node.
7413 An C<isl_ast_node_if> represents an if node.
7414 An C<isl_ast_node_block> represents a compound node.
7415 An C<isl_ast_node_user> represents an expression statement.
7416 An expression statement typically corresponds to a domain element, i.e.,
7417 one of the elements that is visited by the AST.
7419 Each type of node has its own additional properties.
7421 #include <isl/ast.h>
7422 __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
7423 __isl_keep isl_ast_node *node);
7424 __isl_give isl_ast_expr *isl_ast_node_for_get_init(
7425 __isl_keep isl_ast_node *node);
7426 __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
7427 __isl_keep isl_ast_node *node);
7428 __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
7429 __isl_keep isl_ast_node *node);
7430 __isl_give isl_ast_node *isl_ast_node_for_get_body(
7431 __isl_keep isl_ast_node *node);
7432 int isl_ast_node_for_is_degenerate(
7433 __isl_keep isl_ast_node *node);
7435 An C<isl_ast_for> is considered degenerate if it is known to execute
7438 #include <isl/ast.h>
7439 __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
7440 __isl_keep isl_ast_node *node);
7441 __isl_give isl_ast_node *isl_ast_node_if_get_then(
7442 __isl_keep isl_ast_node *node);
7443 int isl_ast_node_if_has_else(
7444 __isl_keep isl_ast_node *node);
7445 __isl_give isl_ast_node *isl_ast_node_if_get_else(
7446 __isl_keep isl_ast_node *node);
7448 __isl_give isl_ast_node_list *
7449 isl_ast_node_block_get_children(
7450 __isl_keep isl_ast_node *node);
7452 __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
7453 __isl_keep isl_ast_node *node);
7455 Each of the returned C<isl_ast_expr>s can in turn be inspected using
7456 the following functions.
7458 #include <isl/ast.h>
7459 enum isl_ast_expr_type isl_ast_expr_get_type(
7460 __isl_keep isl_ast_expr *expr);
7462 The type of an AST expression is one of
7464 C<isl_ast_expr_id> or
7465 C<isl_ast_expr_int>.
7466 An C<isl_ast_expr_op> represents the result of an operation.
7467 An C<isl_ast_expr_id> represents an identifier.
7468 An C<isl_ast_expr_int> represents an integer value.
7470 Each type of expression has its own additional properties.
7472 #include <isl/ast.h>
7473 enum isl_ast_op_type isl_ast_expr_get_op_type(
7474 __isl_keep isl_ast_expr *expr);
7475 int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
7476 __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
7477 __isl_keep isl_ast_expr *expr, int pos);
7478 int isl_ast_node_foreach_ast_op_type(
7479 __isl_keep isl_ast_node *node,
7480 int (*fn)(enum isl_ast_op_type type, void *user),
7483 C<isl_ast_expr_get_op_type> returns the type of the operation
7484 performed. C<isl_ast_expr_get_op_n_arg> returns the number of
7485 arguments. C<isl_ast_expr_get_op_arg> returns the specified
7487 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
7488 C<isl_ast_op_type> that appears in C<node>.
7489 The operation type is one of the following.
7493 =item C<isl_ast_op_and>
7495 Logical I<and> of two arguments.
7496 Both arguments can be evaluated.
7498 =item C<isl_ast_op_and_then>
7500 Logical I<and> of two arguments.
7501 The second argument can only be evaluated if the first evaluates to true.
7503 =item C<isl_ast_op_or>
7505 Logical I<or> of two arguments.
7506 Both arguments can be evaluated.
7508 =item C<isl_ast_op_or_else>
7510 Logical I<or> of two arguments.
7511 The second argument can only be evaluated if the first evaluates to false.
7513 =item C<isl_ast_op_max>
7515 Maximum of two or more arguments.
7517 =item C<isl_ast_op_min>
7519 Minimum of two or more arguments.
7521 =item C<isl_ast_op_minus>
7525 =item C<isl_ast_op_add>
7527 Sum of two arguments.
7529 =item C<isl_ast_op_sub>
7531 Difference of two arguments.
7533 =item C<isl_ast_op_mul>
7535 Product of two arguments.
7537 =item C<isl_ast_op_div>
7539 Exact division. That is, the result is known to be an integer.
7541 =item C<isl_ast_op_fdiv_q>
7543 Result of integer division, rounded towards negative
7546 =item C<isl_ast_op_pdiv_q>
7548 Result of integer division, where dividend is known to be non-negative.
7550 =item C<isl_ast_op_pdiv_r>
7552 Remainder of integer division, where dividend is known to be non-negative.
7554 =item C<isl_ast_op_zdiv_r>
7556 Equal to zero iff the remainder on integer division is zero.
7558 =item C<isl_ast_op_cond>
7560 Conditional operator defined on three arguments.
7561 If the first argument evaluates to true, then the result
7562 is equal to the second argument. Otherwise, the result
7563 is equal to the third argument.
7564 The second and third argument may only be evaluated if
7565 the first argument evaluates to true and false, respectively.
7566 Corresponds to C<a ? b : c> in C.
7568 =item C<isl_ast_op_select>
7570 Conditional operator defined on three arguments.
7571 If the first argument evaluates to true, then the result
7572 is equal to the second argument. Otherwise, the result
7573 is equal to the third argument.
7574 The second and third argument may be evaluated independently
7575 of the value of the first argument.
7576 Corresponds to C<a * b + (1 - a) * c> in C.
7578 =item C<isl_ast_op_eq>
7582 =item C<isl_ast_op_le>
7584 Less than or equal relation.
7586 =item C<isl_ast_op_lt>
7590 =item C<isl_ast_op_ge>
7592 Greater than or equal relation.
7594 =item C<isl_ast_op_gt>
7596 Greater than relation.
7598 =item C<isl_ast_op_call>
7601 The number of arguments of the C<isl_ast_expr> is one more than
7602 the number of arguments in the function call, the first argument
7603 representing the function being called.
7605 =item C<isl_ast_op_access>
7608 The number of arguments of the C<isl_ast_expr> is one more than
7609 the number of index expressions in the array access, the first argument
7610 representing the array being accessed.
7612 =item C<isl_ast_op_member>
7615 This operation has two arguments, a structure and the name of
7616 the member of the structure being accessed.
7620 #include <isl/ast.h>
7621 __isl_give isl_id *isl_ast_expr_get_id(
7622 __isl_keep isl_ast_expr *expr);
7624 Return the identifier represented by the AST expression.
7626 #include <isl/ast.h>
7627 __isl_give isl_val *isl_ast_expr_get_val(
7628 __isl_keep isl_ast_expr *expr);
7630 Return the integer represented by the AST expression.
7632 =head3 Properties of ASTs
7634 #include <isl/ast.h>
7635 int isl_ast_expr_is_equal(__isl_keep isl_ast_expr *expr1,
7636 __isl_keep isl_ast_expr *expr2);
7638 Check if two C<isl_ast_expr>s are equal to each other.
7640 =head3 Manipulating and printing the AST
7642 AST nodes can be copied and freed using the following functions.
7644 #include <isl/ast.h>
7645 __isl_give isl_ast_node *isl_ast_node_copy(
7646 __isl_keep isl_ast_node *node);
7647 __isl_null isl_ast_node *isl_ast_node_free(
7648 __isl_take isl_ast_node *node);
7650 AST expressions can be copied and freed using the following functions.
7652 #include <isl/ast.h>
7653 __isl_give isl_ast_expr *isl_ast_expr_copy(
7654 __isl_keep isl_ast_expr *expr);
7655 __isl_null isl_ast_expr *isl_ast_expr_free(
7656 __isl_take isl_ast_expr *expr);
7658 New AST expressions can be created either directly or within
7659 the context of an C<isl_ast_build>.
7661 #include <isl/ast.h>
7662 __isl_give isl_ast_expr *isl_ast_expr_from_val(
7663 __isl_take isl_val *v);
7664 __isl_give isl_ast_expr *isl_ast_expr_from_id(
7665 __isl_take isl_id *id);
7666 __isl_give isl_ast_expr *isl_ast_expr_neg(
7667 __isl_take isl_ast_expr *expr);
7668 __isl_give isl_ast_expr *isl_ast_expr_address_of(
7669 __isl_take isl_ast_expr *expr);
7670 __isl_give isl_ast_expr *isl_ast_expr_add(
7671 __isl_take isl_ast_expr *expr1,
7672 __isl_take isl_ast_expr *expr2);
7673 __isl_give isl_ast_expr *isl_ast_expr_sub(
7674 __isl_take isl_ast_expr *expr1,
7675 __isl_take isl_ast_expr *expr2);
7676 __isl_give isl_ast_expr *isl_ast_expr_mul(
7677 __isl_take isl_ast_expr *expr1,
7678 __isl_take isl_ast_expr *expr2);
7679 __isl_give isl_ast_expr *isl_ast_expr_div(
7680 __isl_take isl_ast_expr *expr1,
7681 __isl_take isl_ast_expr *expr2);
7682 __isl_give isl_ast_expr *isl_ast_expr_and(
7683 __isl_take isl_ast_expr *expr1,
7684 __isl_take isl_ast_expr *expr2)
7685 __isl_give isl_ast_expr *isl_ast_expr_or(
7686 __isl_take isl_ast_expr *expr1,
7687 __isl_take isl_ast_expr *expr2)
7688 __isl_give isl_ast_expr *isl_ast_expr_eq(
7689 __isl_take isl_ast_expr *expr1,
7690 __isl_take isl_ast_expr *expr2);
7691 __isl_give isl_ast_expr *isl_ast_expr_le(
7692 __isl_take isl_ast_expr *expr1,
7693 __isl_take isl_ast_expr *expr2);
7694 __isl_give isl_ast_expr *isl_ast_expr_lt(
7695 __isl_take isl_ast_expr *expr1,
7696 __isl_take isl_ast_expr *expr2);
7697 __isl_give isl_ast_expr *isl_ast_expr_ge(
7698 __isl_take isl_ast_expr *expr1,
7699 __isl_take isl_ast_expr *expr2);
7700 __isl_give isl_ast_expr *isl_ast_expr_gt(
7701 __isl_take isl_ast_expr *expr1,
7702 __isl_take isl_ast_expr *expr2);
7703 __isl_give isl_ast_expr *isl_ast_expr_access(
7704 __isl_take isl_ast_expr *array,
7705 __isl_take isl_ast_expr_list *indices);
7707 The function C<isl_ast_expr_address_of> can be applied to an
7708 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
7709 to represent the address of the C<isl_ast_expr_access>.
7711 #include <isl/ast_build.h>
7712 __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
7713 __isl_keep isl_ast_build *build,
7714 __isl_take isl_pw_aff *pa);
7715 __isl_give isl_ast_expr *
7716 isl_ast_build_access_from_pw_multi_aff(
7717 __isl_keep isl_ast_build *build,
7718 __isl_take isl_pw_multi_aff *pma);
7719 __isl_give isl_ast_expr *
7720 isl_ast_build_access_from_multi_pw_aff(
7721 __isl_keep isl_ast_build *build,
7722 __isl_take isl_multi_pw_aff *mpa);
7723 __isl_give isl_ast_expr *
7724 isl_ast_build_call_from_pw_multi_aff(
7725 __isl_keep isl_ast_build *build,
7726 __isl_take isl_pw_multi_aff *pma);
7727 __isl_give isl_ast_expr *
7728 isl_ast_build_call_from_multi_pw_aff(
7729 __isl_keep isl_ast_build *build,
7730 __isl_take isl_multi_pw_aff *mpa);
7732 The domains of C<pa>, C<mpa> and C<pma> should correspond
7733 to the schedule space of C<build>.
7734 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
7735 the function being called.
7736 If the accessed space is a nested relation, then it is taken
7737 to represent an access of the member specified by the range
7738 of this nested relation of the structure specified by the domain
7739 of the nested relation.
7741 The following functions can be used to modify an C<isl_ast_expr>.
7743 #include <isl/ast.h>
7744 __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
7745 __isl_take isl_ast_expr *expr, int pos,
7746 __isl_take isl_ast_expr *arg);
7748 Replace the argument of C<expr> at position C<pos> by C<arg>.
7750 #include <isl/ast.h>
7751 __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
7752 __isl_take isl_ast_expr *expr,
7753 __isl_take isl_id_to_ast_expr *id2expr);
7755 The function C<isl_ast_expr_substitute_ids> replaces the
7756 subexpressions of C<expr> of type C<isl_ast_expr_id>
7757 by the corresponding expression in C<id2expr>, if there is any.
7760 User specified data can be attached to an C<isl_ast_node> and obtained
7761 from the same C<isl_ast_node> using the following functions.
7763 #include <isl/ast.h>
7764 __isl_give isl_ast_node *isl_ast_node_set_annotation(
7765 __isl_take isl_ast_node *node,
7766 __isl_take isl_id *annotation);
7767 __isl_give isl_id *isl_ast_node_get_annotation(
7768 __isl_keep isl_ast_node *node);
7770 Basic printing can be performed using the following functions.
7772 #include <isl/ast.h>
7773 __isl_give isl_printer *isl_printer_print_ast_expr(
7774 __isl_take isl_printer *p,
7775 __isl_keep isl_ast_expr *expr);
7776 __isl_give isl_printer *isl_printer_print_ast_node(
7777 __isl_take isl_printer *p,
7778 __isl_keep isl_ast_node *node);
7779 __isl_give char *isl_ast_expr_to_str(
7780 __isl_keep isl_ast_expr *expr);
7782 More advanced printing can be performed using the following functions.
7784 #include <isl/ast.h>
7785 __isl_give isl_printer *isl_ast_op_type_print_macro(
7786 enum isl_ast_op_type type,
7787 __isl_take isl_printer *p);
7788 __isl_give isl_printer *isl_ast_node_print_macros(
7789 __isl_keep isl_ast_node *node,
7790 __isl_take isl_printer *p);
7791 __isl_give isl_printer *isl_ast_node_print(
7792 __isl_keep isl_ast_node *node,
7793 __isl_take isl_printer *p,
7794 __isl_take isl_ast_print_options *options);
7795 __isl_give isl_printer *isl_ast_node_for_print(
7796 __isl_keep isl_ast_node *node,
7797 __isl_take isl_printer *p,
7798 __isl_take isl_ast_print_options *options);
7799 __isl_give isl_printer *isl_ast_node_if_print(
7800 __isl_keep isl_ast_node *node,
7801 __isl_take isl_printer *p,
7802 __isl_take isl_ast_print_options *options);
7804 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
7805 C<isl> may print out an AST that makes use of macros such
7806 as C<floord>, C<min> and C<max>.
7807 C<isl_ast_op_type_print_macro> prints out the macro
7808 corresponding to a specific C<isl_ast_op_type>.
7809 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
7810 for expressions where these macros would be used and prints
7811 out the required macro definitions.
7812 Essentially, C<isl_ast_node_print_macros> calls
7813 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
7814 as function argument.
7815 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
7816 C<isl_ast_node_if_print> print an C<isl_ast_node>
7817 in C<ISL_FORMAT_C>, but allow for some extra control
7818 through an C<isl_ast_print_options> object.
7819 This object can be created using the following functions.
7821 #include <isl/ast.h>
7822 __isl_give isl_ast_print_options *
7823 isl_ast_print_options_alloc(isl_ctx *ctx);
7824 __isl_give isl_ast_print_options *
7825 isl_ast_print_options_copy(
7826 __isl_keep isl_ast_print_options *options);
7827 __isl_null isl_ast_print_options *
7828 isl_ast_print_options_free(
7829 __isl_take isl_ast_print_options *options);
7831 __isl_give isl_ast_print_options *
7832 isl_ast_print_options_set_print_user(
7833 __isl_take isl_ast_print_options *options,
7834 __isl_give isl_printer *(*print_user)(
7835 __isl_take isl_printer *p,
7836 __isl_take isl_ast_print_options *options,
7837 __isl_keep isl_ast_node *node, void *user),
7839 __isl_give isl_ast_print_options *
7840 isl_ast_print_options_set_print_for(
7841 __isl_take isl_ast_print_options *options,
7842 __isl_give isl_printer *(*print_for)(
7843 __isl_take isl_printer *p,
7844 __isl_take isl_ast_print_options *options,
7845 __isl_keep isl_ast_node *node, void *user),
7848 The callback set by C<isl_ast_print_options_set_print_user>
7849 is called whenever a node of type C<isl_ast_node_user> needs to
7851 The callback set by C<isl_ast_print_options_set_print_for>
7852 is called whenever a node of type C<isl_ast_node_for> needs to
7854 Note that C<isl_ast_node_for_print> will I<not> call the
7855 callback set by C<isl_ast_print_options_set_print_for> on the node
7856 on which C<isl_ast_node_for_print> is called, but only on nested
7857 nodes of type C<isl_ast_node_for>. It is therefore safe to
7858 call C<isl_ast_node_for_print> from within the callback set by
7859 C<isl_ast_print_options_set_print_for>.
7861 The following option determines the type to be used for iterators
7862 while printing the AST.
7864 int isl_options_set_ast_iterator_type(
7865 isl_ctx *ctx, const char *val);
7866 const char *isl_options_get_ast_iterator_type(
7869 The AST printer only prints body nodes as blocks if these
7870 blocks cannot be safely omitted.
7871 For example, a C<for> node with one body node will not be
7872 surrounded with braces in C<ISL_FORMAT_C>.
7873 A block will always be printed by setting the following option.
7875 int isl_options_set_ast_always_print_block(isl_ctx *ctx,
7877 int isl_options_get_ast_always_print_block(isl_ctx *ctx);
7881 #include <isl/ast_build.h>
7882 int isl_options_set_ast_build_atomic_upper_bound(
7883 isl_ctx *ctx, int val);
7884 int isl_options_get_ast_build_atomic_upper_bound(
7886 int isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
7888 int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
7889 int isl_options_set_ast_build_exploit_nested_bounds(
7890 isl_ctx *ctx, int val);
7891 int isl_options_get_ast_build_exploit_nested_bounds(
7893 int isl_options_set_ast_build_group_coscheduled(
7894 isl_ctx *ctx, int val);
7895 int isl_options_get_ast_build_group_coscheduled(
7897 int isl_options_set_ast_build_scale_strides(
7898 isl_ctx *ctx, int val);
7899 int isl_options_get_ast_build_scale_strides(
7901 int isl_options_set_ast_build_allow_else(isl_ctx *ctx,
7903 int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
7904 int isl_options_set_ast_build_allow_or(isl_ctx *ctx,
7906 int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
7910 =item * ast_build_atomic_upper_bound
7912 Generate loop upper bounds that consist of the current loop iterator,
7913 an operator and an expression not involving the iterator.
7914 If this option is not set, then the current loop iterator may appear
7915 several times in the upper bound.
7916 For example, when this option is turned off, AST generation
7919 [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
7923 for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
7926 When the option is turned on, the following AST is generated
7928 for (int c0 = 0; c0 <= min(100, n); c0 += 1)
7931 =item * ast_build_prefer_pdiv
7933 If this option is turned off, then the AST generation will
7934 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
7935 operators, but no C<isl_ast_op_pdiv_q> or
7936 C<isl_ast_op_pdiv_r> operators.
7937 If this options is turned on, then C<isl> will try to convert
7938 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
7939 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
7941 =item * ast_build_exploit_nested_bounds
7943 Simplify conditions based on bounds of nested for loops.
7944 In particular, remove conditions that are implied by the fact
7945 that one or more nested loops have at least one iteration,
7946 meaning that the upper bound is at least as large as the lower bound.
7947 For example, when this option is turned off, AST generation
7950 [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
7956 for (int c0 = 0; c0 <= N; c0 += 1)
7957 for (int c1 = 0; c1 <= M; c1 += 1)
7960 When the option is turned on, the following AST is generated
7962 for (int c0 = 0; c0 <= N; c0 += 1)
7963 for (int c1 = 0; c1 <= M; c1 += 1)
7966 =item * ast_build_group_coscheduled
7968 If two domain elements are assigned the same schedule point, then
7969 they may be executed in any order and they may even appear in different
7970 loops. If this options is set, then the AST generator will make
7971 sure that coscheduled domain elements do not appear in separate parts
7972 of the AST. This is useful in case of nested AST generation
7973 if the outer AST generation is given only part of a schedule
7974 and the inner AST generation should handle the domains that are
7975 coscheduled by this initial part of the schedule together.
7976 For example if an AST is generated for a schedule
7978 { A[i] -> [0]; B[i] -> [0] }
7980 then the C<isl_ast_build_set_create_leaf> callback described
7981 below may get called twice, once for each domain.
7982 Setting this option ensures that the callback is only called once
7983 on both domains together.
7985 =item * ast_build_separation_bounds
7987 This option specifies which bounds to use during separation.
7988 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
7989 then all (possibly implicit) bounds on the current dimension will
7990 be used during separation.
7991 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
7992 then only those bounds that are explicitly available will
7993 be used during separation.
7995 =item * ast_build_scale_strides
7997 This option specifies whether the AST generator is allowed
7998 to scale down iterators of strided loops.
8000 =item * ast_build_allow_else
8002 This option specifies whether the AST generator is allowed
8003 to construct if statements with else branches.
8005 =item * ast_build_allow_or
8007 This option specifies whether the AST generator is allowed
8008 to construct if conditions with disjunctions.
8012 =head3 Fine-grained Control over AST Generation
8014 Besides specifying the constraints on the parameters,
8015 an C<isl_ast_build> object can be used to control
8016 various aspects of the AST generation process.
8017 The most prominent way of control is through ``options'',
8018 which can be set using the following function.
8020 #include <isl/ast_build.h>
8021 __isl_give isl_ast_build *
8022 isl_ast_build_set_options(
8023 __isl_take isl_ast_build *control,
8024 __isl_take isl_union_map *options);
8026 The options are encoded in an C<isl_union_map>.
8027 The domain of this union relation refers to the schedule domain,
8028 i.e., the range of the schedule passed to C<isl_ast_build_ast_from_schedule>.
8029 In the case of nested AST generation (see L</"Nested AST Generation">),
8030 the domain of C<options> should refer to the extra piece of the schedule.
8031 That is, it should be equal to the range of the wrapped relation in the
8032 range of the schedule.
8033 The range of the options can consist of elements in one or more spaces,
8034 the names of which determine the effect of the option.
8035 The values of the range typically also refer to the schedule dimension
8036 to which the option applies. In case of nested AST generation
8037 (see L</"Nested AST Generation">), these values refer to the position
8038 of the schedule dimension within the innermost AST generation.
8039 The constraints on the domain elements of
8040 the option should only refer to this dimension and earlier dimensions.
8041 We consider the following spaces.
8045 =item C<separation_class>
8047 This space is a wrapped relation between two one dimensional spaces.
8048 The input space represents the schedule dimension to which the option
8049 applies and the output space represents the separation class.
8050 While constructing a loop corresponding to the specified schedule
8051 dimension(s), the AST generator will try to generate separate loops
8052 for domain elements that are assigned different classes.
8053 If only some of the elements are assigned a class, then those elements
8054 that are not assigned any class will be treated as belonging to a class
8055 that is separate from the explicitly assigned classes.
8056 The typical use case for this option is to separate full tiles from
8058 The other options, described below, are applied after the separation
8061 As an example, consider the separation into full and partial tiles
8062 of a tiling of a triangular domain.
8063 Take, for example, the domain
8065 { A[i,j] : 0 <= i,j and i + j <= 100 }
8067 and a tiling into tiles of 10 by 10. The input to the AST generator
8068 is then the schedule
8070 { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
8073 Without any options, the following AST is generated
8075 for (int c0 = 0; c0 <= 10; c0 += 1)
8076 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
8077 for (int c2 = 10 * c0;
8078 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8080 for (int c3 = 10 * c1;
8081 c3 <= min(10 * c1 + 9, -c2 + 100);
8085 Separation into full and partial tiles can be obtained by assigning
8086 a class, say C<0>, to the full tiles. The full tiles are represented by those
8087 values of the first and second schedule dimensions for which there are
8088 values of the third and fourth dimensions to cover an entire tile.
8089 That is, we need to specify the following option
8091 { [a,b,c,d] -> separation_class[[0]->[0]] :
8092 exists b': 0 <= 10a,10b' and
8093 10a+9+10b'+9 <= 100;
8094 [a,b,c,d] -> separation_class[[1]->[0]] :
8095 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
8099 { [a, b, c, d] -> separation_class[[1] -> [0]] :
8100 a >= 0 and b >= 0 and b <= 8 - a;
8101 [a, b, c, d] -> separation_class[[0] -> [0]] :
8104 With this option, the generated AST is as follows
8107 for (int c0 = 0; c0 <= 8; c0 += 1) {
8108 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
8109 for (int c2 = 10 * c0;
8110 c2 <= 10 * c0 + 9; c2 += 1)
8111 for (int c3 = 10 * c1;
8112 c3 <= 10 * c1 + 9; c3 += 1)
8114 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
8115 for (int c2 = 10 * c0;
8116 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8118 for (int c3 = 10 * c1;
8119 c3 <= min(-c2 + 100, 10 * c1 + 9);
8123 for (int c0 = 9; c0 <= 10; c0 += 1)
8124 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
8125 for (int c2 = 10 * c0;
8126 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8128 for (int c3 = 10 * c1;
8129 c3 <= min(10 * c1 + 9, -c2 + 100);
8136 This is a single-dimensional space representing the schedule dimension(s)
8137 to which ``separation'' should be applied. Separation tries to split
8138 a loop into several pieces if this can avoid the generation of guards
8140 See also the C<atomic> option.
8144 This is a single-dimensional space representing the schedule dimension(s)
8145 for which the domains should be considered ``atomic''. That is, the
8146 AST generator will make sure that any given domain space will only appear
8147 in a single loop at the specified level.
8149 Consider the following schedule
8151 { a[i] -> [i] : 0 <= i < 10;
8152 b[i] -> [i+1] : 0 <= i < 10 }
8154 If the following option is specified
8156 { [i] -> separate[x] }
8158 then the following AST will be generated
8162 for (int c0 = 1; c0 <= 9; c0 += 1) {
8169 If, on the other hand, the following option is specified
8171 { [i] -> atomic[x] }
8173 then the following AST will be generated
8175 for (int c0 = 0; c0 <= 10; c0 += 1) {
8182 If neither C<atomic> nor C<separate> is specified, then the AST generator
8183 may produce either of these two results or some intermediate form.
8187 This is a single-dimensional space representing the schedule dimension(s)
8188 that should be I<completely> unrolled.
8189 To obtain a partial unrolling, the user should apply an additional
8190 strip-mining to the schedule and fully unroll the inner loop.
8194 Additional control is available through the following functions.
8196 #include <isl/ast_build.h>
8197 __isl_give isl_ast_build *
8198 isl_ast_build_set_iterators(
8199 __isl_take isl_ast_build *control,
8200 __isl_take isl_id_list *iterators);
8202 The function C<isl_ast_build_set_iterators> allows the user to
8203 specify a list of iterator C<isl_id>s to be used as iterators.
8204 If the input schedule is injective, then
8205 the number of elements in this list should be as large as the dimension
8206 of the schedule space, but no direct correspondence should be assumed
8207 between dimensions and elements.
8208 If the input schedule is not injective, then an additional number
8209 of C<isl_id>s equal to the largest dimension of the input domains
8211 If the number of provided C<isl_id>s is insufficient, then additional
8212 names are automatically generated.
8214 #include <isl/ast_build.h>
8215 __isl_give isl_ast_build *
8216 isl_ast_build_set_create_leaf(
8217 __isl_take isl_ast_build *control,
8218 __isl_give isl_ast_node *(*fn)(
8219 __isl_take isl_ast_build *build,
8220 void *user), void *user);
8223 C<isl_ast_build_set_create_leaf> function allows for the
8224 specification of a callback that should be called whenever the AST
8225 generator arrives at an element of the schedule domain.
8226 The callback should return an AST node that should be inserted
8227 at the corresponding position of the AST. The default action (when
8228 the callback is not set) is to continue generating parts of the AST to scan
8229 all the domain elements associated to the schedule domain element
8230 and to insert user nodes, ``calling'' the domain element, for each of them.
8231 The C<build> argument contains the current state of the C<isl_ast_build>.
8232 To ease nested AST generation (see L</"Nested AST Generation">),
8233 all control information that is
8234 specific to the current AST generation such as the options and
8235 the callbacks has been removed from this C<isl_ast_build>.
8236 The callback would typically return the result of a nested
8238 user defined node created using the following function.
8240 #include <isl/ast.h>
8241 __isl_give isl_ast_node *isl_ast_node_alloc_user(
8242 __isl_take isl_ast_expr *expr);
8244 #include <isl/ast_build.h>
8245 __isl_give isl_ast_build *
8246 isl_ast_build_set_at_each_domain(
8247 __isl_take isl_ast_build *build,
8248 __isl_give isl_ast_node *(*fn)(
8249 __isl_take isl_ast_node *node,
8250 __isl_keep isl_ast_build *build,
8251 void *user), void *user);
8252 __isl_give isl_ast_build *
8253 isl_ast_build_set_before_each_for(
8254 __isl_take isl_ast_build *build,
8255 __isl_give isl_id *(*fn)(
8256 __isl_keep isl_ast_build *build,
8257 void *user), void *user);
8258 __isl_give isl_ast_build *
8259 isl_ast_build_set_after_each_for(
8260 __isl_take isl_ast_build *build,
8261 __isl_give isl_ast_node *(*fn)(
8262 __isl_take isl_ast_node *node,
8263 __isl_keep isl_ast_build *build,
8264 void *user), void *user);
8266 The callback set by C<isl_ast_build_set_at_each_domain> will
8267 be called for each domain AST node.
8268 The callbacks set by C<isl_ast_build_set_before_each_for>
8269 and C<isl_ast_build_set_after_each_for> will be called
8270 for each for AST node. The first will be called in depth-first
8271 pre-order, while the second will be called in depth-first post-order.
8272 Since C<isl_ast_build_set_before_each_for> is called before the for
8273 node is actually constructed, it is only passed an C<isl_ast_build>.
8274 The returned C<isl_id> will be added as an annotation (using
8275 C<isl_ast_node_set_annotation>) to the constructed for node.
8276 In particular, if the user has also specified an C<after_each_for>
8277 callback, then the annotation can be retrieved from the node passed to
8278 that callback using C<isl_ast_node_get_annotation>.
8279 All callbacks should C<NULL> on failure.
8280 The given C<isl_ast_build> can be used to create new
8281 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
8282 or C<isl_ast_build_call_from_pw_multi_aff>.
8284 =head3 Nested AST Generation
8286 C<isl> allows the user to create an AST within the context
8287 of another AST. These nested ASTs are created using the
8288 same C<isl_ast_build_ast_from_schedule> function that is used to create the
8289 outer AST. The C<build> argument should be an C<isl_ast_build>
8290 passed to a callback set by
8291 C<isl_ast_build_set_create_leaf>.
8292 The space of the range of the C<schedule> argument should refer
8293 to this build. In particular, the space should be a wrapped
8294 relation and the domain of this wrapped relation should be the
8295 same as that of the range of the schedule returned by
8296 C<isl_ast_build_get_schedule> below.
8297 In practice, the new schedule is typically
8298 created by calling C<isl_union_map_range_product> on the old schedule
8299 and some extra piece of the schedule.
8300 The space of the schedule domain is also available from
8301 the C<isl_ast_build>.
8303 #include <isl/ast_build.h>
8304 __isl_give isl_union_map *isl_ast_build_get_schedule(
8305 __isl_keep isl_ast_build *build);
8306 __isl_give isl_space *isl_ast_build_get_schedule_space(
8307 __isl_keep isl_ast_build *build);
8308 __isl_give isl_ast_build *isl_ast_build_restrict(
8309 __isl_take isl_ast_build *build,
8310 __isl_take isl_set *set);
8312 The C<isl_ast_build_get_schedule> function returns a (partial)
8313 schedule for the domains elements for which part of the AST still needs to
8314 be generated in the current build.
8315 In particular, the domain elements are mapped to those iterations of the loops
8316 enclosing the current point of the AST generation inside which
8317 the domain elements are executed.
8318 No direct correspondence between
8319 the input schedule and this schedule should be assumed.
8320 The space obtained from C<isl_ast_build_get_schedule_space> can be used
8321 to create a set for C<isl_ast_build_restrict> to intersect
8322 with the current build. In particular, the set passed to
8323 C<isl_ast_build_restrict> can have additional parameters.
8324 The ids of the set dimensions in the space returned by
8325 C<isl_ast_build_get_schedule_space> correspond to the
8326 iterators of the already generated loops.
8327 The user should not rely on the ids of the output dimensions
8328 of the relations in the union relation returned by
8329 C<isl_ast_build_get_schedule> having any particular value.
8333 Although C<isl> is mainly meant to be used as a library,
8334 it also contains some basic applications that use some
8335 of the functionality of C<isl>.
8336 The input may be specified in either the L<isl format>
8337 or the L<PolyLib format>.
8339 =head2 C<isl_polyhedron_sample>
8341 C<isl_polyhedron_sample> takes a polyhedron as input and prints
8342 an integer element of the polyhedron, if there is any.
8343 The first column in the output is the denominator and is always
8344 equal to 1. If the polyhedron contains no integer points,
8345 then a vector of length zero is printed.
8349 C<isl_pip> takes the same input as the C<example> program
8350 from the C<piplib> distribution, i.e., a set of constraints
8351 on the parameters, a line containing only -1 and finally a set
8352 of constraints on a parametric polyhedron.
8353 The coefficients of the parameters appear in the last columns
8354 (but before the final constant column).
8355 The output is the lexicographic minimum of the parametric polyhedron.
8356 As C<isl> currently does not have its own output format, the output
8357 is just a dump of the internal state.
8359 =head2 C<isl_polyhedron_minimize>
8361 C<isl_polyhedron_minimize> computes the minimum of some linear
8362 or affine objective function over the integer points in a polyhedron.
8363 If an affine objective function
8364 is given, then the constant should appear in the last column.
8366 =head2 C<isl_polytope_scan>
8368 Given a polytope, C<isl_polytope_scan> prints
8369 all integer points in the polytope.
8371 =head2 C<isl_codegen>
8373 Given a schedule, a context set and an options relation,
8374 C<isl_codegen> prints out an AST that scans the domain elements
8375 of the schedule in the order of their image(s) taking into account
8376 the constraints in the context set.