3 C<isl> is a thread-safe C library for manipulating
4 sets and relations of integer points bounded by affine constraints.
5 The descriptions of the sets and relations may involve
6 both parameters and existentially quantified variables.
7 All computations are performed in exact integer arithmetic
8 using C<GMP> or C<imath>.
9 The C<isl> library offers functionality that is similar
10 to that offered by the C<Omega> and C<Omega+> libraries,
11 but the underlying algorithms are in most cases completely different.
13 The library is by no means complete and some fairly basic
14 functionality is still missing.
15 Still, even in its current form, the library has been successfully
16 used as a backend polyhedral library for the polyhedral
17 scanner C<CLooG> and as part of an equivalence checker of
18 static affine programs.
19 For bug reports, feature requests and questions,
20 visit the discussion group at
21 L<http://groups.google.com/group/isl-development>.
23 =head2 Backward Incompatible Changes
25 =head3 Changes since isl-0.02
29 =item * The old printing functions have been deprecated
30 and replaced by C<isl_printer> functions, see L<Input and Output>.
32 =item * Most functions related to dependence analysis have acquired
33 an extra C<must> argument. To obtain the old behavior, this argument
34 should be given the value 1. See L<Dependence Analysis>.
38 =head3 Changes since isl-0.03
42 =item * The function C<isl_pw_qpolynomial_fold_add> has been
43 renamed to C<isl_pw_qpolynomial_fold_fold>.
44 Similarly, C<isl_union_pw_qpolynomial_fold_add> has been
45 renamed to C<isl_union_pw_qpolynomial_fold_fold>.
49 =head3 Changes since isl-0.04
53 =item * All header files have been renamed from C<isl_header.h>
58 =head3 Changes since isl-0.05
62 =item * The functions C<isl_printer_print_basic_set> and
63 C<isl_printer_print_basic_map> no longer print a newline.
65 =item * The functions C<isl_flow_get_no_source>
66 and C<isl_union_map_compute_flow> now return
67 the accesses for which no source could be found instead of
68 the iterations where those accesses occur.
70 =item * The functions C<isl_basic_map_identity> and
71 C<isl_map_identity> now take a B<map> space as input. An old call
72 C<isl_map_identity(space)> can be rewritten to
73 C<isl_map_identity(isl_space_map_from_set(space))>.
75 =item * The function C<isl_map_power> no longer takes
76 a parameter position as input. Instead, the exponent
77 is now expressed as the domain of the resulting relation.
81 =head3 Changes since isl-0.06
85 =item * The format of C<isl_printer_print_qpolynomial>'s
86 C<ISL_FORMAT_ISL> output has changed.
87 Use C<ISL_FORMAT_C> to obtain the old output.
89 =item * The C<*_fast_*> functions have been renamed to C<*_plain_*>.
90 Some of the old names have been kept for backward compatibility,
91 but they will be removed in the future.
95 =head3 Changes since isl-0.07
99 =item * The function C<isl_pw_aff_max> has been renamed to
100 C<isl_pw_aff_union_max>.
101 Similarly, the function C<isl_pw_aff_add> has been renamed to
102 C<isl_pw_aff_union_add>.
104 =item * The C<isl_dim> type has been renamed to C<isl_space>
105 along with the associated functions.
106 Some of the old names have been kept for backward compatibility,
107 but they will be removed in the future.
109 =item * Spaces of maps, sets and parameter domains are now
110 treated differently. The distinction between map spaces and set spaces
111 has always been made on a conceptual level, but proper use of such spaces
112 was never checked. Furthermore, up until isl-0.07 there was no way
113 of explicitly creating a parameter space. These can now be created
114 directly using C<isl_space_params_alloc> or from other spaces using
117 =item * The space in which C<isl_aff>, C<isl_pw_aff>, C<isl_qpolynomial>,
118 C<isl_pw_qpolynomial>, C<isl_qpolynomial_fold> and C<isl_pw_qpolynomial_fold>
119 objects live is now a map space
120 instead of a set space. This means, for example, that the dimensions
121 of the domain of an C<isl_aff> are now considered to be of type
122 C<isl_dim_in> instead of C<isl_dim_set>. Extra functions have been
123 added to obtain the domain space. Some of the constructors still
124 take a domain space and have therefore been renamed.
126 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
127 now take an C<isl_local_space> instead of an C<isl_space>.
128 An C<isl_local_space> can be created from an C<isl_space>
129 using C<isl_local_space_from_space>.
131 =item * The C<isl_div> type has been removed. Functions that used
132 to return an C<isl_div> now return an C<isl_aff>.
133 Note that the space of an C<isl_aff> is that of relation.
134 When replacing a call to C<isl_div_get_coefficient> by a call to
135 C<isl_aff_get_coefficient> any C<isl_dim_set> argument needs
136 to be replaced by C<isl_dim_in>.
137 A call to C<isl_aff_from_div> can be replaced by a call
139 A call to C<isl_qpolynomial_div(div)> call be replaced by
142 isl_qpolynomial_from_aff(isl_aff_floor(div))
144 The function C<isl_constraint_div> has also been renamed
145 to C<isl_constraint_get_div>.
147 =item * The C<nparam> argument has been removed from
148 C<isl_map_read_from_str> and similar functions.
149 When reading input in the original PolyLib format,
150 the result will have no parameters.
151 If parameters are expected, the caller may want to perform
152 dimension manipulation on the result.
156 =head3 Changes since isl-0.09
160 =item * The C<schedule_split_parallel> option has been replaced
161 by the C<schedule_split_scaled> option.
163 =item * The first argument of C<isl_pw_aff_cond> is now
164 an C<isl_pw_aff> instead of an C<isl_set>.
165 A call C<isl_pw_aff_cond(a, b, c)> can be replaced by
167 isl_pw_aff_cond(isl_set_indicator_function(a), b, c)
171 =head3 Changes since isl-0.10
175 =item * The functions C<isl_set_dim_has_lower_bound> and
176 C<isl_set_dim_has_upper_bound> have been renamed to
177 C<isl_set_dim_has_any_lower_bound> and
178 C<isl_set_dim_has_any_upper_bound>.
179 The new C<isl_set_dim_has_lower_bound> and
180 C<isl_set_dim_has_upper_bound> have slightly different meanings.
184 =head3 Changes since isl-0.12
188 =item * C<isl_int> has been replaced by C<isl_val>.
189 Some of the old functions are still available in C<isl/deprecated/*.h>
190 but they will be removed in the future.
192 =item * The functions C<isl_pw_qpolynomial_eval>,
193 C<isl_union_pw_qpolynomial_eval>, C<isl_pw_qpolynomial_fold_eval>
194 and C<isl_union_pw_qpolynomial_fold_eval> have been changed to return
195 an C<isl_val> instead of an C<isl_qpolynomial>.
197 =item * The function C<isl_band_member_is_zero_distance>
198 has been removed. Essentially the same functionality is available
199 through C<isl_band_member_is_coincident>, except that is requires
200 setting up coincidence constraints.
201 The option C<schedule_outer_zero_distance> has accordingly been
202 replaced by the option C<schedule_outer_coincidence>.
204 =item * The function C<isl_vertex_get_expr> has been changed
205 to return an C<isl_multi_aff> instead of a rational C<isl_basic_set>.
206 The function C<isl_vertex_get_domain> has been changed to return
207 a regular basic set, rather than a rational basic set.
211 =head3 Changes since isl-0.14
215 =item * Objects of type C<isl_union_pw_multi_aff> can no longer contain
216 two or more C<isl_pw_multi_aff> objects with the same domain space.
218 =item * The function C<isl_union_pw_multi_aff_add> now consistently
219 computes the sum on the shared definition domain.
220 The function C<isl_union_pw_multi_aff_union_add> has been added
221 to compute the sum on the union of definition domains.
222 The original behavior of C<isl_union_pw_multi_aff_add> was
223 confused and is no longer available.
229 C<isl> is released under the MIT license.
233 Permission is hereby granted, free of charge, to any person obtaining a copy of
234 this software and associated documentation files (the "Software"), to deal in
235 the Software without restriction, including without limitation the rights to
236 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
237 of the Software, and to permit persons to whom the Software is furnished to do
238 so, subject to the following conditions:
240 The above copyright notice and this permission notice shall be included in all
241 copies or substantial portions of the Software.
243 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
244 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
245 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
246 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
247 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
248 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
253 Note that by default C<isl> requires C<GMP>, which is released
254 under the GNU Lesser General Public License (LGPL). This means
255 that code linked against C<isl> is also linked against LGPL code.
257 When configuring with C<--with-int=imath>, C<isl> will link against C<imath>, a
258 library for exact integer arithmetic released under the MIT license.
262 The source of C<isl> can be obtained either as a tarball
263 or from the git repository. Both are available from
264 L<http://freshmeat.net/projects/isl/>.
265 The installation process depends on how you obtained
268 =head2 Installation from the git repository
272 =item 1 Clone or update the repository
274 The first time the source is obtained, you need to clone
277 git clone git://repo.or.cz/isl.git
279 To obtain updates, you need to pull in the latest changes
283 =item 2 Optionally get C<imath> submodule
285 To build C<isl> with C<imath>, you need to obtain the C<imath>
286 submodule by running in the git source tree of C<isl>
291 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
293 =item 2 Generate C<configure>
299 After performing the above steps, continue
300 with the L<Common installation instructions>.
302 =head2 Common installation instructions
306 =item 1 Obtain C<GMP>
308 By default, building C<isl> requires C<GMP>, including its headers files.
309 Your distribution may not provide these header files by default
310 and you may need to install a package called C<gmp-devel> or something
311 similar. Alternatively, C<GMP> can be built from
312 source, available from L<http://gmplib.org/>.
313 C<GMP> is not needed if you build C<isl> with C<imath>.
317 C<isl> uses the standard C<autoconf> C<configure> script.
322 optionally followed by some configure options.
323 A complete list of options can be obtained by running
327 Below we discuss some of the more common options.
333 Installation prefix for C<isl>
335 =item C<--with-int=[gmp|imath]>
337 Select the integer library to be used by C<isl>, the default is C<gmp>.
338 Note that C<isl> may run significantly slower if you use C<imath>.
340 =item C<--with-gmp-prefix>
342 Installation prefix for C<GMP> (architecture-independent files).
344 =item C<--with-gmp-exec-prefix>
346 Installation prefix for C<GMP> (architecture-dependent files).
354 =item 4 Install (optional)
360 =head1 Integer Set Library
362 =head2 Memory Management
364 Since a high-level operation on isl objects usually involves
365 several substeps and since the user is usually not interested in
366 the intermediate results, most functions that return a new object
367 will also release all the objects passed as arguments.
368 If the user still wants to use one or more of these arguments
369 after the function call, she should pass along a copy of the
370 object rather than the object itself.
371 The user is then responsible for making sure that the original
372 object gets used somewhere else or is explicitly freed.
374 The arguments and return values of all documented functions are
375 annotated to make clear which arguments are released and which
376 arguments are preserved. In particular, the following annotations
383 C<__isl_give> means that a new object is returned.
384 The user should make sure that the returned pointer is
385 used exactly once as a value for an C<__isl_take> argument.
386 In between, it can be used as a value for as many
387 C<__isl_keep> arguments as the user likes.
388 There is one exception, and that is the case where the
389 pointer returned is C<NULL>. Is this case, the user
390 is free to use it as an C<__isl_take> argument or not.
391 When applied to a C<char *>, the returned pointer needs to be
396 C<__isl_null> means that a C<NULL> value is returned.
400 C<__isl_take> means that the object the argument points to
401 is taken over by the function and may no longer be used
402 by the user as an argument to any other function.
403 The pointer value must be one returned by a function
404 returning an C<__isl_give> pointer.
405 If the user passes in a C<NULL> value, then this will
406 be treated as an error in the sense that the function will
407 not perform its usual operation. However, it will still
408 make sure that all the other C<__isl_take> arguments
413 C<__isl_keep> means that the function will only use the object
414 temporarily. After the function has finished, the user
415 can still use it as an argument to other functions.
416 A C<NULL> value will be treated in the same way as
417 a C<NULL> value for an C<__isl_take> argument.
418 This annotation may also be used on return values of
419 type C<const char *>, in which case the returned pointer should
420 not be freed by the user and is only valid until the object
421 from which it was derived is updated or freed.
425 =head2 Initialization
427 All manipulations of integer sets and relations occur within
428 the context of an C<isl_ctx>.
429 A given C<isl_ctx> can only be used within a single thread.
430 All arguments of a function are required to have been allocated
431 within the same context.
432 There are currently no functions available for moving an object
433 from one C<isl_ctx> to another C<isl_ctx>. This means that
434 there is currently no way of safely moving an object from one
435 thread to another, unless the whole C<isl_ctx> is moved.
437 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
438 freed using C<isl_ctx_free>.
439 All objects allocated within an C<isl_ctx> should be freed
440 before the C<isl_ctx> itself is freed.
442 isl_ctx *isl_ctx_alloc();
443 void isl_ctx_free(isl_ctx *ctx);
445 The user can impose a bound on the number of low-level I<operations>
446 that can be performed by an C<isl_ctx>. This bound can be set and
447 retrieved using the following functions. A bound of zero means that
448 no bound is imposed. The number of operations performed can be
449 reset using C<isl_ctx_reset_operations>. Note that the number
450 of low-level operations needed to perform a high-level computation
451 may differ significantly across different versions
452 of C<isl>, but it should be the same across different platforms
453 for the same version of C<isl>.
455 Warning: This feature is experimental. C<isl> has good support to abort and
456 bail out during the computation, but this feature may exercise error code paths
457 that are normally not used that much. Consequently, it is not unlikely that
458 hidden bugs will be exposed.
460 void isl_ctx_set_max_operations(isl_ctx *ctx,
461 unsigned long max_operations);
462 unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
463 void isl_ctx_reset_operations(isl_ctx *ctx);
465 In order to be able to create an object in the same context
466 as another object, most object types (described later in
467 this document) provide a function to obtain the context
468 in which the object was created.
471 isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
472 isl_ctx *isl_multi_val_get_ctx(
473 __isl_keep isl_multi_val *mv);
476 isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
478 #include <isl/local_space.h>
479 isl_ctx *isl_local_space_get_ctx(
480 __isl_keep isl_local_space *ls);
483 isl_ctx *isl_set_list_get_ctx(
484 __isl_keep isl_set_list *list);
487 isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
488 isl_ctx *isl_multi_aff_get_ctx(
489 __isl_keep isl_multi_aff *maff);
490 isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
491 isl_ctx *isl_pw_multi_aff_get_ctx(
492 __isl_keep isl_pw_multi_aff *pma);
493 isl_ctx *isl_multi_pw_aff_get_ctx(
494 __isl_keep isl_multi_pw_aff *mpa);
495 isl_ctx *isl_union_pw_multi_aff_get_ctx(
496 __isl_keep isl_union_pw_multi_aff *upma);
498 #include <isl/id_to_ast_expr.h>
499 isl_ctx *isl_id_to_ast_expr_get_ctx(
500 __isl_keep id_to_ast_expr *id2expr);
502 #include <isl/point.h>
503 isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
506 isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
509 isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
511 #include <isl/vertices.h>
512 isl_ctx *isl_vertices_get_ctx(
513 __isl_keep isl_vertices *vertices);
514 isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
515 isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
517 #include <isl/flow.h>
518 isl_ctx *isl_restriction_get_ctx(
519 __isl_keep isl_restriction *restr);
521 #include <isl/schedule.h>
522 isl_ctx *isl_schedule_constraints_get_ctx(
523 __isl_keep isl_schedule_constraints *sc);
525 #include <isl/band.h>
526 isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
528 #include <isl/ast_build.h>
529 isl_ctx *isl_ast_build_get_ctx(
530 __isl_keep isl_ast_build *build);
533 isl_ctx *isl_ast_expr_get_ctx(
534 __isl_keep isl_ast_expr *expr);
535 isl_ctx *isl_ast_node_get_ctx(
536 __isl_keep isl_ast_node *node);
540 An C<isl_val> represents an integer value, a rational value
541 or one of three special values, infinity, negative infinity and NaN.
542 Some predefined values can be created using the following functions.
545 __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
546 __isl_give isl_val *isl_val_one(isl_ctx *ctx);
547 __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
548 __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
549 __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
550 __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
552 Specific integer values can be created using the following functions.
555 __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
557 __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
559 __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
560 size_t n, size_t size, const void *chunks);
562 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
563 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
564 The least significant digit is assumed to be stored first.
566 Value objects can be copied and freed using the following functions.
569 __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
570 __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
572 They can be inspected using the following functions.
575 long isl_val_get_num_si(__isl_keep isl_val *v);
576 long isl_val_get_den_si(__isl_keep isl_val *v);
577 double isl_val_get_d(__isl_keep isl_val *v);
578 size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
580 int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
581 size_t size, void *chunks);
583 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
584 of C<size> bytes needed to store the absolute value of the
586 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
587 which is assumed to have been preallocated by the caller.
588 The least significant digit is stored first.
589 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
590 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
591 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
593 An C<isl_val> can be modified using the following function.
596 __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
599 The following unary properties are defined on C<isl_val>s.
602 int isl_val_sgn(__isl_keep isl_val *v);
603 int isl_val_is_zero(__isl_keep isl_val *v);
604 int isl_val_is_one(__isl_keep isl_val *v);
605 int isl_val_is_negone(__isl_keep isl_val *v);
606 int isl_val_is_nonneg(__isl_keep isl_val *v);
607 int isl_val_is_nonpos(__isl_keep isl_val *v);
608 int isl_val_is_pos(__isl_keep isl_val *v);
609 int isl_val_is_neg(__isl_keep isl_val *v);
610 int isl_val_is_int(__isl_keep isl_val *v);
611 int isl_val_is_rat(__isl_keep isl_val *v);
612 int isl_val_is_nan(__isl_keep isl_val *v);
613 int isl_val_is_infty(__isl_keep isl_val *v);
614 int isl_val_is_neginfty(__isl_keep isl_val *v);
616 Note that the sign of NaN is undefined.
618 The following binary properties are defined on pairs of C<isl_val>s.
621 int isl_val_lt(__isl_keep isl_val *v1,
622 __isl_keep isl_val *v2);
623 int isl_val_le(__isl_keep isl_val *v1,
624 __isl_keep isl_val *v2);
625 int isl_val_gt(__isl_keep isl_val *v1,
626 __isl_keep isl_val *v2);
627 int isl_val_ge(__isl_keep isl_val *v1,
628 __isl_keep isl_val *v2);
629 int isl_val_eq(__isl_keep isl_val *v1,
630 __isl_keep isl_val *v2);
631 int isl_val_ne(__isl_keep isl_val *v1,
632 __isl_keep isl_val *v2);
633 int isl_val_abs_eq(__isl_keep isl_val *v1,
634 __isl_keep isl_val *v2);
636 The function C<isl_val_abs_eq> checks whether its two arguments
637 are equal in absolute value.
639 For integer C<isl_val>s we additionally have the following binary property.
642 int isl_val_is_divisible_by(__isl_keep isl_val *v1,
643 __isl_keep isl_val *v2);
645 An C<isl_val> can also be compared to an integer using the following
646 function. The result is undefined for NaN.
649 int isl_val_cmp_si(__isl_keep isl_val *v, long i);
651 The following unary operations are available on C<isl_val>s.
654 __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
655 __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
656 __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
657 __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
658 __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
659 __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
660 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
662 The following binary operations are available on C<isl_val>s.
665 __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
666 __isl_take isl_val *v2);
667 __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
668 __isl_take isl_val *v2);
669 __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
670 __isl_take isl_val *v2);
671 __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
673 __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
674 __isl_take isl_val *v2);
675 __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
677 __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
678 __isl_take isl_val *v2);
679 __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
681 __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
682 __isl_take isl_val *v2);
684 On integer values, we additionally have the following operations.
687 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
688 __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
689 __isl_take isl_val *v2);
690 __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
691 __isl_take isl_val *v2);
692 __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
693 __isl_take isl_val *v2, __isl_give isl_val **x,
694 __isl_give isl_val **y);
696 The function C<isl_val_gcdext> returns the greatest common divisor g
697 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
698 that C<*x> * C<v1> + C<*y> * C<v2> = g.
700 =head3 GMP specific functions
702 These functions are only available if C<isl> has been compiled with C<GMP>
705 Specific integer and rational values can be created from C<GMP> values using
706 the following functions.
708 #include <isl/val_gmp.h>
709 __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
711 __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
712 const mpz_t n, const mpz_t d);
714 The numerator and denominator of a rational value can be extracted as
715 C<GMP> values using the following functions.
717 #include <isl/val_gmp.h>
718 int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
719 int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
721 =head2 Sets and Relations
723 C<isl> uses six types of objects for representing sets and relations,
724 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
725 C<isl_union_set> and C<isl_union_map>.
726 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
727 can be described as a conjunction of affine constraints, while
728 C<isl_set> and C<isl_map> represent unions of
729 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
730 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
731 to live in the same space. C<isl_union_set>s and C<isl_union_map>s
732 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
733 where spaces are considered different if they have a different number
734 of dimensions and/or different names (see L<"Spaces">).
735 The difference between sets and relations (maps) is that sets have
736 one set of variables, while relations have two sets of variables,
737 input variables and output variables.
739 =head2 Error Handling
741 C<isl> supports different ways to react in case a runtime error is triggered.
742 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
743 with two maps that have incompatible spaces. There are three possible ways
744 to react on error: to warn, to continue or to abort.
746 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
747 the last error in the corresponding C<isl_ctx> and the function in which the
748 error was triggered returns C<NULL>. An error does not corrupt internal state,
749 such that isl can continue to be used. C<isl> also provides functions to
750 read the last error and to reset the memory that stores the last error. The
751 last error is only stored for information purposes. Its presence does not
752 change the behavior of C<isl>. Hence, resetting an error is not required to
753 continue to use isl, but only to observe new errors.
756 enum isl_error isl_ctx_last_error(isl_ctx *ctx);
757 void isl_ctx_reset_error(isl_ctx *ctx);
759 Another option is to continue on error. This is similar to warn on error mode,
760 except that C<isl> does not print any warning. This allows a program to
761 implement its own error reporting.
763 The last option is to directly abort the execution of the program from within
764 the isl library. This makes it obviously impossible to recover from an error,
765 but it allows to directly spot the error location. By aborting on error,
766 debuggers break at the location the error occurred and can provide a stack
767 trace. Other tools that automatically provide stack traces on abort or that do
768 not want to continue execution after an error was triggered may also prefer to
771 The on error behavior of isl can be specified by calling
772 C<isl_options_set_on_error> or by setting the command line option
773 C<--isl-on-error>. Valid arguments for the function call are
774 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
775 choices for the command line option are C<warn>, C<continue> and C<abort>.
776 It is also possible to query the current error mode.
778 #include <isl/options.h>
779 int isl_options_set_on_error(isl_ctx *ctx, int val);
780 int isl_options_get_on_error(isl_ctx *ctx);
784 Identifiers are used to identify both individual dimensions
785 and tuples of dimensions. They consist of an optional name and an optional
786 user pointer. The name and the user pointer cannot both be C<NULL>, however.
787 Identifiers with the same name but different pointer values
788 are considered to be distinct.
789 Similarly, identifiers with different names but the same pointer value
790 are also considered to be distinct.
791 Equal identifiers are represented using the same object.
792 Pairs of identifiers can therefore be tested for equality using the
794 Identifiers can be constructed, copied, freed, inspected and printed
795 using the following functions.
798 __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
799 __isl_keep const char *name, void *user);
800 __isl_give isl_id *isl_id_set_free_user(
801 __isl_take isl_id *id,
802 __isl_give void (*free_user)(void *user));
803 __isl_give isl_id *isl_id_copy(isl_id *id);
804 __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
806 void *isl_id_get_user(__isl_keep isl_id *id);
807 __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
809 __isl_give isl_printer *isl_printer_print_id(
810 __isl_take isl_printer *p, __isl_keep isl_id *id);
812 The callback set by C<isl_id_set_free_user> is called on the user
813 pointer when the last reference to the C<isl_id> is freed.
814 Note that C<isl_id_get_name> returns a pointer to some internal
815 data structure, so the result can only be used while the
816 corresponding C<isl_id> is alive.
820 Whenever a new set, relation or similar object is created from scratch,
821 the space in which it lives needs to be specified using an C<isl_space>.
822 Each space involves zero or more parameters and zero, one or two
823 tuples of set or input/output dimensions. The parameters and dimensions
824 are identified by an C<isl_dim_type> and a position.
825 The type C<isl_dim_param> refers to parameters,
826 the type C<isl_dim_set> refers to set dimensions (for spaces
827 with a single tuple of dimensions) and the types C<isl_dim_in>
828 and C<isl_dim_out> refer to input and output dimensions
829 (for spaces with two tuples of dimensions).
830 Local spaces (see L</"Local Spaces">) also contain dimensions
831 of type C<isl_dim_div>.
832 Note that parameters are only identified by their position within
833 a given object. Across different objects, parameters are (usually)
834 identified by their names or identifiers. Only unnamed parameters
835 are identified by their positions across objects. The use of unnamed
836 parameters is discouraged.
838 #include <isl/space.h>
839 __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
840 unsigned nparam, unsigned n_in, unsigned n_out);
841 __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
843 __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
844 unsigned nparam, unsigned dim);
845 __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
846 __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
848 The space used for creating a parameter domain
849 needs to be created using C<isl_space_params_alloc>.
850 For other sets, the space
851 needs to be created using C<isl_space_set_alloc>, while
852 for a relation, the space
853 needs to be created using C<isl_space_alloc>.
855 To check whether a given space is that of a set or a map
856 or whether it is a parameter space, use these functions:
858 #include <isl/space.h>
859 int isl_space_is_params(__isl_keep isl_space *space);
860 int isl_space_is_set(__isl_keep isl_space *space);
861 int isl_space_is_map(__isl_keep isl_space *space);
863 Spaces can be compared using the following functions:
865 #include <isl/space.h>
866 int isl_space_is_equal(__isl_keep isl_space *space1,
867 __isl_keep isl_space *space2);
868 int isl_space_is_domain(__isl_keep isl_space *space1,
869 __isl_keep isl_space *space2);
870 int isl_space_is_range(__isl_keep isl_space *space1,
871 __isl_keep isl_space *space2);
872 int isl_space_tuple_is_equal(
873 __isl_keep isl_space *space1,
874 enum isl_dim_type type1,
875 __isl_keep isl_space *space2,
876 enum isl_dim_type type2);
878 C<isl_space_is_domain> checks whether the first argument is equal
879 to the domain of the second argument. This requires in particular that
880 the first argument is a set space and that the second argument
881 is a map space. C<isl_space_tuple_is_equal> checks whether the given
882 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
883 spaces are the same. That is, it checks if they have the same
884 identifier (if any), the same dimension and the same internal structure
887 It is often useful to create objects that live in the
888 same space as some other object. This can be accomplished
889 by creating the new objects
890 (see L</"Creating New Sets and Relations"> or
891 L</"Functions">) based on the space
892 of the original object.
895 __isl_give isl_space *isl_basic_set_get_space(
896 __isl_keep isl_basic_set *bset);
897 __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
899 #include <isl/union_set.h>
900 __isl_give isl_space *isl_union_set_get_space(
901 __isl_keep isl_union_set *uset);
904 __isl_give isl_space *isl_basic_map_get_space(
905 __isl_keep isl_basic_map *bmap);
906 __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
908 #include <isl/union_map.h>
909 __isl_give isl_space *isl_union_map_get_space(
910 __isl_keep isl_union_map *umap);
912 #include <isl/constraint.h>
913 __isl_give isl_space *isl_constraint_get_space(
914 __isl_keep isl_constraint *constraint);
916 #include <isl/polynomial.h>
917 __isl_give isl_space *isl_qpolynomial_get_domain_space(
918 __isl_keep isl_qpolynomial *qp);
919 __isl_give isl_space *isl_qpolynomial_get_space(
920 __isl_keep isl_qpolynomial *qp);
921 __isl_give isl_space *isl_qpolynomial_fold_get_space(
922 __isl_keep isl_qpolynomial_fold *fold);
923 __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
924 __isl_keep isl_pw_qpolynomial *pwqp);
925 __isl_give isl_space *isl_pw_qpolynomial_get_space(
926 __isl_keep isl_pw_qpolynomial *pwqp);
927 __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
928 __isl_keep isl_pw_qpolynomial_fold *pwf);
929 __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
930 __isl_keep isl_pw_qpolynomial_fold *pwf);
931 __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
932 __isl_keep isl_union_pw_qpolynomial *upwqp);
933 __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
934 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
937 __isl_give isl_space *isl_multi_val_get_space(
938 __isl_keep isl_multi_val *mv);
941 __isl_give isl_space *isl_aff_get_domain_space(
942 __isl_keep isl_aff *aff);
943 __isl_give isl_space *isl_aff_get_space(
944 __isl_keep isl_aff *aff);
945 __isl_give isl_space *isl_pw_aff_get_domain_space(
946 __isl_keep isl_pw_aff *pwaff);
947 __isl_give isl_space *isl_pw_aff_get_space(
948 __isl_keep isl_pw_aff *pwaff);
949 __isl_give isl_space *isl_multi_aff_get_domain_space(
950 __isl_keep isl_multi_aff *maff);
951 __isl_give isl_space *isl_multi_aff_get_space(
952 __isl_keep isl_multi_aff *maff);
953 __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
954 __isl_keep isl_pw_multi_aff *pma);
955 __isl_give isl_space *isl_pw_multi_aff_get_space(
956 __isl_keep isl_pw_multi_aff *pma);
957 __isl_give isl_space *isl_union_pw_multi_aff_get_space(
958 __isl_keep isl_union_pw_multi_aff *upma);
959 __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
960 __isl_keep isl_multi_pw_aff *mpa);
961 __isl_give isl_space *isl_multi_pw_aff_get_space(
962 __isl_keep isl_multi_pw_aff *mpa);
964 #include <isl/point.h>
965 __isl_give isl_space *isl_point_get_space(
966 __isl_keep isl_point *pnt);
968 The number of dimensions of a given type of space
969 may be read off from a space or an object that lives
970 in a space using the following functions.
971 In case of C<isl_space_dim>, type may be
972 C<isl_dim_param>, C<isl_dim_in> (only for relations),
973 C<isl_dim_out> (only for relations), C<isl_dim_set>
974 (only for sets) or C<isl_dim_all>.
976 #include <isl/space.h>
977 unsigned isl_space_dim(__isl_keep isl_space *space,
978 enum isl_dim_type type);
980 #include <isl/local_space.h>
981 int isl_local_space_dim(__isl_keep isl_local_space *ls,
982 enum isl_dim_type type);
985 unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
986 enum isl_dim_type type);
987 unsigned isl_set_dim(__isl_keep isl_set *set,
988 enum isl_dim_type type);
990 #include <isl/union_set.h>
991 unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
992 enum isl_dim_type type);
995 unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
996 enum isl_dim_type type);
997 unsigned isl_map_dim(__isl_keep isl_map *map,
998 enum isl_dim_type type);
1000 #include <isl/union_map.h>
1001 unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1002 enum isl_dim_type type);
1004 #include <isl/val.h>
1005 unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1006 enum isl_dim_type type);
1008 #include <isl/aff.h>
1009 int isl_aff_dim(__isl_keep isl_aff *aff,
1010 enum isl_dim_type type);
1011 unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1012 enum isl_dim_type type);
1013 unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1014 enum isl_dim_type type);
1015 unsigned isl_pw_multi_aff_dim(
1016 __isl_keep isl_pw_multi_aff *pma,
1017 enum isl_dim_type type);
1018 unsigned isl_multi_pw_aff_dim(
1019 __isl_keep isl_multi_pw_aff *mpa,
1020 enum isl_dim_type type);
1021 unsigned isl_union_pw_multi_aff_dim(
1022 __isl_keep isl_union_pw_multi_aff *upma,
1023 enum isl_dim_type type);
1025 #include <isl/polynomial.h>
1026 unsigned isl_union_pw_qpolynomial_dim(
1027 __isl_keep isl_union_pw_qpolynomial *upwqp,
1028 enum isl_dim_type type);
1029 unsigned isl_union_pw_qpolynomial_fold_dim(
1030 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1031 enum isl_dim_type type);
1033 Note that an C<isl_union_set>, an C<isl_union_map>,
1034 an C<isl_union_pw_multi_aff>,
1035 an C<isl_union_pw_qpolynomial> and
1036 an C<isl_union_pw_qpolynomial_fold>
1037 only have parameters.
1039 The identifiers or names of the individual dimensions of spaces
1040 may be set or read off using the following functions on spaces
1041 or objects that live in spaces.
1042 These functions are mostly useful to obtain the identifiers, positions
1043 or names of the parameters. Identifiers of individual dimensions are
1044 essentially only useful for printing. They are ignored by all other
1045 operations and may not be preserved across those operations.
1047 #include <isl/space.h>
1048 __isl_give isl_space *isl_space_set_dim_id(
1049 __isl_take isl_space *space,
1050 enum isl_dim_type type, unsigned pos,
1051 __isl_take isl_id *id);
1052 int isl_space_has_dim_id(__isl_keep isl_space *space,
1053 enum isl_dim_type type, unsigned pos);
1054 __isl_give isl_id *isl_space_get_dim_id(
1055 __isl_keep isl_space *space,
1056 enum isl_dim_type type, unsigned pos);
1057 __isl_give isl_space *isl_space_set_dim_name(
1058 __isl_take isl_space *space,
1059 enum isl_dim_type type, unsigned pos,
1060 __isl_keep const char *name);
1061 int isl_space_has_dim_name(__isl_keep isl_space *space,
1062 enum isl_dim_type type, unsigned pos);
1063 __isl_keep const char *isl_space_get_dim_name(
1064 __isl_keep isl_space *space,
1065 enum isl_dim_type type, unsigned pos);
1067 #include <isl/local_space.h>
1068 __isl_give isl_local_space *isl_local_space_set_dim_id(
1069 __isl_take isl_local_space *ls,
1070 enum isl_dim_type type, unsigned pos,
1071 __isl_take isl_id *id);
1072 int isl_local_space_has_dim_id(
1073 __isl_keep isl_local_space *ls,
1074 enum isl_dim_type type, unsigned pos);
1075 __isl_give isl_id *isl_local_space_get_dim_id(
1076 __isl_keep isl_local_space *ls,
1077 enum isl_dim_type type, unsigned pos);
1078 __isl_give isl_local_space *isl_local_space_set_dim_name(
1079 __isl_take isl_local_space *ls,
1080 enum isl_dim_type type, unsigned pos, const char *s);
1081 int isl_local_space_has_dim_name(
1082 __isl_keep isl_local_space *ls,
1083 enum isl_dim_type type, unsigned pos)
1084 const char *isl_local_space_get_dim_name(
1085 __isl_keep isl_local_space *ls,
1086 enum isl_dim_type type, unsigned pos);
1088 #include <isl/constraint.h>
1089 const char *isl_constraint_get_dim_name(
1090 __isl_keep isl_constraint *constraint,
1091 enum isl_dim_type type, unsigned pos);
1093 #include <isl/set.h>
1094 __isl_give isl_id *isl_basic_set_get_dim_id(
1095 __isl_keep isl_basic_set *bset,
1096 enum isl_dim_type type, unsigned pos);
1097 __isl_give isl_set *isl_set_set_dim_id(
1098 __isl_take isl_set *set, enum isl_dim_type type,
1099 unsigned pos, __isl_take isl_id *id);
1100 int isl_set_has_dim_id(__isl_keep isl_set *set,
1101 enum isl_dim_type type, unsigned pos);
1102 __isl_give isl_id *isl_set_get_dim_id(
1103 __isl_keep isl_set *set, enum isl_dim_type type,
1105 const char *isl_basic_set_get_dim_name(
1106 __isl_keep isl_basic_set *bset,
1107 enum isl_dim_type type, unsigned pos);
1108 int isl_set_has_dim_name(__isl_keep isl_set *set,
1109 enum isl_dim_type type, unsigned pos);
1110 const char *isl_set_get_dim_name(
1111 __isl_keep isl_set *set,
1112 enum isl_dim_type type, unsigned pos);
1114 #include <isl/map.h>
1115 __isl_give isl_map *isl_map_set_dim_id(
1116 __isl_take isl_map *map, enum isl_dim_type type,
1117 unsigned pos, __isl_take isl_id *id);
1118 int isl_basic_map_has_dim_id(
1119 __isl_keep isl_basic_map *bmap,
1120 enum isl_dim_type type, unsigned pos);
1121 int isl_map_has_dim_id(__isl_keep isl_map *map,
1122 enum isl_dim_type type, unsigned pos);
1123 __isl_give isl_id *isl_map_get_dim_id(
1124 __isl_keep isl_map *map, enum isl_dim_type type,
1126 __isl_give isl_id *isl_union_map_get_dim_id(
1127 __isl_keep isl_union_map *umap,
1128 enum isl_dim_type type, unsigned pos);
1129 const char *isl_basic_map_get_dim_name(
1130 __isl_keep isl_basic_map *bmap,
1131 enum isl_dim_type type, unsigned pos);
1132 int isl_map_has_dim_name(__isl_keep isl_map *map,
1133 enum isl_dim_type type, unsigned pos);
1134 const char *isl_map_get_dim_name(
1135 __isl_keep isl_map *map,
1136 enum isl_dim_type type, unsigned pos);
1138 #include <isl/val.h>
1139 __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1140 __isl_take isl_multi_val *mv,
1141 enum isl_dim_type type, unsigned pos,
1142 __isl_take isl_id *id);
1143 __isl_give isl_id *isl_multi_val_get_dim_id(
1144 __isl_keep isl_multi_val *mv,
1145 enum isl_dim_type type, unsigned pos);
1146 __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1147 __isl_take isl_multi_val *mv,
1148 enum isl_dim_type type, unsigned pos, const char *s);
1150 #include <isl/aff.h>
1151 __isl_give isl_aff *isl_aff_set_dim_id(
1152 __isl_take isl_aff *aff, enum isl_dim_type type,
1153 unsigned pos, __isl_take isl_id *id);
1154 __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1155 __isl_take isl_multi_aff *maff,
1156 enum isl_dim_type type, unsigned pos,
1157 __isl_take isl_id *id);
1158 __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1159 __isl_take isl_pw_aff *pma,
1160 enum isl_dim_type type, unsigned pos,
1161 __isl_take isl_id *id);
1162 __isl_give isl_multi_pw_aff *
1163 isl_multi_pw_aff_set_dim_id(
1164 __isl_take isl_multi_pw_aff *mpa,
1165 enum isl_dim_type type, unsigned pos,
1166 __isl_take isl_id *id);
1167 __isl_give isl_id *isl_multi_aff_get_dim_id(
1168 __isl_keep isl_multi_aff *ma,
1169 enum isl_dim_type type, unsigned pos);
1170 int isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1171 enum isl_dim_type type, unsigned pos);
1172 __isl_give isl_id *isl_pw_aff_get_dim_id(
1173 __isl_keep isl_pw_aff *pa,
1174 enum isl_dim_type type, unsigned pos);
1175 __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1176 __isl_keep isl_pw_multi_aff *pma,
1177 enum isl_dim_type type, unsigned pos);
1178 __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1179 __isl_keep isl_multi_pw_aff *mpa,
1180 enum isl_dim_type type, unsigned pos);
1181 __isl_give isl_aff *isl_aff_set_dim_name(
1182 __isl_take isl_aff *aff, enum isl_dim_type type,
1183 unsigned pos, const char *s);
1184 __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1185 __isl_take isl_multi_aff *maff,
1186 enum isl_dim_type type, unsigned pos, const char *s);
1187 __isl_give isl_multi_pw_aff *
1188 isl_multi_pw_aff_set_dim_name(
1189 __isl_take isl_multi_pw_aff *mpa,
1190 enum isl_dim_type type, unsigned pos, const char *s);
1191 const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1192 enum isl_dim_type type, unsigned pos);
1193 const char *isl_pw_aff_get_dim_name(
1194 __isl_keep isl_pw_aff *pa,
1195 enum isl_dim_type type, unsigned pos);
1196 const char *isl_pw_multi_aff_get_dim_name(
1197 __isl_keep isl_pw_multi_aff *pma,
1198 enum isl_dim_type type, unsigned pos);
1200 #include <isl/polynomial.h>
1201 __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1202 __isl_take isl_qpolynomial *qp,
1203 enum isl_dim_type type, unsigned pos,
1205 __isl_give isl_pw_qpolynomial *
1206 isl_pw_qpolynomial_set_dim_name(
1207 __isl_take isl_pw_qpolynomial *pwqp,
1208 enum isl_dim_type type, unsigned pos,
1210 __isl_give isl_pw_qpolynomial_fold *
1211 isl_pw_qpolynomial_fold_set_dim_name(
1212 __isl_take isl_pw_qpolynomial_fold *pwf,
1213 enum isl_dim_type type, unsigned pos,
1216 Note that C<isl_space_get_name> returns a pointer to some internal
1217 data structure, so the result can only be used while the
1218 corresponding C<isl_space> is alive.
1219 Also note that every function that operates on two sets or relations
1220 requires that both arguments have the same parameters. This also
1221 means that if one of the arguments has named parameters, then the
1222 other needs to have named parameters too and the names need to match.
1223 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1224 arguments may have different parameters (as long as they are named),
1225 in which case the result will have as parameters the union of the parameters of
1228 Given the identifier or name of a dimension (typically a parameter),
1229 its position can be obtained from the following functions.
1231 #include <isl/space.h>
1232 int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1233 enum isl_dim_type type, __isl_keep isl_id *id);
1234 int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1235 enum isl_dim_type type, const char *name);
1237 #include <isl/local_space.h>
1238 int isl_local_space_find_dim_by_name(
1239 __isl_keep isl_local_space *ls,
1240 enum isl_dim_type type, const char *name);
1242 #include <isl/val.h>
1243 int isl_multi_val_find_dim_by_id(
1244 __isl_keep isl_multi_val *mv,
1245 enum isl_dim_type type, __isl_keep isl_id *id);
1246 int isl_multi_val_find_dim_by_name(
1247 __isl_keep isl_multi_val *mv,
1248 enum isl_dim_type type, const char *name);
1250 #include <isl/set.h>
1251 int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1252 enum isl_dim_type type, __isl_keep isl_id *id);
1253 int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1254 enum isl_dim_type type, const char *name);
1256 #include <isl/map.h>
1257 int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1258 enum isl_dim_type type, __isl_keep isl_id *id);
1259 int isl_basic_map_find_dim_by_name(
1260 __isl_keep isl_basic_map *bmap,
1261 enum isl_dim_type type, const char *name);
1262 int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1263 enum isl_dim_type type, const char *name);
1264 int isl_union_map_find_dim_by_name(
1265 __isl_keep isl_union_map *umap,
1266 enum isl_dim_type type, const char *name);
1268 #include <isl/aff.h>
1269 int isl_multi_aff_find_dim_by_id(
1270 __isl_keep isl_multi_aff *ma,
1271 enum isl_dim_type type, __isl_keep isl_id *id);
1272 int isl_multi_pw_aff_find_dim_by_id(
1273 __isl_keep isl_multi_pw_aff *mpa,
1274 enum isl_dim_type type, __isl_keep isl_id *id);
1275 int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1276 enum isl_dim_type type, const char *name);
1277 int isl_multi_aff_find_dim_by_name(
1278 __isl_keep isl_multi_aff *ma,
1279 enum isl_dim_type type, const char *name);
1280 int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1281 enum isl_dim_type type, const char *name);
1282 int isl_multi_pw_aff_find_dim_by_name(
1283 __isl_keep isl_multi_pw_aff *mpa,
1284 enum isl_dim_type type, const char *name);
1285 int isl_pw_multi_aff_find_dim_by_name(
1286 __isl_keep isl_pw_multi_aff *pma,
1287 enum isl_dim_type type, const char *name);
1288 int isl_union_pw_multi_aff_find_dim_by_name(
1289 __isl_keep isl_union_pw_multi_aff *upma,
1290 enum isl_dim_type type, const char *name);
1292 #include <isl/polynomial.h>
1293 int isl_pw_qpolynomial_find_dim_by_name(
1294 __isl_keep isl_pw_qpolynomial *pwqp,
1295 enum isl_dim_type type, const char *name);
1296 int isl_pw_qpolynomial_fold_find_dim_by_name(
1297 __isl_keep isl_pw_qpolynomial_fold *pwf,
1298 enum isl_dim_type type, const char *name);
1299 int isl_union_pw_qpolynomial_find_dim_by_name(
1300 __isl_keep isl_union_pw_qpolynomial *upwqp,
1301 enum isl_dim_type type, const char *name);
1302 int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1303 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1304 enum isl_dim_type type, const char *name);
1306 The identifiers or names of entire spaces may be set or read off
1307 using the following functions.
1309 #include <isl/space.h>
1310 __isl_give isl_space *isl_space_set_tuple_id(
1311 __isl_take isl_space *space,
1312 enum isl_dim_type type, __isl_take isl_id *id);
1313 __isl_give isl_space *isl_space_reset_tuple_id(
1314 __isl_take isl_space *space, enum isl_dim_type type);
1315 int isl_space_has_tuple_id(__isl_keep isl_space *space,
1316 enum isl_dim_type type);
1317 __isl_give isl_id *isl_space_get_tuple_id(
1318 __isl_keep isl_space *space, enum isl_dim_type type);
1319 __isl_give isl_space *isl_space_set_tuple_name(
1320 __isl_take isl_space *space,
1321 enum isl_dim_type type, const char *s);
1322 int isl_space_has_tuple_name(__isl_keep isl_space *space,
1323 enum isl_dim_type type);
1324 const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1325 enum isl_dim_type type);
1327 #include <isl/local_space.h>
1328 __isl_give isl_local_space *isl_local_space_set_tuple_id(
1329 __isl_take isl_local_space *ls,
1330 enum isl_dim_type type, __isl_take isl_id *id);
1332 #include <isl/set.h>
1333 __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1334 __isl_take isl_basic_set *bset,
1335 __isl_take isl_id *id);
1336 __isl_give isl_set *isl_set_set_tuple_id(
1337 __isl_take isl_set *set, __isl_take isl_id *id);
1338 __isl_give isl_set *isl_set_reset_tuple_id(
1339 __isl_take isl_set *set);
1340 int isl_set_has_tuple_id(__isl_keep isl_set *set);
1341 __isl_give isl_id *isl_set_get_tuple_id(
1342 __isl_keep isl_set *set);
1343 __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1344 __isl_take isl_basic_set *set, const char *s);
1345 __isl_give isl_set *isl_set_set_tuple_name(
1346 __isl_take isl_set *set, const char *s);
1347 const char *isl_basic_set_get_tuple_name(
1348 __isl_keep isl_basic_set *bset);
1349 int isl_set_has_tuple_name(__isl_keep isl_set *set);
1350 const char *isl_set_get_tuple_name(
1351 __isl_keep isl_set *set);
1353 #include <isl/map.h>
1354 __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1355 __isl_take isl_basic_map *bmap,
1356 enum isl_dim_type type, __isl_take isl_id *id);
1357 __isl_give isl_map *isl_map_set_tuple_id(
1358 __isl_take isl_map *map, enum isl_dim_type type,
1359 __isl_take isl_id *id);
1360 __isl_give isl_map *isl_map_reset_tuple_id(
1361 __isl_take isl_map *map, enum isl_dim_type type);
1362 int isl_map_has_tuple_id(__isl_keep isl_map *map,
1363 enum isl_dim_type type);
1364 __isl_give isl_id *isl_map_get_tuple_id(
1365 __isl_keep isl_map *map, enum isl_dim_type type);
1366 __isl_give isl_map *isl_map_set_tuple_name(
1367 __isl_take isl_map *map,
1368 enum isl_dim_type type, const char *s);
1369 const char *isl_basic_map_get_tuple_name(
1370 __isl_keep isl_basic_map *bmap,
1371 enum isl_dim_type type);
1372 __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1373 __isl_take isl_basic_map *bmap,
1374 enum isl_dim_type type, const char *s);
1375 int isl_map_has_tuple_name(__isl_keep isl_map *map,
1376 enum isl_dim_type type);
1377 const char *isl_map_get_tuple_name(
1378 __isl_keep isl_map *map,
1379 enum isl_dim_type type);
1381 #include <isl/val.h>
1382 __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1383 __isl_take isl_multi_val *mv,
1384 enum isl_dim_type type, __isl_take isl_id *id);
1385 __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1386 __isl_take isl_multi_val *mv,
1387 enum isl_dim_type type);
1388 int isl_multi_val_has_tuple_id(__isl_keep isl_multi_val *mv,
1389 enum isl_dim_type type);
1390 __isl_give isl_id *isl_multi_val_get_tuple_id(
1391 __isl_keep isl_multi_val *mv,
1392 enum isl_dim_type type);
1393 __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1394 __isl_take isl_multi_val *mv,
1395 enum isl_dim_type type, const char *s);
1396 const char *isl_multi_val_get_tuple_name(
1397 __isl_keep isl_multi_val *mv,
1398 enum isl_dim_type type);
1400 #include <isl/aff.h>
1401 __isl_give isl_aff *isl_aff_set_tuple_id(
1402 __isl_take isl_aff *aff,
1403 enum isl_dim_type type, __isl_take isl_id *id);
1404 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1405 __isl_take isl_multi_aff *maff,
1406 enum isl_dim_type type, __isl_take isl_id *id);
1407 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1408 __isl_take isl_pw_aff *pwaff,
1409 enum isl_dim_type type, __isl_take isl_id *id);
1410 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1411 __isl_take isl_pw_multi_aff *pma,
1412 enum isl_dim_type type, __isl_take isl_id *id);
1413 __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1414 __isl_take isl_multi_aff *ma,
1415 enum isl_dim_type type);
1416 __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1417 __isl_take isl_pw_aff *pa,
1418 enum isl_dim_type type);
1419 __isl_give isl_multi_pw_aff *
1420 isl_multi_pw_aff_reset_tuple_id(
1421 __isl_take isl_multi_pw_aff *mpa,
1422 enum isl_dim_type type);
1423 __isl_give isl_pw_multi_aff *
1424 isl_pw_multi_aff_reset_tuple_id(
1425 __isl_take isl_pw_multi_aff *pma,
1426 enum isl_dim_type type);
1427 int isl_multi_aff_has_tuple_id(__isl_keep isl_multi_aff *ma,
1428 enum isl_dim_type type);
1429 __isl_give isl_id *isl_multi_aff_get_tuple_id(
1430 __isl_keep isl_multi_aff *ma,
1431 enum isl_dim_type type);
1432 int isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1433 enum isl_dim_type type);
1434 __isl_give isl_id *isl_pw_aff_get_tuple_id(
1435 __isl_keep isl_pw_aff *pa,
1436 enum isl_dim_type type);
1437 int isl_pw_multi_aff_has_tuple_id(
1438 __isl_keep isl_pw_multi_aff *pma,
1439 enum isl_dim_type type);
1440 __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1441 __isl_keep isl_pw_multi_aff *pma,
1442 enum isl_dim_type type);
1443 int isl_multi_pw_aff_has_tuple_id(
1444 __isl_keep isl_multi_pw_aff *mpa,
1445 enum isl_dim_type type);
1446 __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1447 __isl_keep isl_multi_pw_aff *mpa,
1448 enum isl_dim_type type);
1449 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1450 __isl_take isl_multi_aff *maff,
1451 enum isl_dim_type type, const char *s);
1452 __isl_give isl_multi_pw_aff *
1453 isl_multi_pw_aff_set_tuple_name(
1454 __isl_take isl_multi_pw_aff *mpa,
1455 enum isl_dim_type type, const char *s);
1456 const char *isl_multi_aff_get_tuple_name(
1457 __isl_keep isl_multi_aff *multi,
1458 enum isl_dim_type type);
1459 int isl_pw_multi_aff_has_tuple_name(
1460 __isl_keep isl_pw_multi_aff *pma,
1461 enum isl_dim_type type);
1462 const char *isl_pw_multi_aff_get_tuple_name(
1463 __isl_keep isl_pw_multi_aff *pma,
1464 enum isl_dim_type type);
1466 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1467 or C<isl_dim_set>. As with C<isl_space_get_name>,
1468 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1470 Binary operations require the corresponding spaces of their arguments
1471 to have the same name.
1473 To keep the names of all parameters and tuples, but reset the user pointers
1474 of all the corresponding identifiers, use the following function.
1476 #include <isl/space.h>
1477 __isl_give isl_space *isl_space_reset_user(
1478 __isl_take isl_space *space);
1480 #include <isl/set.h>
1481 __isl_give isl_set *isl_set_reset_user(
1482 __isl_take isl_set *set);
1484 #include <isl/map.h>
1485 __isl_give isl_map *isl_map_reset_user(
1486 __isl_take isl_map *map);
1488 #include <isl/union_set.h>
1489 __isl_give isl_union_set *isl_union_set_reset_user(
1490 __isl_take isl_union_set *uset);
1492 #include <isl/union_map.h>
1493 __isl_give isl_union_map *isl_union_map_reset_user(
1494 __isl_take isl_union_map *umap);
1496 #include <isl/val.h>
1497 __isl_give isl_multi_val *isl_multi_val_reset_user(
1498 __isl_take isl_multi_val *mv);
1500 #include <isl/aff.h>
1501 __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1502 __isl_take isl_multi_aff *ma);
1503 __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1504 __isl_take isl_pw_aff *pa);
1505 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1506 __isl_take isl_multi_pw_aff *mpa);
1507 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1508 __isl_take isl_pw_multi_aff *pma);
1509 __isl_give isl_union_pw_multi_aff *
1510 isl_union_pw_multi_aff_reset_user(
1511 __isl_take isl_union_pw_multi_aff *upma);
1513 #include <isl/polynomial.h>
1514 __isl_give isl_pw_qpolynomial *
1515 isl_pw_qpolynomial_reset_user(
1516 __isl_take isl_pw_qpolynomial *pwqp);
1517 __isl_give isl_union_pw_qpolynomial *
1518 isl_union_pw_qpolynomial_reset_user(
1519 __isl_take isl_union_pw_qpolynomial *upwqp);
1520 __isl_give isl_pw_qpolynomial_fold *
1521 isl_pw_qpolynomial_fold_reset_user(
1522 __isl_take isl_pw_qpolynomial_fold *pwf);
1523 __isl_give isl_union_pw_qpolynomial_fold *
1524 isl_union_pw_qpolynomial_fold_reset_user(
1525 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1527 Spaces can be nested. In particular, the domain of a set or
1528 the domain or range of a relation can be a nested relation.
1529 This process is also called I<wrapping>.
1530 The functions for detecting, constructing and deconstructing
1531 such nested spaces can be found in the wrapping properties
1532 of L</"Unary Properties">, the wrapping operations
1533 of L</"Unary Operations"> and the Cartesian product operations
1534 of L</"Basic Operations">.
1536 Spaces can be created from other spaces
1537 using the functions described in L</"Unary Operations">
1538 and L</"Binary Operations">.
1542 A local space is essentially a space with
1543 zero or more existentially quantified variables.
1544 The local space of various objects can be obtained
1545 using the following functions.
1547 #include <isl/constraint.h>
1548 __isl_give isl_local_space *isl_constraint_get_local_space(
1549 __isl_keep isl_constraint *constraint);
1551 #include <isl/set.h>
1552 __isl_give isl_local_space *isl_basic_set_get_local_space(
1553 __isl_keep isl_basic_set *bset);
1555 #include <isl/map.h>
1556 __isl_give isl_local_space *isl_basic_map_get_local_space(
1557 __isl_keep isl_basic_map *bmap);
1559 #include <isl/aff.h>
1560 __isl_give isl_local_space *isl_aff_get_domain_local_space(
1561 __isl_keep isl_aff *aff);
1562 __isl_give isl_local_space *isl_aff_get_local_space(
1563 __isl_keep isl_aff *aff);
1565 A new local space can be created from a space using
1567 #include <isl/local_space.h>
1568 __isl_give isl_local_space *isl_local_space_from_space(
1569 __isl_take isl_space *space);
1571 They can be inspected, modified, copied and freed using the following functions.
1573 #include <isl/local_space.h>
1574 int isl_local_space_is_params(
1575 __isl_keep isl_local_space *ls);
1576 int isl_local_space_is_set(__isl_keep isl_local_space *ls);
1577 __isl_give isl_space *isl_local_space_get_space(
1578 __isl_keep isl_local_space *ls);
1579 __isl_give isl_aff *isl_local_space_get_div(
1580 __isl_keep isl_local_space *ls, int pos);
1581 __isl_give isl_local_space *isl_local_space_copy(
1582 __isl_keep isl_local_space *ls);
1583 __isl_null isl_local_space *isl_local_space_free(
1584 __isl_take isl_local_space *ls);
1586 Note that C<isl_local_space_get_div> can only be used on local spaces
1589 Two local spaces can be compared using
1591 int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
1592 __isl_keep isl_local_space *ls2);
1594 Local spaces can be created from other local spaces
1595 using the functions described in L</"Unary Operations">
1596 and L</"Binary Operations">.
1598 =head2 Creating New Sets and Relations
1600 C<isl> has functions for creating some standard sets and relations.
1604 =item * Empty sets and relations
1606 __isl_give isl_basic_set *isl_basic_set_empty(
1607 __isl_take isl_space *space);
1608 __isl_give isl_basic_map *isl_basic_map_empty(
1609 __isl_take isl_space *space);
1610 __isl_give isl_set *isl_set_empty(
1611 __isl_take isl_space *space);
1612 __isl_give isl_map *isl_map_empty(
1613 __isl_take isl_space *space);
1614 __isl_give isl_union_set *isl_union_set_empty(
1615 __isl_take isl_space *space);
1616 __isl_give isl_union_map *isl_union_map_empty(
1617 __isl_take isl_space *space);
1619 For C<isl_union_set>s and C<isl_union_map>s, the space
1620 is only used to specify the parameters.
1622 =item * Universe sets and relations
1624 __isl_give isl_basic_set *isl_basic_set_universe(
1625 __isl_take isl_space *space);
1626 __isl_give isl_basic_map *isl_basic_map_universe(
1627 __isl_take isl_space *space);
1628 __isl_give isl_set *isl_set_universe(
1629 __isl_take isl_space *space);
1630 __isl_give isl_map *isl_map_universe(
1631 __isl_take isl_space *space);
1632 __isl_give isl_union_set *isl_union_set_universe(
1633 __isl_take isl_union_set *uset);
1634 __isl_give isl_union_map *isl_union_map_universe(
1635 __isl_take isl_union_map *umap);
1637 The sets and relations constructed by the functions above
1638 contain all integer values, while those constructed by the
1639 functions below only contain non-negative values.
1641 __isl_give isl_basic_set *isl_basic_set_nat_universe(
1642 __isl_take isl_space *space);
1643 __isl_give isl_basic_map *isl_basic_map_nat_universe(
1644 __isl_take isl_space *space);
1645 __isl_give isl_set *isl_set_nat_universe(
1646 __isl_take isl_space *space);
1647 __isl_give isl_map *isl_map_nat_universe(
1648 __isl_take isl_space *space);
1650 =item * Identity relations
1652 __isl_give isl_basic_map *isl_basic_map_identity(
1653 __isl_take isl_space *space);
1654 __isl_give isl_map *isl_map_identity(
1655 __isl_take isl_space *space);
1657 The number of input and output dimensions in C<space> needs
1660 =item * Lexicographic order
1662 __isl_give isl_map *isl_map_lex_lt(
1663 __isl_take isl_space *set_space);
1664 __isl_give isl_map *isl_map_lex_le(
1665 __isl_take isl_space *set_space);
1666 __isl_give isl_map *isl_map_lex_gt(
1667 __isl_take isl_space *set_space);
1668 __isl_give isl_map *isl_map_lex_ge(
1669 __isl_take isl_space *set_space);
1670 __isl_give isl_map *isl_map_lex_lt_first(
1671 __isl_take isl_space *space, unsigned n);
1672 __isl_give isl_map *isl_map_lex_le_first(
1673 __isl_take isl_space *space, unsigned n);
1674 __isl_give isl_map *isl_map_lex_gt_first(
1675 __isl_take isl_space *space, unsigned n);
1676 __isl_give isl_map *isl_map_lex_ge_first(
1677 __isl_take isl_space *space, unsigned n);
1679 The first four functions take a space for a B<set>
1680 and return relations that express that the elements in the domain
1681 are lexicographically less
1682 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1683 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1684 than the elements in the range.
1685 The last four functions take a space for a map
1686 and return relations that express that the first C<n> dimensions
1687 in the domain are lexicographically less
1688 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1689 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1690 than the first C<n> dimensions in the range.
1694 A basic set or relation can be converted to a set or relation
1695 using the following functions.
1697 __isl_give isl_set *isl_set_from_basic_set(
1698 __isl_take isl_basic_set *bset);
1699 __isl_give isl_map *isl_map_from_basic_map(
1700 __isl_take isl_basic_map *bmap);
1702 Sets and relations can be converted to union sets and relations
1703 using the following functions.
1705 __isl_give isl_union_set *isl_union_set_from_basic_set(
1706 __isl_take isl_basic_set *bset);
1707 __isl_give isl_union_map *isl_union_map_from_basic_map(
1708 __isl_take isl_basic_map *bmap);
1709 __isl_give isl_union_set *isl_union_set_from_set(
1710 __isl_take isl_set *set);
1711 __isl_give isl_union_map *isl_union_map_from_map(
1712 __isl_take isl_map *map);
1714 The inverse conversions below can only be used if the input
1715 union set or relation is known to contain elements in exactly one
1718 __isl_give isl_set *isl_set_from_union_set(
1719 __isl_take isl_union_set *uset);
1720 __isl_give isl_map *isl_map_from_union_map(
1721 __isl_take isl_union_map *umap);
1723 Sets and relations can be copied and freed again using the following
1726 __isl_give isl_basic_set *isl_basic_set_copy(
1727 __isl_keep isl_basic_set *bset);
1728 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1729 __isl_give isl_union_set *isl_union_set_copy(
1730 __isl_keep isl_union_set *uset);
1731 __isl_give isl_basic_map *isl_basic_map_copy(
1732 __isl_keep isl_basic_map *bmap);
1733 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1734 __isl_give isl_union_map *isl_union_map_copy(
1735 __isl_keep isl_union_map *umap);
1736 __isl_null isl_basic_set *isl_basic_set_free(
1737 __isl_take isl_basic_set *bset);
1738 __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1739 __isl_null isl_union_set *isl_union_set_free(
1740 __isl_take isl_union_set *uset);
1741 __isl_null isl_basic_map *isl_basic_map_free(
1742 __isl_take isl_basic_map *bmap);
1743 __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1744 __isl_null isl_union_map *isl_union_map_free(
1745 __isl_take isl_union_map *umap);
1747 Other sets and relations can be constructed by starting
1748 from a universe set or relation, adding equality and/or
1749 inequality constraints and then projecting out the
1750 existentially quantified variables, if any.
1751 Constraints can be constructed, manipulated and
1752 added to (or removed from) (basic) sets and relations
1753 using the following functions.
1755 #include <isl/constraint.h>
1756 __isl_give isl_constraint *isl_equality_alloc(
1757 __isl_take isl_local_space *ls);
1758 __isl_give isl_constraint *isl_inequality_alloc(
1759 __isl_take isl_local_space *ls);
1760 __isl_give isl_constraint *isl_constraint_set_constant_si(
1761 __isl_take isl_constraint *constraint, int v);
1762 __isl_give isl_constraint *isl_constraint_set_constant_val(
1763 __isl_take isl_constraint *constraint,
1764 __isl_take isl_val *v);
1765 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1766 __isl_take isl_constraint *constraint,
1767 enum isl_dim_type type, int pos, int v);
1768 __isl_give isl_constraint *
1769 isl_constraint_set_coefficient_val(
1770 __isl_take isl_constraint *constraint,
1771 enum isl_dim_type type, int pos,
1772 __isl_take isl_val *v);
1773 __isl_give isl_basic_map *isl_basic_map_add_constraint(
1774 __isl_take isl_basic_map *bmap,
1775 __isl_take isl_constraint *constraint);
1776 __isl_give isl_basic_set *isl_basic_set_add_constraint(
1777 __isl_take isl_basic_set *bset,
1778 __isl_take isl_constraint *constraint);
1779 __isl_give isl_map *isl_map_add_constraint(
1780 __isl_take isl_map *map,
1781 __isl_take isl_constraint *constraint);
1782 __isl_give isl_set *isl_set_add_constraint(
1783 __isl_take isl_set *set,
1784 __isl_take isl_constraint *constraint);
1785 __isl_give isl_basic_set *isl_basic_set_drop_constraint(
1786 __isl_take isl_basic_set *bset,
1787 __isl_take isl_constraint *constraint);
1789 For example, to create a set containing the even integers
1790 between 10 and 42, you would use the following code.
1793 isl_local_space *ls;
1795 isl_basic_set *bset;
1797 space = isl_space_set_alloc(ctx, 0, 2);
1798 bset = isl_basic_set_universe(isl_space_copy(space));
1799 ls = isl_local_space_from_space(space);
1801 c = isl_equality_alloc(isl_local_space_copy(ls));
1802 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1803 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1804 bset = isl_basic_set_add_constraint(bset, c);
1806 c = isl_inequality_alloc(isl_local_space_copy(ls));
1807 c = isl_constraint_set_constant_si(c, -10);
1808 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1809 bset = isl_basic_set_add_constraint(bset, c);
1811 c = isl_inequality_alloc(ls);
1812 c = isl_constraint_set_constant_si(c, 42);
1813 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1814 bset = isl_basic_set_add_constraint(bset, c);
1816 bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1820 isl_basic_set *bset;
1821 bset = isl_basic_set_read_from_str(ctx,
1822 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1824 A basic set or relation can also be constructed from two matrices
1825 describing the equalities and the inequalities.
1827 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1828 __isl_take isl_space *space,
1829 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1830 enum isl_dim_type c1,
1831 enum isl_dim_type c2, enum isl_dim_type c3,
1832 enum isl_dim_type c4);
1833 __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1834 __isl_take isl_space *space,
1835 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1836 enum isl_dim_type c1,
1837 enum isl_dim_type c2, enum isl_dim_type c3,
1838 enum isl_dim_type c4, enum isl_dim_type c5);
1840 The C<isl_dim_type> arguments indicate the order in which
1841 different kinds of variables appear in the input matrices
1842 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1843 C<isl_dim_set> and C<isl_dim_div> for sets and
1844 of C<isl_dim_cst>, C<isl_dim_param>,
1845 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1847 A (basic or union) set or relation can also be constructed from a
1848 (union) (piecewise) (multiple) affine expression
1849 or a list of affine expressions
1850 (See L</"Functions">).
1852 __isl_give isl_basic_map *isl_basic_map_from_aff(
1853 __isl_take isl_aff *aff);
1854 __isl_give isl_map *isl_map_from_aff(
1855 __isl_take isl_aff *aff);
1856 __isl_give isl_set *isl_set_from_pw_aff(
1857 __isl_take isl_pw_aff *pwaff);
1858 __isl_give isl_map *isl_map_from_pw_aff(
1859 __isl_take isl_pw_aff *pwaff);
1860 __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1861 __isl_take isl_space *domain_space,
1862 __isl_take isl_aff_list *list);
1863 __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
1864 __isl_take isl_multi_aff *maff)
1865 __isl_give isl_map *isl_map_from_multi_aff(
1866 __isl_take isl_multi_aff *maff)
1867 __isl_give isl_set *isl_set_from_pw_multi_aff(
1868 __isl_take isl_pw_multi_aff *pma);
1869 __isl_give isl_map *isl_map_from_pw_multi_aff(
1870 __isl_take isl_pw_multi_aff *pma);
1871 __isl_give isl_set *isl_set_from_multi_pw_aff(
1872 __isl_take isl_multi_pw_aff *mpa);
1873 __isl_give isl_map *isl_map_from_multi_pw_aff(
1874 __isl_take isl_multi_pw_aff *mpa);
1875 __isl_give isl_union_map *
1876 isl_union_map_from_union_pw_multi_aff(
1877 __isl_take isl_union_pw_multi_aff *upma);
1879 The C<domain_space> argument describes the domain of the resulting
1880 basic relation. It is required because the C<list> may consist
1881 of zero affine expressions.
1883 =head2 Inspecting Sets and Relations
1885 Usually, the user should not have to care about the actual constraints
1886 of the sets and maps, but should instead apply the abstract operations
1887 explained in the following sections.
1888 Occasionally, however, it may be required to inspect the individual
1889 coefficients of the constraints. This section explains how to do so.
1890 In these cases, it may also be useful to have C<isl> compute
1891 an explicit representation of the existentially quantified variables.
1893 __isl_give isl_set *isl_set_compute_divs(
1894 __isl_take isl_set *set);
1895 __isl_give isl_map *isl_map_compute_divs(
1896 __isl_take isl_map *map);
1897 __isl_give isl_union_set *isl_union_set_compute_divs(
1898 __isl_take isl_union_set *uset);
1899 __isl_give isl_union_map *isl_union_map_compute_divs(
1900 __isl_take isl_union_map *umap);
1902 This explicit representation defines the existentially quantified
1903 variables as integer divisions of the other variables, possibly
1904 including earlier existentially quantified variables.
1905 An explicitly represented existentially quantified variable therefore
1906 has a unique value when the values of the other variables are known.
1907 If, furthermore, the same existentials, i.e., existentials
1908 with the same explicit representations, should appear in the
1909 same order in each of the disjuncts of a set or map, then the user should call
1910 either of the following functions.
1912 __isl_give isl_set *isl_set_align_divs(
1913 __isl_take isl_set *set);
1914 __isl_give isl_map *isl_map_align_divs(
1915 __isl_take isl_map *map);
1917 Alternatively, the existentially quantified variables can be removed
1918 using the following functions, which compute an overapproximation.
1920 __isl_give isl_basic_set *isl_basic_set_remove_divs(
1921 __isl_take isl_basic_set *bset);
1922 __isl_give isl_basic_map *isl_basic_map_remove_divs(
1923 __isl_take isl_basic_map *bmap);
1924 __isl_give isl_set *isl_set_remove_divs(
1925 __isl_take isl_set *set);
1926 __isl_give isl_map *isl_map_remove_divs(
1927 __isl_take isl_map *map);
1929 It is also possible to only remove those divs that are defined
1930 in terms of a given range of dimensions or only those for which
1931 no explicit representation is known.
1933 __isl_give isl_basic_set *
1934 isl_basic_set_remove_divs_involving_dims(
1935 __isl_take isl_basic_set *bset,
1936 enum isl_dim_type type,
1937 unsigned first, unsigned n);
1938 __isl_give isl_basic_map *
1939 isl_basic_map_remove_divs_involving_dims(
1940 __isl_take isl_basic_map *bmap,
1941 enum isl_dim_type type,
1942 unsigned first, unsigned n);
1943 __isl_give isl_set *isl_set_remove_divs_involving_dims(
1944 __isl_take isl_set *set, enum isl_dim_type type,
1945 unsigned first, unsigned n);
1946 __isl_give isl_map *isl_map_remove_divs_involving_dims(
1947 __isl_take isl_map *map, enum isl_dim_type type,
1948 unsigned first, unsigned n);
1950 __isl_give isl_basic_set *
1951 isl_basic_set_remove_unknown_divs(
1952 __isl_take isl_basic_set *bset);
1953 __isl_give isl_set *isl_set_remove_unknown_divs(
1954 __isl_take isl_set *set);
1955 __isl_give isl_map *isl_map_remove_unknown_divs(
1956 __isl_take isl_map *map);
1958 To iterate over all the sets or maps in a union set or map, use
1960 int isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
1961 int (*fn)(__isl_take isl_set *set, void *user),
1963 int isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
1964 int (*fn)(__isl_take isl_map *map, void *user),
1967 The number of sets or maps in a union set or map can be obtained
1970 int isl_union_set_n_set(__isl_keep isl_union_set *uset);
1971 int isl_union_map_n_map(__isl_keep isl_union_map *umap);
1973 To extract the set or map in a given space from a union, use
1975 __isl_give isl_set *isl_union_set_extract_set(
1976 __isl_keep isl_union_set *uset,
1977 __isl_take isl_space *space);
1978 __isl_give isl_map *isl_union_map_extract_map(
1979 __isl_keep isl_union_map *umap,
1980 __isl_take isl_space *space);
1982 To iterate over all the basic sets or maps in a set or map, use
1984 int isl_set_foreach_basic_set(__isl_keep isl_set *set,
1985 int (*fn)(__isl_take isl_basic_set *bset, void *user),
1987 int isl_map_foreach_basic_map(__isl_keep isl_map *map,
1988 int (*fn)(__isl_take isl_basic_map *bmap, void *user),
1991 The callback function C<fn> should return 0 if successful and
1992 -1 if an error occurs. In the latter case, or if any other error
1993 occurs, the above functions will return -1.
1995 It should be noted that C<isl> does not guarantee that
1996 the basic sets or maps passed to C<fn> are disjoint.
1997 If this is required, then the user should call one of
1998 the following functions first.
2000 __isl_give isl_set *isl_set_make_disjoint(
2001 __isl_take isl_set *set);
2002 __isl_give isl_map *isl_map_make_disjoint(
2003 __isl_take isl_map *map);
2005 The number of basic sets in a set can be obtained
2006 or the number of basic maps in a map can be obtained
2009 #include <isl/set.h>
2010 int isl_set_n_basic_set(__isl_keep isl_set *set);
2012 #include <isl/map.h>
2013 int isl_map_n_basic_map(__isl_keep isl_map *map);
2015 To iterate over the constraints of a basic set or map, use
2017 #include <isl/constraint.h>
2019 int isl_basic_set_n_constraint(
2020 __isl_keep isl_basic_set *bset);
2021 int isl_basic_set_foreach_constraint(
2022 __isl_keep isl_basic_set *bset,
2023 int (*fn)(__isl_take isl_constraint *c, void *user),
2025 int isl_basic_map_n_constraint(
2026 __isl_keep isl_basic_map *bmap);
2027 int isl_basic_map_foreach_constraint(
2028 __isl_keep isl_basic_map *bmap,
2029 int (*fn)(__isl_take isl_constraint *c, void *user),
2031 __isl_null isl_constraint *isl_constraint_free(
2032 __isl_take isl_constraint *c);
2034 Again, the callback function C<fn> should return 0 if successful and
2035 -1 if an error occurs. In the latter case, or if any other error
2036 occurs, the above functions will return -1.
2037 The constraint C<c> represents either an equality or an inequality.
2038 Use the following function to find out whether a constraint
2039 represents an equality. If not, it represents an inequality.
2041 int isl_constraint_is_equality(
2042 __isl_keep isl_constraint *constraint);
2044 It is also possible to obtain a list of constraints from a basic
2047 #include <isl/constraint.h>
2048 __isl_give isl_constraint_list *
2049 isl_basic_map_get_constraint_list(
2050 __isl_keep isl_basic_map *bmap);
2051 __isl_give isl_constraint_list *
2052 isl_basic_set_get_constraint_list(
2053 __isl_keep isl_basic_set *bset);
2055 These functions require that all existentially quantified variables
2056 have an explicit representation.
2057 The returned list can be manipulated using the functions in L<"Lists">.
2059 The coefficients of the constraints can be inspected using
2060 the following functions.
2062 int isl_constraint_is_lower_bound(
2063 __isl_keep isl_constraint *constraint,
2064 enum isl_dim_type type, unsigned pos);
2065 int isl_constraint_is_upper_bound(
2066 __isl_keep isl_constraint *constraint,
2067 enum isl_dim_type type, unsigned pos);
2068 __isl_give isl_val *isl_constraint_get_constant_val(
2069 __isl_keep isl_constraint *constraint);
2070 __isl_give isl_val *isl_constraint_get_coefficient_val(
2071 __isl_keep isl_constraint *constraint,
2072 enum isl_dim_type type, int pos);
2074 The explicit representations of the existentially quantified
2075 variables can be inspected using the following function.
2076 Note that the user is only allowed to use this function
2077 if the inspected set or map is the result of a call
2078 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2079 The existentially quantified variable is equal to the floor
2080 of the returned affine expression. The affine expression
2081 itself can be inspected using the functions in
2084 __isl_give isl_aff *isl_constraint_get_div(
2085 __isl_keep isl_constraint *constraint, int pos);
2087 To obtain the constraints of a basic set or map in matrix
2088 form, use the following functions.
2090 __isl_give isl_mat *isl_basic_set_equalities_matrix(
2091 __isl_keep isl_basic_set *bset,
2092 enum isl_dim_type c1, enum isl_dim_type c2,
2093 enum isl_dim_type c3, enum isl_dim_type c4);
2094 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2095 __isl_keep isl_basic_set *bset,
2096 enum isl_dim_type c1, enum isl_dim_type c2,
2097 enum isl_dim_type c3, enum isl_dim_type c4);
2098 __isl_give isl_mat *isl_basic_map_equalities_matrix(
2099 __isl_keep isl_basic_map *bmap,
2100 enum isl_dim_type c1,
2101 enum isl_dim_type c2, enum isl_dim_type c3,
2102 enum isl_dim_type c4, enum isl_dim_type c5);
2103 __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2104 __isl_keep isl_basic_map *bmap,
2105 enum isl_dim_type c1,
2106 enum isl_dim_type c2, enum isl_dim_type c3,
2107 enum isl_dim_type c4, enum isl_dim_type c5);
2109 The C<isl_dim_type> arguments dictate the order in which
2110 different kinds of variables appear in the resulting matrix.
2111 For set inputs, they should be a permutation of
2112 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2113 For map inputs, they should be a permutation of
2114 C<isl_dim_cst>, C<isl_dim_param>,
2115 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2119 Points are elements of a set. They can be used to construct
2120 simple sets (boxes) or they can be used to represent the
2121 individual elements of a set.
2122 The zero point (the origin) can be created using
2124 __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2126 The coordinates of a point can be inspected, set and changed
2129 __isl_give isl_val *isl_point_get_coordinate_val(
2130 __isl_keep isl_point *pnt,
2131 enum isl_dim_type type, int pos);
2132 __isl_give isl_point *isl_point_set_coordinate_val(
2133 __isl_take isl_point *pnt,
2134 enum isl_dim_type type, int pos,
2135 __isl_take isl_val *v);
2137 __isl_give isl_point *isl_point_add_ui(
2138 __isl_take isl_point *pnt,
2139 enum isl_dim_type type, int pos, unsigned val);
2140 __isl_give isl_point *isl_point_sub_ui(
2141 __isl_take isl_point *pnt,
2142 enum isl_dim_type type, int pos, unsigned val);
2144 Points can be copied or freed using
2146 __isl_give isl_point *isl_point_copy(
2147 __isl_keep isl_point *pnt);
2148 void isl_point_free(__isl_take isl_point *pnt);
2150 A singleton set can be created from a point using
2152 __isl_give isl_basic_set *isl_basic_set_from_point(
2153 __isl_take isl_point *pnt);
2154 __isl_give isl_set *isl_set_from_point(
2155 __isl_take isl_point *pnt);
2157 and a box can be created from two opposite extremal points using
2159 __isl_give isl_basic_set *isl_basic_set_box_from_points(
2160 __isl_take isl_point *pnt1,
2161 __isl_take isl_point *pnt2);
2162 __isl_give isl_set *isl_set_box_from_points(
2163 __isl_take isl_point *pnt1,
2164 __isl_take isl_point *pnt2);
2166 All elements of a B<bounded> (union) set can be enumerated using
2167 the following functions.
2169 int isl_set_foreach_point(__isl_keep isl_set *set,
2170 int (*fn)(__isl_take isl_point *pnt, void *user),
2172 int isl_union_set_foreach_point(__isl_keep isl_union_set *uset,
2173 int (*fn)(__isl_take isl_point *pnt, void *user),
2176 The function C<fn> is called for each integer point in
2177 C<set> with as second argument the last argument of
2178 the C<isl_set_foreach_point> call. The function C<fn>
2179 should return C<0> on success and C<-1> on failure.
2180 In the latter case, C<isl_set_foreach_point> will stop
2181 enumerating and return C<-1> as well.
2182 If the enumeration is performed successfully and to completion,
2183 then C<isl_set_foreach_point> returns C<0>.
2185 To obtain a single point of a (basic) set, use
2187 __isl_give isl_point *isl_basic_set_sample_point(
2188 __isl_take isl_basic_set *bset);
2189 __isl_give isl_point *isl_set_sample_point(
2190 __isl_take isl_set *set);
2192 If C<set> does not contain any (integer) points, then the
2193 resulting point will be ``void'', a property that can be
2196 int isl_point_is_void(__isl_keep isl_point *pnt);
2200 Besides sets and relation, C<isl> also supports various types of functions.
2201 Each of these types is derived from the value type (see L</"Values">)
2202 or from one of two primitive function types
2203 through the application of zero or more type constructors.
2204 We first describe the primitive type and then we describe
2205 the types derived from these primitive types.
2207 =head3 Primitive Functions
2209 C<isl> support two primitive function types, quasi-affine
2210 expressions and quasipolynomials.
2211 A quasi-affine expression is defined either over a parameter
2212 space or over a set and is composed of integer constants,
2213 parameters and set variables, addition, subtraction and
2214 integer division by an integer constant.
2215 For example, the quasi-affine expression
2217 [n] -> { [x] -> [2*floor((4 n + x)/9] }
2219 maps C<x> to C<2*floor((4 n + x)/9>.
2220 A quasipolynomial is a polynomial expression in quasi-affine
2221 expression. That is, it additionally allows for multiplication.
2222 Note, though, that it is not allowed to construct an integer
2223 division of an expression involving multiplications.
2224 Here is an example of a quasipolynomial that is not
2225 quasi-affine expression
2227 [n] -> { [x] -> (n*floor((4 n + x)/9) }
2229 Note that the external representations of quasi-affine expressions
2230 and quasipolynomials are different. Quasi-affine expressions
2231 use a notation with square brackets just like binary relations,
2232 while quasipolynomials do not. This might change at some point.
2234 If a primitive function is defined over a parameter space,
2235 then the space of the function itself is that of a set.
2236 If it is defined over a set, then the space of the function
2237 is that of a relation. In both cases, the set space (or
2238 the output space) is single-dimensional, anonymous and unstructured.
2239 To create functions with multiple dimensions or with other kinds
2240 of set or output spaces, use multiple expressions
2241 (see L</"Multiple Expressions">).
2245 =item * Quasi-affine Expressions
2247 Besides the expressions described above, a quasi-affine
2248 expression can also be set to NaN. Such expressions
2249 typically represent a failure to represent a result
2250 as a quasi-affine expression.
2252 The zero quasi affine expression or the quasi affine expression
2253 that is equal to a given value or
2254 a specified dimension on a given domain can be created using
2256 #include <isl/aff.h>
2257 __isl_give isl_aff *isl_aff_zero_on_domain(
2258 __isl_take isl_local_space *ls);
2259 __isl_give isl_aff *isl_aff_val_on_domain(
2260 __isl_take isl_local_space *ls,
2261 __isl_take isl_val *val);
2262 __isl_give isl_aff *isl_aff_var_on_domain(
2263 __isl_take isl_local_space *ls,
2264 enum isl_dim_type type, unsigned pos);
2265 __isl_give isl_aff *isl_aff_nan_on_domain(
2266 __isl_take isl_local_space *ls);
2268 Quasi affine expressions can be copied and freed using
2270 #include <isl/aff.h>
2271 __isl_give isl_aff *isl_aff_copy(
2272 __isl_keep isl_aff *aff);
2273 __isl_null isl_aff *isl_aff_free(
2274 __isl_take isl_aff *aff);
2276 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2277 using the following function. The constraint is required to have
2278 a non-zero coefficient for the specified dimension.
2280 #include <isl/constraint.h>
2281 __isl_give isl_aff *isl_constraint_get_bound(
2282 __isl_keep isl_constraint *constraint,
2283 enum isl_dim_type type, int pos);
2285 The entire affine expression of the constraint can also be extracted
2286 using the following function.
2288 #include <isl/constraint.h>
2289 __isl_give isl_aff *isl_constraint_get_aff(
2290 __isl_keep isl_constraint *constraint);
2292 Conversely, an equality constraint equating
2293 the affine expression to zero or an inequality constraint enforcing
2294 the affine expression to be non-negative, can be constructed using
2296 __isl_give isl_constraint *isl_equality_from_aff(
2297 __isl_take isl_aff *aff);
2298 __isl_give isl_constraint *isl_inequality_from_aff(
2299 __isl_take isl_aff *aff);
2301 The coefficients and the integer divisions of an affine expression
2302 can be inspected using the following functions.
2304 #include <isl/aff.h>
2305 __isl_give isl_val *isl_aff_get_constant_val(
2306 __isl_keep isl_aff *aff);
2307 __isl_give isl_val *isl_aff_get_coefficient_val(
2308 __isl_keep isl_aff *aff,
2309 enum isl_dim_type type, int pos);
2310 int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2311 enum isl_dim_type type, int pos);
2312 __isl_give isl_val *isl_aff_get_denominator_val(
2313 __isl_keep isl_aff *aff);
2314 __isl_give isl_aff *isl_aff_get_div(
2315 __isl_keep isl_aff *aff, int pos);
2317 They can be modified using the following functions.
2319 #include <isl/aff.h>
2320 __isl_give isl_aff *isl_aff_set_constant_si(
2321 __isl_take isl_aff *aff, int v);
2322 __isl_give isl_aff *isl_aff_set_constant_val(
2323 __isl_take isl_aff *aff, __isl_take isl_val *v);
2324 __isl_give isl_aff *isl_aff_set_coefficient_si(
2325 __isl_take isl_aff *aff,
2326 enum isl_dim_type type, int pos, int v);
2327 __isl_give isl_aff *isl_aff_set_coefficient_val(
2328 __isl_take isl_aff *aff,
2329 enum isl_dim_type type, int pos,
2330 __isl_take isl_val *v);
2332 __isl_give isl_aff *isl_aff_add_constant_si(
2333 __isl_take isl_aff *aff, int v);
2334 __isl_give isl_aff *isl_aff_add_constant_val(
2335 __isl_take isl_aff *aff, __isl_take isl_val *v);
2336 __isl_give isl_aff *isl_aff_add_constant_num_si(
2337 __isl_take isl_aff *aff, int v);
2338 __isl_give isl_aff *isl_aff_add_coefficient_si(
2339 __isl_take isl_aff *aff,
2340 enum isl_dim_type type, int pos, int v);
2341 __isl_give isl_aff *isl_aff_add_coefficient_val(
2342 __isl_take isl_aff *aff,
2343 enum isl_dim_type type, int pos,
2344 __isl_take isl_val *v);
2346 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2347 set the I<numerator> of the constant or coefficient, while
2348 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2349 the constant or coefficient as a whole.
2350 The C<add_constant> and C<add_coefficient> functions add an integer
2351 or rational value to
2352 the possibly rational constant or coefficient.
2353 The C<add_constant_num> functions add an integer value to
2356 =item * Quasipolynomials
2358 Some simple quasipolynomials can be created using the following functions.
2360 #include <isl/polynomial.h>
2361 __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2362 __isl_take isl_space *domain);
2363 __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2364 __isl_take isl_space *domain);
2365 __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2366 __isl_take isl_space *domain);
2367 __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2368 __isl_take isl_space *domain);
2369 __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2370 __isl_take isl_space *domain);
2371 __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2372 __isl_take isl_space *domain,
2373 __isl_take isl_val *val);
2374 __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2375 __isl_take isl_space *domain,
2376 enum isl_dim_type type, unsigned pos);
2377 __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2378 __isl_take isl_aff *aff);
2380 Recall that the space in which a quasipolynomial lives is a map space
2381 with a one-dimensional range. The C<domain> argument in some of
2382 the functions above corresponds to the domain of this map space.
2384 Quasipolynomials can be copied and freed again using the following
2387 #include <isl/polynomial.h>
2388 __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2389 __isl_keep isl_qpolynomial *qp);
2390 __isl_null isl_qpolynomial *isl_qpolynomial_free(
2391 __isl_take isl_qpolynomial *qp);
2393 The constant term of a quasipolynomial can be extracted using
2395 __isl_give isl_val *isl_qpolynomial_get_constant_val(
2396 __isl_keep isl_qpolynomial *qp);
2398 To iterate over all terms in a quasipolynomial,
2401 int isl_qpolynomial_foreach_term(
2402 __isl_keep isl_qpolynomial *qp,
2403 int (*fn)(__isl_take isl_term *term,
2404 void *user), void *user);
2406 The terms themselves can be inspected and freed using
2409 unsigned isl_term_dim(__isl_keep isl_term *term,
2410 enum isl_dim_type type);
2411 __isl_give isl_val *isl_term_get_coefficient_val(
2412 __isl_keep isl_term *term);
2413 int isl_term_get_exp(__isl_keep isl_term *term,
2414 enum isl_dim_type type, unsigned pos);
2415 __isl_give isl_aff *isl_term_get_div(
2416 __isl_keep isl_term *term, unsigned pos);
2417 void isl_term_free(__isl_take isl_term *term);
2419 Each term is a product of parameters, set variables and
2420 integer divisions. The function C<isl_term_get_exp>
2421 returns the exponent of a given dimensions in the given term.
2427 A reduction represents a maximum or a minimum of its
2429 The only reduction type defined by C<isl> is
2430 C<isl_qpolynomial_fold>.
2432 There are currently no functions to directly create such
2433 objects, but they do appear in the piecewise quasipolynomial
2434 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2436 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2438 Reductions can be copied and freed using
2439 the following functions.
2441 #include <isl/polynomial.h>
2442 __isl_give isl_qpolynomial_fold *
2443 isl_qpolynomial_fold_copy(
2444 __isl_keep isl_qpolynomial_fold *fold);
2445 void isl_qpolynomial_fold_free(
2446 __isl_take isl_qpolynomial_fold *fold);
2448 To iterate over all quasipolynomials in a reduction, use
2450 int isl_qpolynomial_fold_foreach_qpolynomial(
2451 __isl_keep isl_qpolynomial_fold *fold,
2452 int (*fn)(__isl_take isl_qpolynomial *qp,
2453 void *user), void *user);
2455 =head3 Multiple Expressions
2457 A multiple expression represents a sequence of zero or
2458 more base expressions, all defined on the same domain space.
2459 The domain space of the multiple expression is the same
2460 as that of the base expressions, but the range space
2461 can be any space. In case the base expressions have
2462 a set space, the corresponding multiple expression
2463 also has a set space.
2464 Objects of the value type do not have an associated space.
2465 The space of a multiple value is therefore always a set space.
2467 The multiple expression types defined by C<isl>
2468 are C<isl_multi_val>, C<isl_multi_aff> and C<isl_multi_pw_aff>.
2470 A multiple expression with the value zero for
2471 each output (or set) dimension can be created
2472 using the following functions.
2474 #include <isl/val.h>
2475 __isl_give isl_multi_val *isl_multi_val_zero(
2476 __isl_take isl_space *space);
2478 #include <isl/aff.h>
2479 __isl_give isl_multi_aff *isl_multi_aff_zero(
2480 __isl_take isl_space *space);
2481 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2482 __isl_take isl_space *space);
2484 An identity function can be created using the following
2485 functions. The space needs to be that of a relation
2486 with the same number of input and output dimensions.
2488 #include <isl/aff.h>
2489 __isl_give isl_multi_aff *isl_multi_aff_identity(
2490 __isl_take isl_space *space);
2491 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2492 __isl_take isl_space *space);
2494 A function that performs a projection on a universe
2495 relation or set can be created using the following functions.
2496 See also the corresponding
2497 projection operations in L</"Unary Operations">.
2499 #include <isl/aff.h>
2500 __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2501 __isl_take isl_space *space);
2502 __isl_give isl_multi_aff *isl_multi_aff_range_map(
2503 __isl_take isl_space *space);
2504 __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2505 __isl_take isl_space *space,
2506 enum isl_dim_type type,
2507 unsigned first, unsigned n);
2509 A multiple expression can be created from a single
2510 base expression using the following functions.
2511 The space of the created multiple expression is the same
2512 as that of the base expression.
2514 #include <isl/aff.h>
2515 __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2516 __isl_take isl_aff *aff);
2517 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2518 __isl_take isl_pw_aff *pa);
2520 A multiple expression can be created from a list
2521 of base expression in a specified space.
2522 The domain of this space needs to be the same
2523 as the domains of the base expressions in the list.
2524 If the base expressions have a set space (or no associated space),
2525 then this space also needs to be a set space.
2527 #include <isl/val.h>
2528 __isl_give isl_multi_val *isl_multi_val_from_val_list(
2529 __isl_take isl_space *space,
2530 __isl_take isl_val_list *list);
2532 #include <isl/aff.h>
2533 __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2534 __isl_take isl_space *space,
2535 __isl_take isl_aff_list *list);
2537 As a convenience, a multiple piecewise expression can
2538 also be created from a multiple expression.
2539 Each piecewise expression in the result has a single
2542 #include <isl/aff.h>
2543 __isl_give isl_multi_pw_aff *
2544 isl_multi_pw_aff_from_multi_aff(
2545 __isl_take isl_multi_aff *ma);
2547 A multiple quasi-affine expression can be created from
2548 a multiple value with a given domain space using the following
2551 #include <isl/aff.h>
2552 __isl_give isl_multi_aff *
2553 isl_multi_aff_multi_val_on_space(
2554 __isl_take isl_space *space,
2555 __isl_take isl_multi_val *mv);
2557 Multiple expressions can be copied and freed using
2558 the following functions.
2560 #include <isl/val.h>
2561 __isl_give isl_multi_val *isl_multi_val_copy(
2562 __isl_keep isl_multi_val *mv);
2563 __isl_null isl_multi_val *isl_multi_val_free(
2564 __isl_take isl_multi_val *mv);
2566 #include <isl/aff.h>
2567 __isl_give isl_multi_aff *isl_multi_aff_copy(
2568 __isl_keep isl_multi_aff *maff);
2569 __isl_null isl_multi_aff *isl_multi_aff_free(
2570 __isl_take isl_multi_aff *maff);
2571 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2572 __isl_keep isl_multi_pw_aff *mpa);
2573 __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2574 __isl_take isl_multi_pw_aff *mpa);
2576 The base expression at a given position of a multiple
2577 expression can be extracted using the following functions.
2579 #include <isl/val.h>
2580 __isl_give isl_val *isl_multi_val_get_val(
2581 __isl_keep isl_multi_val *mv, int pos);
2583 #include <isl/aff.h>
2584 __isl_give isl_aff *isl_multi_aff_get_aff(
2585 __isl_keep isl_multi_aff *multi, int pos);
2586 __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2587 __isl_keep isl_multi_pw_aff *mpa, int pos);
2589 It can be replaced using the following functions.
2591 #include <isl/val.h>
2592 __isl_give isl_multi_val *isl_multi_val_set_val(
2593 __isl_take isl_multi_val *mv, int pos,
2594 __isl_take isl_val *val);
2596 #include <isl/aff.h>
2597 __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2598 __isl_take isl_multi_aff *multi, int pos,
2599 __isl_take isl_aff *aff);
2601 =head3 Piecewise Expressions
2603 A piecewise expression is an expression that is described
2604 using zero or more base expression defined over the same
2605 number of cells in the domain space of the base expressions.
2606 All base expressions are defined over the same
2607 domain space and the cells are disjoint.
2608 The space of a piecewise expression is the same as
2609 that of the base expressions.
2610 If the union of the cells is a strict subset of the domain
2611 space, then the value of the piecewise expression outside
2612 this union is different for types derived from quasi-affine
2613 expressions and those derived from quasipolynomials.
2614 Piecewise expressions derived from quasi-affine expressions
2615 are considered to be undefined outside the union of their cells.
2616 Piecewise expressions derived from quasipolynomials
2617 are considered to be zero outside the union of their cells.
2619 Piecewise quasipolynomials are mainly used by the C<barvinok>
2620 library for representing the number of elements in a parametric set or map.
2621 For example, the piecewise quasipolynomial
2623 [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2625 represents the number of points in the map
2627 [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2629 The piecewise expression types defined by C<isl>
2630 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2631 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2633 A piecewise expression with no cells can be created using
2634 the following functions.
2636 #include <isl/aff.h>
2637 __isl_give isl_pw_aff *isl_pw_aff_empty(
2638 __isl_take isl_space *space);
2639 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2640 __isl_take isl_space *space);
2642 A piecewise expression with a single universe cell can be
2643 created using the following functions.
2645 #include <isl/aff.h>
2646 __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2647 __isl_take isl_aff *aff);
2648 __isl_give isl_pw_multi_aff *
2649 isl_pw_multi_aff_from_multi_aff(
2650 __isl_take isl_multi_aff *ma);
2652 #include <isl/polynomial.h>
2653 __isl_give isl_pw_qpolynomial *
2654 isl_pw_qpolynomial_from_qpolynomial(
2655 __isl_take isl_qpolynomial *qp);
2657 A piecewise expression with a single specified cell can be
2658 created using the following functions.
2660 #include <isl/aff.h>
2661 __isl_give isl_pw_aff *isl_pw_aff_alloc(
2662 __isl_take isl_set *set, __isl_take isl_aff *aff);
2663 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2664 __isl_take isl_set *set,
2665 __isl_take isl_multi_aff *maff);
2667 #include <isl/polynomial.h>
2668 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2669 __isl_take isl_set *set,
2670 __isl_take isl_qpolynomial *qp);
2672 The following convenience functions first create a base expression and
2673 then create a piecewise expression over a universe domain.
2675 #include <isl/aff.h>
2676 __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2677 __isl_take isl_local_space *ls);
2678 __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2679 __isl_take isl_local_space *ls,
2680 enum isl_dim_type type, unsigned pos);
2681 __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2682 __isl_take isl_local_space *ls);
2683 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2684 __isl_take isl_space *space);
2685 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2686 __isl_take isl_space *space);
2687 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2688 __isl_take isl_space *space);
2689 __isl_give isl_pw_multi_aff *
2690 isl_pw_multi_aff_project_out_map(
2691 __isl_take isl_space *space,
2692 enum isl_dim_type type,
2693 unsigned first, unsigned n);
2695 #include <isl/polynomial.h>
2696 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2697 __isl_take isl_space *space);
2699 The following convenience functions first create a base expression and
2700 then create a piecewise expression over a given domain.
2702 #include <isl/aff.h>
2703 __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2704 __isl_take isl_set *domain,
2705 __isl_take isl_val *v);
2706 __isl_give isl_pw_multi_aff *
2707 isl_pw_multi_aff_multi_val_on_domain(
2708 __isl_take isl_set *domain,
2709 __isl_take isl_multi_val *mv);
2711 As a convenience, a piecewise multiple expression can
2712 also be created from a piecewise expression.
2713 Each multiple expression in the result is derived
2714 from the corresponding base expression.
2716 #include <isl/aff.h>
2717 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2718 __isl_take isl_pw_aff *pa);
2720 Similarly, a piecewise quasipolynomial can be
2721 created from a piecewise quasi-affine expression using
2722 the following function.
2724 #include <isl/polynomial.h>
2725 __isl_give isl_pw_qpolynomial *
2726 isl_pw_qpolynomial_from_pw_aff(
2727 __isl_take isl_pw_aff *pwaff);
2729 Piecewise expressions can be copied and freed using the following functions.
2731 #include <isl/aff.h>
2732 __isl_give isl_pw_aff *isl_pw_aff_copy(
2733 __isl_keep isl_pw_aff *pwaff);
2734 __isl_null isl_pw_aff *isl_pw_aff_free(
2735 __isl_take isl_pw_aff *pwaff);
2736 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
2737 __isl_keep isl_pw_multi_aff *pma);
2738 __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
2739 __isl_take isl_pw_multi_aff *pma);
2741 #include <isl/polynomial.h>
2742 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
2743 __isl_keep isl_pw_qpolynomial *pwqp);
2744 __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
2745 __isl_take isl_pw_qpolynomial *pwqp);
2746 __isl_give isl_pw_qpolynomial_fold *
2747 isl_pw_qpolynomial_fold_copy(
2748 __isl_keep isl_pw_qpolynomial_fold *pwf);
2749 __isl_null isl_pw_qpolynomial_fold *
2750 isl_pw_qpolynomial_fold_free(
2751 __isl_take isl_pw_qpolynomial_fold *pwf);
2753 To iterate over the different cells of a piecewise expression,
2754 use the following functions.
2756 #include <isl/aff.h>
2757 int isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
2758 int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
2759 int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
2760 int (*fn)(__isl_take isl_set *set,
2761 __isl_take isl_aff *aff,
2762 void *user), void *user);
2763 int isl_pw_multi_aff_foreach_piece(
2764 __isl_keep isl_pw_multi_aff *pma,
2765 int (*fn)(__isl_take isl_set *set,
2766 __isl_take isl_multi_aff *maff,
2767 void *user), void *user);
2769 #include <isl/polynomial.h>
2770 int isl_pw_qpolynomial_foreach_piece(
2771 __isl_keep isl_pw_qpolynomial *pwqp,
2772 int (*fn)(__isl_take isl_set *set,
2773 __isl_take isl_qpolynomial *qp,
2774 void *user), void *user);
2775 int isl_pw_qpolynomial_foreach_lifted_piece(
2776 __isl_keep isl_pw_qpolynomial *pwqp,
2777 int (*fn)(__isl_take isl_set *set,
2778 __isl_take isl_qpolynomial *qp,
2779 void *user), void *user);
2780 int isl_pw_qpolynomial_fold_foreach_piece(
2781 __isl_keep isl_pw_qpolynomial_fold *pwf,
2782 int (*fn)(__isl_take isl_set *set,
2783 __isl_take isl_qpolynomial_fold *fold,
2784 void *user), void *user);
2785 int isl_pw_qpolynomial_fold_foreach_lifted_piece(
2786 __isl_keep isl_pw_qpolynomial_fold *pwf,
2787 int (*fn)(__isl_take isl_set *set,
2788 __isl_take isl_qpolynomial_fold *fold,
2789 void *user), void *user);
2791 As usual, the function C<fn> should return C<0> on success
2792 and C<-1> on failure. The difference between
2793 C<isl_pw_qpolynomial_foreach_piece> and
2794 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
2795 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
2796 compute unique representations for all existentially quantified
2797 variables and then turn these existentially quantified variables
2798 into extra set variables, adapting the associated quasipolynomial
2799 accordingly. This means that the C<set> passed to C<fn>
2800 will not have any existentially quantified variables, but that
2801 the dimensions of the sets may be different for different
2802 invocations of C<fn>.
2803 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
2804 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
2806 A piecewise expression consisting of the expressions at a given
2807 position of a piecewise multiple expression can be extracted
2808 using the following function.
2810 #include <isl/aff.h>
2811 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
2812 __isl_keep isl_pw_multi_aff *pma, int pos);
2814 These expressions can be replaced using the following function.
2816 #include <isl/aff.h>
2817 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
2818 __isl_take isl_pw_multi_aff *pma, unsigned pos,
2819 __isl_take isl_pw_aff *pa);
2821 Note that there is a difference between C<isl_multi_pw_aff> and
2822 C<isl_pw_multi_aff> objects. The first is a sequence of piecewise
2823 affine expressions, while the second is a piecewise sequence
2824 of affine expressions. In particular, each of the piecewise
2825 affine expressions in an C<isl_multi_pw_aff> may have a different
2826 domain, while all multiple expressions associated to a cell
2827 in an C<isl_pw_multi_aff> have the same domain.
2828 It is possible to convert between the two, but when converting
2829 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
2830 of the result is the intersection of the domains of the input.
2831 The reverse conversion is exact.
2833 #include <isl/aff.h>
2834 __isl_give isl_pw_multi_aff *
2835 isl_pw_multi_aff_from_multi_pw_aff(
2836 __isl_take isl_multi_pw_aff *mpa);
2837 __isl_give isl_multi_pw_aff *
2838 isl_multi_pw_aff_from_pw_multi_aff(
2839 __isl_take isl_pw_multi_aff *pma);
2841 =head3 Union Expressions
2843 A union expression collects base expressions defined
2844 over different domains. The space of a union expression
2845 is that of the shared parameter space.
2847 The union expression types defined by C<isl>
2848 are C<isl_union_pw_multi_aff>, C<isl_union_pw_qpolynomial> and
2849 C<isl_union_pw_qpolynomial_fold>.
2851 An empty union expression can be created using the following functions.
2853 #include <isl/aff.h>
2854 __isl_give isl_union_pw_multi_aff *
2855 isl_union_pw_multi_aff_empty(
2856 __isl_take isl_space *space);
2858 #include <isl/polynomial.h>
2859 __isl_give isl_union_pw_qpolynomial *
2860 isl_union_pw_qpolynomial_zero(
2861 __isl_take isl_space *space);
2863 A union expression containing a single base expression
2864 can be created using the following functions.
2866 #include <isl/aff.h>
2867 __isl_give isl_union_pw_multi_aff *
2868 isl_union_pw_multi_aff_from_pw_multi_aff(
2869 __isl_take isl_pw_multi_aff *pma);
2871 #include <isl/polynomial.h>
2872 __isl_give isl_union_pw_qpolynomial *
2873 isl_union_pw_qpolynomial_from_pw_qpolynomial(
2874 __isl_take isl_pw_qpolynomial *pwqp);
2876 The following function creates a base expression on each
2877 of the sets in the union set and collects the results.
2879 #include <isl/aff.h>
2880 __isl_give isl_union_pw_multi_aff *
2881 isl_union_pw_multi_aff_multi_val_on_domain(
2882 __isl_take isl_union_set *domain,
2883 __isl_take isl_multi_val *mv);
2885 A base expression can be added to a union expression using
2886 the following functions.
2888 #include <isl/aff.h>
2889 __isl_give isl_union_pw_multi_aff *
2890 isl_union_pw_multi_aff_add_pw_multi_aff(
2891 __isl_take isl_union_pw_multi_aff *upma,
2892 __isl_take isl_pw_multi_aff *pma);
2894 #include <isl/polynomial.h>
2895 __isl_give isl_union_pw_qpolynomial *
2896 isl_union_pw_qpolynomial_add_pw_qpolynomial(
2897 __isl_take isl_union_pw_qpolynomial *upwqp,
2898 __isl_take isl_pw_qpolynomial *pwqp);
2900 Union expressions can be copied and freed using
2901 the following functions.
2903 #include <isl/aff.h>
2904 __isl_give isl_union_pw_multi_aff *
2905 isl_union_pw_multi_aff_copy(
2906 __isl_keep isl_union_pw_multi_aff *upma);
2907 __isl_null isl_union_pw_multi_aff *
2908 isl_union_pw_multi_aff_free(
2909 __isl_take isl_union_pw_multi_aff *upma);
2911 #include <isl/polynomial.h>
2912 __isl_give isl_union_pw_qpolynomial *
2913 isl_union_pw_qpolynomial_copy(
2914 __isl_keep isl_union_pw_qpolynomial *upwqp);
2915 __isl_null isl_union_pw_qpolynomial *
2916 isl_union_pw_qpolynomial_free(
2917 __isl_take isl_union_pw_qpolynomial *upwqp);
2918 __isl_give isl_union_pw_qpolynomial_fold *
2919 isl_union_pw_qpolynomial_fold_copy(
2920 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
2921 __isl_null isl_union_pw_qpolynomial_fold *
2922 isl_union_pw_qpolynomial_fold_free(
2923 __isl_take isl_union_pw_qpolynomial_fold *upwf);
2925 To iterate over the base expressions in a union expression,
2926 use the following functions.
2928 #include <isl/aff.h>
2929 int isl_union_pw_multi_aff_n_pw_multi_aff(
2930 __isl_keep isl_union_pw_multi_aff *upma);
2931 int isl_union_pw_multi_aff_foreach_pw_multi_aff(
2932 __isl_keep isl_union_pw_multi_aff *upma,
2933 int (*fn)(__isl_take isl_pw_multi_aff *pma,
2934 void *user), void *user);
2936 #include <isl/polynomial.h>
2937 int isl_union_pw_qplynomial_n_pw_qpolynomial(
2938 __isl_keep isl_union_pw_qpolynomial *upwqp);
2939 int isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
2940 __isl_keep isl_union_pw_qpolynomial *upwqp,
2941 int (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
2942 void *user), void *user);
2943 int isl_union_pw_qplynomial_fold_n_pw_qpolynomial_fold(
2944 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
2945 int isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
2946 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
2947 int (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
2948 void *user), void *user);
2950 To extract the base expression in a given space from a union, use
2951 the following functions.
2953 #include <isl/aff.h>
2954 __isl_give isl_pw_multi_aff *
2955 isl_union_pw_multi_aff_extract_pw_multi_aff(
2956 __isl_keep isl_union_pw_multi_aff *upma,
2957 __isl_take isl_space *space);
2959 #include <isl/polynomial.h>
2960 __isl_give isl_pw_qpolynomial *
2961 isl_union_pw_qpolynomial_extract_pw_qpolynomial(
2962 __isl_keep isl_union_pw_qpolynomial *upwqp,
2963 __isl_take isl_space *space);
2965 =head2 Input and Output
2967 For set and relation,
2968 C<isl> supports its own input/output format, which is similar
2969 to the C<Omega> format, but also supports the C<PolyLib> format
2971 For other object types, typically only an C<isl> format is supported.
2973 =head3 C<isl> format
2975 The C<isl> format is similar to that of C<Omega>, but has a different
2976 syntax for describing the parameters and allows for the definition
2977 of an existentially quantified variable as the integer division
2978 of an affine expression.
2979 For example, the set of integers C<i> between C<0> and C<n>
2980 such that C<i % 10 <= 6> can be described as
2982 [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
2985 A set or relation can have several disjuncts, separated
2986 by the keyword C<or>. Each disjunct is either a conjunction
2987 of constraints or a projection (C<exists>) of a conjunction
2988 of constraints. The constraints are separated by the keyword
2991 =head3 C<PolyLib> format
2993 If the represented set is a union, then the first line
2994 contains a single number representing the number of disjuncts.
2995 Otherwise, a line containing the number C<1> is optional.
2997 Each disjunct is represented by a matrix of constraints.
2998 The first line contains two numbers representing
2999 the number of rows and columns,
3000 where the number of rows is equal to the number of constraints
3001 and the number of columns is equal to two plus the number of variables.
3002 The following lines contain the actual rows of the constraint matrix.
3003 In each row, the first column indicates whether the constraint
3004 is an equality (C<0>) or inequality (C<1>). The final column
3005 corresponds to the constant term.
3007 If the set is parametric, then the coefficients of the parameters
3008 appear in the last columns before the constant column.
3009 The coefficients of any existentially quantified variables appear
3010 between those of the set variables and those of the parameters.
3012 =head3 Extended C<PolyLib> format
3014 The extended C<PolyLib> format is nearly identical to the
3015 C<PolyLib> format. The only difference is that the line
3016 containing the number of rows and columns of a constraint matrix
3017 also contains four additional numbers:
3018 the number of output dimensions, the number of input dimensions,
3019 the number of local dimensions (i.e., the number of existentially
3020 quantified variables) and the number of parameters.
3021 For sets, the number of ``output'' dimensions is equal
3022 to the number of set dimensions, while the number of ``input''
3027 Objects can be read from input using the following functions.
3029 #include <isl/val.h>
3030 __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3032 __isl_give isl_multi_val *isl_multi_val_read_from_str(
3033 isl_ctx *ctx, const char *str);
3035 #include <isl/set.h>
3036 __isl_give isl_basic_set *isl_basic_set_read_from_file(
3037 isl_ctx *ctx, FILE *input);
3038 __isl_give isl_basic_set *isl_basic_set_read_from_str(
3039 isl_ctx *ctx, const char *str);
3040 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3042 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3045 #include <isl/map.h>
3046 __isl_give isl_basic_map *isl_basic_map_read_from_file(
3047 isl_ctx *ctx, FILE *input);
3048 __isl_give isl_basic_map *isl_basic_map_read_from_str(
3049 isl_ctx *ctx, const char *str);
3050 __isl_give isl_map *isl_map_read_from_file(
3051 isl_ctx *ctx, FILE *input);
3052 __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3055 #include <isl/union_set.h>
3056 __isl_give isl_union_set *isl_union_set_read_from_file(
3057 isl_ctx *ctx, FILE *input);
3058 __isl_give isl_union_set *isl_union_set_read_from_str(
3059 isl_ctx *ctx, const char *str);
3061 #include <isl/union_map.h>
3062 __isl_give isl_union_map *isl_union_map_read_from_file(
3063 isl_ctx *ctx, FILE *input);
3064 __isl_give isl_union_map *isl_union_map_read_from_str(
3065 isl_ctx *ctx, const char *str);
3067 #include <isl/aff.h>
3068 __isl_give isl_aff *isl_aff_read_from_str(
3069 isl_ctx *ctx, const char *str);
3070 __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3071 isl_ctx *ctx, const char *str);
3072 __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3073 isl_ctx *ctx, const char *str);
3074 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3075 isl_ctx *ctx, const char *str);
3076 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3077 isl_ctx *ctx, const char *str);
3078 __isl_give isl_union_pw_multi_aff *
3079 isl_union_pw_multi_aff_read_from_str(
3080 isl_ctx *ctx, const char *str);
3082 #include <isl/polynomial.h>
3083 __isl_give isl_union_pw_qpolynomial *
3084 isl_union_pw_qpolynomial_read_from_str(
3085 isl_ctx *ctx, const char *str);
3087 For sets and relations,
3088 the input format is autodetected and may be either the C<PolyLib> format
3089 or the C<isl> format.
3093 Before anything can be printed, an C<isl_printer> needs to
3096 __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3098 __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3099 __isl_null isl_printer *isl_printer_free(
3100 __isl_take isl_printer *printer);
3101 __isl_give char *isl_printer_get_str(
3102 __isl_keep isl_printer *printer);
3104 The printer can be inspected using the following functions.
3106 FILE *isl_printer_get_file(
3107 __isl_keep isl_printer *printer);
3108 int isl_printer_get_output_format(
3109 __isl_keep isl_printer *p);
3111 The behavior of the printer can be modified in various ways
3113 __isl_give isl_printer *isl_printer_set_output_format(
3114 __isl_take isl_printer *p, int output_format);
3115 __isl_give isl_printer *isl_printer_set_indent(
3116 __isl_take isl_printer *p, int indent);
3117 __isl_give isl_printer *isl_printer_set_indent_prefix(
3118 __isl_take isl_printer *p, const char *prefix);
3119 __isl_give isl_printer *isl_printer_indent(
3120 __isl_take isl_printer *p, int indent);
3121 __isl_give isl_printer *isl_printer_set_prefix(
3122 __isl_take isl_printer *p, const char *prefix);
3123 __isl_give isl_printer *isl_printer_set_suffix(
3124 __isl_take isl_printer *p, const char *suffix);
3126 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3127 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3128 and defaults to C<ISL_FORMAT_ISL>.
3129 Each line in the output is prefixed by C<indent_prefix>,
3130 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3131 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3132 In the C<PolyLib> format output,
3133 the coefficients of the existentially quantified variables
3134 appear between those of the set variables and those
3136 The function C<isl_printer_indent> increases the indentation
3137 by the specified amount (which may be negative).
3139 To actually print something, use
3141 #include <isl/printer.h>
3142 __isl_give isl_printer *isl_printer_print_double(
3143 __isl_take isl_printer *p, double d);
3145 #include <isl/val.h>
3146 __isl_give isl_printer *isl_printer_print_val(
3147 __isl_take isl_printer *p, __isl_keep isl_val *v);
3149 #include <isl/set.h>
3150 __isl_give isl_printer *isl_printer_print_basic_set(
3151 __isl_take isl_printer *printer,
3152 __isl_keep isl_basic_set *bset);
3153 __isl_give isl_printer *isl_printer_print_set(
3154 __isl_take isl_printer *printer,
3155 __isl_keep isl_set *set);
3157 #include <isl/map.h>
3158 __isl_give isl_printer *isl_printer_print_basic_map(
3159 __isl_take isl_printer *printer,
3160 __isl_keep isl_basic_map *bmap);
3161 __isl_give isl_printer *isl_printer_print_map(
3162 __isl_take isl_printer *printer,
3163 __isl_keep isl_map *map);
3165 #include <isl/union_set.h>
3166 __isl_give isl_printer *isl_printer_print_union_set(
3167 __isl_take isl_printer *p,
3168 __isl_keep isl_union_set *uset);
3170 #include <isl/union_map.h>
3171 __isl_give isl_printer *isl_printer_print_union_map(
3172 __isl_take isl_printer *p,
3173 __isl_keep isl_union_map *umap);
3175 #include <isl/val.h>
3176 __isl_give isl_printer *isl_printer_print_multi_val(
3177 __isl_take isl_printer *p,
3178 __isl_keep isl_multi_val *mv);
3180 #include <isl/aff.h>
3181 __isl_give isl_printer *isl_printer_print_aff(
3182 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3183 __isl_give isl_printer *isl_printer_print_multi_aff(
3184 __isl_take isl_printer *p,
3185 __isl_keep isl_multi_aff *maff);
3186 __isl_give isl_printer *isl_printer_print_pw_aff(
3187 __isl_take isl_printer *p,
3188 __isl_keep isl_pw_aff *pwaff);
3189 __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3190 __isl_take isl_printer *p,
3191 __isl_keep isl_pw_multi_aff *pma);
3192 __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3193 __isl_take isl_printer *p,
3194 __isl_keep isl_multi_pw_aff *mpa);
3195 __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3196 __isl_take isl_printer *p,
3197 __isl_keep isl_union_pw_multi_aff *upma);
3199 #include <isl/polynomial.h>
3200 __isl_give isl_printer *isl_printer_print_qpolynomial(
3201 __isl_take isl_printer *p,
3202 __isl_keep isl_qpolynomial *qp);
3203 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3204 __isl_take isl_printer *p,
3205 __isl_keep isl_pw_qpolynomial *pwqp);
3206 __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3207 __isl_take isl_printer *p,
3208 __isl_keep isl_union_pw_qpolynomial *upwqp);
3210 __isl_give isl_printer *
3211 isl_printer_print_pw_qpolynomial_fold(
3212 __isl_take isl_printer *p,
3213 __isl_keep isl_pw_qpolynomial_fold *pwf);
3214 __isl_give isl_printer *
3215 isl_printer_print_union_pw_qpolynomial_fold(
3216 __isl_take isl_printer *p,
3217 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3219 For C<isl_printer_print_qpolynomial>,
3220 C<isl_printer_print_pw_qpolynomial> and
3221 C<isl_printer_print_pw_qpolynomial_fold>,
3222 the output format of the printer
3223 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3224 For C<isl_printer_print_union_pw_qpolynomial> and
3225 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3227 In case of printing in C<ISL_FORMAT_C>, the user may want
3228 to set the names of all dimensions first.
3230 When called on a file printer, the following function flushes
3231 the file. When called on a string printer, the buffer is cleared.
3233 __isl_give isl_printer *isl_printer_flush(
3234 __isl_take isl_printer *p);
3236 Alternatively, a string representation can be obtained
3237 directly using the following functions, which always print
3240 #include <isl/space.h>
3241 __isl_give char *isl_space_to_str(
3242 __isl_keep isl_space *space);
3244 #include <isl/val.h>
3245 __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3246 __isl_give char *isl_multi_val_to_str(
3247 __isl_keep isl_multi_val *mv);
3249 #include <isl/set.h>
3250 __isl_give char *isl_set_to_str(
3251 __isl_keep isl_set *set);
3253 #include <isl/union_set.h>
3254 __isl_give char *isl_union_set_to_str(
3255 __isl_keep isl_union_set *uset);
3257 #include <isl/map.h>
3258 __isl_give char *isl_map_to_str(
3259 __isl_keep isl_map *map);
3261 #include <isl/union_map.h>
3262 __isl_give char *isl_union_map_to_str(
3263 __isl_keep isl_union_map *umap);
3265 #include <isl/aff.h>
3266 __isl_give char *isl_multi_aff_to_str(
3267 __isl_keep isl_multi_aff *aff);
3268 __isl_give char *isl_union_pw_multi_aff_to_str(
3269 __isl_keep isl_union_pw_multi_aff *upma);
3273 =head3 Unary Properties
3279 The following functions test whether the given set or relation
3280 contains any integer points. The ``plain'' variants do not perform
3281 any computations, but simply check if the given set or relation
3282 is already known to be empty.
3284 int isl_basic_set_plain_is_empty(__isl_keep isl_basic_set *bset);
3285 int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
3286 int isl_set_plain_is_empty(__isl_keep isl_set *set);
3287 int isl_set_is_empty(__isl_keep isl_set *set);
3288 int isl_union_set_is_empty(__isl_keep isl_union_set *uset);
3289 int isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
3290 int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
3291 int isl_map_plain_is_empty(__isl_keep isl_map *map);
3292 int isl_map_is_empty(__isl_keep isl_map *map);
3293 int isl_union_map_is_empty(__isl_keep isl_union_map *umap);
3295 =item * Universality
3297 int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
3298 int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
3299 int isl_set_plain_is_universe(__isl_keep isl_set *set);
3301 =item * Single-valuedness
3303 #include <isl/set.h>
3304 int isl_set_is_singleton(__isl_keep isl_set *set);
3306 #include <isl/map.h>
3307 int isl_basic_map_is_single_valued(
3308 __isl_keep isl_basic_map *bmap);
3309 int isl_map_plain_is_single_valued(
3310 __isl_keep isl_map *map);
3311 int isl_map_is_single_valued(__isl_keep isl_map *map);
3313 #include <isl/union_map.h>
3314 int isl_union_map_is_single_valued(__isl_keep isl_union_map *umap);
3318 int isl_map_plain_is_injective(__isl_keep isl_map *map);
3319 int isl_map_is_injective(__isl_keep isl_map *map);
3320 int isl_union_map_plain_is_injective(
3321 __isl_keep isl_union_map *umap);
3322 int isl_union_map_is_injective(
3323 __isl_keep isl_union_map *umap);
3327 int isl_map_is_bijective(__isl_keep isl_map *map);
3328 int isl_union_map_is_bijective(__isl_keep isl_union_map *umap);
3332 __isl_give isl_val *
3333 isl_basic_map_plain_get_val_if_fixed(
3334 __isl_keep isl_basic_map *bmap,
3335 enum isl_dim_type type, unsigned pos);
3336 __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3337 __isl_keep isl_set *set,
3338 enum isl_dim_type type, unsigned pos);
3339 __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3340 __isl_keep isl_map *map,
3341 enum isl_dim_type type, unsigned pos);
3343 If the set or relation obviously lies on a hyperplane where the given dimension
3344 has a fixed value, then return that value.
3345 Otherwise return NaN.
3349 int isl_set_dim_residue_class_val(
3350 __isl_keep isl_set *set,
3351 int pos, __isl_give isl_val **modulo,
3352 __isl_give isl_val **residue);
3354 Check if the values of the given set dimension are equal to a fixed
3355 value modulo some integer value. If so, assign the modulo to C<*modulo>
3356 and the fixed value to C<*residue>. If the given dimension attains only
3357 a single value, then assign C<0> to C<*modulo> and the fixed value to
3359 If the dimension does not attain only a single value and if no modulo
3360 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3364 To check whether the description of a set, relation or function depends
3365 on one or more given dimensions,
3366 the following functions can be used.
3368 #include <isl/constraint.h>
3369 int isl_constraint_involves_dims(
3370 __isl_keep isl_constraint *constraint,
3371 enum isl_dim_type type, unsigned first, unsigned n);
3373 #include <isl/set.h>
3374 int isl_basic_set_involves_dims(
3375 __isl_keep isl_basic_set *bset,
3376 enum isl_dim_type type, unsigned first, unsigned n);
3377 int isl_set_involves_dims(__isl_keep isl_set *set,
3378 enum isl_dim_type type, unsigned first, unsigned n);
3380 #include <isl/map.h>
3381 int isl_basic_map_involves_dims(
3382 __isl_keep isl_basic_map *bmap,
3383 enum isl_dim_type type, unsigned first, unsigned n);
3384 int isl_map_involves_dims(__isl_keep isl_map *map,
3385 enum isl_dim_type type, unsigned first, unsigned n);
3387 #include <isl/union_map.h>
3388 int isl_union_map_involves_dims(
3389 __isl_keep isl_union_map *umap,
3390 enum isl_dim_type type, unsigned first, unsigned n);
3392 #include <isl/aff.h>
3393 int isl_aff_involves_dims(__isl_keep isl_aff *aff,
3394 enum isl_dim_type type, unsigned first, unsigned n);
3395 int isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff,
3396 enum isl_dim_type type, unsigned first, unsigned n);
3397 int isl_multi_aff_involves_dims(
3398 __isl_keep isl_multi_aff *ma,
3399 enum isl_dim_type type, unsigned first, unsigned n);
3400 int isl_multi_pw_aff_involves_dims(
3401 __isl_keep isl_multi_pw_aff *mpa,
3402 enum isl_dim_type type, unsigned first, unsigned n);
3404 Similarly, the following functions can be used to check whether
3405 a given dimension is involved in any lower or upper bound.
3407 #include <isl/set.h>
3408 int isl_set_dim_has_any_lower_bound(__isl_keep isl_set *set,
3409 enum isl_dim_type type, unsigned pos);
3410 int isl_set_dim_has_any_upper_bound(__isl_keep isl_set *set,
3411 enum isl_dim_type type, unsigned pos);
3413 Note that these functions return true even if there is a bound on
3414 the dimension on only some of the basic sets of C<set>.
3415 To check if they have a bound for all of the basic sets in C<set>,
3416 use the following functions instead.
3418 #include <isl/set.h>
3419 int isl_set_dim_has_lower_bound(__isl_keep isl_set *set,
3420 enum isl_dim_type type, unsigned pos);
3421 int isl_set_dim_has_upper_bound(__isl_keep isl_set *set,
3422 enum isl_dim_type type, unsigned pos);
3426 To check whether a set is a parameter domain, use this function:
3428 int isl_set_is_params(__isl_keep isl_set *set);
3429 int isl_union_set_is_params(
3430 __isl_keep isl_union_set *uset);
3434 The following functions check whether the space of the given
3435 (basic) set or relation range is a wrapped relation.
3437 #include <isl/space.h>
3438 int isl_space_is_wrapping(
3439 __isl_keep isl_space *space);
3440 int isl_space_domain_is_wrapping(
3441 __isl_keep isl_space *space);
3442 int isl_space_range_is_wrapping(
3443 __isl_keep isl_space *space);
3445 #include <isl/set.h>
3446 int isl_basic_set_is_wrapping(
3447 __isl_keep isl_basic_set *bset);
3448 int isl_set_is_wrapping(__isl_keep isl_set *set);
3450 #include <isl/map.h>
3451 int isl_map_domain_is_wrapping(
3452 __isl_keep isl_map *map);
3453 int isl_map_range_is_wrapping(
3454 __isl_keep isl_map *map);
3456 #include <isl/val.h>
3457 int isl_multi_val_range_is_wrapping(
3458 __isl_keep isl_multi_val *mv);
3460 #include <isl/aff.h>
3461 int isl_multi_aff_range_is_wrapping(
3462 __isl_keep isl_multi_aff *ma);
3463 int isl_multi_pw_aff_range_is_wrapping(
3464 __isl_keep isl_multi_pw_aff *mpa);
3466 The input to C<isl_space_is_wrapping> should
3467 be the space of a set, while that of
3468 C<isl_space_domain_is_wrapping> and
3469 C<isl_space_range_is_wrapping> should be the space of a relation.
3471 =item * Internal Product
3473 int isl_basic_map_can_zip(
3474 __isl_keep isl_basic_map *bmap);
3475 int isl_map_can_zip(__isl_keep isl_map *map);
3477 Check whether the product of domain and range of the given relation
3479 i.e., whether both domain and range are nested relations.
3483 int isl_basic_map_can_curry(
3484 __isl_keep isl_basic_map *bmap);
3485 int isl_map_can_curry(__isl_keep isl_map *map);
3487 Check whether the domain of the (basic) relation is a wrapped relation.
3489 int isl_basic_map_can_uncurry(
3490 __isl_keep isl_basic_map *bmap);
3491 int isl_map_can_uncurry(__isl_keep isl_map *map);
3493 Check whether the range of the (basic) relation is a wrapped relation.
3495 =item * Special Values
3497 #include <isl/aff.h>
3498 int isl_aff_is_cst(__isl_keep isl_aff *aff);
3499 int isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3501 Check whether the given expression is a constant.
3503 #include <isl/aff.h>
3504 int isl_aff_is_nan(__isl_keep isl_aff *aff);
3505 int isl_pw_aff_involves_nan(__isl_keep isl_pw_aff *pa);
3507 Check whether the given expression is equal to or involves NaN.
3509 #include <isl/aff.h>
3510 int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
3512 Check whether the affine expression is obviously zero.
3516 =head3 Binary Properties
3522 The following functions check whether two objects
3523 represent the same set, relation or function.
3524 The C<plain> variants only return true if the objects
3525 are obviously the same. That is, they may return false
3526 even if the objects are the same, but they will never
3527 return true if the objects are not the same.
3529 #include <isl/set.h>
3530 int isl_basic_set_plain_is_equal(
3531 __isl_keep isl_basic_set *bset1,
3532 __isl_keep isl_basic_set *bset2);
3533 int isl_set_plain_is_equal(__isl_keep isl_set *set1,
3534 __isl_keep isl_set *set2);
3535 int isl_set_is_equal(__isl_keep isl_set *set1,
3536 __isl_keep isl_set *set2);
3538 #include <isl/map.h>
3539 int isl_basic_map_is_equal(
3540 __isl_keep isl_basic_map *bmap1,
3541 __isl_keep isl_basic_map *bmap2);
3542 int isl_map_is_equal(__isl_keep isl_map *map1,
3543 __isl_keep isl_map *map2);
3544 int isl_map_plain_is_equal(__isl_keep isl_map *map1,
3545 __isl_keep isl_map *map2);
3547 #include <isl/union_set.h>
3548 int isl_union_set_is_equal(
3549 __isl_keep isl_union_set *uset1,
3550 __isl_keep isl_union_set *uset2);
3552 #include <isl/union_map.h>
3553 int isl_union_map_is_equal(
3554 __isl_keep isl_union_map *umap1,
3555 __isl_keep isl_union_map *umap2);
3557 #include <isl/aff.h>
3558 int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1,
3559 __isl_keep isl_aff *aff2);
3560 int isl_multi_aff_plain_is_equal(
3561 __isl_keep isl_multi_aff *maff1,
3562 __isl_keep isl_multi_aff *maff2);
3563 int isl_pw_aff_plain_is_equal(
3564 __isl_keep isl_pw_aff *pwaff1,
3565 __isl_keep isl_pw_aff *pwaff2);
3566 int isl_pw_multi_aff_plain_is_equal(
3567 __isl_keep isl_pw_multi_aff *pma1,
3568 __isl_keep isl_pw_multi_aff *pma2);
3569 int isl_multi_pw_aff_plain_is_equal(
3570 __isl_keep isl_multi_pw_aff *mpa1,
3571 __isl_keep isl_multi_pw_aff *mpa2);
3572 int isl_multi_pw_aff_is_equal(
3573 __isl_keep isl_multi_pw_aff *mpa1,
3574 __isl_keep isl_multi_pw_aff *mpa2);
3575 int isl_union_pw_multi_aff_plain_is_equal(
3576 __isl_keep isl_union_pw_multi_aff *upma1,
3577 __isl_keep isl_union_pw_multi_aff *upma2);
3579 #include <isl/polynomial.h>
3580 int isl_union_pw_qpolynomial_plain_is_equal(
3581 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3582 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3583 int isl_union_pw_qpolynomial_fold_plain_is_equal(
3584 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3585 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3587 =item * Disjointness
3589 #include <isl/set.h>
3590 int isl_basic_set_is_disjoint(
3591 __isl_keep isl_basic_set *bset1,
3592 __isl_keep isl_basic_set *bset2);
3593 int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
3594 __isl_keep isl_set *set2);
3595 int isl_set_is_disjoint(__isl_keep isl_set *set1,
3596 __isl_keep isl_set *set2);
3598 #include <isl/map.h>
3599 int isl_basic_map_is_disjoint(
3600 __isl_keep isl_basic_map *bmap1,
3601 __isl_keep isl_basic_map *bmap2);
3602 int isl_map_is_disjoint(__isl_keep isl_map *map1,
3603 __isl_keep isl_map *map2);
3605 #include <isl/union_set.h>
3606 int isl_union_set_is_disjoint(
3607 __isl_keep isl_union_set *uset1,
3608 __isl_keep isl_union_set *uset2);
3610 #include <isl/union_map.h>
3611 int isl_union_map_is_disjoint(
3612 __isl_keep isl_union_map *umap1,
3613 __isl_keep isl_union_map *umap2);
3617 int isl_basic_set_is_subset(
3618 __isl_keep isl_basic_set *bset1,
3619 __isl_keep isl_basic_set *bset2);
3620 int isl_set_is_subset(__isl_keep isl_set *set1,
3621 __isl_keep isl_set *set2);
3622 int isl_set_is_strict_subset(
3623 __isl_keep isl_set *set1,
3624 __isl_keep isl_set *set2);
3625 int isl_union_set_is_subset(
3626 __isl_keep isl_union_set *uset1,
3627 __isl_keep isl_union_set *uset2);
3628 int isl_union_set_is_strict_subset(
3629 __isl_keep isl_union_set *uset1,
3630 __isl_keep isl_union_set *uset2);
3631 int isl_basic_map_is_subset(
3632 __isl_keep isl_basic_map *bmap1,
3633 __isl_keep isl_basic_map *bmap2);
3634 int isl_basic_map_is_strict_subset(
3635 __isl_keep isl_basic_map *bmap1,
3636 __isl_keep isl_basic_map *bmap2);
3637 int isl_map_is_subset(
3638 __isl_keep isl_map *map1,
3639 __isl_keep isl_map *map2);
3640 int isl_map_is_strict_subset(
3641 __isl_keep isl_map *map1,
3642 __isl_keep isl_map *map2);
3643 int isl_union_map_is_subset(
3644 __isl_keep isl_union_map *umap1,
3645 __isl_keep isl_union_map *umap2);
3646 int isl_union_map_is_strict_subset(
3647 __isl_keep isl_union_map *umap1,
3648 __isl_keep isl_union_map *umap2);
3650 Check whether the first argument is a (strict) subset of the
3655 Every comparison function returns a negative value if the first
3656 argument is considered smaller than the second, a positive value
3657 if the first argument is considered greater and zero if the two
3658 constraints are considered the same by the comparison criterion.
3660 #include <isl/constraint.h>
3661 int isl_constraint_plain_cmp(
3662 __isl_keep isl_constraint *c1,
3663 __isl_keep isl_constraint *c2);
3665 This function is useful for sorting C<isl_constraint>s.
3666 The order depends on the internal representation of the inputs.
3667 The order is fixed over different calls to the function (assuming
3668 the internal representation of the inputs has not changed), but may
3669 change over different versions of C<isl>.
3671 #include <isl/constraint.h>
3672 int isl_constraint_cmp_last_non_zero(
3673 __isl_keep isl_constraint *c1,
3674 __isl_keep isl_constraint *c2);
3676 This function can be used to sort constraints that live in the same
3677 local space. Constraints that involve ``earlier'' dimensions or
3678 that have a smaller coefficient for the shared latest dimension
3679 are considered smaller than other constraints.
3680 This function only defines a B<partial> order.
3682 #include <isl/set.h>
3683 int isl_set_plain_cmp(__isl_keep isl_set *set1,
3684 __isl_keep isl_set *set2);
3686 This function is useful for sorting C<isl_set>s.
3687 The order depends on the internal representation of the inputs.
3688 The order is fixed over different calls to the function (assuming
3689 the internal representation of the inputs has not changed), but may
3690 change over different versions of C<isl>.
3692 #include <isl/aff.h>
3693 int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
3694 __isl_keep isl_pw_aff *pa2);
3696 The function C<isl_pw_aff_plain_cmp> can be used to sort
3697 C<isl_pw_aff>s. The order is not strictly defined.
3698 The current order sorts expressions that only involve
3699 earlier dimensions before those that involve later dimensions.
3703 =head2 Unary Operations
3709 __isl_give isl_set *isl_set_complement(
3710 __isl_take isl_set *set);
3711 __isl_give isl_map *isl_map_complement(
3712 __isl_take isl_map *map);
3716 #include <isl/space.h>
3717 __isl_give isl_space *isl_space_reverse(
3718 __isl_take isl_space *space);
3720 #include <isl/map.h>
3721 __isl_give isl_basic_map *isl_basic_map_reverse(
3722 __isl_take isl_basic_map *bmap);
3723 __isl_give isl_map *isl_map_reverse(
3724 __isl_take isl_map *map);
3726 #include <isl/union_map.h>
3727 __isl_give isl_union_map *isl_union_map_reverse(
3728 __isl_take isl_union_map *umap);
3732 #include <isl/space.h>
3733 __isl_give isl_space *isl_space_domain(
3734 __isl_take isl_space *space);
3735 __isl_give isl_space *isl_space_range(
3736 __isl_take isl_space *space);
3737 __isl_give isl_space *isl_space_params(
3738 __isl_take isl_space *space);
3740 #include <isl/local_space.h>
3741 __isl_give isl_local_space *isl_local_space_domain(
3742 __isl_take isl_local_space *ls);
3743 __isl_give isl_local_space *isl_local_space_range(
3744 __isl_take isl_local_space *ls);
3746 #include <isl/set.h>
3747 __isl_give isl_basic_set *isl_basic_set_project_out(
3748 __isl_take isl_basic_set *bset,
3749 enum isl_dim_type type, unsigned first, unsigned n);
3750 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
3751 enum isl_dim_type type, unsigned first, unsigned n);
3752 __isl_give isl_basic_set *isl_basic_set_params(
3753 __isl_take isl_basic_set *bset);
3754 __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
3756 #include <isl/map.h>
3757 __isl_give isl_basic_map *isl_basic_map_project_out(
3758 __isl_take isl_basic_map *bmap,
3759 enum isl_dim_type type, unsigned first, unsigned n);
3760 __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
3761 enum isl_dim_type type, unsigned first, unsigned n);
3762 __isl_give isl_basic_set *isl_basic_map_domain(
3763 __isl_take isl_basic_map *bmap);
3764 __isl_give isl_basic_set *isl_basic_map_range(
3765 __isl_take isl_basic_map *bmap);
3766 __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
3767 __isl_give isl_set *isl_map_domain(
3768 __isl_take isl_map *bmap);
3769 __isl_give isl_set *isl_map_range(
3770 __isl_take isl_map *map);
3772 #include <isl/union_set.h>
3773 __isl_give isl_union_set *isl_union_set_project_out(
3774 __isl_take isl_union_set *uset,
3775 enum isl_dim_type type,
3776 unsigned first, unsigned n);
3777 __isl_give isl_set *isl_union_set_params(
3778 __isl_take isl_union_set *uset);
3780 The function C<isl_union_set_project_out> can only project out
3783 #include <isl/union_map.h>
3784 __isl_give isl_union_map *isl_union_map_project_out(
3785 __isl_take isl_union_map *umap,
3786 enum isl_dim_type type, unsigned first, unsigned n);
3787 __isl_give isl_set *isl_union_map_params(
3788 __isl_take isl_union_map *umap);
3789 __isl_give isl_union_set *isl_union_map_domain(
3790 __isl_take isl_union_map *umap);
3791 __isl_give isl_union_set *isl_union_map_range(
3792 __isl_take isl_union_map *umap);
3794 The function C<isl_union_map_project_out> can only project out
3797 #include <isl/aff.h>
3798 __isl_give isl_aff *isl_aff_project_domain_on_params(
3799 __isl_take isl_aff *aff);
3800 __isl_give isl_pw_multi_aff *
3801 isl_pw_multi_aff_project_domain_on_params(
3802 __isl_take isl_pw_multi_aff *pma);
3803 __isl_give isl_set *isl_pw_aff_domain(
3804 __isl_take isl_pw_aff *pwaff);
3805 __isl_give isl_set *isl_pw_multi_aff_domain(
3806 __isl_take isl_pw_multi_aff *pma);
3807 __isl_give isl_set *isl_multi_pw_aff_domain(
3808 __isl_take isl_multi_pw_aff *mpa);
3809 __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
3810 __isl_take isl_union_pw_multi_aff *upma);
3811 __isl_give isl_set *isl_pw_aff_params(
3812 __isl_take isl_pw_aff *pwa);
3814 #include <isl/polynomial.h>
3815 __isl_give isl_qpolynomial *
3816 isl_qpolynomial_project_domain_on_params(
3817 __isl_take isl_qpolynomial *qp);
3818 __isl_give isl_pw_qpolynomial *
3819 isl_pw_qpolynomial_project_domain_on_params(
3820 __isl_take isl_pw_qpolynomial *pwqp);
3821 __isl_give isl_pw_qpolynomial_fold *
3822 isl_pw_qpolynomial_fold_project_domain_on_params(
3823 __isl_take isl_pw_qpolynomial_fold *pwf);
3824 __isl_give isl_set *isl_pw_qpolynomial_domain(
3825 __isl_take isl_pw_qpolynomial *pwqp);
3826 __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
3827 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3828 __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
3829 __isl_take isl_union_pw_qpolynomial *upwqp);
3831 #include <isl/space.h>
3832 __isl_give isl_space *isl_space_domain_map(
3833 __isl_take isl_space *space);
3834 __isl_give isl_space *isl_space_range_map(
3835 __isl_take isl_space *space);
3837 #include <isl/map.h>
3838 __isl_give isl_map *isl_set_wrapped_domain_map(
3839 __isl_take isl_set *set);
3840 __isl_give isl_basic_map *isl_basic_map_domain_map(
3841 __isl_take isl_basic_map *bmap);
3842 __isl_give isl_basic_map *isl_basic_map_range_map(
3843 __isl_take isl_basic_map *bmap);
3844 __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
3845 __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
3847 #include <isl/union_map.h>
3848 __isl_give isl_union_map *isl_union_map_domain_map(
3849 __isl_take isl_union_map *umap);
3850 __isl_give isl_union_map *isl_union_map_range_map(
3851 __isl_take isl_union_map *umap);
3852 __isl_give isl_union_map *
3853 isl_union_set_wrapped_domain_map(
3854 __isl_take isl_union_set *uset);
3856 The functions above construct a (basic, regular or union) relation
3857 that maps (a wrapped version of) the input relation to its domain or range.
3858 C<isl_set_wrapped_domain_map> maps the input set to the domain
3859 of its wrapped relation.
3863 __isl_give isl_basic_set *isl_basic_set_eliminate(
3864 __isl_take isl_basic_set *bset,
3865 enum isl_dim_type type,
3866 unsigned first, unsigned n);
3867 __isl_give isl_set *isl_set_eliminate(
3868 __isl_take isl_set *set, enum isl_dim_type type,
3869 unsigned first, unsigned n);
3870 __isl_give isl_basic_map *isl_basic_map_eliminate(
3871 __isl_take isl_basic_map *bmap,
3872 enum isl_dim_type type,
3873 unsigned first, unsigned n);
3874 __isl_give isl_map *isl_map_eliminate(
3875 __isl_take isl_map *map, enum isl_dim_type type,
3876 unsigned first, unsigned n);
3878 Eliminate the coefficients for the given dimensions from the constraints,
3879 without removing the dimensions.
3881 =item * Constructing a set from a parameter domain
3883 A zero-dimensional space or (basic) set can be constructed
3884 on a given parameter domain using the following functions.
3886 #include <isl/space.h>
3887 __isl_give isl_space *isl_space_set_from_params(
3888 __isl_take isl_space *space);
3890 #include <isl/set.h>
3891 __isl_give isl_basic_set *isl_basic_set_from_params(
3892 __isl_take isl_basic_set *bset);
3893 __isl_give isl_set *isl_set_from_params(
3894 __isl_take isl_set *set);
3896 =item * Constructing a relation from a set
3898 Create a relation with the given set as domain or range.
3899 The range or domain of the created relation is a zero-dimensional
3900 flat anonymous space.
3902 #include <isl/space.h>
3903 __isl_give isl_space *isl_space_from_domain(
3904 __isl_take isl_space *space);
3905 __isl_give isl_space *isl_space_from_range(
3906 __isl_take isl_space *space);
3907 __isl_give isl_space *isl_space_map_from_set(
3908 __isl_take isl_space *space);
3909 __isl_give isl_space *isl_space_map_from_domain_and_range(
3910 __isl_take isl_space *domain,
3911 __isl_take isl_space *range);
3913 #include <isl/local_space.h>
3914 __isl_give isl_local_space *isl_local_space_from_domain(
3915 __isl_take isl_local_space *ls);
3917 #include <isl/map.h>
3918 __isl_give isl_map *isl_map_from_domain(
3919 __isl_take isl_set *set);
3920 __isl_give isl_map *isl_map_from_range(
3921 __isl_take isl_set *set);
3923 #include <isl/val.h>
3924 __isl_give isl_multi_val *isl_multi_val_from_range(
3925 __isl_take isl_multi_val *mv);
3927 #include <isl/aff.h>
3928 __isl_give isl_multi_aff *isl_multi_aff_from_range(
3929 __isl_take isl_multi_aff *ma);
3930 __isl_give isl_pw_aff *isl_pw_aff_from_range(
3931 __isl_take isl_pw_aff *pwa);
3932 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
3933 __isl_take isl_multi_pw_aff *mpa);
3934 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
3935 __isl_take isl_set *set);
3936 __isl_give isl_union_pw_multi_aff *
3937 isl_union_pw_multi_aff_from_domain(
3938 __isl_take isl_union_set *uset);
3942 #include <isl/set.h>
3943 __isl_give isl_basic_set *isl_basic_set_fix_si(
3944 __isl_take isl_basic_set *bset,
3945 enum isl_dim_type type, unsigned pos, int value);
3946 __isl_give isl_basic_set *isl_basic_set_fix_val(
3947 __isl_take isl_basic_set *bset,
3948 enum isl_dim_type type, unsigned pos,
3949 __isl_take isl_val *v);
3950 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
3951 enum isl_dim_type type, unsigned pos, int value);
3952 __isl_give isl_set *isl_set_fix_val(
3953 __isl_take isl_set *set,
3954 enum isl_dim_type type, unsigned pos,
3955 __isl_take isl_val *v);
3957 #include <isl/map.h>
3958 __isl_give isl_basic_map *isl_basic_map_fix_si(
3959 __isl_take isl_basic_map *bmap,
3960 enum isl_dim_type type, unsigned pos, int value);
3961 __isl_give isl_basic_map *isl_basic_map_fix_val(
3962 __isl_take isl_basic_map *bmap,
3963 enum isl_dim_type type, unsigned pos,
3964 __isl_take isl_val *v);
3965 __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
3966 enum isl_dim_type type, unsigned pos, int value);
3967 __isl_give isl_map *isl_map_fix_val(
3968 __isl_take isl_map *map,
3969 enum isl_dim_type type, unsigned pos,
3970 __isl_take isl_val *v);
3972 #include <isl/aff.h>
3973 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
3974 __isl_take isl_pw_multi_aff *pma,
3975 enum isl_dim_type type, unsigned pos, int value);
3977 #include <isl/polynomial.h>
3978 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
3979 __isl_take isl_pw_qpolynomial *pwqp,
3980 enum isl_dim_type type, unsigned n,
3981 __isl_take isl_val *v);
3983 Intersect the set, relation or function domain
3984 with the hyperplane where the given
3985 dimension has the fixed given value.
3987 __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
3988 __isl_take isl_basic_map *bmap,
3989 enum isl_dim_type type, unsigned pos, int value);
3990 __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
3991 __isl_take isl_basic_map *bmap,
3992 enum isl_dim_type type, unsigned pos, int value);
3993 __isl_give isl_set *isl_set_lower_bound_si(
3994 __isl_take isl_set *set,
3995 enum isl_dim_type type, unsigned pos, int value);
3996 __isl_give isl_set *isl_set_lower_bound_val(
3997 __isl_take isl_set *set,
3998 enum isl_dim_type type, unsigned pos,
3999 __isl_take isl_val *value);
4000 __isl_give isl_map *isl_map_lower_bound_si(
4001 __isl_take isl_map *map,
4002 enum isl_dim_type type, unsigned pos, int value);
4003 __isl_give isl_set *isl_set_upper_bound_si(
4004 __isl_take isl_set *set,
4005 enum isl_dim_type type, unsigned pos, int value);
4006 __isl_give isl_set *isl_set_upper_bound_val(
4007 __isl_take isl_set *set,
4008 enum isl_dim_type type, unsigned pos,
4009 __isl_take isl_val *value);
4010 __isl_give isl_map *isl_map_upper_bound_si(
4011 __isl_take isl_map *map,
4012 enum isl_dim_type type, unsigned pos, int value);
4014 Intersect the set or relation with the half-space where the given
4015 dimension has a value bounded by the fixed given integer value.
4017 __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4018 enum isl_dim_type type1, int pos1,
4019 enum isl_dim_type type2, int pos2);
4020 __isl_give isl_basic_map *isl_basic_map_equate(
4021 __isl_take isl_basic_map *bmap,
4022 enum isl_dim_type type1, int pos1,
4023 enum isl_dim_type type2, int pos2);
4024 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4025 enum isl_dim_type type1, int pos1,
4026 enum isl_dim_type type2, int pos2);
4028 Intersect the set or relation with the hyperplane where the given
4029 dimensions are equal to each other.
4031 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4032 enum isl_dim_type type1, int pos1,
4033 enum isl_dim_type type2, int pos2);
4035 Intersect the relation with the hyperplane where the given
4036 dimensions have opposite values.
4038 __isl_give isl_map *isl_map_order_le(
4039 __isl_take isl_map *map,
4040 enum isl_dim_type type1, int pos1,
4041 enum isl_dim_type type2, int pos2);
4042 __isl_give isl_basic_map *isl_basic_map_order_ge(
4043 __isl_take isl_basic_map *bmap,
4044 enum isl_dim_type type1, int pos1,
4045 enum isl_dim_type type2, int pos2);
4046 __isl_give isl_map *isl_map_order_ge(
4047 __isl_take isl_map *map,
4048 enum isl_dim_type type1, int pos1,
4049 enum isl_dim_type type2, int pos2);
4050 __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4051 enum isl_dim_type type1, int pos1,
4052 enum isl_dim_type type2, int pos2);
4053 __isl_give isl_basic_map *isl_basic_map_order_gt(
4054 __isl_take isl_basic_map *bmap,
4055 enum isl_dim_type type1, int pos1,
4056 enum isl_dim_type type2, int pos2);
4057 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4058 enum isl_dim_type type1, int pos1,
4059 enum isl_dim_type type2, int pos2);
4061 Intersect the relation with the half-space where the given
4062 dimensions satisfy the given ordering.
4066 #include <isl/aff.h>
4067 __isl_give isl_basic_set *isl_aff_zero_basic_set(
4068 __isl_take isl_aff *aff);
4069 __isl_give isl_basic_set *isl_aff_neg_basic_set(
4070 __isl_take isl_aff *aff);
4071 __isl_give isl_set *isl_pw_aff_pos_set(
4072 __isl_take isl_pw_aff *pa);
4073 __isl_give isl_set *isl_pw_aff_nonneg_set(
4074 __isl_take isl_pw_aff *pwaff);
4075 __isl_give isl_set *isl_pw_aff_zero_set(
4076 __isl_take isl_pw_aff *pwaff);
4077 __isl_give isl_set *isl_pw_aff_non_zero_set(
4078 __isl_take isl_pw_aff *pwaff);
4080 The function C<isl_aff_neg_basic_set> returns a basic set
4081 containing those elements in the domain space
4082 of C<aff> where C<aff> is negative.
4083 The function C<isl_pw_aff_nonneg_set> returns a set
4084 containing those elements in the domain
4085 of C<pwaff> where C<pwaff> is non-negative.
4089 __isl_give isl_map *isl_set_identity(
4090 __isl_take isl_set *set);
4091 __isl_give isl_union_map *isl_union_set_identity(
4092 __isl_take isl_union_set *uset);
4093 __isl_give isl_union_pw_multi_aff *
4094 isl_union_set_identity_union_pw_multi_aff(
4095 __isl_take isl_union_set *uset);
4097 Construct an identity relation on the given (union) set.
4099 =item * Function Extraction
4101 A piecewise quasi affine expression that is equal to 1 on a set
4102 and 0 outside the set can be created using the following function.
4104 #include <isl/aff.h>
4105 __isl_give isl_pw_aff *isl_set_indicator_function(
4106 __isl_take isl_set *set);
4108 A piecewise multiple quasi affine expression can be extracted
4109 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4110 and the C<isl_map> is single-valued.
4111 In case of a conversion from an C<isl_union_map>
4112 to an C<isl_union_pw_multi_aff>, these properties need to hold
4113 in each domain space.
4115 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4116 __isl_take isl_set *set);
4117 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4118 __isl_take isl_map *map);
4120 __isl_give isl_union_pw_multi_aff *
4121 isl_union_pw_multi_aff_from_union_set(
4122 __isl_take isl_union_set *uset);
4123 __isl_give isl_union_pw_multi_aff *
4124 isl_union_pw_multi_aff_from_union_map(
4125 __isl_take isl_union_map *umap);
4129 __isl_give isl_basic_set *isl_basic_map_deltas(
4130 __isl_take isl_basic_map *bmap);
4131 __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4132 __isl_give isl_union_set *isl_union_map_deltas(
4133 __isl_take isl_union_map *umap);
4135 These functions return a (basic) set containing the differences
4136 between image elements and corresponding domain elements in the input.
4138 __isl_give isl_basic_map *isl_basic_map_deltas_map(
4139 __isl_take isl_basic_map *bmap);
4140 __isl_give isl_map *isl_map_deltas_map(
4141 __isl_take isl_map *map);
4142 __isl_give isl_union_map *isl_union_map_deltas_map(
4143 __isl_take isl_union_map *umap);
4145 The functions above construct a (basic, regular or union) relation
4146 that maps (a wrapped version of) the input relation to its delta set.
4150 Simplify the representation of a set, relation or functions by trying
4151 to combine pairs of basic sets or relations into a single
4152 basic set or relation.
4154 #include <isl/set.h>
4155 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4157 #include <isl/map.h>
4158 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4160 #include <isl/union_set.h>
4161 __isl_give isl_union_set *isl_union_set_coalesce(
4162 __isl_take isl_union_set *uset);
4164 #include <isl/union_map.h>
4165 __isl_give isl_union_map *isl_union_map_coalesce(
4166 __isl_take isl_union_map *umap);
4168 #include <isl/aff.h>
4169 __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4170 __isl_take isl_pw_aff *pwqp);
4171 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4172 __isl_take isl_pw_multi_aff *pma);
4173 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4174 __isl_take isl_multi_pw_aff *mpa);
4175 __isl_give isl_union_pw_multi_aff *
4176 isl_union_pw_multi_aff_coalesce(
4177 __isl_take isl_union_pw_multi_aff *upma);
4179 #include <isl/polynomial.h>
4180 __isl_give isl_pw_qpolynomial_fold *
4181 isl_pw_qpolynomial_fold_coalesce(
4182 __isl_take isl_pw_qpolynomial_fold *pwf);
4183 __isl_give isl_union_pw_qpolynomial *
4184 isl_union_pw_qpolynomial_coalesce(
4185 __isl_take isl_union_pw_qpolynomial *upwqp);
4186 __isl_give isl_union_pw_qpolynomial_fold *
4187 isl_union_pw_qpolynomial_fold_coalesce(
4188 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4190 One of the methods for combining pairs of basic sets or relations
4191 can result in coefficients that are much larger than those that appear
4192 in the constraints of the input. By default, the coefficients are
4193 not allowed to grow larger, but this can be changed by unsetting
4194 the following option.
4196 int isl_options_set_coalesce_bounded_wrapping(
4197 isl_ctx *ctx, int val);
4198 int isl_options_get_coalesce_bounded_wrapping(
4201 =item * Detecting equalities
4203 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4204 __isl_take isl_basic_set *bset);
4205 __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4206 __isl_take isl_basic_map *bmap);
4207 __isl_give isl_set *isl_set_detect_equalities(
4208 __isl_take isl_set *set);
4209 __isl_give isl_map *isl_map_detect_equalities(
4210 __isl_take isl_map *map);
4211 __isl_give isl_union_set *isl_union_set_detect_equalities(
4212 __isl_take isl_union_set *uset);
4213 __isl_give isl_union_map *isl_union_map_detect_equalities(
4214 __isl_take isl_union_map *umap);
4216 Simplify the representation of a set or relation by detecting implicit
4219 =item * Removing redundant constraints
4221 #include <isl/set.h>
4222 __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4223 __isl_take isl_basic_set *bset);
4224 __isl_give isl_set *isl_set_remove_redundancies(
4225 __isl_take isl_set *set);
4227 #include <isl/union_set.h>
4228 __isl_give isl_union_set *
4229 isl_union_set_remove_redundancies(
4230 __isl_take isl_union_set *uset);
4232 #include <isl/map.h>
4233 __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4234 __isl_take isl_basic_map *bmap);
4235 __isl_give isl_map *isl_map_remove_redundancies(
4236 __isl_take isl_map *map);
4238 #include <isl/union_map.h>
4239 __isl_give isl_union_map *
4240 isl_union_map_remove_redundancies(
4241 __isl_take isl_union_map *umap);
4245 __isl_give isl_basic_set *isl_set_convex_hull(
4246 __isl_take isl_set *set);
4247 __isl_give isl_basic_map *isl_map_convex_hull(
4248 __isl_take isl_map *map);
4250 If the input set or relation has any existentially quantified
4251 variables, then the result of these operations is currently undefined.
4255 #include <isl/set.h>
4256 __isl_give isl_basic_set *
4257 isl_set_unshifted_simple_hull(
4258 __isl_take isl_set *set);
4259 __isl_give isl_basic_set *isl_set_simple_hull(
4260 __isl_take isl_set *set);
4261 __isl_give isl_basic_set *
4262 isl_set_unshifted_simple_hull_from_set_list(
4263 __isl_take isl_set *set,
4264 __isl_take isl_set_list *list);
4266 #include <isl/map.h>
4267 __isl_give isl_basic_map *
4268 isl_map_unshifted_simple_hull(
4269 __isl_take isl_map *map);
4270 __isl_give isl_basic_map *isl_map_simple_hull(
4271 __isl_take isl_map *map);
4272 __isl_give isl_basic_map *
4273 isl_map_unshifted_simple_hull_from_map_list(
4274 __isl_take isl_map *map,
4275 __isl_take isl_map_list *list);
4277 #include <isl/union_map.h>
4278 __isl_give isl_union_map *isl_union_map_simple_hull(
4279 __isl_take isl_union_map *umap);
4281 These functions compute a single basic set or relation
4282 that contains the whole input set or relation.
4283 In particular, the output is described by translates
4284 of the constraints describing the basic sets or relations in the input.
4285 In case of C<isl_set_unshifted_simple_hull>, only the original
4286 constraints are used, without any translation.
4287 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4288 C<isl_map_unshifted_simple_hull_from_map_list>, the
4289 constraints are taken from the elements of the second argument.
4293 (See \autoref{s:simple hull}.)
4299 __isl_give isl_basic_set *isl_basic_set_affine_hull(
4300 __isl_take isl_basic_set *bset);
4301 __isl_give isl_basic_set *isl_set_affine_hull(
4302 __isl_take isl_set *set);
4303 __isl_give isl_union_set *isl_union_set_affine_hull(
4304 __isl_take isl_union_set *uset);
4305 __isl_give isl_basic_map *isl_basic_map_affine_hull(
4306 __isl_take isl_basic_map *bmap);
4307 __isl_give isl_basic_map *isl_map_affine_hull(
4308 __isl_take isl_map *map);
4309 __isl_give isl_union_map *isl_union_map_affine_hull(
4310 __isl_take isl_union_map *umap);
4312 In case of union sets and relations, the affine hull is computed
4315 =item * Polyhedral hull
4317 __isl_give isl_basic_set *isl_set_polyhedral_hull(
4318 __isl_take isl_set *set);
4319 __isl_give isl_basic_map *isl_map_polyhedral_hull(
4320 __isl_take isl_map *map);
4321 __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4322 __isl_take isl_union_set *uset);
4323 __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4324 __isl_take isl_union_map *umap);
4326 These functions compute a single basic set or relation
4327 not involving any existentially quantified variables
4328 that contains the whole input set or relation.
4329 In case of union sets and relations, the polyhedral hull is computed
4332 =item * Other approximations
4334 #include <isl/set.h>
4335 __isl_give isl_basic_set *
4336 isl_basic_set_drop_constraints_involving_dims(
4337 __isl_take isl_basic_set *bset,
4338 enum isl_dim_type type,
4339 unsigned first, unsigned n);
4340 __isl_give isl_basic_set *
4341 isl_basic_set_drop_constraints_not_involving_dims(
4342 __isl_take isl_basic_set *bset,
4343 enum isl_dim_type type,
4344 unsigned first, unsigned n);
4345 __isl_give isl_set *
4346 isl_set_drop_constraints_involving_dims(
4347 __isl_take isl_set *set,
4348 enum isl_dim_type type,
4349 unsigned first, unsigned n);
4351 #include <isl/map.h>
4352 __isl_give isl_basic_map *
4353 isl_basic_map_drop_constraints_involving_dims(
4354 __isl_take isl_basic_map *bmap,
4355 enum isl_dim_type type,
4356 unsigned first, unsigned n);
4357 __isl_give isl_map *
4358 isl_map_drop_constraints_involving_dims(
4359 __isl_take isl_map *map,
4360 enum isl_dim_type type,
4361 unsigned first, unsigned n);
4363 These functions drop any constraints (not) involving the specified dimensions.
4364 Note that the result depends on the representation of the input.
4366 #include <isl/polynomial.h>
4367 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4368 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4369 __isl_give isl_union_pw_qpolynomial *
4370 isl_union_pw_qpolynomial_to_polynomial(
4371 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4373 Approximate each quasipolynomial by a polynomial. If C<sign> is positive,
4374 the polynomial will be an overapproximation. If C<sign> is negative,
4375 it will be an underapproximation. If C<sign> is zero, the approximation
4376 will lie somewhere in between.
4380 __isl_give isl_basic_set *isl_basic_set_sample(
4381 __isl_take isl_basic_set *bset);
4382 __isl_give isl_basic_set *isl_set_sample(
4383 __isl_take isl_set *set);
4384 __isl_give isl_basic_map *isl_basic_map_sample(
4385 __isl_take isl_basic_map *bmap);
4386 __isl_give isl_basic_map *isl_map_sample(
4387 __isl_take isl_map *map);
4389 If the input (basic) set or relation is non-empty, then return
4390 a singleton subset of the input. Otherwise, return an empty set.
4392 =item * Optimization
4394 #include <isl/ilp.h>
4395 __isl_give isl_val *isl_basic_set_max_val(
4396 __isl_keep isl_basic_set *bset,
4397 __isl_keep isl_aff *obj);
4398 __isl_give isl_val *isl_set_min_val(
4399 __isl_keep isl_set *set,
4400 __isl_keep isl_aff *obj);
4401 __isl_give isl_val *isl_set_max_val(
4402 __isl_keep isl_set *set,
4403 __isl_keep isl_aff *obj);
4405 Compute the minimum or maximum of the integer affine expression C<obj>
4406 over the points in C<set>, returning the result in C<opt>.
4407 The result is C<NULL> in case of an error, the optimal value in case
4408 there is one, negative infinity or infinity if the problem is unbounded and
4409 NaN if the problem is empty.
4411 =item * Parametric optimization
4413 __isl_give isl_pw_aff *isl_set_dim_min(
4414 __isl_take isl_set *set, int pos);
4415 __isl_give isl_pw_aff *isl_set_dim_max(
4416 __isl_take isl_set *set, int pos);
4417 __isl_give isl_pw_aff *isl_map_dim_max(
4418 __isl_take isl_map *map, int pos);
4420 Compute the minimum or maximum of the given set or output dimension
4421 as a function of the parameters (and input dimensions), but independently
4422 of the other set or output dimensions.
4423 For lexicographic optimization, see L<"Lexicographic Optimization">.
4427 The following functions compute either the set of (rational) coefficient
4428 values of valid constraints for the given set or the set of (rational)
4429 values satisfying the constraints with coefficients from the given set.
4430 Internally, these two sets of functions perform essentially the
4431 same operations, except that the set of coefficients is assumed to
4432 be a cone, while the set of values may be any polyhedron.
4433 The current implementation is based on the Farkas lemma and
4434 Fourier-Motzkin elimination, but this may change or be made optional
4435 in future. In particular, future implementations may use different
4436 dualization algorithms or skip the elimination step.
4438 __isl_give isl_basic_set *isl_basic_set_coefficients(
4439 __isl_take isl_basic_set *bset);
4440 __isl_give isl_basic_set *isl_set_coefficients(
4441 __isl_take isl_set *set);
4442 __isl_give isl_union_set *isl_union_set_coefficients(
4443 __isl_take isl_union_set *bset);
4444 __isl_give isl_basic_set *isl_basic_set_solutions(
4445 __isl_take isl_basic_set *bset);
4446 __isl_give isl_basic_set *isl_set_solutions(
4447 __isl_take isl_set *set);
4448 __isl_give isl_union_set *isl_union_set_solutions(
4449 __isl_take isl_union_set *bset);
4453 __isl_give isl_map *isl_map_fixed_power_val(
4454 __isl_take isl_map *map,
4455 __isl_take isl_val *exp);
4456 __isl_give isl_union_map *
4457 isl_union_map_fixed_power_val(
4458 __isl_take isl_union_map *umap,
4459 __isl_take isl_val *exp);
4461 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4462 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4463 of C<map> is computed.
4465 __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4467 __isl_give isl_union_map *isl_union_map_power(
4468 __isl_take isl_union_map *umap, int *exact);
4470 Compute a parametric representation for all positive powers I<k> of C<map>.
4471 The result maps I<k> to a nested relation corresponding to the
4472 I<k>th power of C<map>.
4473 The result may be an overapproximation. If the result is known to be exact,
4474 then C<*exact> is set to C<1>.
4476 =item * Transitive closure
4478 __isl_give isl_map *isl_map_transitive_closure(
4479 __isl_take isl_map *map, int *exact);
4480 __isl_give isl_union_map *isl_union_map_transitive_closure(
4481 __isl_take isl_union_map *umap, int *exact);
4483 Compute the transitive closure of C<map>.
4484 The result may be an overapproximation. If the result is known to be exact,
4485 then C<*exact> is set to C<1>.
4487 =item * Reaching path lengths
4489 __isl_give isl_map *isl_map_reaching_path_lengths(
4490 __isl_take isl_map *map, int *exact);
4492 Compute a relation that maps each element in the range of C<map>
4493 to the lengths of all paths composed of edges in C<map> that
4494 end up in the given element.
4495 The result may be an overapproximation. If the result is known to be exact,
4496 then C<*exact> is set to C<1>.
4497 To compute the I<maximal> path length, the resulting relation
4498 should be postprocessed by C<isl_map_lexmax>.
4499 In particular, if the input relation is a dependence relation
4500 (mapping sources to sinks), then the maximal path length corresponds
4501 to the free schedule.
4502 Note, however, that C<isl_map_lexmax> expects the maximum to be
4503 finite, so if the path lengths are unbounded (possibly due to
4504 the overapproximation), then you will get an error message.
4508 #include <isl/space.h>
4509 __isl_give isl_space *isl_space_wrap(
4510 __isl_take isl_space *space);
4511 __isl_give isl_space *isl_space_unwrap(
4512 __isl_take isl_space *space);
4514 #include <isl/local_space.h>
4515 __isl_give isl_local_space *isl_local_space_wrap(
4516 __isl_take isl_local_space *ls);
4518 #include <isl/set.h>
4519 __isl_give isl_basic_map *isl_basic_set_unwrap(
4520 __isl_take isl_basic_set *bset);
4521 __isl_give isl_map *isl_set_unwrap(
4522 __isl_take isl_set *set);
4524 #include <isl/map.h>
4525 __isl_give isl_basic_set *isl_basic_map_wrap(
4526 __isl_take isl_basic_map *bmap);
4527 __isl_give isl_set *isl_map_wrap(
4528 __isl_take isl_map *map);
4530 #include <isl/union_set.h>
4531 __isl_give isl_union_map *isl_union_set_unwrap(
4532 __isl_take isl_union_set *uset);
4534 #include <isl/union_map.h>
4535 __isl_give isl_union_set *isl_union_map_wrap(
4536 __isl_take isl_union_map *umap);
4538 The input to C<isl_space_unwrap> should
4539 be the space of a set, while that of
4540 C<isl_space_wrap> should be the space of a relation.
4541 Conversely, the output of C<isl_space_unwrap> is the space
4542 of a relation, while that of C<isl_space_wrap> is the space of a set.
4546 Remove any internal structure of domain (and range) of the given
4547 set or relation. If there is any such internal structure in the input,
4548 then the name of the space is also removed.
4550 #include <isl/local_space.h>
4551 __isl_give isl_local_space *
4552 isl_local_space_flatten_domain(
4553 __isl_take isl_local_space *ls);
4554 __isl_give isl_local_space *
4555 isl_local_space_flatten_range(
4556 __isl_take isl_local_space *ls);
4558 #include <isl/set.h>
4559 __isl_give isl_basic_set *isl_basic_set_flatten(
4560 __isl_take isl_basic_set *bset);
4561 __isl_give isl_set *isl_set_flatten(
4562 __isl_take isl_set *set);
4564 #include <isl/map.h>
4565 __isl_give isl_basic_map *isl_basic_map_flatten_domain(
4566 __isl_take isl_basic_map *bmap);
4567 __isl_give isl_basic_map *isl_basic_map_flatten_range(
4568 __isl_take isl_basic_map *bmap);
4569 __isl_give isl_map *isl_map_flatten_range(
4570 __isl_take isl_map *map);
4571 __isl_give isl_map *isl_map_flatten_domain(
4572 __isl_take isl_map *map);
4573 __isl_give isl_basic_map *isl_basic_map_flatten(
4574 __isl_take isl_basic_map *bmap);
4575 __isl_give isl_map *isl_map_flatten(
4576 __isl_take isl_map *map);
4578 #include <isl/val.h>
4579 __isl_give isl_multi_val *isl_multi_val_flatten_range(
4580 __isl_take isl_multi_val *mv);
4582 #include <isl/aff.h>
4583 __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
4584 __isl_take isl_multi_aff *ma);
4585 __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
4586 __isl_take isl_multi_aff *ma);
4587 __isl_give isl_multi_pw_aff *
4588 isl_multi_pw_aff_flatten_range(
4589 __isl_take isl_multi_pw_aff *mpa);
4591 #include <isl/map.h>
4592 __isl_give isl_map *isl_set_flatten_map(
4593 __isl_take isl_set *set);
4595 The function above constructs a relation
4596 that maps the input set to a flattened version of the set.
4600 Lift the input set to a space with extra dimensions corresponding
4601 to the existentially quantified variables in the input.
4602 In particular, the result lives in a wrapped map where the domain
4603 is the original space and the range corresponds to the original
4604 existentially quantified variables.
4606 #include <isl/set.h>
4607 __isl_give isl_basic_set *isl_basic_set_lift(
4608 __isl_take isl_basic_set *bset);
4609 __isl_give isl_set *isl_set_lift(
4610 __isl_take isl_set *set);
4611 __isl_give isl_union_set *isl_union_set_lift(
4612 __isl_take isl_union_set *uset);
4614 Given a local space that contains the existentially quantified
4615 variables of a set, a basic relation that, when applied to
4616 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
4617 can be constructed using the following function.
4619 #include <isl/local_space.h>
4620 __isl_give isl_basic_map *isl_local_space_lifting(
4621 __isl_take isl_local_space *ls);
4623 #include <isl/aff.h>
4624 __isl_give isl_multi_aff *isl_multi_aff_lift(
4625 __isl_take isl_multi_aff *maff,
4626 __isl_give isl_local_space **ls);
4628 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
4629 then it is assigned the local space that lies at the basis of
4630 the lifting applied.
4632 =item * Internal Product
4634 #include <isl/space.h>
4635 __isl_give isl_space *isl_space_zip(
4636 __isl_take isl_space *space);
4638 #include <isl/map.h>
4639 __isl_give isl_basic_map *isl_basic_map_zip(
4640 __isl_take isl_basic_map *bmap);
4641 __isl_give isl_map *isl_map_zip(
4642 __isl_take isl_map *map);
4644 #include <isl/union_map.h>
4645 __isl_give isl_union_map *isl_union_map_zip(
4646 __isl_take isl_union_map *umap);
4648 Given a relation with nested relations for domain and range,
4649 interchange the range of the domain with the domain of the range.
4653 #include <isl/space.h>
4654 __isl_give isl_space *isl_space_curry(
4655 __isl_take isl_space *space);
4656 __isl_give isl_space *isl_space_uncurry(
4657 __isl_take isl_space *space);
4659 #include <isl/map.h>
4660 __isl_give isl_basic_map *isl_basic_map_curry(
4661 __isl_take isl_basic_map *bmap);
4662 __isl_give isl_basic_map *isl_basic_map_uncurry(
4663 __isl_take isl_basic_map *bmap);
4664 __isl_give isl_map *isl_map_curry(
4665 __isl_take isl_map *map);
4666 __isl_give isl_map *isl_map_uncurry(
4667 __isl_take isl_map *map);
4669 #include <isl/union_map.h>
4670 __isl_give isl_union_map *isl_union_map_curry(
4671 __isl_take isl_union_map *umap);
4672 __isl_give isl_union_map *isl_union_map_uncurry(
4673 __isl_take isl_union_map *umap);
4675 Given a relation with a nested relation for domain,
4676 the C<curry> functions
4677 move the range of the nested relation out of the domain
4678 and use it as the domain of a nested relation in the range,
4679 with the original range as range of this nested relation.
4680 The C<uncurry> functions perform the inverse operation.
4682 =item * Aligning parameters
4684 Change the order of the parameters of the given set, relation
4686 such that the first parameters match those of C<model>.
4687 This may involve the introduction of extra parameters.
4688 All parameters need to be named.
4690 #include <isl/space.h>
4691 __isl_give isl_space *isl_space_align_params(
4692 __isl_take isl_space *space1,
4693 __isl_take isl_space *space2)
4695 #include <isl/set.h>
4696 __isl_give isl_basic_set *isl_basic_set_align_params(
4697 __isl_take isl_basic_set *bset,
4698 __isl_take isl_space *model);
4699 __isl_give isl_set *isl_set_align_params(
4700 __isl_take isl_set *set,
4701 __isl_take isl_space *model);
4703 #include <isl/map.h>
4704 __isl_give isl_basic_map *isl_basic_map_align_params(
4705 __isl_take isl_basic_map *bmap,
4706 __isl_take isl_space *model);
4707 __isl_give isl_map *isl_map_align_params(
4708 __isl_take isl_map *map,
4709 __isl_take isl_space *model);
4711 #include <isl/val.h>
4712 __isl_give isl_multi_val *isl_multi_val_align_params(
4713 __isl_take isl_multi_val *mv,
4714 __isl_take isl_space *model);
4716 #include <isl/aff.h>
4717 __isl_give isl_aff *isl_aff_align_params(
4718 __isl_take isl_aff *aff,
4719 __isl_take isl_space *model);
4720 __isl_give isl_multi_aff *isl_multi_aff_align_params(
4721 __isl_take isl_multi_aff *multi,
4722 __isl_take isl_space *model);
4723 __isl_give isl_pw_aff *isl_pw_aff_align_params(
4724 __isl_take isl_pw_aff *pwaff,
4725 __isl_take isl_space *model);
4726 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
4727 __isl_take isl_pw_multi_aff *pma,
4728 __isl_take isl_space *model);
4729 __isl_give isl_union_pw_multi_aff *
4730 isl_union_pw_multi_aff_align_params(
4731 __isl_take isl_union_pw_multi_aff *upma,
4732 __isl_take isl_space *model);
4734 #include <isl/polynomial.h>
4735 __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
4736 __isl_take isl_qpolynomial *qp,
4737 __isl_take isl_space *model);
4739 =item * Unary Arithmethic Operations
4741 #include <isl/val.h>
4742 __isl_give isl_multi_val *isl_multi_val_neg(
4743 __isl_take isl_multi_val *mv);
4745 #include <isl/aff.h>
4746 __isl_give isl_aff *isl_aff_neg(
4747 __isl_take isl_aff *aff);
4748 __isl_give isl_multi_aff *isl_multi_aff_neg(
4749 __isl_take isl_multi_aff *ma);
4750 __isl_give isl_pw_aff *isl_pw_aff_neg(
4751 __isl_take isl_pw_aff *pwaff);
4752 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
4753 __isl_take isl_pw_multi_aff *pma);
4754 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
4755 __isl_take isl_multi_pw_aff *mpa);
4756 __isl_give isl_union_pw_multi_aff *
4757 isl_union_pw_multi_aff_neg(
4758 __isl_take isl_union_pw_multi_aff *upma);
4759 __isl_give isl_aff *isl_aff_ceil(
4760 __isl_take isl_aff *aff);
4761 __isl_give isl_pw_aff *isl_pw_aff_ceil(
4762 __isl_take isl_pw_aff *pwaff);
4763 __isl_give isl_aff *isl_aff_floor(
4764 __isl_take isl_aff *aff);
4765 __isl_give isl_multi_aff *isl_multi_aff_floor(
4766 __isl_take isl_multi_aff *ma);
4767 __isl_give isl_pw_aff *isl_pw_aff_floor(
4768 __isl_take isl_pw_aff *pwaff);
4770 #include <isl/aff.h>
4771 __isl_give isl_pw_aff *isl_pw_aff_list_min(
4772 __isl_take isl_pw_aff_list *list);
4773 __isl_give isl_pw_aff *isl_pw_aff_list_max(
4774 __isl_take isl_pw_aff_list *list);
4776 #include <isl/polynomial.h>
4777 __isl_give isl_qpolynomial *isl_qpolynomial_neg(
4778 __isl_take isl_qpolynomial *qp);
4779 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
4780 __isl_take isl_pw_qpolynomial *pwqp);
4781 __isl_give isl_union_pw_qpolynomial *
4782 isl_union_pw_qpolynomial_neg(
4783 __isl_take isl_union_pw_qpolynomial *upwqp);
4784 __isl_give isl_qpolynomial *isl_qpolynomial_pow(
4785 __isl_take isl_qpolynomial *qp,
4787 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
4788 __isl_take isl_pw_qpolynomial *pwqp,
4793 The following functions evaluate a function in a point.
4795 #include <isl/polynomial.h>
4796 __isl_give isl_val *isl_pw_qpolynomial_eval(
4797 __isl_take isl_pw_qpolynomial *pwqp,
4798 __isl_take isl_point *pnt);
4799 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
4800 __isl_take isl_pw_qpolynomial_fold *pwf,
4801 __isl_take isl_point *pnt);
4802 __isl_give isl_val *isl_union_pw_qpolynomial_eval(
4803 __isl_take isl_union_pw_qpolynomial *upwqp,
4804 __isl_take isl_point *pnt);
4805 __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
4806 __isl_take isl_union_pw_qpolynomial_fold *upwf,
4807 __isl_take isl_point *pnt);
4809 =item * Dimension manipulation
4811 It is usually not advisable to directly change the (input or output)
4812 space of a set or a relation as this removes the name and the internal
4813 structure of the space. However, the functions below can be useful
4814 to add new parameters, assuming
4815 C<isl_set_align_params> and C<isl_map_align_params>
4818 #include <isl/space.h>
4819 __isl_give isl_space *isl_space_add_dims(
4820 __isl_take isl_space *space,
4821 enum isl_dim_type type, unsigned n);
4822 __isl_give isl_space *isl_space_insert_dims(
4823 __isl_take isl_space *space,
4824 enum isl_dim_type type, unsigned pos, unsigned n);
4825 __isl_give isl_space *isl_space_drop_dims(
4826 __isl_take isl_space *space,
4827 enum isl_dim_type type, unsigned first, unsigned n);
4828 __isl_give isl_space *isl_space_move_dims(
4829 __isl_take isl_space *space,
4830 enum isl_dim_type dst_type, unsigned dst_pos,
4831 enum isl_dim_type src_type, unsigned src_pos,
4834 #include <isl/local_space.h>
4835 __isl_give isl_local_space *isl_local_space_add_dims(
4836 __isl_take isl_local_space *ls,
4837 enum isl_dim_type type, unsigned n);
4838 __isl_give isl_local_space *isl_local_space_insert_dims(
4839 __isl_take isl_local_space *ls,
4840 enum isl_dim_type type, unsigned first, unsigned n);
4841 __isl_give isl_local_space *isl_local_space_drop_dims(
4842 __isl_take isl_local_space *ls,
4843 enum isl_dim_type type, unsigned first, unsigned n);
4845 #include <isl/set.h>
4846 __isl_give isl_basic_set *isl_basic_set_add_dims(
4847 __isl_take isl_basic_set *bset,
4848 enum isl_dim_type type, unsigned n);
4849 __isl_give isl_set *isl_set_add_dims(
4850 __isl_take isl_set *set,
4851 enum isl_dim_type type, unsigned n);
4852 __isl_give isl_basic_set *isl_basic_set_insert_dims(
4853 __isl_take isl_basic_set *bset,
4854 enum isl_dim_type type, unsigned pos,
4856 __isl_give isl_set *isl_set_insert_dims(
4857 __isl_take isl_set *set,
4858 enum isl_dim_type type, unsigned pos, unsigned n);
4859 __isl_give isl_basic_set *isl_basic_set_move_dims(
4860 __isl_take isl_basic_set *bset,
4861 enum isl_dim_type dst_type, unsigned dst_pos,
4862 enum isl_dim_type src_type, unsigned src_pos,
4864 __isl_give isl_set *isl_set_move_dims(
4865 __isl_take isl_set *set,
4866 enum isl_dim_type dst_type, unsigned dst_pos,
4867 enum isl_dim_type src_type, unsigned src_pos,
4870 #include <isl/map.h>
4871 __isl_give isl_map *isl_map_add_dims(
4872 __isl_take isl_map *map,
4873 enum isl_dim_type type, unsigned n);
4874 __isl_give isl_basic_map *isl_basic_map_insert_dims(
4875 __isl_take isl_basic_map *bmap,
4876 enum isl_dim_type type, unsigned pos,
4878 __isl_give isl_map *isl_map_insert_dims(
4879 __isl_take isl_map *map,
4880 enum isl_dim_type type, unsigned pos, unsigned n);
4881 __isl_give isl_basic_map *isl_basic_map_move_dims(
4882 __isl_take isl_basic_map *bmap,
4883 enum isl_dim_type dst_type, unsigned dst_pos,
4884 enum isl_dim_type src_type, unsigned src_pos,
4886 __isl_give isl_map *isl_map_move_dims(
4887 __isl_take isl_map *map,
4888 enum isl_dim_type dst_type, unsigned dst_pos,
4889 enum isl_dim_type src_type, unsigned src_pos,
4892 #include <isl/val.h>
4893 __isl_give isl_multi_val *isl_multi_val_insert_dims(
4894 __isl_take isl_multi_val *mv,
4895 enum isl_dim_type type, unsigned first, unsigned n);
4896 __isl_give isl_multi_val *isl_multi_val_add_dims(
4897 __isl_take isl_multi_val *mv,
4898 enum isl_dim_type type, unsigned n);
4899 __isl_give isl_multi_val *isl_multi_val_drop_dims(
4900 __isl_take isl_multi_val *mv,
4901 enum isl_dim_type type, unsigned first, unsigned n);
4903 #include <isl/aff.h>
4904 __isl_give isl_aff *isl_aff_insert_dims(
4905 __isl_take isl_aff *aff,
4906 enum isl_dim_type type, unsigned first, unsigned n);
4907 __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
4908 __isl_take isl_multi_aff *ma,
4909 enum isl_dim_type type, unsigned first, unsigned n);
4910 __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
4911 __isl_take isl_pw_aff *pwaff,
4912 enum isl_dim_type type, unsigned first, unsigned n);
4913 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
4914 __isl_take isl_multi_pw_aff *mpa,
4915 enum isl_dim_type type, unsigned first, unsigned n);
4916 __isl_give isl_aff *isl_aff_add_dims(
4917 __isl_take isl_aff *aff,
4918 enum isl_dim_type type, unsigned n);
4919 __isl_give isl_multi_aff *isl_multi_aff_add_dims(
4920 __isl_take isl_multi_aff *ma,
4921 enum isl_dim_type type, unsigned n);
4922 __isl_give isl_pw_aff *isl_pw_aff_add_dims(
4923 __isl_take isl_pw_aff *pwaff,
4924 enum isl_dim_type type, unsigned n);
4925 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
4926 __isl_take isl_multi_pw_aff *mpa,
4927 enum isl_dim_type type, unsigned n);
4928 __isl_give isl_aff *isl_aff_drop_dims(
4929 __isl_take isl_aff *aff,
4930 enum isl_dim_type type, unsigned first, unsigned n);
4931 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
4932 __isl_take isl_multi_aff *maff,
4933 enum isl_dim_type type, unsigned first, unsigned n);
4934 __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
4935 __isl_take isl_pw_aff *pwaff,
4936 enum isl_dim_type type, unsigned first, unsigned n);
4937 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
4938 __isl_take isl_pw_multi_aff *pma,
4939 enum isl_dim_type type, unsigned first, unsigned n);
4940 __isl_give isl_aff *isl_aff_move_dims(
4941 __isl_take isl_aff *aff,
4942 enum isl_dim_type dst_type, unsigned dst_pos,
4943 enum isl_dim_type src_type, unsigned src_pos,
4945 __isl_give isl_multi_aff *isl_multi_aff_move_dims(
4946 __isl_take isl_multi_aff *ma,
4947 enum isl_dim_type dst_type, unsigned dst_pos,
4948 enum isl_dim_type src_type, unsigned src_pos,
4950 __isl_give isl_pw_aff *isl_pw_aff_move_dims(
4951 __isl_take isl_pw_aff *pa,
4952 enum isl_dim_type dst_type, unsigned dst_pos,
4953 enum isl_dim_type src_type, unsigned src_pos,
4955 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
4956 __isl_take isl_multi_pw_aff *pma,
4957 enum isl_dim_type dst_type, unsigned dst_pos,
4958 enum isl_dim_type src_type, unsigned src_pos,
4963 =head2 Binary Operations
4965 The two arguments of a binary operation not only need to live
4966 in the same C<isl_ctx>, they currently also need to have
4967 the same (number of) parameters.
4969 =head3 Basic Operations
4973 =item * Intersection
4975 #include <isl/local_space.h>
4976 __isl_give isl_local_space *isl_local_space_intersect(
4977 __isl_take isl_local_space *ls1,
4978 __isl_take isl_local_space *ls2);
4980 #include <isl/set.h>
4981 __isl_give isl_basic_set *isl_basic_set_intersect_params(
4982 __isl_take isl_basic_set *bset1,
4983 __isl_take isl_basic_set *bset2);
4984 __isl_give isl_basic_set *isl_basic_set_intersect(
4985 __isl_take isl_basic_set *bset1,
4986 __isl_take isl_basic_set *bset2);
4987 __isl_give isl_basic_set *isl_basic_set_list_intersect(
4988 __isl_take struct isl_basic_set_list *list);
4989 __isl_give isl_set *isl_set_intersect_params(
4990 __isl_take isl_set *set,
4991 __isl_take isl_set *params);
4992 __isl_give isl_set *isl_set_intersect(
4993 __isl_take isl_set *set1,
4994 __isl_take isl_set *set2);
4996 #include <isl/map.h>
4997 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
4998 __isl_take isl_basic_map *bmap,
4999 __isl_take isl_basic_set *bset);
5000 __isl_give isl_basic_map *isl_basic_map_intersect_range(
5001 __isl_take isl_basic_map *bmap,
5002 __isl_take isl_basic_set *bset);
5003 __isl_give isl_basic_map *isl_basic_map_intersect(
5004 __isl_take isl_basic_map *bmap1,
5005 __isl_take isl_basic_map *bmap2);
5006 __isl_give isl_basic_map *isl_basic_map_list_intersect(
5007 __isl_take isl_basic_map_list *list);
5008 __isl_give isl_map *isl_map_intersect_params(
5009 __isl_take isl_map *map,
5010 __isl_take isl_set *params);
5011 __isl_give isl_map *isl_map_intersect_domain(
5012 __isl_take isl_map *map,
5013 __isl_take isl_set *set);
5014 __isl_give isl_map *isl_map_intersect_range(
5015 __isl_take isl_map *map,
5016 __isl_take isl_set *set);
5017 __isl_give isl_map *isl_map_intersect(
5018 __isl_take isl_map *map1,
5019 __isl_take isl_map *map2);
5021 #include <isl/union_set.h>
5022 __isl_give isl_union_set *isl_union_set_intersect_params(
5023 __isl_take isl_union_set *uset,
5024 __isl_take isl_set *set);
5025 __isl_give isl_union_set *isl_union_set_intersect(
5026 __isl_take isl_union_set *uset1,
5027 __isl_take isl_union_set *uset2);
5029 #include <isl/union_map.h>
5030 __isl_give isl_union_map *isl_union_map_intersect_params(
5031 __isl_take isl_union_map *umap,
5032 __isl_take isl_set *set);
5033 __isl_give isl_union_map *isl_union_map_intersect_domain(
5034 __isl_take isl_union_map *umap,
5035 __isl_take isl_union_set *uset);
5036 __isl_give isl_union_map *isl_union_map_intersect_range(
5037 __isl_take isl_union_map *umap,
5038 __isl_take isl_union_set *uset);
5039 __isl_give isl_union_map *isl_union_map_intersect(
5040 __isl_take isl_union_map *umap1,
5041 __isl_take isl_union_map *umap2);
5043 #include <isl/aff.h>
5044 __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5045 __isl_take isl_pw_aff *pa,
5046 __isl_take isl_set *set);
5047 __isl_give isl_multi_pw_aff *
5048 isl_multi_pw_aff_intersect_domain(
5049 __isl_take isl_multi_pw_aff *mpa,
5050 __isl_take isl_set *domain);
5051 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5052 __isl_take isl_pw_multi_aff *pma,
5053 __isl_take isl_set *set);
5054 __isl_give isl_union_pw_multi_aff *
5055 isl_union_pw_multi_aff_intersect_domain(
5056 __isl_take isl_union_pw_multi_aff *upma,
5057 __isl_take isl_union_set *uset);
5058 __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5059 __isl_take isl_pw_aff *pa,
5060 __isl_take isl_set *set);
5061 __isl_give isl_multi_pw_aff *
5062 isl_multi_pw_aff_intersect_params(
5063 __isl_take isl_multi_pw_aff *mpa,
5064 __isl_take isl_set *set);
5065 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5066 __isl_take isl_pw_multi_aff *pma,
5067 __isl_take isl_set *set);
5068 __isl_give isl_union_pw_multi_aff *
5069 isl_union_pw_multi_aff_intersect_params(
5070 __isl_take isl_union_pw_multi_aff *upma,
5071 __isl_take isl_set *set);
5073 #include <isl/polynomial.h>
5074 __isl_give isl_pw_qpolynomial *
5075 isl_pw_qpolynomial_intersect_domain(
5076 __isl_take isl_pw_qpolynomial *pwpq,
5077 __isl_take isl_set *set);
5078 __isl_give isl_union_pw_qpolynomial *
5079 isl_union_pw_qpolynomial_intersect_domain(
5080 __isl_take isl_union_pw_qpolynomial *upwpq,
5081 __isl_take isl_union_set *uset);
5082 __isl_give isl_union_pw_qpolynomial_fold *
5083 isl_union_pw_qpolynomial_fold_intersect_domain(
5084 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5085 __isl_take isl_union_set *uset);
5086 __isl_give isl_pw_qpolynomial *
5087 isl_pw_qpolynomial_intersect_params(
5088 __isl_take isl_pw_qpolynomial *pwpq,
5089 __isl_take isl_set *set);
5090 __isl_give isl_pw_qpolynomial_fold *
5091 isl_pw_qpolynomial_fold_intersect_params(
5092 __isl_take isl_pw_qpolynomial_fold *pwf,
5093 __isl_take isl_set *set);
5094 __isl_give isl_union_pw_qpolynomial *
5095 isl_union_pw_qpolynomial_intersect_params(
5096 __isl_take isl_union_pw_qpolynomial *upwpq,
5097 __isl_take isl_set *set);
5098 __isl_give isl_union_pw_qpolynomial_fold *
5099 isl_union_pw_qpolynomial_fold_intersect_params(
5100 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5101 __isl_take isl_set *set);
5103 The second argument to the C<_params> functions needs to be
5104 a parametric (basic) set. For the other functions, a parametric set
5105 for either argument is only allowed if the other argument is
5106 a parametric set as well.
5107 The list passed to C<isl_basic_set_list_intersect> needs to have
5108 at least one element and all elements need to live in the same space.
5112 #include <isl/set.h>
5113 __isl_give isl_set *isl_basic_set_union(
5114 __isl_take isl_basic_set *bset1,
5115 __isl_take isl_basic_set *bset2);
5116 __isl_give isl_set *isl_set_union(
5117 __isl_take isl_set *set1,
5118 __isl_take isl_set *set2);
5120 #include <isl/map.h>
5121 __isl_give isl_map *isl_basic_map_union(
5122 __isl_take isl_basic_map *bmap1,
5123 __isl_take isl_basic_map *bmap2);
5124 __isl_give isl_map *isl_map_union(
5125 __isl_take isl_map *map1,
5126 __isl_take isl_map *map2);
5128 #include <isl/union_set.h>
5129 __isl_give isl_union_set *isl_union_set_union(
5130 __isl_take isl_union_set *uset1,
5131 __isl_take isl_union_set *uset2);
5132 __isl_give isl_union_set *isl_union_set_list_union(
5133 __isl_take isl_union_set_list *list);
5135 #include <isl/union_map.h>
5136 __isl_give isl_union_map *isl_union_map_union(
5137 __isl_take isl_union_map *umap1,
5138 __isl_take isl_union_map *umap2);
5140 =item * Set difference
5142 #include <isl/set.h>
5143 __isl_give isl_set *isl_set_subtract(
5144 __isl_take isl_set *set1,
5145 __isl_take isl_set *set2);
5147 #include <isl/map.h>
5148 __isl_give isl_map *isl_map_subtract(
5149 __isl_take isl_map *map1,
5150 __isl_take isl_map *map2);
5151 __isl_give isl_map *isl_map_subtract_domain(
5152 __isl_take isl_map *map,
5153 __isl_take isl_set *dom);
5154 __isl_give isl_map *isl_map_subtract_range(
5155 __isl_take isl_map *map,
5156 __isl_take isl_set *dom);
5158 #include <isl/union_set.h>
5159 __isl_give isl_union_set *isl_union_set_subtract(
5160 __isl_take isl_union_set *uset1,
5161 __isl_take isl_union_set *uset2);
5163 #include <isl/union_map.h>
5164 __isl_give isl_union_map *isl_union_map_subtract(
5165 __isl_take isl_union_map *umap1,
5166 __isl_take isl_union_map *umap2);
5167 __isl_give isl_union_map *isl_union_map_subtract_domain(
5168 __isl_take isl_union_map *umap,
5169 __isl_take isl_union_set *dom);
5170 __isl_give isl_union_map *isl_union_map_subtract_range(
5171 __isl_take isl_union_map *umap,
5172 __isl_take isl_union_set *dom);
5174 #include <isl/aff.h>
5175 __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5176 __isl_take isl_pw_aff *pa,
5177 __isl_take isl_set *set);
5178 __isl_give isl_pw_multi_aff *
5179 isl_pw_multi_aff_subtract_domain(
5180 __isl_take isl_pw_multi_aff *pma,
5181 __isl_take isl_set *set);
5182 __isl_give isl_union_pw_multi_aff *
5183 isl_union_pw_multi_aff_subtract_domain(
5184 __isl_take isl_union_pw_multi_aff *upma,
5185 __isl_take isl_union_set *uset);
5187 #include <isl/polynomial.h>
5188 __isl_give isl_pw_qpolynomial *
5189 isl_pw_qpolynomial_subtract_domain(
5190 __isl_take isl_pw_qpolynomial *pwpq,
5191 __isl_take isl_set *set);
5192 __isl_give isl_pw_qpolynomial_fold *
5193 isl_pw_qpolynomial_fold_subtract_domain(
5194 __isl_take isl_pw_qpolynomial_fold *pwf,
5195 __isl_take isl_set *set);
5196 __isl_give isl_union_pw_qpolynomial *
5197 isl_union_pw_qpolynomial_subtract_domain(
5198 __isl_take isl_union_pw_qpolynomial *upwpq,
5199 __isl_take isl_union_set *uset);
5200 __isl_give isl_union_pw_qpolynomial_fold *
5201 isl_union_pw_qpolynomial_fold_subtract_domain(
5202 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5203 __isl_take isl_union_set *uset);
5207 #include <isl/space.h>
5208 __isl_give isl_space *isl_space_join(
5209 __isl_take isl_space *left,
5210 __isl_take isl_space *right);
5212 #include <isl/map.h>
5213 __isl_give isl_basic_set *isl_basic_set_apply(
5214 __isl_take isl_basic_set *bset,
5215 __isl_take isl_basic_map *bmap);
5216 __isl_give isl_set *isl_set_apply(
5217 __isl_take isl_set *set,
5218 __isl_take isl_map *map);
5219 __isl_give isl_union_set *isl_union_set_apply(
5220 __isl_take isl_union_set *uset,
5221 __isl_take isl_union_map *umap);
5222 __isl_give isl_basic_map *isl_basic_map_apply_domain(
5223 __isl_take isl_basic_map *bmap1,
5224 __isl_take isl_basic_map *bmap2);
5225 __isl_give isl_basic_map *isl_basic_map_apply_range(
5226 __isl_take isl_basic_map *bmap1,
5227 __isl_take isl_basic_map *bmap2);
5228 __isl_give isl_map *isl_map_apply_domain(
5229 __isl_take isl_map *map1,
5230 __isl_take isl_map *map2);
5231 __isl_give isl_map *isl_map_apply_range(
5232 __isl_take isl_map *map1,
5233 __isl_take isl_map *map2);
5235 #include <isl/union_map.h>
5236 __isl_give isl_union_map *isl_union_map_apply_domain(
5237 __isl_take isl_union_map *umap1,
5238 __isl_take isl_union_map *umap2);
5239 __isl_give isl_union_map *isl_union_map_apply_range(
5240 __isl_take isl_union_map *umap1,
5241 __isl_take isl_union_map *umap2);
5243 #include <isl/polynomial.h>
5244 __isl_give isl_pw_qpolynomial_fold *
5245 isl_set_apply_pw_qpolynomial_fold(
5246 __isl_take isl_set *set,
5247 __isl_take isl_pw_qpolynomial_fold *pwf,
5249 __isl_give isl_pw_qpolynomial_fold *
5250 isl_map_apply_pw_qpolynomial_fold(
5251 __isl_take isl_map *map,
5252 __isl_take isl_pw_qpolynomial_fold *pwf,
5254 __isl_give isl_union_pw_qpolynomial_fold *
5255 isl_union_set_apply_union_pw_qpolynomial_fold(
5256 __isl_take isl_union_set *uset,
5257 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5259 __isl_give isl_union_pw_qpolynomial_fold *
5260 isl_union_map_apply_union_pw_qpolynomial_fold(
5261 __isl_take isl_union_map *umap,
5262 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5265 The functions taking a map
5266 compose the given map with the given piecewise quasipolynomial reduction.
5267 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5268 over all elements in the intersection of the range of the map
5269 and the domain of the piecewise quasipolynomial reduction
5270 as a function of an element in the domain of the map.
5271 The functions taking a set compute a bound over all elements in the
5272 intersection of the set and the domain of the
5273 piecewise quasipolynomial reduction.
5277 #include <isl/set.h>
5278 __isl_give isl_basic_set *
5279 isl_basic_set_preimage_multi_aff(
5280 __isl_take isl_basic_set *bset,
5281 __isl_take isl_multi_aff *ma);
5282 __isl_give isl_set *isl_set_preimage_multi_aff(
5283 __isl_take isl_set *set,
5284 __isl_take isl_multi_aff *ma);
5285 __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5286 __isl_take isl_set *set,
5287 __isl_take isl_pw_multi_aff *pma);
5288 __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5289 __isl_take isl_set *set,
5290 __isl_take isl_multi_pw_aff *mpa);
5292 #include <isl/union_set.h>
5293 __isl_give isl_union_set *
5294 isl_union_set_preimage_multi_aff(
5295 __isl_take isl_union_set *uset,
5296 __isl_take isl_multi_aff *ma);
5297 __isl_give isl_union_set *
5298 isl_union_set_preimage_pw_multi_aff(
5299 __isl_take isl_union_set *uset,
5300 __isl_take isl_pw_multi_aff *pma);
5301 __isl_give isl_union_set *
5302 isl_union_set_preimage_union_pw_multi_aff(
5303 __isl_take isl_union_set *uset,
5304 __isl_take isl_union_pw_multi_aff *upma);
5306 #include <isl/map.h>
5307 __isl_give isl_basic_map *
5308 isl_basic_map_preimage_domain_multi_aff(
5309 __isl_take isl_basic_map *bmap,
5310 __isl_take isl_multi_aff *ma);
5311 __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5312 __isl_take isl_map *map,
5313 __isl_take isl_multi_aff *ma);
5314 __isl_give isl_map *isl_map_preimage_range_multi_aff(
5315 __isl_take isl_map *map,
5316 __isl_take isl_multi_aff *ma);
5317 __isl_give isl_map *
5318 isl_map_preimage_domain_pw_multi_aff(
5319 __isl_take isl_map *map,
5320 __isl_take isl_pw_multi_aff *pma);
5321 __isl_give isl_map *
5322 isl_map_preimage_range_pw_multi_aff(
5323 __isl_take isl_map *map,
5324 __isl_take isl_pw_multi_aff *pma);
5325 __isl_give isl_map *
5326 isl_map_preimage_domain_multi_pw_aff(
5327 __isl_take isl_map *map,
5328 __isl_take isl_multi_pw_aff *mpa);
5329 __isl_give isl_basic_map *
5330 isl_basic_map_preimage_range_multi_aff(
5331 __isl_take isl_basic_map *bmap,
5332 __isl_take isl_multi_aff *ma);
5334 #include <isl/union_map.h>
5335 __isl_give isl_union_map *
5336 isl_union_map_preimage_domain_multi_aff(
5337 __isl_take isl_union_map *umap,
5338 __isl_take isl_multi_aff *ma);
5339 __isl_give isl_union_map *
5340 isl_union_map_preimage_range_multi_aff(
5341 __isl_take isl_union_map *umap,
5342 __isl_take isl_multi_aff *ma);
5343 __isl_give isl_union_map *
5344 isl_union_map_preimage_domain_pw_multi_aff(
5345 __isl_take isl_union_map *umap,
5346 __isl_take isl_pw_multi_aff *pma);
5347 __isl_give isl_union_map *
5348 isl_union_map_preimage_range_pw_multi_aff(
5349 __isl_take isl_union_map *umap,
5350 __isl_take isl_pw_multi_aff *pma);
5351 __isl_give isl_union_map *
5352 isl_union_map_preimage_domain_union_pw_multi_aff(
5353 __isl_take isl_union_map *umap,
5354 __isl_take isl_union_pw_multi_aff *upma);
5355 __isl_give isl_union_map *
5356 isl_union_map_preimage_range_union_pw_multi_aff(
5357 __isl_take isl_union_map *umap,
5358 __isl_take isl_union_pw_multi_aff *upma);
5360 These functions compute the preimage of the given set or map domain/range under
5361 the given function. In other words, the expression is plugged
5362 into the set description or into the domain/range of the map.
5366 #include <isl/aff.h>
5367 __isl_give isl_aff *isl_aff_pullback_aff(
5368 __isl_take isl_aff *aff1,
5369 __isl_take isl_aff *aff2);
5370 __isl_give isl_aff *isl_aff_pullback_multi_aff(
5371 __isl_take isl_aff *aff,
5372 __isl_take isl_multi_aff *ma);
5373 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5374 __isl_take isl_pw_aff *pa,
5375 __isl_take isl_multi_aff *ma);
5376 __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5377 __isl_take isl_pw_aff *pa,
5378 __isl_take isl_pw_multi_aff *pma);
5379 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5380 __isl_take isl_pw_aff *pa,
5381 __isl_take isl_multi_pw_aff *mpa);
5382 __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5383 __isl_take isl_multi_aff *ma1,
5384 __isl_take isl_multi_aff *ma2);
5385 __isl_give isl_pw_multi_aff *
5386 isl_pw_multi_aff_pullback_multi_aff(
5387 __isl_take isl_pw_multi_aff *pma,
5388 __isl_take isl_multi_aff *ma);
5389 __isl_give isl_multi_pw_aff *
5390 isl_multi_pw_aff_pullback_multi_aff(
5391 __isl_take isl_multi_pw_aff *mpa,
5392 __isl_take isl_multi_aff *ma);
5393 __isl_give isl_pw_multi_aff *
5394 isl_pw_multi_aff_pullback_pw_multi_aff(
5395 __isl_take isl_pw_multi_aff *pma1,
5396 __isl_take isl_pw_multi_aff *pma2);
5397 __isl_give isl_multi_pw_aff *
5398 isl_multi_pw_aff_pullback_pw_multi_aff(
5399 __isl_take isl_multi_pw_aff *mpa,
5400 __isl_take isl_pw_multi_aff *pma);
5401 __isl_give isl_multi_pw_aff *
5402 isl_multi_pw_aff_pullback_multi_pw_aff(
5403 __isl_take isl_multi_pw_aff *mpa1,
5404 __isl_take isl_multi_pw_aff *mpa2);
5406 These functions precompose the first expression by the second function.
5407 In other words, the second function is plugged
5408 into the first expression.
5412 #include <isl/aff.h>
5413 __isl_give isl_basic_set *isl_aff_le_basic_set(
5414 __isl_take isl_aff *aff1,
5415 __isl_take isl_aff *aff2);
5416 __isl_give isl_basic_set *isl_aff_ge_basic_set(
5417 __isl_take isl_aff *aff1,
5418 __isl_take isl_aff *aff2);
5419 __isl_give isl_set *isl_pw_aff_eq_set(
5420 __isl_take isl_pw_aff *pwaff1,
5421 __isl_take isl_pw_aff *pwaff2);
5422 __isl_give isl_set *isl_pw_aff_ne_set(
5423 __isl_take isl_pw_aff *pwaff1,
5424 __isl_take isl_pw_aff *pwaff2);
5425 __isl_give isl_set *isl_pw_aff_le_set(
5426 __isl_take isl_pw_aff *pwaff1,
5427 __isl_take isl_pw_aff *pwaff2);
5428 __isl_give isl_set *isl_pw_aff_lt_set(
5429 __isl_take isl_pw_aff *pwaff1,
5430 __isl_take isl_pw_aff *pwaff2);
5431 __isl_give isl_set *isl_pw_aff_ge_set(
5432 __isl_take isl_pw_aff *pwaff1,
5433 __isl_take isl_pw_aff *pwaff2);
5434 __isl_give isl_set *isl_pw_aff_gt_set(
5435 __isl_take isl_pw_aff *pwaff1,
5436 __isl_take isl_pw_aff *pwaff2);
5438 __isl_give isl_set *isl_multi_aff_lex_le_set(
5439 __isl_take isl_multi_aff *ma1,
5440 __isl_take isl_multi_aff *ma2);
5441 __isl_give isl_set *isl_multi_aff_lex_ge_set(
5442 __isl_take isl_multi_aff *ma1,
5443 __isl_take isl_multi_aff *ma2);
5445 __isl_give isl_set *isl_pw_aff_list_eq_set(
5446 __isl_take isl_pw_aff_list *list1,
5447 __isl_take isl_pw_aff_list *list2);
5448 __isl_give isl_set *isl_pw_aff_list_ne_set(
5449 __isl_take isl_pw_aff_list *list1,
5450 __isl_take isl_pw_aff_list *list2);
5451 __isl_give isl_set *isl_pw_aff_list_le_set(
5452 __isl_take isl_pw_aff_list *list1,
5453 __isl_take isl_pw_aff_list *list2);
5454 __isl_give isl_set *isl_pw_aff_list_lt_set(
5455 __isl_take isl_pw_aff_list *list1,
5456 __isl_take isl_pw_aff_list *list2);
5457 __isl_give isl_set *isl_pw_aff_list_ge_set(
5458 __isl_take isl_pw_aff_list *list1,
5459 __isl_take isl_pw_aff_list *list2);
5460 __isl_give isl_set *isl_pw_aff_list_gt_set(
5461 __isl_take isl_pw_aff_list *list1,
5462 __isl_take isl_pw_aff_list *list2);
5464 The function C<isl_aff_ge_basic_set> returns a basic set
5465 containing those elements in the shared space
5466 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
5467 The function C<isl_pw_aff_ge_set> returns a set
5468 containing those elements in the shared domain
5469 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
5470 greater than or equal to C<pwaff2>.
5471 The function C<isl_multi_aff_lex_le_set> returns a set
5472 containing those elements in the shared domain space
5473 where C<ma1> is lexicographically smaller than or
5475 The functions operating on C<isl_pw_aff_list> apply the corresponding
5476 C<isl_pw_aff> function to each pair of elements in the two lists.
5478 =item * Cartesian Product
5480 #include <isl/space.h>
5481 __isl_give isl_space *isl_space_product(
5482 __isl_take isl_space *space1,
5483 __isl_take isl_space *space2);
5484 __isl_give isl_space *isl_space_domain_product(
5485 __isl_take isl_space *space1,
5486 __isl_take isl_space *space2);
5487 __isl_give isl_space *isl_space_range_product(
5488 __isl_take isl_space *space1,
5489 __isl_take isl_space *space2);
5492 C<isl_space_product>, C<isl_space_domain_product>
5493 and C<isl_space_range_product> take pairs or relation spaces and
5494 produce a single relations space, where either the domain, the range
5495 or both domain and range are wrapped spaces of relations between
5496 the domains and/or ranges of the input spaces.
5497 If the product is only constructed over the domain or the range
5498 then the ranges or the domains of the inputs should be the same.
5499 The function C<isl_space_product> also accepts a pair of set spaces,
5500 in which case it returns a wrapped space of a relation between the
5503 #include <isl/set.h>
5504 __isl_give isl_set *isl_set_product(
5505 __isl_take isl_set *set1,
5506 __isl_take isl_set *set2);
5508 #include <isl/map.h>
5509 __isl_give isl_basic_map *isl_basic_map_domain_product(
5510 __isl_take isl_basic_map *bmap1,
5511 __isl_take isl_basic_map *bmap2);
5512 __isl_give isl_basic_map *isl_basic_map_range_product(
5513 __isl_take isl_basic_map *bmap1,
5514 __isl_take isl_basic_map *bmap2);
5515 __isl_give isl_basic_map *isl_basic_map_product(
5516 __isl_take isl_basic_map *bmap1,
5517 __isl_take isl_basic_map *bmap2);
5518 __isl_give isl_map *isl_map_domain_product(
5519 __isl_take isl_map *map1,
5520 __isl_take isl_map *map2);
5521 __isl_give isl_map *isl_map_range_product(
5522 __isl_take isl_map *map1,
5523 __isl_take isl_map *map2);
5524 __isl_give isl_map *isl_map_product(
5525 __isl_take isl_map *map1,
5526 __isl_take isl_map *map2);
5528 #include <isl/union_set.h>
5529 __isl_give isl_union_set *isl_union_set_product(
5530 __isl_take isl_union_set *uset1,
5531 __isl_take isl_union_set *uset2);
5533 #include <isl/union_map.h>
5534 __isl_give isl_union_map *isl_union_map_domain_product(
5535 __isl_take isl_union_map *umap1,
5536 __isl_take isl_union_map *umap2);
5537 __isl_give isl_union_map *isl_union_map_range_product(
5538 __isl_take isl_union_map *umap1,
5539 __isl_take isl_union_map *umap2);
5540 __isl_give isl_union_map *isl_union_map_product(
5541 __isl_take isl_union_map *umap1,
5542 __isl_take isl_union_map *umap2);
5544 #include <isl/val.h>
5545 __isl_give isl_multi_val *isl_multi_val_range_product(
5546 __isl_take isl_multi_val *mv1,
5547 __isl_take isl_multi_val *mv2);
5548 __isl_give isl_multi_val *isl_multi_val_product(
5549 __isl_take isl_multi_val *mv1,
5550 __isl_take isl_multi_val *mv2);
5552 #include <isl/aff.h>
5553 __isl_give isl_multi_aff *isl_multi_aff_range_product(
5554 __isl_take isl_multi_aff *ma1,
5555 __isl_take isl_multi_aff *ma2);
5556 __isl_give isl_multi_aff *isl_multi_aff_product(
5557 __isl_take isl_multi_aff *ma1,
5558 __isl_take isl_multi_aff *ma2);
5559 __isl_give isl_multi_pw_aff *
5560 isl_multi_pw_aff_range_product(
5561 __isl_take isl_multi_pw_aff *mpa1,
5562 __isl_take isl_multi_pw_aff *mpa2);
5563 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
5564 __isl_take isl_multi_pw_aff *mpa1,
5565 __isl_take isl_multi_pw_aff *mpa2);
5566 __isl_give isl_pw_multi_aff *
5567 isl_pw_multi_aff_range_product(
5568 __isl_take isl_pw_multi_aff *pma1,
5569 __isl_take isl_pw_multi_aff *pma2);
5570 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
5571 __isl_take isl_pw_multi_aff *pma1,
5572 __isl_take isl_pw_multi_aff *pma2);
5574 The above functions compute the cross product of the given
5575 sets, relations or functions. The domains and ranges of the results
5576 are wrapped maps between domains and ranges of the inputs.
5577 To obtain a ``flat'' product, use the following functions
5580 #include <isl/set.h>
5581 __isl_give isl_basic_set *isl_basic_set_flat_product(
5582 __isl_take isl_basic_set *bset1,
5583 __isl_take isl_basic_set *bset2);
5584 __isl_give isl_set *isl_set_flat_product(
5585 __isl_take isl_set *set1,
5586 __isl_take isl_set *set2);
5588 #include <isl/map.h>
5589 __isl_give isl_basic_map *isl_basic_map_flat_range_product(
5590 __isl_take isl_basic_map *bmap1,
5591 __isl_take isl_basic_map *bmap2);
5592 __isl_give isl_map *isl_map_flat_domain_product(
5593 __isl_take isl_map *map1,
5594 __isl_take isl_map *map2);
5595 __isl_give isl_map *isl_map_flat_range_product(
5596 __isl_take isl_map *map1,
5597 __isl_take isl_map *map2);
5598 __isl_give isl_basic_map *isl_basic_map_flat_product(
5599 __isl_take isl_basic_map *bmap1,
5600 __isl_take isl_basic_map *bmap2);
5601 __isl_give isl_map *isl_map_flat_product(
5602 __isl_take isl_map *map1,
5603 __isl_take isl_map *map2);
5605 #include <isl/union_map.h>
5606 __isl_give isl_union_map *
5607 isl_union_map_flat_domain_product(
5608 __isl_take isl_union_map *umap1,
5609 __isl_take isl_union_map *umap2);
5610 __isl_give isl_union_map *
5611 isl_union_map_flat_range_product(
5612 __isl_take isl_union_map *umap1,
5613 __isl_take isl_union_map *umap2);
5615 #include <isl/val.h>
5616 __isl_give isl_multi_val *isl_multi_val_flat_range_product(
5617 __isl_take isl_multi_val *mv1,
5618 __isl_take isl_multi_aff *mv2);
5620 #include <isl/aff.h>
5621 __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
5622 __isl_take isl_multi_aff *ma1,
5623 __isl_take isl_multi_aff *ma2);
5624 __isl_give isl_pw_multi_aff *
5625 isl_pw_multi_aff_flat_range_product(
5626 __isl_take isl_pw_multi_aff *pma1,
5627 __isl_take isl_pw_multi_aff *pma2);
5628 __isl_give isl_multi_pw_aff *
5629 isl_multi_pw_aff_flat_range_product(
5630 __isl_take isl_multi_pw_aff *mpa1,
5631 __isl_take isl_multi_pw_aff *mpa2);
5632 __isl_give isl_union_pw_multi_aff *
5633 isl_union_pw_multi_aff_flat_range_product(
5634 __isl_take isl_union_pw_multi_aff *upma1,
5635 __isl_take isl_union_pw_multi_aff *upma2);
5637 #include <isl/space.h>
5638 __isl_give isl_space *isl_space_factor_domain(
5639 __isl_take isl_space *space);
5640 __isl_give isl_space *isl_space_factor_range(
5641 __isl_take isl_space *space);
5642 __isl_give isl_space *isl_space_domain_factor_domain(
5643 __isl_take isl_space *space);
5644 __isl_give isl_space *isl_space_domain_factor_range(
5645 __isl_take isl_space *space);
5646 __isl_give isl_space *isl_space_range_factor_domain(
5647 __isl_take isl_space *space);
5648 __isl_give isl_space *isl_space_range_factor_range(
5649 __isl_take isl_space *space);
5651 The functions C<isl_space_range_factor_domain> and
5652 C<isl_space_range_factor_range> extract the two arguments from
5653 the result of a call to C<isl_space_range_product>.
5655 The arguments of a call to C<isl_map_range_product> can be extracted
5656 from the result using the following functions.
5658 #include <isl/map.h>
5659 __isl_give isl_map *isl_map_factor_domain(
5660 __isl_take isl_map *map);
5661 __isl_give isl_map *isl_map_factor_range(
5662 __isl_take isl_map *map);
5663 __isl_give isl_map *isl_map_domain_factor_domain(
5664 __isl_take isl_map *map);
5665 __isl_give isl_map *isl_map_domain_factor_range(
5666 __isl_take isl_map *map);
5667 __isl_give isl_map *isl_map_range_factor_domain(
5668 __isl_take isl_map *map);
5669 __isl_give isl_map *isl_map_range_factor_range(
5670 __isl_take isl_map *map);
5672 #include <isl/union_map.h>
5673 __isl_give isl_union_map *isl_union_map_factor_domain(
5674 __isl_take isl_union_map *umap);
5675 __isl_give isl_union_map *isl_union_map_factor_range(
5676 __isl_take isl_union_map *umap);
5677 __isl_give isl_union_map *
5678 isl_union_map_domain_factor_domain(
5679 __isl_take isl_union_map *umap);
5680 __isl_give isl_union_map *
5681 isl_union_map_domain_factor_range(
5682 __isl_take isl_union_map *umap);
5683 __isl_give isl_union_map *
5684 isl_union_map_range_factor_range(
5685 __isl_take isl_union_map *umap);
5687 #include <isl/val.h>
5688 __isl_give isl_multi_val *
5689 isl_multi_val_range_factor_domain(
5690 __isl_take isl_multi_val *mv);
5691 __isl_give isl_multi_val *
5692 isl_multi_val_range_factor_range(
5693 __isl_take isl_multi_val *mv);
5695 #include <isl/aff.h>
5696 __isl_give isl_multi_aff *
5697 isl_multi_aff_range_factor_domain(
5698 __isl_take isl_multi_aff *ma);
5699 __isl_give isl_multi_aff *
5700 isl_multi_aff_range_factor_range(
5701 __isl_take isl_multi_aff *ma);
5702 __isl_give isl_multi_pw_aff *
5703 isl_multi_pw_aff_range_factor_domain(
5704 __isl_take isl_multi_pw_aff *mpa);
5705 __isl_give isl_multi_pw_aff *
5706 isl_multi_pw_aff_range_factor_range(
5707 __isl_take isl_multi_pw_aff *mpa);
5709 The splice functions are a generalization of the flat product functions,
5710 where the second argument may be inserted at any position inside
5711 the first argument rather than being placed at the end.
5713 #include <isl/val.h>
5714 __isl_give isl_multi_val *isl_multi_val_range_splice(
5715 __isl_take isl_multi_val *mv1, unsigned pos,
5716 __isl_take isl_multi_val *mv2);
5718 #include <isl/aff.h>
5719 __isl_give isl_multi_aff *isl_multi_aff_range_splice(
5720 __isl_take isl_multi_aff *ma1, unsigned pos,
5721 __isl_take isl_multi_aff *ma2);
5722 __isl_give isl_multi_aff *isl_multi_aff_splice(
5723 __isl_take isl_multi_aff *ma1,
5724 unsigned in_pos, unsigned out_pos,
5725 __isl_take isl_multi_aff *ma2);
5726 __isl_give isl_multi_pw_aff *
5727 isl_multi_pw_aff_range_splice(
5728 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
5729 __isl_take isl_multi_pw_aff *mpa2);
5730 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
5731 __isl_take isl_multi_pw_aff *mpa1,
5732 unsigned in_pos, unsigned out_pos,
5733 __isl_take isl_multi_pw_aff *mpa2);
5735 =item * Simplification
5737 When applied to a set or relation,
5738 the gist operation returns a set or relation that has the
5739 same intersection with the context as the input set or relation.
5740 Any implicit equality in the intersection is made explicit in the result,
5741 while all inequalities that are redundant with respect to the intersection
5743 In case of union sets and relations, the gist operation is performed
5746 When applied to a function,
5747 the gist operation applies the set gist operation to each of
5748 the cells in the domain of the input piecewise expression.
5749 The context is also exploited
5750 to simplify the expression associated to each cell.
5752 #include <isl/set.h>
5753 __isl_give isl_basic_set *isl_basic_set_gist(
5754 __isl_take isl_basic_set *bset,
5755 __isl_take isl_basic_set *context);
5756 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
5757 __isl_take isl_set *context);
5758 __isl_give isl_set *isl_set_gist_params(
5759 __isl_take isl_set *set,
5760 __isl_take isl_set *context);
5762 #include <isl/map.h>
5763 __isl_give isl_basic_map *isl_basic_map_gist(
5764 __isl_take isl_basic_map *bmap,
5765 __isl_take isl_basic_map *context);
5766 __isl_give isl_basic_map *isl_basic_map_gist_domain(
5767 __isl_take isl_basic_map *bmap,
5768 __isl_take isl_basic_set *context);
5769 __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
5770 __isl_take isl_map *context);
5771 __isl_give isl_map *isl_map_gist_params(
5772 __isl_take isl_map *map,
5773 __isl_take isl_set *context);
5774 __isl_give isl_map *isl_map_gist_domain(
5775 __isl_take isl_map *map,
5776 __isl_take isl_set *context);
5777 __isl_give isl_map *isl_map_gist_range(
5778 __isl_take isl_map *map,
5779 __isl_take isl_set *context);
5781 #include <isl/union_set.h>
5782 __isl_give isl_union_set *isl_union_set_gist(
5783 __isl_take isl_union_set *uset,
5784 __isl_take isl_union_set *context);
5785 __isl_give isl_union_set *isl_union_set_gist_params(
5786 __isl_take isl_union_set *uset,
5787 __isl_take isl_set *set);
5789 #include <isl/union_map.h>
5790 __isl_give isl_union_map *isl_union_map_gist(
5791 __isl_take isl_union_map *umap,
5792 __isl_take isl_union_map *context);
5793 __isl_give isl_union_map *isl_union_map_gist_params(
5794 __isl_take isl_union_map *umap,
5795 __isl_take isl_set *set);
5796 __isl_give isl_union_map *isl_union_map_gist_domain(
5797 __isl_take isl_union_map *umap,
5798 __isl_take isl_union_set *uset);
5799 __isl_give isl_union_map *isl_union_map_gist_range(
5800 __isl_take isl_union_map *umap,
5801 __isl_take isl_union_set *uset);
5803 #include <isl/aff.h>
5804 __isl_give isl_aff *isl_aff_gist_params(
5805 __isl_take isl_aff *aff,
5806 __isl_take isl_set *context);
5807 __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
5808 __isl_take isl_set *context);
5809 __isl_give isl_multi_aff *isl_multi_aff_gist_params(
5810 __isl_take isl_multi_aff *maff,
5811 __isl_take isl_set *context);
5812 __isl_give isl_multi_aff *isl_multi_aff_gist(
5813 __isl_take isl_multi_aff *maff,
5814 __isl_take isl_set *context);
5815 __isl_give isl_pw_aff *isl_pw_aff_gist_params(
5816 __isl_take isl_pw_aff *pwaff,
5817 __isl_take isl_set *context);
5818 __isl_give isl_pw_aff *isl_pw_aff_gist(
5819 __isl_take isl_pw_aff *pwaff,
5820 __isl_take isl_set *context);
5821 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
5822 __isl_take isl_pw_multi_aff *pma,
5823 __isl_take isl_set *set);
5824 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
5825 __isl_take isl_pw_multi_aff *pma,
5826 __isl_take isl_set *set);
5827 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
5828 __isl_take isl_multi_pw_aff *mpa,
5829 __isl_take isl_set *set);
5830 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
5831 __isl_take isl_multi_pw_aff *mpa,
5832 __isl_take isl_set *set);
5833 __isl_give isl_union_pw_multi_aff *
5834 isl_union_pw_multi_aff_gist_params(
5835 __isl_take isl_union_pw_multi_aff *upma,
5836 __isl_take isl_set *context);
5837 __isl_give isl_union_pw_multi_aff *
5838 isl_union_pw_multi_aff_gist(
5839 __isl_take isl_union_pw_multi_aff *upma,
5840 __isl_take isl_union_set *context);
5842 #include <isl/polynomial.h>
5843 __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
5844 __isl_take isl_qpolynomial *qp,
5845 __isl_take isl_set *context);
5846 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
5847 __isl_take isl_qpolynomial *qp,
5848 __isl_take isl_set *context);
5849 __isl_give isl_qpolynomial_fold *
5850 isl_qpolynomial_fold_gist_params(
5851 __isl_take isl_qpolynomial_fold *fold,
5852 __isl_take isl_set *context);
5853 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
5854 __isl_take isl_qpolynomial_fold *fold,
5855 __isl_take isl_set *context);
5856 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
5857 __isl_take isl_pw_qpolynomial *pwqp,
5858 __isl_take isl_set *context);
5859 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
5860 __isl_take isl_pw_qpolynomial *pwqp,
5861 __isl_take isl_set *context);
5862 __isl_give isl_pw_qpolynomial_fold *
5863 isl_pw_qpolynomial_fold_gist(
5864 __isl_take isl_pw_qpolynomial_fold *pwf,
5865 __isl_take isl_set *context);
5866 __isl_give isl_pw_qpolynomial_fold *
5867 isl_pw_qpolynomial_fold_gist_params(
5868 __isl_take isl_pw_qpolynomial_fold *pwf,
5869 __isl_take isl_set *context);
5870 __isl_give isl_union_pw_qpolynomial *
5871 isl_union_pw_qpolynomial_gist_params(
5872 __isl_take isl_union_pw_qpolynomial *upwqp,
5873 __isl_take isl_set *context);
5874 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
5875 __isl_take isl_union_pw_qpolynomial *upwqp,
5876 __isl_take isl_union_set *context);
5877 __isl_give isl_union_pw_qpolynomial_fold *
5878 isl_union_pw_qpolynomial_fold_gist(
5879 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5880 __isl_take isl_union_set *context);
5881 __isl_give isl_union_pw_qpolynomial_fold *
5882 isl_union_pw_qpolynomial_fold_gist_params(
5883 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5884 __isl_take isl_set *context);
5886 =item * Binary Arithmethic Operations
5888 #include <isl/val.h>
5889 __isl_give isl_multi_val *isl_multi_val_sub(
5890 __isl_take isl_multi_val *mv1,
5891 __isl_take isl_multi_val *mv2);
5893 #include <isl/aff.h>
5894 __isl_give isl_aff *isl_aff_add(
5895 __isl_take isl_aff *aff1,
5896 __isl_take isl_aff *aff2);
5897 __isl_give isl_multi_aff *isl_multi_aff_add(
5898 __isl_take isl_multi_aff *maff1,
5899 __isl_take isl_multi_aff *maff2);
5900 __isl_give isl_pw_aff *isl_pw_aff_add(
5901 __isl_take isl_pw_aff *pwaff1,
5902 __isl_take isl_pw_aff *pwaff2);
5903 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
5904 __isl_take isl_pw_multi_aff *pma1,
5905 __isl_take isl_pw_multi_aff *pma2);
5906 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
5907 __isl_take isl_union_pw_multi_aff *upma1,
5908 __isl_take isl_union_pw_multi_aff *upma2);
5909 __isl_give isl_pw_aff *isl_pw_aff_min(
5910 __isl_take isl_pw_aff *pwaff1,
5911 __isl_take isl_pw_aff *pwaff2);
5912 __isl_give isl_pw_aff *isl_pw_aff_max(
5913 __isl_take isl_pw_aff *pwaff1,
5914 __isl_take isl_pw_aff *pwaff2);
5915 __isl_give isl_aff *isl_aff_sub(
5916 __isl_take isl_aff *aff1,
5917 __isl_take isl_aff *aff2);
5918 __isl_give isl_multi_aff *isl_multi_aff_sub(
5919 __isl_take isl_multi_aff *ma1,
5920 __isl_take isl_multi_aff *ma2);
5921 __isl_give isl_pw_aff *isl_pw_aff_sub(
5922 __isl_take isl_pw_aff *pwaff1,
5923 __isl_take isl_pw_aff *pwaff2);
5924 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
5925 __isl_take isl_multi_pw_aff *mpa1,
5926 __isl_take isl_multi_pw_aff *mpa2);
5927 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
5928 __isl_take isl_pw_multi_aff *pma1,
5929 __isl_take isl_pw_multi_aff *pma2);
5930 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
5931 __isl_take isl_union_pw_multi_aff *upma1,
5932 __isl_take isl_union_pw_multi_aff *upma2);
5934 C<isl_aff_sub> subtracts the second argument from the first.
5936 #include <isl/polynomial.h>
5937 __isl_give isl_qpolynomial *isl_qpolynomial_add(
5938 __isl_take isl_qpolynomial *qp1,
5939 __isl_take isl_qpolynomial *qp2);
5940 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
5941 __isl_take isl_pw_qpolynomial *pwqp1,
5942 __isl_take isl_pw_qpolynomial *pwqp2);
5943 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
5944 __isl_take isl_pw_qpolynomial *pwqp1,
5945 __isl_take isl_pw_qpolynomial *pwqp2);
5946 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
5947 __isl_take isl_pw_qpolynomial_fold *pwf1,
5948 __isl_take isl_pw_qpolynomial_fold *pwf2);
5949 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
5950 __isl_take isl_union_pw_qpolynomial *upwqp1,
5951 __isl_take isl_union_pw_qpolynomial *upwqp2);
5952 __isl_give isl_qpolynomial *isl_qpolynomial_sub(
5953 __isl_take isl_qpolynomial *qp1,
5954 __isl_take isl_qpolynomial *qp2);
5955 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
5956 __isl_take isl_pw_qpolynomial *pwqp1,
5957 __isl_take isl_pw_qpolynomial *pwqp2);
5958 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
5959 __isl_take isl_union_pw_qpolynomial *upwqp1,
5960 __isl_take isl_union_pw_qpolynomial *upwqp2);
5961 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
5962 __isl_take isl_pw_qpolynomial_fold *pwf1,
5963 __isl_take isl_pw_qpolynomial_fold *pwf2);
5964 __isl_give isl_union_pw_qpolynomial_fold *
5965 isl_union_pw_qpolynomial_fold_fold(
5966 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
5967 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
5969 #include <isl/aff.h>
5970 __isl_give isl_pw_aff *isl_pw_aff_union_add(
5971 __isl_take isl_pw_aff *pwaff1,
5972 __isl_take isl_pw_aff *pwaff2);
5973 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
5974 __isl_take isl_pw_multi_aff *pma1,
5975 __isl_take isl_pw_multi_aff *pma2);
5976 __isl_give isl_union_pw_multi_aff *
5977 isl_union_pw_multi_aff_union_add(
5978 __isl_take isl_union_pw_multi_aff *upma1,
5979 __isl_take isl_union_pw_multi_aff *upma2);
5980 __isl_give isl_pw_aff *isl_pw_aff_union_min(
5981 __isl_take isl_pw_aff *pwaff1,
5982 __isl_take isl_pw_aff *pwaff2);
5983 __isl_give isl_pw_aff *isl_pw_aff_union_max(
5984 __isl_take isl_pw_aff *pwaff1,
5985 __isl_take isl_pw_aff *pwaff2);
5987 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
5988 expression with a domain that is the union of those of C<pwaff1> and
5989 C<pwaff2> and such that on each cell, the quasi-affine expression is
5990 the maximum of those of C<pwaff1> and C<pwaff2>. If only one of
5991 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
5992 associated expression is the defined one.
5993 This in contrast to the C<isl_pw_aff_max> function, which is
5994 only defined on the shared definition domain of the arguments.
5996 #include <isl/val.h>
5997 __isl_give isl_multi_val *isl_multi_val_add_val(
5998 __isl_take isl_multi_val *mv,
5999 __isl_take isl_val *v);
6000 __isl_give isl_multi_val *isl_multi_val_mod_val(
6001 __isl_take isl_multi_val *mv,
6002 __isl_take isl_val *v);
6003 __isl_give isl_multi_val *isl_multi_val_scale_val(
6004 __isl_take isl_multi_val *mv,
6005 __isl_take isl_val *v);
6006 __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6007 __isl_take isl_multi_val *mv,
6008 __isl_take isl_val *v);
6010 #include <isl/aff.h>
6011 __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6012 __isl_take isl_val *mod);
6013 __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6014 __isl_take isl_pw_aff *pa,
6015 __isl_take isl_val *mod);
6016 __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6017 __isl_take isl_val *v);
6018 __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6019 __isl_take isl_multi_aff *ma,
6020 __isl_take isl_val *v);
6021 __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6022 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6023 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6024 __isl_take isl_multi_pw_aff *mpa,
6025 __isl_take isl_val *v);
6026 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6027 __isl_take isl_pw_multi_aff *pma,
6028 __isl_take isl_val *v);
6029 __isl_give isl_union_pw_multi_aff *
6030 isl_union_pw_multi_aff_scale_val(
6031 __isl_take isl_union_pw_multi_aff *upma,
6032 __isl_take isl_val *val);
6033 __isl_give isl_aff *isl_aff_scale_down_ui(
6034 __isl_take isl_aff *aff, unsigned f);
6035 __isl_give isl_aff *isl_aff_scale_down_val(
6036 __isl_take isl_aff *aff, __isl_take isl_val *v);
6037 __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6038 __isl_take isl_multi_aff *ma,
6039 __isl_take isl_val *v);
6040 __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6041 __isl_take isl_pw_aff *pa,
6042 __isl_take isl_val *f);
6043 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6044 __isl_take isl_multi_pw_aff *mpa,
6045 __isl_take isl_val *v);
6046 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6047 __isl_take isl_pw_multi_aff *pma,
6048 __isl_take isl_val *v);
6049 __isl_give isl_union_pw_multi_aff *
6050 isl_union_pw_multi_aff_scale_down_val(
6051 __isl_take isl_union_pw_multi_aff *upma,
6052 __isl_take isl_val *val);
6054 #include <isl/polynomial.h>
6055 __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6056 __isl_take isl_qpolynomial *qp,
6057 __isl_take isl_val *v);
6058 __isl_give isl_qpolynomial_fold *
6059 isl_qpolynomial_fold_scale_val(
6060 __isl_take isl_qpolynomial_fold *fold,
6061 __isl_take isl_val *v);
6062 __isl_give isl_pw_qpolynomial *
6063 isl_pw_qpolynomial_scale_val(
6064 __isl_take isl_pw_qpolynomial *pwqp,
6065 __isl_take isl_val *v);
6066 __isl_give isl_pw_qpolynomial_fold *
6067 isl_pw_qpolynomial_fold_scale_val(
6068 __isl_take isl_pw_qpolynomial_fold *pwf,
6069 __isl_take isl_val *v);
6070 __isl_give isl_union_pw_qpolynomial *
6071 isl_union_pw_qpolynomial_scale_val(
6072 __isl_take isl_union_pw_qpolynomial *upwqp,
6073 __isl_take isl_val *v);
6074 __isl_give isl_union_pw_qpolynomial_fold *
6075 isl_union_pw_qpolynomial_fold_scale_val(
6076 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6077 __isl_take isl_val *v);
6078 __isl_give isl_qpolynomial *
6079 isl_qpolynomial_scale_down_val(
6080 __isl_take isl_qpolynomial *qp,
6081 __isl_take isl_val *v);
6082 __isl_give isl_qpolynomial_fold *
6083 isl_qpolynomial_fold_scale_down_val(
6084 __isl_take isl_qpolynomial_fold *fold,
6085 __isl_take isl_val *v);
6086 __isl_give isl_pw_qpolynomial *
6087 isl_pw_qpolynomial_scale_down_val(
6088 __isl_take isl_pw_qpolynomial *pwqp,
6089 __isl_take isl_val *v);
6090 __isl_give isl_pw_qpolynomial_fold *
6091 isl_pw_qpolynomial_fold_scale_down_val(
6092 __isl_take isl_pw_qpolynomial_fold *pwf,
6093 __isl_take isl_val *v);
6094 __isl_give isl_union_pw_qpolynomial *
6095 isl_union_pw_qpolynomial_scale_down_val(
6096 __isl_take isl_union_pw_qpolynomial *upwqp,
6097 __isl_take isl_val *v);
6098 __isl_give isl_union_pw_qpolynomial_fold *
6099 isl_union_pw_qpolynomial_fold_scale_down_val(
6100 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6101 __isl_take isl_val *v);
6103 #include <isl/val.h>
6104 __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6105 __isl_take isl_multi_val *mv1,
6106 __isl_take isl_multi_val *mv2);
6107 __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6108 __isl_take isl_multi_val *mv1,
6109 __isl_take isl_multi_val *mv2);
6110 __isl_give isl_multi_val *
6111 isl_multi_val_scale_down_multi_val(
6112 __isl_take isl_multi_val *mv1,
6113 __isl_take isl_multi_val *mv2);
6115 #include <isl/aff.h>
6116 __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6117 __isl_take isl_multi_aff *ma,
6118 __isl_take isl_multi_val *mv);
6119 __isl_give isl_multi_pw_aff *
6120 isl_multi_pw_aff_mod_multi_val(
6121 __isl_take isl_multi_pw_aff *mpa,
6122 __isl_take isl_multi_val *mv);
6123 __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6124 __isl_take isl_multi_aff *ma,
6125 __isl_take isl_multi_val *mv);
6126 __isl_give isl_pw_multi_aff *
6127 isl_pw_multi_aff_scale_multi_val(
6128 __isl_take isl_pw_multi_aff *pma,
6129 __isl_take isl_multi_val *mv);
6130 __isl_give isl_multi_pw_aff *
6131 isl_multi_pw_aff_scale_multi_val(
6132 __isl_take isl_multi_pw_aff *mpa,
6133 __isl_take isl_multi_val *mv);
6134 __isl_give isl_union_pw_multi_aff *
6135 isl_union_pw_multi_aff_scale_multi_val(
6136 __isl_take isl_union_pw_multi_aff *upma,
6137 __isl_take isl_multi_val *mv);
6138 __isl_give isl_multi_aff *
6139 isl_multi_aff_scale_down_multi_val(
6140 __isl_take isl_multi_aff *ma,
6141 __isl_take isl_multi_val *mv);
6142 __isl_give isl_multi_pw_aff *
6143 isl_multi_pw_aff_scale_down_multi_val(
6144 __isl_take isl_multi_pw_aff *mpa,
6145 __isl_take isl_multi_val *mv);
6147 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6148 by the corresponding elements of C<mv>.
6150 #include <isl/aff.h>
6151 __isl_give isl_aff *isl_aff_mul(
6152 __isl_take isl_aff *aff1,
6153 __isl_take isl_aff *aff2);
6154 __isl_give isl_aff *isl_aff_div(
6155 __isl_take isl_aff *aff1,
6156 __isl_take isl_aff *aff2);
6157 __isl_give isl_pw_aff *isl_pw_aff_mul(
6158 __isl_take isl_pw_aff *pwaff1,
6159 __isl_take isl_pw_aff *pwaff2);
6160 __isl_give isl_pw_aff *isl_pw_aff_div(
6161 __isl_take isl_pw_aff *pa1,
6162 __isl_take isl_pw_aff *pa2);
6163 __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6164 __isl_take isl_pw_aff *pa1,
6165 __isl_take isl_pw_aff *pa2);
6166 __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6167 __isl_take isl_pw_aff *pa1,
6168 __isl_take isl_pw_aff *pa2);
6170 When multiplying two affine expressions, at least one of the two needs
6171 to be a constant. Similarly, when dividing an affine expression by another,
6172 the second expression needs to be a constant.
6173 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6174 rounding towards zero. C<isl_pw_aff_tdiv_r> computes the corresponding
6177 #include <isl/polynomial.h>
6178 __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6179 __isl_take isl_qpolynomial *qp1,
6180 __isl_take isl_qpolynomial *qp2);
6181 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6182 __isl_take isl_pw_qpolynomial *pwqp1,
6183 __isl_take isl_pw_qpolynomial *pwqp2);
6184 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6185 __isl_take isl_union_pw_qpolynomial *upwqp1,
6186 __isl_take isl_union_pw_qpolynomial *upwqp2);
6190 =head3 Lexicographic Optimization
6192 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6193 the following functions
6194 compute a set that contains the lexicographic minimum or maximum
6195 of the elements in C<set> (or C<bset>) for those values of the parameters
6196 that satisfy C<dom>.
6197 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6198 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6200 In other words, the union of the parameter values
6201 for which the result is non-empty and of C<*empty>
6204 #include <isl/set.h>
6205 __isl_give isl_set *isl_basic_set_partial_lexmin(
6206 __isl_take isl_basic_set *bset,
6207 __isl_take isl_basic_set *dom,
6208 __isl_give isl_set **empty);
6209 __isl_give isl_set *isl_basic_set_partial_lexmax(
6210 __isl_take isl_basic_set *bset,
6211 __isl_take isl_basic_set *dom,
6212 __isl_give isl_set **empty);
6213 __isl_give isl_set *isl_set_partial_lexmin(
6214 __isl_take isl_set *set, __isl_take isl_set *dom,
6215 __isl_give isl_set **empty);
6216 __isl_give isl_set *isl_set_partial_lexmax(
6217 __isl_take isl_set *set, __isl_take isl_set *dom,
6218 __isl_give isl_set **empty);
6220 Given a (basic) set C<set> (or C<bset>), the following functions simply
6221 return a set containing the lexicographic minimum or maximum
6222 of the elements in C<set> (or C<bset>).
6223 In case of union sets, the optimum is computed per space.
6225 #include <isl/set.h>
6226 __isl_give isl_set *isl_basic_set_lexmin(
6227 __isl_take isl_basic_set *bset);
6228 __isl_give isl_set *isl_basic_set_lexmax(
6229 __isl_take isl_basic_set *bset);
6230 __isl_give isl_set *isl_set_lexmin(
6231 __isl_take isl_set *set);
6232 __isl_give isl_set *isl_set_lexmax(
6233 __isl_take isl_set *set);
6234 __isl_give isl_union_set *isl_union_set_lexmin(
6235 __isl_take isl_union_set *uset);
6236 __isl_give isl_union_set *isl_union_set_lexmax(
6237 __isl_take isl_union_set *uset);
6239 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6240 the following functions
6241 compute a relation that maps each element of C<dom>
6242 to the single lexicographic minimum or maximum
6243 of the elements that are associated to that same
6244 element in C<map> (or C<bmap>).
6245 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6246 that contains the elements in C<dom> that do not map
6247 to any elements in C<map> (or C<bmap>).
6248 In other words, the union of the domain of the result and of C<*empty>
6251 #include <isl/map.h>
6252 __isl_give isl_map *isl_basic_map_partial_lexmax(
6253 __isl_take isl_basic_map *bmap,
6254 __isl_take isl_basic_set *dom,
6255 __isl_give isl_set **empty);
6256 __isl_give isl_map *isl_basic_map_partial_lexmin(
6257 __isl_take isl_basic_map *bmap,
6258 __isl_take isl_basic_set *dom,
6259 __isl_give isl_set **empty);
6260 __isl_give isl_map *isl_map_partial_lexmax(
6261 __isl_take isl_map *map, __isl_take isl_set *dom,
6262 __isl_give isl_set **empty);
6263 __isl_give isl_map *isl_map_partial_lexmin(
6264 __isl_take isl_map *map, __isl_take isl_set *dom,
6265 __isl_give isl_set **empty);
6267 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6268 return a map mapping each element in the domain of
6269 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6270 of all elements associated to that element.
6271 In case of union relations, the optimum is computed per space.
6273 #include <isl/map.h>
6274 __isl_give isl_map *isl_basic_map_lexmin(
6275 __isl_take isl_basic_map *bmap);
6276 __isl_give isl_map *isl_basic_map_lexmax(
6277 __isl_take isl_basic_map *bmap);
6278 __isl_give isl_map *isl_map_lexmin(
6279 __isl_take isl_map *map);
6280 __isl_give isl_map *isl_map_lexmax(
6281 __isl_take isl_map *map);
6282 __isl_give isl_union_map *isl_union_map_lexmin(
6283 __isl_take isl_union_map *umap);
6284 __isl_give isl_union_map *isl_union_map_lexmax(
6285 __isl_take isl_union_map *umap);
6287 The following functions return their result in the form of
6288 a piecewise multi-affine expression,
6289 but are otherwise equivalent to the corresponding functions
6290 returning a basic set or relation.
6292 #include <isl/set.h>
6293 __isl_give isl_pw_multi_aff *
6294 isl_basic_set_partial_lexmin_pw_multi_aff(
6295 __isl_take isl_basic_set *bset,
6296 __isl_take isl_basic_set *dom,
6297 __isl_give isl_set **empty);
6298 __isl_give isl_pw_multi_aff *
6299 isl_basic_set_partial_lexmax_pw_multi_aff(
6300 __isl_take isl_basic_set *bset,
6301 __isl_take isl_basic_set *dom,
6302 __isl_give isl_set **empty);
6303 __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6304 __isl_take isl_set *set);
6305 __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6306 __isl_take isl_set *set);
6308 #include <isl/map.h>
6309 __isl_give isl_pw_multi_aff *
6310 isl_basic_map_lexmin_pw_multi_aff(
6311 __isl_take isl_basic_map *bmap);
6312 __isl_give isl_pw_multi_aff *
6313 isl_basic_map_partial_lexmin_pw_multi_aff(
6314 __isl_take isl_basic_map *bmap,
6315 __isl_take isl_basic_set *dom,
6316 __isl_give isl_set **empty);
6317 __isl_give isl_pw_multi_aff *
6318 isl_basic_map_partial_lexmax_pw_multi_aff(
6319 __isl_take isl_basic_map *bmap,
6320 __isl_take isl_basic_set *dom,
6321 __isl_give isl_set **empty);
6322 __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
6323 __isl_take isl_map *map);
6324 __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
6325 __isl_take isl_map *map);
6327 The following functions return the lexicographic minimum or maximum
6328 on the shared domain of the inputs and the single defined function
6329 on those parts of the domain where only a single function is defined.
6331 #include <isl/aff.h>
6332 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
6333 __isl_take isl_pw_multi_aff *pma1,
6334 __isl_take isl_pw_multi_aff *pma2);
6335 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
6336 __isl_take isl_pw_multi_aff *pma1,
6337 __isl_take isl_pw_multi_aff *pma2);
6339 =head2 Ternary Operations
6341 #include <isl/aff.h>
6342 __isl_give isl_pw_aff *isl_pw_aff_cond(
6343 __isl_take isl_pw_aff *cond,
6344 __isl_take isl_pw_aff *pwaff_true,
6345 __isl_take isl_pw_aff *pwaff_false);
6347 The function C<isl_pw_aff_cond> performs a conditional operator
6348 and returns an expression that is equal to C<pwaff_true>
6349 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
6350 where C<cond> is zero.
6354 Lists are defined over several element types, including
6355 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>,
6356 C<isl_union_pw_multi_aff>, C<isl_constraint>,
6357 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
6358 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
6359 Here we take lists of C<isl_set>s as an example.
6360 Lists can be created, copied, modified and freed using the following functions.
6362 #include <isl/set.h>
6363 __isl_give isl_set_list *isl_set_list_from_set(
6364 __isl_take isl_set *el);
6365 __isl_give isl_set_list *isl_set_list_alloc(
6366 isl_ctx *ctx, int n);
6367 __isl_give isl_set_list *isl_set_list_copy(
6368 __isl_keep isl_set_list *list);
6369 __isl_give isl_set_list *isl_set_list_insert(
6370 __isl_take isl_set_list *list, unsigned pos,
6371 __isl_take isl_set *el);
6372 __isl_give isl_set_list *isl_set_list_add(
6373 __isl_take isl_set_list *list,
6374 __isl_take isl_set *el);
6375 __isl_give isl_set_list *isl_set_list_drop(
6376 __isl_take isl_set_list *list,
6377 unsigned first, unsigned n);
6378 __isl_give isl_set_list *isl_set_list_set_set(
6379 __isl_take isl_set_list *list, int index,
6380 __isl_take isl_set *set);
6381 __isl_give isl_set_list *isl_set_list_concat(
6382 __isl_take isl_set_list *list1,
6383 __isl_take isl_set_list *list2);
6384 __isl_give isl_set_list *isl_set_list_sort(
6385 __isl_take isl_set_list *list,
6386 int (*cmp)(__isl_keep isl_set *a,
6387 __isl_keep isl_set *b, void *user),
6389 __isl_null isl_set_list *isl_set_list_free(
6390 __isl_take isl_set_list *list);
6392 C<isl_set_list_alloc> creates an empty list with an initial capacity
6393 for C<n> elements. C<isl_set_list_insert> and C<isl_set_list_add>
6394 add elements to a list, increasing its capacity as needed.
6395 C<isl_set_list_from_set> creates a list with a single element.
6397 Lists can be inspected using the following functions.
6399 #include <isl/set.h>
6400 int isl_set_list_n_set(__isl_keep isl_set_list *list);
6401 __isl_give isl_set *isl_set_list_get_set(
6402 __isl_keep isl_set_list *list, int index);
6403 int isl_set_list_foreach(__isl_keep isl_set_list *list,
6404 int (*fn)(__isl_take isl_set *el, void *user),
6406 int isl_set_list_foreach_scc(__isl_keep isl_set_list *list,
6407 int (*follows)(__isl_keep isl_set *a,
6408 __isl_keep isl_set *b, void *user),
6410 int (*fn)(__isl_take isl_set *el, void *user),
6413 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
6414 strongly connected components of the graph with as vertices the elements
6415 of C<list> and a directed edge from vertex C<b> to vertex C<a>
6416 iff C<follows(a, b)> returns C<1>. The callbacks C<follows> and C<fn>
6417 should return C<-1> on error.
6419 Lists can be printed using
6421 #include <isl/set.h>
6422 __isl_give isl_printer *isl_printer_print_set_list(
6423 __isl_take isl_printer *p,
6424 __isl_keep isl_set_list *list);
6426 =head2 Associative arrays
6428 Associative arrays map isl objects of a specific type to isl objects
6429 of some (other) specific type. They are defined for several pairs
6430 of types, including (C<isl_map>, C<isl_basic_set>),
6431 (C<isl_id>, C<isl_ast_expr>) and.
6432 (C<isl_id>, C<isl_pw_aff>).
6433 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
6436 Associative arrays can be created, copied and freed using
6437 the following functions.
6439 #include <isl/id_to_ast_expr.h>
6440 __isl_give id_to_ast_expr *isl_id_to_ast_expr_alloc(
6441 isl_ctx *ctx, int min_size);
6442 __isl_give id_to_ast_expr *isl_id_to_ast_expr_copy(
6443 __isl_keep id_to_ast_expr *id2expr);
6444 __isl_null id_to_ast_expr *isl_id_to_ast_expr_free(
6445 __isl_take id_to_ast_expr *id2expr);
6447 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
6448 to specify the expected size of the associative array.
6449 The associative array will be grown automatically as needed.
6451 Associative arrays can be inspected using the following functions.
6453 #include <isl/id_to_ast_expr.h>
6454 int isl_id_to_ast_expr_has(
6455 __isl_keep id_to_ast_expr *id2expr,
6456 __isl_keep isl_id *key);
6457 __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
6458 __isl_keep id_to_ast_expr *id2expr,
6459 __isl_take isl_id *key);
6460 int isl_id_to_ast_expr_foreach(
6461 __isl_keep id_to_ast_expr *id2expr,
6462 int (*fn)(__isl_take isl_id *key,
6463 __isl_take isl_ast_expr *val, void *user),
6466 They can be modified using the following function.
6468 #include <isl/id_to_ast_expr.h>
6469 __isl_give id_to_ast_expr *isl_id_to_ast_expr_set(
6470 __isl_take id_to_ast_expr *id2expr,
6471 __isl_take isl_id *key,
6472 __isl_take isl_ast_expr *val);
6473 __isl_give id_to_ast_expr *isl_id_to_ast_expr_drop(
6474 __isl_take id_to_ast_expr *id2expr,
6475 __isl_take isl_id *key);
6477 Associative arrays can be printed using the following function.
6479 #include <isl/id_to_ast_expr.h>
6480 __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
6481 __isl_take isl_printer *p,
6482 __isl_keep id_to_ast_expr *id2expr);
6486 Vectors can be created, copied and freed using the following functions.
6488 #include <isl/vec.h>
6489 __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
6491 __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
6492 __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
6494 Note that the elements of a newly created vector may have arbitrary values.
6495 The elements can be changed and inspected using the following functions.
6497 int isl_vec_size(__isl_keep isl_vec *vec);
6498 __isl_give isl_val *isl_vec_get_element_val(
6499 __isl_keep isl_vec *vec, int pos);
6500 __isl_give isl_vec *isl_vec_set_element_si(
6501 __isl_take isl_vec *vec, int pos, int v);
6502 __isl_give isl_vec *isl_vec_set_element_val(
6503 __isl_take isl_vec *vec, int pos,
6504 __isl_take isl_val *v);
6505 __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
6507 __isl_give isl_vec *isl_vec_set_val(
6508 __isl_take isl_vec *vec, __isl_take isl_val *v);
6509 int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
6510 __isl_keep isl_vec *vec2, int pos);
6512 C<isl_vec_get_element> will return a negative value if anything went wrong.
6513 In that case, the value of C<*v> is undefined.
6515 The following function can be used to concatenate two vectors.
6517 __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
6518 __isl_take isl_vec *vec2);
6522 Matrices can be created, copied and freed using the following functions.
6524 #include <isl/mat.h>
6525 __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
6526 unsigned n_row, unsigned n_col);
6527 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
6528 __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
6530 Note that the elements of a newly created matrix may have arbitrary values.
6531 The elements can be changed and inspected using the following functions.
6533 int isl_mat_rows(__isl_keep isl_mat *mat);
6534 int isl_mat_cols(__isl_keep isl_mat *mat);
6535 __isl_give isl_val *isl_mat_get_element_val(
6536 __isl_keep isl_mat *mat, int row, int col);
6537 __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
6538 int row, int col, int v);
6539 __isl_give isl_mat *isl_mat_set_element_val(
6540 __isl_take isl_mat *mat, int row, int col,
6541 __isl_take isl_val *v);
6543 C<isl_mat_get_element> will return a negative value if anything went wrong.
6544 In that case, the value of C<*v> is undefined.
6546 The following function can be used to compute the (right) inverse
6547 of a matrix, i.e., a matrix such that the product of the original
6548 and the inverse (in that order) is a multiple of the identity matrix.
6549 The input matrix is assumed to be of full row-rank.
6551 __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
6553 The following function can be used to compute the (right) kernel
6554 (or null space) of a matrix, i.e., a matrix such that the product of
6555 the original and the kernel (in that order) is the zero matrix.
6557 __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
6559 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
6561 The following functions determine
6562 an upper or lower bound on a quasipolynomial over its domain.
6564 __isl_give isl_pw_qpolynomial_fold *
6565 isl_pw_qpolynomial_bound(
6566 __isl_take isl_pw_qpolynomial *pwqp,
6567 enum isl_fold type, int *tight);
6569 __isl_give isl_union_pw_qpolynomial_fold *
6570 isl_union_pw_qpolynomial_bound(
6571 __isl_take isl_union_pw_qpolynomial *upwqp,
6572 enum isl_fold type, int *tight);
6574 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
6575 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
6576 is the returned bound is known be tight, i.e., for each value
6577 of the parameters there is at least
6578 one element in the domain that reaches the bound.
6579 If the domain of C<pwqp> is not wrapping, then the bound is computed
6580 over all elements in that domain and the result has a purely parametric
6581 domain. If the domain of C<pwqp> is wrapping, then the bound is
6582 computed over the range of the wrapped relation. The domain of the
6583 wrapped relation becomes the domain of the result.
6585 =head2 Parametric Vertex Enumeration
6587 The parametric vertex enumeration described in this section
6588 is mainly intended to be used internally and by the C<barvinok>
6591 #include <isl/vertices.h>
6592 __isl_give isl_vertices *isl_basic_set_compute_vertices(
6593 __isl_keep isl_basic_set *bset);
6595 The function C<isl_basic_set_compute_vertices> performs the
6596 actual computation of the parametric vertices and the chamber
6597 decomposition and store the result in an C<isl_vertices> object.
6598 This information can be queried by either iterating over all
6599 the vertices or iterating over all the chambers or cells
6600 and then iterating over all vertices that are active on the chamber.
6602 int isl_vertices_foreach_vertex(
6603 __isl_keep isl_vertices *vertices,
6604 int (*fn)(__isl_take isl_vertex *vertex, void *user),
6607 int isl_vertices_foreach_cell(
6608 __isl_keep isl_vertices *vertices,
6609 int (*fn)(__isl_take isl_cell *cell, void *user),
6611 int isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
6612 int (*fn)(__isl_take isl_vertex *vertex, void *user),
6615 Other operations that can be performed on an C<isl_vertices> object are
6618 int isl_vertices_get_n_vertices(
6619 __isl_keep isl_vertices *vertices);
6620 void isl_vertices_free(__isl_take isl_vertices *vertices);
6622 Vertices can be inspected and destroyed using the following functions.
6624 int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
6625 __isl_give isl_basic_set *isl_vertex_get_domain(
6626 __isl_keep isl_vertex *vertex);
6627 __isl_give isl_multi_aff *isl_vertex_get_expr(
6628 __isl_keep isl_vertex *vertex);
6629 void isl_vertex_free(__isl_take isl_vertex *vertex);
6631 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
6632 describing the vertex in terms of the parameters,
6633 while C<isl_vertex_get_domain> returns the activity domain
6636 Chambers can be inspected and destroyed using the following functions.
6638 __isl_give isl_basic_set *isl_cell_get_domain(
6639 __isl_keep isl_cell *cell);
6640 void isl_cell_free(__isl_take isl_cell *cell);
6642 =head1 Polyhedral Compilation Library
6644 This section collects functionality in C<isl> that has been specifically
6645 designed for use during polyhedral compilation.
6647 =head2 Dependence Analysis
6649 C<isl> contains specialized functionality for performing
6650 array dataflow analysis. That is, given a I<sink> access relation
6651 and a collection of possible I<source> access relations,
6652 C<isl> can compute relations that describe
6653 for each iteration of the sink access, which iteration
6654 of which of the source access relations was the last
6655 to access the same data element before the given iteration
6657 The resulting dependence relations map source iterations
6658 to the corresponding sink iterations.
6659 To compute standard flow dependences, the sink should be
6660 a read, while the sources should be writes.
6661 If any of the source accesses are marked as being I<may>
6662 accesses, then there will be a dependence from the last
6663 I<must> access B<and> from any I<may> access that follows
6664 this last I<must> access.
6665 In particular, if I<all> sources are I<may> accesses,
6666 then memory based dependence analysis is performed.
6667 If, on the other hand, all sources are I<must> accesses,
6668 then value based dependence analysis is performed.
6670 #include <isl/flow.h>
6672 typedef int (*isl_access_level_before)(void *first, void *second);
6674 __isl_give isl_access_info *isl_access_info_alloc(
6675 __isl_take isl_map *sink,
6676 void *sink_user, isl_access_level_before fn,
6678 __isl_give isl_access_info *isl_access_info_add_source(
6679 __isl_take isl_access_info *acc,
6680 __isl_take isl_map *source, int must,
6682 __isl_null isl_access_info *isl_access_info_free(
6683 __isl_take isl_access_info *acc);
6685 __isl_give isl_flow *isl_access_info_compute_flow(
6686 __isl_take isl_access_info *acc);
6688 int isl_flow_foreach(__isl_keep isl_flow *deps,
6689 int (*fn)(__isl_take isl_map *dep, int must,
6690 void *dep_user, void *user),
6692 __isl_give isl_map *isl_flow_get_no_source(
6693 __isl_keep isl_flow *deps, int must);
6694 void isl_flow_free(__isl_take isl_flow *deps);
6696 The function C<isl_access_info_compute_flow> performs the actual
6697 dependence analysis. The other functions are used to construct
6698 the input for this function or to read off the output.
6700 The input is collected in an C<isl_access_info>, which can
6701 be created through a call to C<isl_access_info_alloc>.
6702 The arguments to this functions are the sink access relation
6703 C<sink>, a token C<sink_user> used to identify the sink
6704 access to the user, a callback function for specifying the
6705 relative order of source and sink accesses, and the number
6706 of source access relations that will be added.
6707 The callback function has type C<int (*)(void *first, void *second)>.
6708 The function is called with two user supplied tokens identifying
6709 either a source or the sink and it should return the shared nesting
6710 level and the relative order of the two accesses.
6711 In particular, let I<n> be the number of loops shared by
6712 the two accesses. If C<first> precedes C<second> textually,
6713 then the function should return I<2 * n + 1>; otherwise,
6714 it should return I<2 * n>.
6715 The sources can be added to the C<isl_access_info> by performing
6716 (at most) C<max_source> calls to C<isl_access_info_add_source>.
6717 C<must> indicates whether the source is a I<must> access
6718 or a I<may> access. Note that a multi-valued access relation
6719 should only be marked I<must> if every iteration in the domain
6720 of the relation accesses I<all> elements in its image.
6721 The C<source_user> token is again used to identify
6722 the source access. The range of the source access relation
6723 C<source> should have the same dimension as the range
6724 of the sink access relation.
6725 The C<isl_access_info_free> function should usually not be
6726 called explicitly, because it is called implicitly by
6727 C<isl_access_info_compute_flow>.
6729 The result of the dependence analysis is collected in an
6730 C<isl_flow>. There may be elements of
6731 the sink access for which no preceding source access could be
6732 found or for which all preceding sources are I<may> accesses.
6733 The relations containing these elements can be obtained through
6734 calls to C<isl_flow_get_no_source>, the first with C<must> set
6735 and the second with C<must> unset.
6736 In the case of standard flow dependence analysis,
6737 with the sink a read and the sources I<must> writes,
6738 the first relation corresponds to the reads from uninitialized
6739 array elements and the second relation is empty.
6740 The actual flow dependences can be extracted using
6741 C<isl_flow_foreach>. This function will call the user-specified
6742 callback function C<fn> for each B<non-empty> dependence between
6743 a source and the sink. The callback function is called
6744 with four arguments, the actual flow dependence relation
6745 mapping source iterations to sink iterations, a boolean that
6746 indicates whether it is a I<must> or I<may> dependence, a token
6747 identifying the source and an additional C<void *> with value
6748 equal to the third argument of the C<isl_flow_foreach> call.
6749 A dependence is marked I<must> if it originates from a I<must>
6750 source and if it is not followed by any I<may> sources.
6752 After finishing with an C<isl_flow>, the user should call
6753 C<isl_flow_free> to free all associated memory.
6755 A higher-level interface to dependence analysis is provided
6756 by the following function.
6758 #include <isl/flow.h>
6760 int isl_union_map_compute_flow(__isl_take isl_union_map *sink,
6761 __isl_take isl_union_map *must_source,
6762 __isl_take isl_union_map *may_source,
6763 __isl_take isl_union_map *schedule,
6764 __isl_give isl_union_map **must_dep,
6765 __isl_give isl_union_map **may_dep,
6766 __isl_give isl_union_map **must_no_source,
6767 __isl_give isl_union_map **may_no_source);
6769 The arrays are identified by the tuple names of the ranges
6770 of the accesses. The iteration domains by the tuple names
6771 of the domains of the accesses and of the schedule.
6772 The relative order of the iteration domains is given by the
6773 schedule. The relations returned through C<must_no_source>
6774 and C<may_no_source> are subsets of C<sink>.
6775 Any of C<must_dep>, C<may_dep>, C<must_no_source>
6776 or C<may_no_source> may be C<NULL>, but a C<NULL> value for
6777 any of the other arguments is treated as an error.
6779 =head3 Interaction with Dependence Analysis
6781 During the dependence analysis, we frequently need to perform
6782 the following operation. Given a relation between sink iterations
6783 and potential source iterations from a particular source domain,
6784 what is the last potential source iteration corresponding to each
6785 sink iteration. It can sometimes be convenient to adjust
6786 the set of potential source iterations before or after each such operation.
6787 The prototypical example is fuzzy array dataflow analysis,
6788 where we need to analyze if, based on data-dependent constraints,
6789 the sink iteration can ever be executed without one or more of
6790 the corresponding potential source iterations being executed.
6791 If so, we can introduce extra parameters and select an unknown
6792 but fixed source iteration from the potential source iterations.
6793 To be able to perform such manipulations, C<isl> provides the following
6796 #include <isl/flow.h>
6798 typedef __isl_give isl_restriction *(*isl_access_restrict)(
6799 __isl_keep isl_map *source_map,
6800 __isl_keep isl_set *sink, void *source_user,
6802 __isl_give isl_access_info *isl_access_info_set_restrict(
6803 __isl_take isl_access_info *acc,
6804 isl_access_restrict fn, void *user);
6806 The function C<isl_access_info_set_restrict> should be called
6807 before calling C<isl_access_info_compute_flow> and registers a callback function
6808 that will be called any time C<isl> is about to compute the last
6809 potential source. The first argument is the (reverse) proto-dependence,
6810 mapping sink iterations to potential source iterations.
6811 The second argument represents the sink iterations for which
6812 we want to compute the last source iteration.
6813 The third argument is the token corresponding to the source
6814 and the final argument is the token passed to C<isl_access_info_set_restrict>.
6815 The callback is expected to return a restriction on either the input or
6816 the output of the operation computing the last potential source.
6817 If the input needs to be restricted then restrictions are needed
6818 for both the source and the sink iterations. The sink iterations
6819 and the potential source iterations will be intersected with these sets.
6820 If the output needs to be restricted then only a restriction on the source
6821 iterations is required.
6822 If any error occurs, the callback should return C<NULL>.
6823 An C<isl_restriction> object can be created, freed and inspected
6824 using the following functions.
6826 #include <isl/flow.h>
6828 __isl_give isl_restriction *isl_restriction_input(
6829 __isl_take isl_set *source_restr,
6830 __isl_take isl_set *sink_restr);
6831 __isl_give isl_restriction *isl_restriction_output(
6832 __isl_take isl_set *source_restr);
6833 __isl_give isl_restriction *isl_restriction_none(
6834 __isl_take isl_map *source_map);
6835 __isl_give isl_restriction *isl_restriction_empty(
6836 __isl_take isl_map *source_map);
6837 __isl_null isl_restriction *isl_restriction_free(
6838 __isl_take isl_restriction *restr);
6840 C<isl_restriction_none> and C<isl_restriction_empty> are special
6841 cases of C<isl_restriction_input>. C<isl_restriction_none>
6842 is essentially equivalent to
6844 isl_restriction_input(isl_set_universe(
6845 isl_space_range(isl_map_get_space(source_map))),
6847 isl_space_domain(isl_map_get_space(source_map))));
6849 whereas C<isl_restriction_empty> is essentially equivalent to
6851 isl_restriction_input(isl_set_empty(
6852 isl_space_range(isl_map_get_space(source_map))),
6854 isl_space_domain(isl_map_get_space(source_map))));
6858 B<The functionality described in this section is fairly new
6859 and may be subject to change.>
6861 #include <isl/schedule.h>
6862 __isl_give isl_schedule *
6863 isl_schedule_constraints_compute_schedule(
6864 __isl_take isl_schedule_constraints *sc);
6865 __isl_null isl_schedule *isl_schedule_free(
6866 __isl_take isl_schedule *sched);
6868 The function C<isl_schedule_constraints_compute_schedule> can be
6869 used to compute a schedule that satisfies the given schedule constraints.
6870 These schedule constraints include the iteration domain for which
6871 a schedule should be computed and dependences between pairs of
6872 iterations. In particular, these dependences include
6873 I<validity> dependences and I<proximity> dependences.
6874 By default, the algorithm used to construct the schedule is similar
6875 to that of C<Pluto>.
6876 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
6878 The generated schedule respects all validity dependences.
6879 That is, all dependence distances over these dependences in the
6880 scheduled space are lexicographically positive.
6881 The default algorithm tries to ensure that the dependence distances
6882 over coincidence constraints are zero and to minimize the
6883 dependence distances over proximity dependences.
6884 Moreover, it tries to obtain sequences (bands) of schedule dimensions
6885 for groups of domains where the dependence distances over validity
6886 dependences have only non-negative values.
6887 When using Feautrier's algorithm, the coincidence and proximity constraints
6888 are only taken into account during the extension to a
6889 full-dimensional schedule.
6891 An C<isl_schedule_constraints> object can be constructed
6892 and manipulated using the following functions.
6894 #include <isl/schedule.h>
6895 __isl_give isl_schedule_constraints *
6896 isl_schedule_constraints_copy(
6897 __isl_keep isl_schedule_constraints *sc);
6898 __isl_give isl_schedule_constraints *
6899 isl_schedule_constraints_on_domain(
6900 __isl_take isl_union_set *domain);
6901 __isl_give isl_schedule_constraints *
6902 isl_schedule_constraints_set_validity(
6903 __isl_take isl_schedule_constraints *sc,
6904 __isl_take isl_union_map *validity);
6905 __isl_give isl_schedule_constraints *
6906 isl_schedule_constraints_set_coincidence(
6907 __isl_take isl_schedule_constraints *sc,
6908 __isl_take isl_union_map *coincidence);
6909 __isl_give isl_schedule_constraints *
6910 isl_schedule_constraints_set_proximity(
6911 __isl_take isl_schedule_constraints *sc,
6912 __isl_take isl_union_map *proximity);
6913 __isl_give isl_schedule_constraints *
6914 isl_schedule_constraints_set_conditional_validity(
6915 __isl_take isl_schedule_constraints *sc,
6916 __isl_take isl_union_map *condition,
6917 __isl_take isl_union_map *validity);
6918 __isl_null isl_schedule_constraints *
6919 isl_schedule_constraints_free(
6920 __isl_take isl_schedule_constraints *sc);
6922 The initial C<isl_schedule_constraints> object created by
6923 C<isl_schedule_constraints_on_domain> does not impose any constraints.
6924 That is, it has an empty set of dependences.
6925 The function C<isl_schedule_constraints_set_validity> replaces the
6926 validity dependences, mapping domain elements I<i> to domain
6927 elements that should be scheduled after I<i>.
6928 The function C<isl_schedule_constraints_set_coincidence> replaces the
6929 coincidence dependences, mapping domain elements I<i> to domain
6930 elements that should be scheduled together with I<I>, if possible.
6931 The function C<isl_schedule_constraints_set_proximity> replaces the
6932 proximity dependences, mapping domain elements I<i> to domain
6933 elements that should be scheduled either before I<I>
6934 or as early as possible after I<i>.
6936 The function C<isl_schedule_constraints_set_conditional_validity>
6937 replaces the conditional validity constraints.
6938 A conditional validity constraint is only imposed when any of the corresponding
6939 conditions is satisfied, i.e., when any of them is non-zero.
6940 That is, the scheduler ensures that within each band if the dependence
6941 distances over the condition constraints are not all zero
6942 then all corresponding conditional validity constraints are respected.
6943 A conditional validity constraint corresponds to a condition
6944 if the two are adjacent, i.e., if the domain of one relation intersect
6945 the range of the other relation.
6946 The typical use case of conditional validity constraints is
6947 to allow order constraints between live ranges to be violated
6948 as long as the live ranges themselves are local to the band.
6949 To allow more fine-grained control over which conditions correspond
6950 to which conditional validity constraints, the domains and ranges
6951 of these relations may include I<tags>. That is, the domains and
6952 ranges of those relation may themselves be wrapped relations
6953 where the iteration domain appears in the domain of those wrapped relations
6954 and the range of the wrapped relations can be arbitrarily chosen
6955 by the user. Conditions and conditional validity constraints are only
6956 considered adjacent to each other if the entire wrapped relation matches.
6957 In particular, a relation with a tag will never be considered adjacent
6958 to a relation without a tag.
6960 The following function computes a schedule directly from
6961 an iteration domain and validity and proximity dependences
6962 and is implemented in terms of the functions described above.
6963 The use of C<isl_union_set_compute_schedule> is discouraged.
6965 #include <isl/schedule.h>
6966 __isl_give isl_schedule *isl_union_set_compute_schedule(
6967 __isl_take isl_union_set *domain,
6968 __isl_take isl_union_map *validity,
6969 __isl_take isl_union_map *proximity);
6971 A mapping from the domains to the scheduled space can be obtained
6972 from an C<isl_schedule> using the following function.
6974 __isl_give isl_union_map *isl_schedule_get_map(
6975 __isl_keep isl_schedule *sched);
6977 A representation of the schedule can be printed using
6979 __isl_give isl_printer *isl_printer_print_schedule(
6980 __isl_take isl_printer *p,
6981 __isl_keep isl_schedule *schedule);
6983 A representation of the schedule as a forest of bands can be obtained
6984 using the following function.
6986 __isl_give isl_band_list *isl_schedule_get_band_forest(
6987 __isl_keep isl_schedule *schedule);
6989 The individual bands can be visited in depth-first post-order
6990 using the following function.
6992 #include <isl/schedule.h>
6993 int isl_schedule_foreach_band(
6994 __isl_keep isl_schedule *sched,
6995 int (*fn)(__isl_keep isl_band *band, void *user),
6998 The list can be manipulated as explained in L<"Lists">.
6999 The bands inside the list can be copied and freed using the following
7002 #include <isl/band.h>
7003 __isl_give isl_band *isl_band_copy(
7004 __isl_keep isl_band *band);
7005 __isl_null isl_band *isl_band_free(
7006 __isl_take isl_band *band);
7008 Each band contains zero or more scheduling dimensions.
7009 These are referred to as the members of the band.
7010 The section of the schedule that corresponds to the band is
7011 referred to as the partial schedule of the band.
7012 For those nodes that participate in a band, the outer scheduling
7013 dimensions form the prefix schedule, while the inner scheduling
7014 dimensions form the suffix schedule.
7015 That is, if we take a cut of the band forest, then the union of
7016 the concatenations of the prefix, partial and suffix schedules of
7017 each band in the cut is equal to the entire schedule (modulo
7018 some possible padding at the end with zero scheduling dimensions).
7019 The properties of a band can be inspected using the following functions.
7021 #include <isl/band.h>
7022 int isl_band_has_children(__isl_keep isl_band *band);
7023 __isl_give isl_band_list *isl_band_get_children(
7024 __isl_keep isl_band *band);
7026 __isl_give isl_union_map *isl_band_get_prefix_schedule(
7027 __isl_keep isl_band *band);
7028 __isl_give isl_union_map *isl_band_get_partial_schedule(
7029 __isl_keep isl_band *band);
7030 __isl_give isl_union_map *isl_band_get_suffix_schedule(
7031 __isl_keep isl_band *band);
7033 int isl_band_n_member(__isl_keep isl_band *band);
7034 int isl_band_member_is_coincident(
7035 __isl_keep isl_band *band, int pos);
7037 int isl_band_list_foreach_band(
7038 __isl_keep isl_band_list *list,
7039 int (*fn)(__isl_keep isl_band *band, void *user),
7042 Note that a scheduling dimension is considered to be ``coincident''
7043 if it satisfies the coincidence constraints within its band.
7044 That is, if the dependence distances of the coincidence
7045 constraints are all zero in that direction (for fixed
7046 iterations of outer bands).
7047 Like C<isl_schedule_foreach_band>,
7048 the function C<isl_band_list_foreach_band> calls C<fn> on the bands
7049 in depth-first post-order.
7051 A band can be tiled using the following function.
7053 #include <isl/band.h>
7054 int isl_band_tile(__isl_keep isl_band *band,
7055 __isl_take isl_vec *sizes);
7057 int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
7059 int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
7060 int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
7062 int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
7064 The C<isl_band_tile> function tiles the band using the given tile sizes
7065 inside its schedule.
7066 A new child band is created to represent the point loops and it is
7067 inserted between the modified band and its children.
7068 The C<tile_scale_tile_loops> option specifies whether the tile
7069 loops iterators should be scaled by the tile sizes.
7070 If the C<tile_shift_point_loops> option is set, then the point loops
7071 are shifted to start at zero.
7073 A band can be split into two nested bands using the following function.
7075 int isl_band_split(__isl_keep isl_band *band, int pos);
7077 The resulting outer band contains the first C<pos> dimensions of C<band>
7078 while the inner band contains the remaining dimensions.
7080 A representation of the band can be printed using
7082 #include <isl/band.h>
7083 __isl_give isl_printer *isl_printer_print_band(
7084 __isl_take isl_printer *p,
7085 __isl_keep isl_band *band);
7089 #include <isl/schedule.h>
7090 int isl_options_set_schedule_max_coefficient(
7091 isl_ctx *ctx, int val);
7092 int isl_options_get_schedule_max_coefficient(
7094 int isl_options_set_schedule_max_constant_term(
7095 isl_ctx *ctx, int val);
7096 int isl_options_get_schedule_max_constant_term(
7098 int isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
7099 int isl_options_get_schedule_fuse(isl_ctx *ctx);
7100 int isl_options_set_schedule_maximize_band_depth(
7101 isl_ctx *ctx, int val);
7102 int isl_options_get_schedule_maximize_band_depth(
7104 int isl_options_set_schedule_outer_coincidence(
7105 isl_ctx *ctx, int val);
7106 int isl_options_get_schedule_outer_coincidence(
7108 int isl_options_set_schedule_split_scaled(
7109 isl_ctx *ctx, int val);
7110 int isl_options_get_schedule_split_scaled(
7112 int isl_options_set_schedule_algorithm(
7113 isl_ctx *ctx, int val);
7114 int isl_options_get_schedule_algorithm(
7116 int isl_options_set_schedule_separate_components(
7117 isl_ctx *ctx, int val);
7118 int isl_options_get_schedule_separate_components(
7123 =item * schedule_max_coefficient
7125 This option enforces that the coefficients for variable and parameter
7126 dimensions in the calculated schedule are not larger than the specified value.
7127 This option can significantly increase the speed of the scheduling calculation
7128 and may also prevent fusing of unrelated dimensions. A value of -1 means that
7129 this option does not introduce bounds on the variable or parameter
7132 =item * schedule_max_constant_term
7134 This option enforces that the constant coefficients in the calculated schedule
7135 are not larger than the maximal constant term. This option can significantly
7136 increase the speed of the scheduling calculation and may also prevent fusing of
7137 unrelated dimensions. A value of -1 means that this option does not introduce
7138 bounds on the constant coefficients.
7140 =item * schedule_fuse
7142 This option controls the level of fusion.
7143 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
7144 resulting schedule will be distributed as much as possible.
7145 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
7146 try to fuse loops in the resulting schedule.
7148 =item * schedule_maximize_band_depth
7150 If this option is set, we do not split bands at the point
7151 where we detect splitting is necessary. Instead, we
7152 backtrack and split bands as early as possible. This
7153 reduces the number of splits and maximizes the width of
7154 the bands. Wider bands give more possibilities for tiling.
7155 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
7156 then bands will be split as early as possible, even if there is no need.
7157 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
7159 =item * schedule_outer_coincidence
7161 If this option is set, then we try to construct schedules
7162 where the outermost scheduling dimension in each band
7163 satisfies the coincidence constraints.
7165 =item * schedule_split_scaled
7167 If this option is set, then we try to construct schedules in which the
7168 constant term is split off from the linear part if the linear parts of
7169 the scheduling rows for all nodes in the graphs have a common non-trivial
7171 The constant term is then placed in a separate band and the linear
7174 =item * schedule_algorithm
7176 Selects the scheduling algorithm to be used.
7177 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
7178 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
7180 =item * schedule_separate_components
7182 If at any point the dependence graph contains any (weakly connected) components,
7183 then these components are scheduled separately.
7184 If this option is not set, then some iterations of the domains
7185 in these components may be scheduled together.
7186 If this option is set, then the components are given consecutive
7191 =head2 AST Generation
7193 This section describes the C<isl> functionality for generating
7194 ASTs that visit all the elements
7195 in a domain in an order specified by a schedule.
7196 In particular, given a C<isl_union_map>, an AST is generated
7197 that visits all the elements in the domain of the C<isl_union_map>
7198 according to the lexicographic order of the corresponding image
7199 element(s). If the range of the C<isl_union_map> consists of
7200 elements in more than one space, then each of these spaces is handled
7201 separately in an arbitrary order.
7202 It should be noted that the image elements only specify the I<order>
7203 in which the corresponding domain elements should be visited.
7204 No direct relation between the image elements and the loop iterators
7205 in the generated AST should be assumed.
7207 Each AST is generated within a build. The initial build
7208 simply specifies the constraints on the parameters (if any)
7209 and can be created, inspected, copied and freed using the following functions.
7211 #include <isl/ast_build.h>
7212 __isl_give isl_ast_build *isl_ast_build_from_context(
7213 __isl_take isl_set *set);
7214 __isl_give isl_ast_build *isl_ast_build_copy(
7215 __isl_keep isl_ast_build *build);
7216 __isl_null isl_ast_build *isl_ast_build_free(
7217 __isl_take isl_ast_build *build);
7219 The C<set> argument is usually a parameter set with zero or more parameters.
7220 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
7221 and L</"Fine-grained Control over AST Generation">.
7222 Finally, the AST itself can be constructed using the following
7225 #include <isl/ast_build.h>
7226 __isl_give isl_ast_node *isl_ast_build_ast_from_schedule(
7227 __isl_keep isl_ast_build *build,
7228 __isl_take isl_union_map *schedule);
7230 =head3 Inspecting the AST
7232 The basic properties of an AST node can be obtained as follows.
7234 #include <isl/ast.h>
7235 enum isl_ast_node_type isl_ast_node_get_type(
7236 __isl_keep isl_ast_node *node);
7238 The type of an AST node is one of
7239 C<isl_ast_node_for>,
7241 C<isl_ast_node_block> or
7242 C<isl_ast_node_user>.
7243 An C<isl_ast_node_for> represents a for node.
7244 An C<isl_ast_node_if> represents an if node.
7245 An C<isl_ast_node_block> represents a compound node.
7246 An C<isl_ast_node_user> represents an expression statement.
7247 An expression statement typically corresponds to a domain element, i.e.,
7248 one of the elements that is visited by the AST.
7250 Each type of node has its own additional properties.
7252 #include <isl/ast.h>
7253 __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
7254 __isl_keep isl_ast_node *node);
7255 __isl_give isl_ast_expr *isl_ast_node_for_get_init(
7256 __isl_keep isl_ast_node *node);
7257 __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
7258 __isl_keep isl_ast_node *node);
7259 __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
7260 __isl_keep isl_ast_node *node);
7261 __isl_give isl_ast_node *isl_ast_node_for_get_body(
7262 __isl_keep isl_ast_node *node);
7263 int isl_ast_node_for_is_degenerate(
7264 __isl_keep isl_ast_node *node);
7266 An C<isl_ast_for> is considered degenerate if it is known to execute
7269 #include <isl/ast.h>
7270 __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
7271 __isl_keep isl_ast_node *node);
7272 __isl_give isl_ast_node *isl_ast_node_if_get_then(
7273 __isl_keep isl_ast_node *node);
7274 int isl_ast_node_if_has_else(
7275 __isl_keep isl_ast_node *node);
7276 __isl_give isl_ast_node *isl_ast_node_if_get_else(
7277 __isl_keep isl_ast_node *node);
7279 __isl_give isl_ast_node_list *
7280 isl_ast_node_block_get_children(
7281 __isl_keep isl_ast_node *node);
7283 __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
7284 __isl_keep isl_ast_node *node);
7286 Each of the returned C<isl_ast_expr>s can in turn be inspected using
7287 the following functions.
7289 #include <isl/ast.h>
7290 enum isl_ast_expr_type isl_ast_expr_get_type(
7291 __isl_keep isl_ast_expr *expr);
7293 The type of an AST expression is one of
7295 C<isl_ast_expr_id> or
7296 C<isl_ast_expr_int>.
7297 An C<isl_ast_expr_op> represents the result of an operation.
7298 An C<isl_ast_expr_id> represents an identifier.
7299 An C<isl_ast_expr_int> represents an integer value.
7301 Each type of expression has its own additional properties.
7303 #include <isl/ast.h>
7304 enum isl_ast_op_type isl_ast_expr_get_op_type(
7305 __isl_keep isl_ast_expr *expr);
7306 int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
7307 __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
7308 __isl_keep isl_ast_expr *expr, int pos);
7309 int isl_ast_node_foreach_ast_op_type(
7310 __isl_keep isl_ast_node *node,
7311 int (*fn)(enum isl_ast_op_type type, void *user),
7314 C<isl_ast_expr_get_op_type> returns the type of the operation
7315 performed. C<isl_ast_expr_get_op_n_arg> returns the number of
7316 arguments. C<isl_ast_expr_get_op_arg> returns the specified
7318 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
7319 C<isl_ast_op_type> that appears in C<node>.
7320 The operation type is one of the following.
7324 =item C<isl_ast_op_and>
7326 Logical I<and> of two arguments.
7327 Both arguments can be evaluated.
7329 =item C<isl_ast_op_and_then>
7331 Logical I<and> of two arguments.
7332 The second argument can only be evaluated if the first evaluates to true.
7334 =item C<isl_ast_op_or>
7336 Logical I<or> of two arguments.
7337 Both arguments can be evaluated.
7339 =item C<isl_ast_op_or_else>
7341 Logical I<or> of two arguments.
7342 The second argument can only be evaluated if the first evaluates to false.
7344 =item C<isl_ast_op_max>
7346 Maximum of two or more arguments.
7348 =item C<isl_ast_op_min>
7350 Minimum of two or more arguments.
7352 =item C<isl_ast_op_minus>
7356 =item C<isl_ast_op_add>
7358 Sum of two arguments.
7360 =item C<isl_ast_op_sub>
7362 Difference of two arguments.
7364 =item C<isl_ast_op_mul>
7366 Product of two arguments.
7368 =item C<isl_ast_op_div>
7370 Exact division. That is, the result is known to be an integer.
7372 =item C<isl_ast_op_fdiv_q>
7374 Result of integer division, rounded towards negative
7377 =item C<isl_ast_op_pdiv_q>
7379 Result of integer division, where dividend is known to be non-negative.
7381 =item C<isl_ast_op_pdiv_r>
7383 Remainder of integer division, where dividend is known to be non-negative.
7385 =item C<isl_ast_op_zdiv_r>
7387 Equal to zero iff the remainder on integer division is zero.
7389 =item C<isl_ast_op_cond>
7391 Conditional operator defined on three arguments.
7392 If the first argument evaluates to true, then the result
7393 is equal to the second argument. Otherwise, the result
7394 is equal to the third argument.
7395 The second and third argument may only be evaluated if
7396 the first argument evaluates to true and false, respectively.
7397 Corresponds to C<a ? b : c> in C.
7399 =item C<isl_ast_op_select>
7401 Conditional operator defined on three arguments.
7402 If the first argument evaluates to true, then the result
7403 is equal to the second argument. Otherwise, the result
7404 is equal to the third argument.
7405 The second and third argument may be evaluated independently
7406 of the value of the first argument.
7407 Corresponds to C<a * b + (1 - a) * c> in C.
7409 =item C<isl_ast_op_eq>
7413 =item C<isl_ast_op_le>
7415 Less than or equal relation.
7417 =item C<isl_ast_op_lt>
7421 =item C<isl_ast_op_ge>
7423 Greater than or equal relation.
7425 =item C<isl_ast_op_gt>
7427 Greater than relation.
7429 =item C<isl_ast_op_call>
7432 The number of arguments of the C<isl_ast_expr> is one more than
7433 the number of arguments in the function call, the first argument
7434 representing the function being called.
7436 =item C<isl_ast_op_access>
7439 The number of arguments of the C<isl_ast_expr> is one more than
7440 the number of index expressions in the array access, the first argument
7441 representing the array being accessed.
7443 =item C<isl_ast_op_member>
7446 This operation has two arguments, a structure and the name of
7447 the member of the structure being accessed.
7451 #include <isl/ast.h>
7452 __isl_give isl_id *isl_ast_expr_get_id(
7453 __isl_keep isl_ast_expr *expr);
7455 Return the identifier represented by the AST expression.
7457 #include <isl/ast.h>
7458 __isl_give isl_val *isl_ast_expr_get_val(
7459 __isl_keep isl_ast_expr *expr);
7461 Return the integer represented by the AST expression.
7463 =head3 Properties of ASTs
7465 #include <isl/ast.h>
7466 int isl_ast_expr_is_equal(__isl_keep isl_ast_expr *expr1,
7467 __isl_keep isl_ast_expr *expr2);
7469 Check if two C<isl_ast_expr>s are equal to each other.
7471 =head3 Manipulating and printing the AST
7473 AST nodes can be copied and freed using the following functions.
7475 #include <isl/ast.h>
7476 __isl_give isl_ast_node *isl_ast_node_copy(
7477 __isl_keep isl_ast_node *node);
7478 __isl_null isl_ast_node *isl_ast_node_free(
7479 __isl_take isl_ast_node *node);
7481 AST expressions can be copied and freed using the following functions.
7483 #include <isl/ast.h>
7484 __isl_give isl_ast_expr *isl_ast_expr_copy(
7485 __isl_keep isl_ast_expr *expr);
7486 __isl_null isl_ast_expr *isl_ast_expr_free(
7487 __isl_take isl_ast_expr *expr);
7489 New AST expressions can be created either directly or within
7490 the context of an C<isl_ast_build>.
7492 #include <isl/ast.h>
7493 __isl_give isl_ast_expr *isl_ast_expr_from_val(
7494 __isl_take isl_val *v);
7495 __isl_give isl_ast_expr *isl_ast_expr_from_id(
7496 __isl_take isl_id *id);
7497 __isl_give isl_ast_expr *isl_ast_expr_neg(
7498 __isl_take isl_ast_expr *expr);
7499 __isl_give isl_ast_expr *isl_ast_expr_address_of(
7500 __isl_take isl_ast_expr *expr);
7501 __isl_give isl_ast_expr *isl_ast_expr_add(
7502 __isl_take isl_ast_expr *expr1,
7503 __isl_take isl_ast_expr *expr2);
7504 __isl_give isl_ast_expr *isl_ast_expr_sub(
7505 __isl_take isl_ast_expr *expr1,
7506 __isl_take isl_ast_expr *expr2);
7507 __isl_give isl_ast_expr *isl_ast_expr_mul(
7508 __isl_take isl_ast_expr *expr1,
7509 __isl_take isl_ast_expr *expr2);
7510 __isl_give isl_ast_expr *isl_ast_expr_div(
7511 __isl_take isl_ast_expr *expr1,
7512 __isl_take isl_ast_expr *expr2);
7513 __isl_give isl_ast_expr *isl_ast_expr_and(
7514 __isl_take isl_ast_expr *expr1,
7515 __isl_take isl_ast_expr *expr2)
7516 __isl_give isl_ast_expr *isl_ast_expr_or(
7517 __isl_take isl_ast_expr *expr1,
7518 __isl_take isl_ast_expr *expr2)
7519 __isl_give isl_ast_expr *isl_ast_expr_eq(
7520 __isl_take isl_ast_expr *expr1,
7521 __isl_take isl_ast_expr *expr2);
7522 __isl_give isl_ast_expr *isl_ast_expr_le(
7523 __isl_take isl_ast_expr *expr1,
7524 __isl_take isl_ast_expr *expr2);
7525 __isl_give isl_ast_expr *isl_ast_expr_lt(
7526 __isl_take isl_ast_expr *expr1,
7527 __isl_take isl_ast_expr *expr2);
7528 __isl_give isl_ast_expr *isl_ast_expr_ge(
7529 __isl_take isl_ast_expr *expr1,
7530 __isl_take isl_ast_expr *expr2);
7531 __isl_give isl_ast_expr *isl_ast_expr_gt(
7532 __isl_take isl_ast_expr *expr1,
7533 __isl_take isl_ast_expr *expr2);
7534 __isl_give isl_ast_expr *isl_ast_expr_access(
7535 __isl_take isl_ast_expr *array,
7536 __isl_take isl_ast_expr_list *indices);
7538 The function C<isl_ast_expr_address_of> can be applied to an
7539 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
7540 to represent the address of the C<isl_ast_expr_access>.
7542 #include <isl/ast_build.h>
7543 __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
7544 __isl_keep isl_ast_build *build,
7545 __isl_take isl_pw_aff *pa);
7546 __isl_give isl_ast_expr *
7547 isl_ast_build_access_from_pw_multi_aff(
7548 __isl_keep isl_ast_build *build,
7549 __isl_take isl_pw_multi_aff *pma);
7550 __isl_give isl_ast_expr *
7551 isl_ast_build_access_from_multi_pw_aff(
7552 __isl_keep isl_ast_build *build,
7553 __isl_take isl_multi_pw_aff *mpa);
7554 __isl_give isl_ast_expr *
7555 isl_ast_build_call_from_pw_multi_aff(
7556 __isl_keep isl_ast_build *build,
7557 __isl_take isl_pw_multi_aff *pma);
7558 __isl_give isl_ast_expr *
7559 isl_ast_build_call_from_multi_pw_aff(
7560 __isl_keep isl_ast_build *build,
7561 __isl_take isl_multi_pw_aff *mpa);
7563 The domains of C<pa>, C<mpa> and C<pma> should correspond
7564 to the schedule space of C<build>.
7565 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
7566 the function being called.
7567 If the accessed space is a nested relation, then it is taken
7568 to represent an access of the member specified by the range
7569 of this nested relation of the structure specified by the domain
7570 of the nested relation.
7572 The following functions can be used to modify an C<isl_ast_expr>.
7574 #include <isl/ast.h>
7575 __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
7576 __isl_take isl_ast_expr *expr, int pos,
7577 __isl_take isl_ast_expr *arg);
7579 Replace the argument of C<expr> at position C<pos> by C<arg>.
7581 #include <isl/ast.h>
7582 __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
7583 __isl_take isl_ast_expr *expr,
7584 __isl_take isl_id_to_ast_expr *id2expr);
7586 The function C<isl_ast_expr_substitute_ids> replaces the
7587 subexpressions of C<expr> of type C<isl_ast_expr_id>
7588 by the corresponding expression in C<id2expr>, if there is any.
7591 User specified data can be attached to an C<isl_ast_node> and obtained
7592 from the same C<isl_ast_node> using the following functions.
7594 #include <isl/ast.h>
7595 __isl_give isl_ast_node *isl_ast_node_set_annotation(
7596 __isl_take isl_ast_node *node,
7597 __isl_take isl_id *annotation);
7598 __isl_give isl_id *isl_ast_node_get_annotation(
7599 __isl_keep isl_ast_node *node);
7601 Basic printing can be performed using the following functions.
7603 #include <isl/ast.h>
7604 __isl_give isl_printer *isl_printer_print_ast_expr(
7605 __isl_take isl_printer *p,
7606 __isl_keep isl_ast_expr *expr);
7607 __isl_give isl_printer *isl_printer_print_ast_node(
7608 __isl_take isl_printer *p,
7609 __isl_keep isl_ast_node *node);
7610 __isl_give char *isl_ast_expr_to_str(
7611 __isl_keep isl_ast_expr *expr);
7613 More advanced printing can be performed using the following functions.
7615 #include <isl/ast.h>
7616 __isl_give isl_printer *isl_ast_op_type_print_macro(
7617 enum isl_ast_op_type type,
7618 __isl_take isl_printer *p);
7619 __isl_give isl_printer *isl_ast_node_print_macros(
7620 __isl_keep isl_ast_node *node,
7621 __isl_take isl_printer *p);
7622 __isl_give isl_printer *isl_ast_node_print(
7623 __isl_keep isl_ast_node *node,
7624 __isl_take isl_printer *p,
7625 __isl_take isl_ast_print_options *options);
7626 __isl_give isl_printer *isl_ast_node_for_print(
7627 __isl_keep isl_ast_node *node,
7628 __isl_take isl_printer *p,
7629 __isl_take isl_ast_print_options *options);
7630 __isl_give isl_printer *isl_ast_node_if_print(
7631 __isl_keep isl_ast_node *node,
7632 __isl_take isl_printer *p,
7633 __isl_take isl_ast_print_options *options);
7635 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
7636 C<isl> may print out an AST that makes use of macros such
7637 as C<floord>, C<min> and C<max>.
7638 C<isl_ast_op_type_print_macro> prints out the macro
7639 corresponding to a specific C<isl_ast_op_type>.
7640 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
7641 for expressions where these macros would be used and prints
7642 out the required macro definitions.
7643 Essentially, C<isl_ast_node_print_macros> calls
7644 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
7645 as function argument.
7646 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
7647 C<isl_ast_node_if_print> print an C<isl_ast_node>
7648 in C<ISL_FORMAT_C>, but allow for some extra control
7649 through an C<isl_ast_print_options> object.
7650 This object can be created using the following functions.
7652 #include <isl/ast.h>
7653 __isl_give isl_ast_print_options *
7654 isl_ast_print_options_alloc(isl_ctx *ctx);
7655 __isl_give isl_ast_print_options *
7656 isl_ast_print_options_copy(
7657 __isl_keep isl_ast_print_options *options);
7658 __isl_null isl_ast_print_options *
7659 isl_ast_print_options_free(
7660 __isl_take isl_ast_print_options *options);
7662 __isl_give isl_ast_print_options *
7663 isl_ast_print_options_set_print_user(
7664 __isl_take isl_ast_print_options *options,
7665 __isl_give isl_printer *(*print_user)(
7666 __isl_take isl_printer *p,
7667 __isl_take isl_ast_print_options *options,
7668 __isl_keep isl_ast_node *node, void *user),
7670 __isl_give isl_ast_print_options *
7671 isl_ast_print_options_set_print_for(
7672 __isl_take isl_ast_print_options *options,
7673 __isl_give isl_printer *(*print_for)(
7674 __isl_take isl_printer *p,
7675 __isl_take isl_ast_print_options *options,
7676 __isl_keep isl_ast_node *node, void *user),
7679 The callback set by C<isl_ast_print_options_set_print_user>
7680 is called whenever a node of type C<isl_ast_node_user> needs to
7682 The callback set by C<isl_ast_print_options_set_print_for>
7683 is called whenever a node of type C<isl_ast_node_for> needs to
7685 Note that C<isl_ast_node_for_print> will I<not> call the
7686 callback set by C<isl_ast_print_options_set_print_for> on the node
7687 on which C<isl_ast_node_for_print> is called, but only on nested
7688 nodes of type C<isl_ast_node_for>. It is therefore safe to
7689 call C<isl_ast_node_for_print> from within the callback set by
7690 C<isl_ast_print_options_set_print_for>.
7692 The following option determines the type to be used for iterators
7693 while printing the AST.
7695 int isl_options_set_ast_iterator_type(
7696 isl_ctx *ctx, const char *val);
7697 const char *isl_options_get_ast_iterator_type(
7700 The AST printer only prints body nodes as blocks if these
7701 blocks cannot be safely omitted.
7702 For example, a C<for> node with one body node will not be
7703 surrounded with braces in C<ISL_FORMAT_C>.
7704 A block will always be printed by setting the following option.
7706 int isl_options_set_ast_always_print_block(isl_ctx *ctx,
7708 int isl_options_get_ast_always_print_block(isl_ctx *ctx);
7712 #include <isl/ast_build.h>
7713 int isl_options_set_ast_build_atomic_upper_bound(
7714 isl_ctx *ctx, int val);
7715 int isl_options_get_ast_build_atomic_upper_bound(
7717 int isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
7719 int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
7720 int isl_options_set_ast_build_exploit_nested_bounds(
7721 isl_ctx *ctx, int val);
7722 int isl_options_get_ast_build_exploit_nested_bounds(
7724 int isl_options_set_ast_build_group_coscheduled(
7725 isl_ctx *ctx, int val);
7726 int isl_options_get_ast_build_group_coscheduled(
7728 int isl_options_set_ast_build_scale_strides(
7729 isl_ctx *ctx, int val);
7730 int isl_options_get_ast_build_scale_strides(
7732 int isl_options_set_ast_build_allow_else(isl_ctx *ctx,
7734 int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
7735 int isl_options_set_ast_build_allow_or(isl_ctx *ctx,
7737 int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
7741 =item * ast_build_atomic_upper_bound
7743 Generate loop upper bounds that consist of the current loop iterator,
7744 an operator and an expression not involving the iterator.
7745 If this option is not set, then the current loop iterator may appear
7746 several times in the upper bound.
7747 For example, when this option is turned off, AST generation
7750 [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
7754 for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
7757 When the option is turned on, the following AST is generated
7759 for (int c0 = 0; c0 <= min(100, n); c0 += 1)
7762 =item * ast_build_prefer_pdiv
7764 If this option is turned off, then the AST generation will
7765 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
7766 operators, but no C<isl_ast_op_pdiv_q> or
7767 C<isl_ast_op_pdiv_r> operators.
7768 If this options is turned on, then C<isl> will try to convert
7769 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
7770 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
7772 =item * ast_build_exploit_nested_bounds
7774 Simplify conditions based on bounds of nested for loops.
7775 In particular, remove conditions that are implied by the fact
7776 that one or more nested loops have at least one iteration,
7777 meaning that the upper bound is at least as large as the lower bound.
7778 For example, when this option is turned off, AST generation
7781 [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
7787 for (int c0 = 0; c0 <= N; c0 += 1)
7788 for (int c1 = 0; c1 <= M; c1 += 1)
7791 When the option is turned on, the following AST is generated
7793 for (int c0 = 0; c0 <= N; c0 += 1)
7794 for (int c1 = 0; c1 <= M; c1 += 1)
7797 =item * ast_build_group_coscheduled
7799 If two domain elements are assigned the same schedule point, then
7800 they may be executed in any order and they may even appear in different
7801 loops. If this options is set, then the AST generator will make
7802 sure that coscheduled domain elements do not appear in separate parts
7803 of the AST. This is useful in case of nested AST generation
7804 if the outer AST generation is given only part of a schedule
7805 and the inner AST generation should handle the domains that are
7806 coscheduled by this initial part of the schedule together.
7807 For example if an AST is generated for a schedule
7809 { A[i] -> [0]; B[i] -> [0] }
7811 then the C<isl_ast_build_set_create_leaf> callback described
7812 below may get called twice, once for each domain.
7813 Setting this option ensures that the callback is only called once
7814 on both domains together.
7816 =item * ast_build_separation_bounds
7818 This option specifies which bounds to use during separation.
7819 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
7820 then all (possibly implicit) bounds on the current dimension will
7821 be used during separation.
7822 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
7823 then only those bounds that are explicitly available will
7824 be used during separation.
7826 =item * ast_build_scale_strides
7828 This option specifies whether the AST generator is allowed
7829 to scale down iterators of strided loops.
7831 =item * ast_build_allow_else
7833 This option specifies whether the AST generator is allowed
7834 to construct if statements with else branches.
7836 =item * ast_build_allow_or
7838 This option specifies whether the AST generator is allowed
7839 to construct if conditions with disjunctions.
7843 =head3 Fine-grained Control over AST Generation
7845 Besides specifying the constraints on the parameters,
7846 an C<isl_ast_build> object can be used to control
7847 various aspects of the AST generation process.
7848 The most prominent way of control is through ``options'',
7849 which can be set using the following function.
7851 #include <isl/ast_build.h>
7852 __isl_give isl_ast_build *
7853 isl_ast_build_set_options(
7854 __isl_take isl_ast_build *control,
7855 __isl_take isl_union_map *options);
7857 The options are encoded in an C<isl_union_map>.
7858 The domain of this union relation refers to the schedule domain,
7859 i.e., the range of the schedule passed to C<isl_ast_build_ast_from_schedule>.
7860 In the case of nested AST generation (see L</"Nested AST Generation">),
7861 the domain of C<options> should refer to the extra piece of the schedule.
7862 That is, it should be equal to the range of the wrapped relation in the
7863 range of the schedule.
7864 The range of the options can consist of elements in one or more spaces,
7865 the names of which determine the effect of the option.
7866 The values of the range typically also refer to the schedule dimension
7867 to which the option applies. In case of nested AST generation
7868 (see L</"Nested AST Generation">), these values refer to the position
7869 of the schedule dimension within the innermost AST generation.
7870 The constraints on the domain elements of
7871 the option should only refer to this dimension and earlier dimensions.
7872 We consider the following spaces.
7876 =item C<separation_class>
7878 This space is a wrapped relation between two one dimensional spaces.
7879 The input space represents the schedule dimension to which the option
7880 applies and the output space represents the separation class.
7881 While constructing a loop corresponding to the specified schedule
7882 dimension(s), the AST generator will try to generate separate loops
7883 for domain elements that are assigned different classes.
7884 If only some of the elements are assigned a class, then those elements
7885 that are not assigned any class will be treated as belonging to a class
7886 that is separate from the explicitly assigned classes.
7887 The typical use case for this option is to separate full tiles from
7889 The other options, described below, are applied after the separation
7892 As an example, consider the separation into full and partial tiles
7893 of a tiling of a triangular domain.
7894 Take, for example, the domain
7896 { A[i,j] : 0 <= i,j and i + j <= 100 }
7898 and a tiling into tiles of 10 by 10. The input to the AST generator
7899 is then the schedule
7901 { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
7904 Without any options, the following AST is generated
7906 for (int c0 = 0; c0 <= 10; c0 += 1)
7907 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
7908 for (int c2 = 10 * c0;
7909 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
7911 for (int c3 = 10 * c1;
7912 c3 <= min(10 * c1 + 9, -c2 + 100);
7916 Separation into full and partial tiles can be obtained by assigning
7917 a class, say C<0>, to the full tiles. The full tiles are represented by those
7918 values of the first and second schedule dimensions for which there are
7919 values of the third and fourth dimensions to cover an entire tile.
7920 That is, we need to specify the following option
7922 { [a,b,c,d] -> separation_class[[0]->[0]] :
7923 exists b': 0 <= 10a,10b' and
7924 10a+9+10b'+9 <= 100;
7925 [a,b,c,d] -> separation_class[[1]->[0]] :
7926 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
7930 { [a, b, c, d] -> separation_class[[1] -> [0]] :
7931 a >= 0 and b >= 0 and b <= 8 - a;
7932 [a, b, c, d] -> separation_class[[0] -> [0]] :
7935 With this option, the generated AST is as follows
7938 for (int c0 = 0; c0 <= 8; c0 += 1) {
7939 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
7940 for (int c2 = 10 * c0;
7941 c2 <= 10 * c0 + 9; c2 += 1)
7942 for (int c3 = 10 * c1;
7943 c3 <= 10 * c1 + 9; c3 += 1)
7945 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
7946 for (int c2 = 10 * c0;
7947 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
7949 for (int c3 = 10 * c1;
7950 c3 <= min(-c2 + 100, 10 * c1 + 9);
7954 for (int c0 = 9; c0 <= 10; c0 += 1)
7955 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
7956 for (int c2 = 10 * c0;
7957 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
7959 for (int c3 = 10 * c1;
7960 c3 <= min(10 * c1 + 9, -c2 + 100);
7967 This is a single-dimensional space representing the schedule dimension(s)
7968 to which ``separation'' should be applied. Separation tries to split
7969 a loop into several pieces if this can avoid the generation of guards
7971 See also the C<atomic> option.
7975 This is a single-dimensional space representing the schedule dimension(s)
7976 for which the domains should be considered ``atomic''. That is, the
7977 AST generator will make sure that any given domain space will only appear
7978 in a single loop at the specified level.
7980 Consider the following schedule
7982 { a[i] -> [i] : 0 <= i < 10;
7983 b[i] -> [i+1] : 0 <= i < 10 }
7985 If the following option is specified
7987 { [i] -> separate[x] }
7989 then the following AST will be generated
7993 for (int c0 = 1; c0 <= 9; c0 += 1) {
8000 If, on the other hand, the following option is specified
8002 { [i] -> atomic[x] }
8004 then the following AST will be generated
8006 for (int c0 = 0; c0 <= 10; c0 += 1) {
8013 If neither C<atomic> nor C<separate> is specified, then the AST generator
8014 may produce either of these two results or some intermediate form.
8018 This is a single-dimensional space representing the schedule dimension(s)
8019 that should be I<completely> unrolled.
8020 To obtain a partial unrolling, the user should apply an additional
8021 strip-mining to the schedule and fully unroll the inner loop.
8025 Additional control is available through the following functions.
8027 #include <isl/ast_build.h>
8028 __isl_give isl_ast_build *
8029 isl_ast_build_set_iterators(
8030 __isl_take isl_ast_build *control,
8031 __isl_take isl_id_list *iterators);
8033 The function C<isl_ast_build_set_iterators> allows the user to
8034 specify a list of iterator C<isl_id>s to be used as iterators.
8035 If the input schedule is injective, then
8036 the number of elements in this list should be as large as the dimension
8037 of the schedule space, but no direct correspondence should be assumed
8038 between dimensions and elements.
8039 If the input schedule is not injective, then an additional number
8040 of C<isl_id>s equal to the largest dimension of the input domains
8042 If the number of provided C<isl_id>s is insufficient, then additional
8043 names are automatically generated.
8045 #include <isl/ast_build.h>
8046 __isl_give isl_ast_build *
8047 isl_ast_build_set_create_leaf(
8048 __isl_take isl_ast_build *control,
8049 __isl_give isl_ast_node *(*fn)(
8050 __isl_take isl_ast_build *build,
8051 void *user), void *user);
8054 C<isl_ast_build_set_create_leaf> function allows for the
8055 specification of a callback that should be called whenever the AST
8056 generator arrives at an element of the schedule domain.
8057 The callback should return an AST node that should be inserted
8058 at the corresponding position of the AST. The default action (when
8059 the callback is not set) is to continue generating parts of the AST to scan
8060 all the domain elements associated to the schedule domain element
8061 and to insert user nodes, ``calling'' the domain element, for each of them.
8062 The C<build> argument contains the current state of the C<isl_ast_build>.
8063 To ease nested AST generation (see L</"Nested AST Generation">),
8064 all control information that is
8065 specific to the current AST generation such as the options and
8066 the callbacks has been removed from this C<isl_ast_build>.
8067 The callback would typically return the result of a nested
8069 user defined node created using the following function.
8071 #include <isl/ast.h>
8072 __isl_give isl_ast_node *isl_ast_node_alloc_user(
8073 __isl_take isl_ast_expr *expr);
8075 #include <isl/ast_build.h>
8076 __isl_give isl_ast_build *
8077 isl_ast_build_set_at_each_domain(
8078 __isl_take isl_ast_build *build,
8079 __isl_give isl_ast_node *(*fn)(
8080 __isl_take isl_ast_node *node,
8081 __isl_keep isl_ast_build *build,
8082 void *user), void *user);
8083 __isl_give isl_ast_build *
8084 isl_ast_build_set_before_each_for(
8085 __isl_take isl_ast_build *build,
8086 __isl_give isl_id *(*fn)(
8087 __isl_keep isl_ast_build *build,
8088 void *user), void *user);
8089 __isl_give isl_ast_build *
8090 isl_ast_build_set_after_each_for(
8091 __isl_take isl_ast_build *build,
8092 __isl_give isl_ast_node *(*fn)(
8093 __isl_take isl_ast_node *node,
8094 __isl_keep isl_ast_build *build,
8095 void *user), void *user);
8097 The callback set by C<isl_ast_build_set_at_each_domain> will
8098 be called for each domain AST node.
8099 The callbacks set by C<isl_ast_build_set_before_each_for>
8100 and C<isl_ast_build_set_after_each_for> will be called
8101 for each for AST node. The first will be called in depth-first
8102 pre-order, while the second will be called in depth-first post-order.
8103 Since C<isl_ast_build_set_before_each_for> is called before the for
8104 node is actually constructed, it is only passed an C<isl_ast_build>.
8105 The returned C<isl_id> will be added as an annotation (using
8106 C<isl_ast_node_set_annotation>) to the constructed for node.
8107 In particular, if the user has also specified an C<after_each_for>
8108 callback, then the annotation can be retrieved from the node passed to
8109 that callback using C<isl_ast_node_get_annotation>.
8110 All callbacks should C<NULL> on failure.
8111 The given C<isl_ast_build> can be used to create new
8112 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
8113 or C<isl_ast_build_call_from_pw_multi_aff>.
8115 =head3 Nested AST Generation
8117 C<isl> allows the user to create an AST within the context
8118 of another AST. These nested ASTs are created using the
8119 same C<isl_ast_build_ast_from_schedule> function that is used to create the
8120 outer AST. The C<build> argument should be an C<isl_ast_build>
8121 passed to a callback set by
8122 C<isl_ast_build_set_create_leaf>.
8123 The space of the range of the C<schedule> argument should refer
8124 to this build. In particular, the space should be a wrapped
8125 relation and the domain of this wrapped relation should be the
8126 same as that of the range of the schedule returned by
8127 C<isl_ast_build_get_schedule> below.
8128 In practice, the new schedule is typically
8129 created by calling C<isl_union_map_range_product> on the old schedule
8130 and some extra piece of the schedule.
8131 The space of the schedule domain is also available from
8132 the C<isl_ast_build>.
8134 #include <isl/ast_build.h>
8135 __isl_give isl_union_map *isl_ast_build_get_schedule(
8136 __isl_keep isl_ast_build *build);
8137 __isl_give isl_space *isl_ast_build_get_schedule_space(
8138 __isl_keep isl_ast_build *build);
8139 __isl_give isl_ast_build *isl_ast_build_restrict(
8140 __isl_take isl_ast_build *build,
8141 __isl_take isl_set *set);
8143 The C<isl_ast_build_get_schedule> function returns a (partial)
8144 schedule for the domains elements for which part of the AST still needs to
8145 be generated in the current build.
8146 In particular, the domain elements are mapped to those iterations of the loops
8147 enclosing the current point of the AST generation inside which
8148 the domain elements are executed.
8149 No direct correspondence between
8150 the input schedule and this schedule should be assumed.
8151 The space obtained from C<isl_ast_build_get_schedule_space> can be used
8152 to create a set for C<isl_ast_build_restrict> to intersect
8153 with the current build. In particular, the set passed to
8154 C<isl_ast_build_restrict> can have additional parameters.
8155 The ids of the set dimensions in the space returned by
8156 C<isl_ast_build_get_schedule_space> correspond to the
8157 iterators of the already generated loops.
8158 The user should not rely on the ids of the output dimensions
8159 of the relations in the union relation returned by
8160 C<isl_ast_build_get_schedule> having any particular value.
8164 Although C<isl> is mainly meant to be used as a library,
8165 it also contains some basic applications that use some
8166 of the functionality of C<isl>.
8167 The input may be specified in either the L<isl format>
8168 or the L<PolyLib format>.
8170 =head2 C<isl_polyhedron_sample>
8172 C<isl_polyhedron_sample> takes a polyhedron as input and prints
8173 an integer element of the polyhedron, if there is any.
8174 The first column in the output is the denominator and is always
8175 equal to 1. If the polyhedron contains no integer points,
8176 then a vector of length zero is printed.
8180 C<isl_pip> takes the same input as the C<example> program
8181 from the C<piplib> distribution, i.e., a set of constraints
8182 on the parameters, a line containing only -1 and finally a set
8183 of constraints on a parametric polyhedron.
8184 The coefficients of the parameters appear in the last columns
8185 (but before the final constant column).
8186 The output is the lexicographic minimum of the parametric polyhedron.
8187 As C<isl> currently does not have its own output format, the output
8188 is just a dump of the internal state.
8190 =head2 C<isl_polyhedron_minimize>
8192 C<isl_polyhedron_minimize> computes the minimum of some linear
8193 or affine objective function over the integer points in a polyhedron.
8194 If an affine objective function
8195 is given, then the constant should appear in the last column.
8197 =head2 C<isl_polytope_scan>
8199 Given a polytope, C<isl_polytope_scan> prints
8200 all integer points in the polytope.
8202 =head2 C<isl_codegen>
8204 Given a schedule, a context set and an options relation,
8205 C<isl_codegen> prints out an AST that scans the domain elements
8206 of the schedule in the order of their image(s) taking into account
8207 the constraints in the context set.