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.
225 =item * Band forests have been replaced by schedule trees.
231 C<isl> is released under the MIT license.
235 Permission is hereby granted, free of charge, to any person obtaining a copy of
236 this software and associated documentation files (the "Software"), to deal in
237 the Software without restriction, including without limitation the rights to
238 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
239 of the Software, and to permit persons to whom the Software is furnished to do
240 so, subject to the following conditions:
242 The above copyright notice and this permission notice shall be included in all
243 copies or substantial portions of the Software.
245 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
246 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
247 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
248 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
249 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
250 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
255 Note that by default C<isl> requires C<GMP>, which is released
256 under the GNU Lesser General Public License (LGPL). This means
257 that code linked against C<isl> is also linked against LGPL code.
259 When configuring with C<--with-int=imath>, C<isl> will link against C<imath>, a
260 library for exact integer arithmetic released under the MIT license.
264 The source of C<isl> can be obtained either as a tarball
265 or from the git repository. Both are available from
266 L<http://freshmeat.net/projects/isl/>.
267 The installation process depends on how you obtained
270 =head2 Installation from the git repository
274 =item 1 Clone or update the repository
276 The first time the source is obtained, you need to clone
279 git clone git://repo.or.cz/isl.git
281 To obtain updates, you need to pull in the latest changes
285 =item 2 Optionally get C<imath> submodule
287 To build C<isl> with C<imath>, you need to obtain the C<imath>
288 submodule by running in the git source tree of C<isl>
293 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
295 =item 2 Generate C<configure>
301 After performing the above steps, continue
302 with the L<Common installation instructions>.
304 =head2 Common installation instructions
308 =item 1 Obtain C<GMP>
310 By default, building C<isl> requires C<GMP>, including its headers files.
311 Your distribution may not provide these header files by default
312 and you may need to install a package called C<gmp-devel> or something
313 similar. Alternatively, C<GMP> can be built from
314 source, available from L<http://gmplib.org/>.
315 C<GMP> is not needed if you build C<isl> with C<imath>.
319 C<isl> uses the standard C<autoconf> C<configure> script.
324 optionally followed by some configure options.
325 A complete list of options can be obtained by running
329 Below we discuss some of the more common options.
335 Installation prefix for C<isl>
337 =item C<--with-int=[gmp|imath]>
339 Select the integer library to be used by C<isl>, the default is C<gmp>.
340 Note that C<isl> may run significantly slower if you use C<imath>.
342 =item C<--with-gmp-prefix>
344 Installation prefix for C<GMP> (architecture-independent files).
346 =item C<--with-gmp-exec-prefix>
348 Installation prefix for C<GMP> (architecture-dependent files).
356 =item 4 Install (optional)
362 =head1 Integer Set Library
364 =head2 Memory Management
366 Since a high-level operation on isl objects usually involves
367 several substeps and since the user is usually not interested in
368 the intermediate results, most functions that return a new object
369 will also release all the objects passed as arguments.
370 If the user still wants to use one or more of these arguments
371 after the function call, she should pass along a copy of the
372 object rather than the object itself.
373 The user is then responsible for making sure that the original
374 object gets used somewhere else or is explicitly freed.
376 The arguments and return values of all documented functions are
377 annotated to make clear which arguments are released and which
378 arguments are preserved. In particular, the following annotations
385 C<__isl_give> means that a new object is returned.
386 The user should make sure that the returned pointer is
387 used exactly once as a value for an C<__isl_take> argument.
388 In between, it can be used as a value for as many
389 C<__isl_keep> arguments as the user likes.
390 There is one exception, and that is the case where the
391 pointer returned is C<NULL>. Is this case, the user
392 is free to use it as an C<__isl_take> argument or not.
393 When applied to a C<char *>, the returned pointer needs to be
398 C<__isl_null> means that a C<NULL> value is returned.
402 C<__isl_take> means that the object the argument points to
403 is taken over by the function and may no longer be used
404 by the user as an argument to any other function.
405 The pointer value must be one returned by a function
406 returning an C<__isl_give> pointer.
407 If the user passes in a C<NULL> value, then this will
408 be treated as an error in the sense that the function will
409 not perform its usual operation. However, it will still
410 make sure that all the other C<__isl_take> arguments
415 C<__isl_keep> means that the function will only use the object
416 temporarily. After the function has finished, the user
417 can still use it as an argument to other functions.
418 A C<NULL> value will be treated in the same way as
419 a C<NULL> value for an C<__isl_take> argument.
420 This annotation may also be used on return values of
421 type C<const char *>, in which case the returned pointer should
422 not be freed by the user and is only valid until the object
423 from which it was derived is updated or freed.
427 =head2 Initialization
429 All manipulations of integer sets and relations occur within
430 the context of an C<isl_ctx>.
431 A given C<isl_ctx> can only be used within a single thread.
432 All arguments of a function are required to have been allocated
433 within the same context.
434 There are currently no functions available for moving an object
435 from one C<isl_ctx> to another C<isl_ctx>. This means that
436 there is currently no way of safely moving an object from one
437 thread to another, unless the whole C<isl_ctx> is moved.
439 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
440 freed using C<isl_ctx_free>.
441 All objects allocated within an C<isl_ctx> should be freed
442 before the C<isl_ctx> itself is freed.
444 isl_ctx *isl_ctx_alloc();
445 void isl_ctx_free(isl_ctx *ctx);
447 The user can impose a bound on the number of low-level I<operations>
448 that can be performed by an C<isl_ctx>. This bound can be set and
449 retrieved using the following functions. A bound of zero means that
450 no bound is imposed. The number of operations performed can be
451 reset using C<isl_ctx_reset_operations>. Note that the number
452 of low-level operations needed to perform a high-level computation
453 may differ significantly across different versions
454 of C<isl>, but it should be the same across different platforms
455 for the same version of C<isl>.
457 Warning: This feature is experimental. C<isl> has good support to abort and
458 bail out during the computation, but this feature may exercise error code paths
459 that are normally not used that much. Consequently, it is not unlikely that
460 hidden bugs will be exposed.
462 void isl_ctx_set_max_operations(isl_ctx *ctx,
463 unsigned long max_operations);
464 unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
465 void isl_ctx_reset_operations(isl_ctx *ctx);
467 In order to be able to create an object in the same context
468 as another object, most object types (described later in
469 this document) provide a function to obtain the context
470 in which the object was created.
473 isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
474 isl_ctx *isl_multi_val_get_ctx(
475 __isl_keep isl_multi_val *mv);
478 isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
480 #include <isl/local_space.h>
481 isl_ctx *isl_local_space_get_ctx(
482 __isl_keep isl_local_space *ls);
485 isl_ctx *isl_set_list_get_ctx(
486 __isl_keep isl_set_list *list);
489 isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
490 isl_ctx *isl_multi_aff_get_ctx(
491 __isl_keep isl_multi_aff *maff);
492 isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
493 isl_ctx *isl_pw_multi_aff_get_ctx(
494 __isl_keep isl_pw_multi_aff *pma);
495 isl_ctx *isl_multi_pw_aff_get_ctx(
496 __isl_keep isl_multi_pw_aff *mpa);
497 isl_ctx *isl_union_pw_aff_get_ctx(
498 __isl_keep isl_union_pw_aff *upa);
499 isl_ctx *isl_union_pw_multi_aff_get_ctx(
500 __isl_keep isl_union_pw_multi_aff *upma);
501 isl_ctx *isl_multi_union_pw_aff_get_ctx(
502 __isl_keep isl_multi_union_pw_aff *mupa);
504 #include <isl/id_to_ast_expr.h>
505 isl_ctx *isl_id_to_ast_expr_get_ctx(
506 __isl_keep isl_id_to_ast_expr *id2expr);
508 #include <isl/point.h>
509 isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
512 isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
515 isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
517 #include <isl/vertices.h>
518 isl_ctx *isl_vertices_get_ctx(
519 __isl_keep isl_vertices *vertices);
520 isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
521 isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
523 #include <isl/flow.h>
524 isl_ctx *isl_restriction_get_ctx(
525 __isl_keep isl_restriction *restr);
527 #include <isl/schedule.h>
528 isl_ctx *isl_schedule_get_ctx(
529 __isl_keep isl_schedule *sched);
530 isl_ctx *isl_schedule_constraints_get_ctx(
531 __isl_keep isl_schedule_constraints *sc);
533 #include <isl/schedule_node.h>
534 isl_ctx *isl_schedule_node_get_ctx(
535 __isl_keep isl_schedule_node *node);
537 #include <isl/band.h>
538 isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
540 #include <isl/ast_build.h>
541 isl_ctx *isl_ast_build_get_ctx(
542 __isl_keep isl_ast_build *build);
545 isl_ctx *isl_ast_expr_get_ctx(
546 __isl_keep isl_ast_expr *expr);
547 isl_ctx *isl_ast_node_get_ctx(
548 __isl_keep isl_ast_node *node);
552 An C<isl_val> represents an integer value, a rational value
553 or one of three special values, infinity, negative infinity and NaN.
554 Some predefined values can be created using the following functions.
557 __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
558 __isl_give isl_val *isl_val_one(isl_ctx *ctx);
559 __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
560 __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
561 __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
562 __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
564 Specific integer values can be created using the following functions.
567 __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
569 __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
571 __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
572 size_t n, size_t size, const void *chunks);
574 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
575 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
576 The least significant digit is assumed to be stored first.
578 Value objects can be copied and freed using the following functions.
581 __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
582 __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
584 They can be inspected using the following functions.
587 long isl_val_get_num_si(__isl_keep isl_val *v);
588 long isl_val_get_den_si(__isl_keep isl_val *v);
589 double isl_val_get_d(__isl_keep isl_val *v);
590 size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
592 int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
593 size_t size, void *chunks);
595 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
596 of C<size> bytes needed to store the absolute value of the
598 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
599 which is assumed to have been preallocated by the caller.
600 The least significant digit is stored first.
601 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
602 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
603 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
605 An C<isl_val> can be modified using the following function.
608 __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
611 The following unary properties are defined on C<isl_val>s.
614 int isl_val_sgn(__isl_keep isl_val *v);
615 int isl_val_is_zero(__isl_keep isl_val *v);
616 int isl_val_is_one(__isl_keep isl_val *v);
617 int isl_val_is_negone(__isl_keep isl_val *v);
618 int isl_val_is_nonneg(__isl_keep isl_val *v);
619 int isl_val_is_nonpos(__isl_keep isl_val *v);
620 int isl_val_is_pos(__isl_keep isl_val *v);
621 int isl_val_is_neg(__isl_keep isl_val *v);
622 int isl_val_is_int(__isl_keep isl_val *v);
623 int isl_val_is_rat(__isl_keep isl_val *v);
624 int isl_val_is_nan(__isl_keep isl_val *v);
625 int isl_val_is_infty(__isl_keep isl_val *v);
626 int isl_val_is_neginfty(__isl_keep isl_val *v);
628 Note that the sign of NaN is undefined.
630 The following binary properties are defined on pairs of C<isl_val>s.
633 int isl_val_lt(__isl_keep isl_val *v1,
634 __isl_keep isl_val *v2);
635 int isl_val_le(__isl_keep isl_val *v1,
636 __isl_keep isl_val *v2);
637 int isl_val_gt(__isl_keep isl_val *v1,
638 __isl_keep isl_val *v2);
639 int isl_val_ge(__isl_keep isl_val *v1,
640 __isl_keep isl_val *v2);
641 int isl_val_eq(__isl_keep isl_val *v1,
642 __isl_keep isl_val *v2);
643 int isl_val_ne(__isl_keep isl_val *v1,
644 __isl_keep isl_val *v2);
645 int isl_val_abs_eq(__isl_keep isl_val *v1,
646 __isl_keep isl_val *v2);
648 The function C<isl_val_abs_eq> checks whether its two arguments
649 are equal in absolute value.
651 For integer C<isl_val>s we additionally have the following binary property.
654 int isl_val_is_divisible_by(__isl_keep isl_val *v1,
655 __isl_keep isl_val *v2);
657 An C<isl_val> can also be compared to an integer using the following
658 function. The result is undefined for NaN.
661 int isl_val_cmp_si(__isl_keep isl_val *v, long i);
663 The following unary operations are available on C<isl_val>s.
666 __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
667 __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
668 __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
669 __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
670 __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
671 __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
672 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
674 The following binary operations are available on C<isl_val>s.
677 __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
678 __isl_take isl_val *v2);
679 __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
680 __isl_take isl_val *v2);
681 __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
682 __isl_take isl_val *v2);
683 __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
685 __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
686 __isl_take isl_val *v2);
687 __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
689 __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
690 __isl_take isl_val *v2);
691 __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
693 __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
694 __isl_take isl_val *v2);
696 On integer values, we additionally have the following operations.
699 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
700 __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
701 __isl_take isl_val *v2);
702 __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
703 __isl_take isl_val *v2);
704 __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
705 __isl_take isl_val *v2, __isl_give isl_val **x,
706 __isl_give isl_val **y);
708 The function C<isl_val_gcdext> returns the greatest common divisor g
709 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
710 that C<*x> * C<v1> + C<*y> * C<v2> = g.
712 =head3 GMP specific functions
714 These functions are only available if C<isl> has been compiled with C<GMP>
717 Specific integer and rational values can be created from C<GMP> values using
718 the following functions.
720 #include <isl/val_gmp.h>
721 __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
723 __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
724 const mpz_t n, const mpz_t d);
726 The numerator and denominator of a rational value can be extracted as
727 C<GMP> values using the following functions.
729 #include <isl/val_gmp.h>
730 int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
731 int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
733 =head2 Sets and Relations
735 C<isl> uses six types of objects for representing sets and relations,
736 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
737 C<isl_union_set> and C<isl_union_map>.
738 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
739 can be described as a conjunction of affine constraints, while
740 C<isl_set> and C<isl_map> represent unions of
741 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
742 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
743 to live in the same space. C<isl_union_set>s and C<isl_union_map>s
744 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
745 where spaces are considered different if they have a different number
746 of dimensions and/or different names (see L<"Spaces">).
747 The difference between sets and relations (maps) is that sets have
748 one set of variables, while relations have two sets of variables,
749 input variables and output variables.
751 =head2 Error Handling
753 C<isl> supports different ways to react in case a runtime error is triggered.
754 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
755 with two maps that have incompatible spaces. There are three possible ways
756 to react on error: to warn, to continue or to abort.
758 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
759 the last error in the corresponding C<isl_ctx> and the function in which the
760 error was triggered returns C<NULL>. An error does not corrupt internal state,
761 such that isl can continue to be used. C<isl> also provides functions to
762 read the last error and to reset the memory that stores the last error. The
763 last error is only stored for information purposes. Its presence does not
764 change the behavior of C<isl>. Hence, resetting an error is not required to
765 continue to use isl, but only to observe new errors.
768 enum isl_error isl_ctx_last_error(isl_ctx *ctx);
769 void isl_ctx_reset_error(isl_ctx *ctx);
771 Another option is to continue on error. This is similar to warn on error mode,
772 except that C<isl> does not print any warning. This allows a program to
773 implement its own error reporting.
775 The last option is to directly abort the execution of the program from within
776 the isl library. This makes it obviously impossible to recover from an error,
777 but it allows to directly spot the error location. By aborting on error,
778 debuggers break at the location the error occurred and can provide a stack
779 trace. Other tools that automatically provide stack traces on abort or that do
780 not want to continue execution after an error was triggered may also prefer to
783 The on error behavior of isl can be specified by calling
784 C<isl_options_set_on_error> or by setting the command line option
785 C<--isl-on-error>. Valid arguments for the function call are
786 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
787 choices for the command line option are C<warn>, C<continue> and C<abort>.
788 It is also possible to query the current error mode.
790 #include <isl/options.h>
791 int isl_options_set_on_error(isl_ctx *ctx, int val);
792 int isl_options_get_on_error(isl_ctx *ctx);
796 Identifiers are used to identify both individual dimensions
797 and tuples of dimensions. They consist of an optional name and an optional
798 user pointer. The name and the user pointer cannot both be C<NULL>, however.
799 Identifiers with the same name but different pointer values
800 are considered to be distinct.
801 Similarly, identifiers with different names but the same pointer value
802 are also considered to be distinct.
803 Equal identifiers are represented using the same object.
804 Pairs of identifiers can therefore be tested for equality using the
806 Identifiers can be constructed, copied, freed, inspected and printed
807 using the following functions.
810 __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
811 __isl_keep const char *name, void *user);
812 __isl_give isl_id *isl_id_set_free_user(
813 __isl_take isl_id *id,
814 __isl_give void (*free_user)(void *user));
815 __isl_give isl_id *isl_id_copy(isl_id *id);
816 __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
818 void *isl_id_get_user(__isl_keep isl_id *id);
819 __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
821 __isl_give isl_printer *isl_printer_print_id(
822 __isl_take isl_printer *p, __isl_keep isl_id *id);
824 The callback set by C<isl_id_set_free_user> is called on the user
825 pointer when the last reference to the C<isl_id> is freed.
826 Note that C<isl_id_get_name> returns a pointer to some internal
827 data structure, so the result can only be used while the
828 corresponding C<isl_id> is alive.
832 Whenever a new set, relation or similar object is created from scratch,
833 the space in which it lives needs to be specified using an C<isl_space>.
834 Each space involves zero or more parameters and zero, one or two
835 tuples of set or input/output dimensions. The parameters and dimensions
836 are identified by an C<isl_dim_type> and a position.
837 The type C<isl_dim_param> refers to parameters,
838 the type C<isl_dim_set> refers to set dimensions (for spaces
839 with a single tuple of dimensions) and the types C<isl_dim_in>
840 and C<isl_dim_out> refer to input and output dimensions
841 (for spaces with two tuples of dimensions).
842 Local spaces (see L</"Local Spaces">) also contain dimensions
843 of type C<isl_dim_div>.
844 Note that parameters are only identified by their position within
845 a given object. Across different objects, parameters are (usually)
846 identified by their names or identifiers. Only unnamed parameters
847 are identified by their positions across objects. The use of unnamed
848 parameters is discouraged.
850 #include <isl/space.h>
851 __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
852 unsigned nparam, unsigned n_in, unsigned n_out);
853 __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
855 __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
856 unsigned nparam, unsigned dim);
857 __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
858 __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
860 The space used for creating a parameter domain
861 needs to be created using C<isl_space_params_alloc>.
862 For other sets, the space
863 needs to be created using C<isl_space_set_alloc>, while
864 for a relation, the space
865 needs to be created using C<isl_space_alloc>.
867 To check whether a given space is that of a set or a map
868 or whether it is a parameter space, use these functions:
870 #include <isl/space.h>
871 int isl_space_is_params(__isl_keep isl_space *space);
872 int isl_space_is_set(__isl_keep isl_space *space);
873 int isl_space_is_map(__isl_keep isl_space *space);
875 Spaces can be compared using the following functions:
877 #include <isl/space.h>
878 int isl_space_is_equal(__isl_keep isl_space *space1,
879 __isl_keep isl_space *space2);
880 int isl_space_is_domain(__isl_keep isl_space *space1,
881 __isl_keep isl_space *space2);
882 int isl_space_is_range(__isl_keep isl_space *space1,
883 __isl_keep isl_space *space2);
884 int isl_space_tuple_is_equal(
885 __isl_keep isl_space *space1,
886 enum isl_dim_type type1,
887 __isl_keep isl_space *space2,
888 enum isl_dim_type type2);
890 C<isl_space_is_domain> checks whether the first argument is equal
891 to the domain of the second argument. This requires in particular that
892 the first argument is a set space and that the second argument
893 is a map space. C<isl_space_tuple_is_equal> checks whether the given
894 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
895 spaces are the same. That is, it checks if they have the same
896 identifier (if any), the same dimension and the same internal structure
899 It is often useful to create objects that live in the
900 same space as some other object. This can be accomplished
901 by creating the new objects
902 (see L</"Creating New Sets and Relations"> or
903 L</"Functions">) based on the space
904 of the original object.
907 __isl_give isl_space *isl_basic_set_get_space(
908 __isl_keep isl_basic_set *bset);
909 __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
911 #include <isl/union_set.h>
912 __isl_give isl_space *isl_union_set_get_space(
913 __isl_keep isl_union_set *uset);
916 __isl_give isl_space *isl_basic_map_get_space(
917 __isl_keep isl_basic_map *bmap);
918 __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
920 #include <isl/union_map.h>
921 __isl_give isl_space *isl_union_map_get_space(
922 __isl_keep isl_union_map *umap);
924 #include <isl/constraint.h>
925 __isl_give isl_space *isl_constraint_get_space(
926 __isl_keep isl_constraint *constraint);
928 #include <isl/polynomial.h>
929 __isl_give isl_space *isl_qpolynomial_get_domain_space(
930 __isl_keep isl_qpolynomial *qp);
931 __isl_give isl_space *isl_qpolynomial_get_space(
932 __isl_keep isl_qpolynomial *qp);
933 __isl_give isl_space *isl_qpolynomial_fold_get_space(
934 __isl_keep isl_qpolynomial_fold *fold);
935 __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
936 __isl_keep isl_pw_qpolynomial *pwqp);
937 __isl_give isl_space *isl_pw_qpolynomial_get_space(
938 __isl_keep isl_pw_qpolynomial *pwqp);
939 __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
940 __isl_keep isl_pw_qpolynomial_fold *pwf);
941 __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
942 __isl_keep isl_pw_qpolynomial_fold *pwf);
943 __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
944 __isl_keep isl_union_pw_qpolynomial *upwqp);
945 __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
946 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
949 __isl_give isl_space *isl_multi_val_get_space(
950 __isl_keep isl_multi_val *mv);
953 __isl_give isl_space *isl_aff_get_domain_space(
954 __isl_keep isl_aff *aff);
955 __isl_give isl_space *isl_aff_get_space(
956 __isl_keep isl_aff *aff);
957 __isl_give isl_space *isl_pw_aff_get_domain_space(
958 __isl_keep isl_pw_aff *pwaff);
959 __isl_give isl_space *isl_pw_aff_get_space(
960 __isl_keep isl_pw_aff *pwaff);
961 __isl_give isl_space *isl_multi_aff_get_domain_space(
962 __isl_keep isl_multi_aff *maff);
963 __isl_give isl_space *isl_multi_aff_get_space(
964 __isl_keep isl_multi_aff *maff);
965 __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
966 __isl_keep isl_pw_multi_aff *pma);
967 __isl_give isl_space *isl_pw_multi_aff_get_space(
968 __isl_keep isl_pw_multi_aff *pma);
969 __isl_give isl_space *isl_union_pw_aff_get_space(
970 __isl_keep isl_union_pw_aff *upa);
971 __isl_give isl_space *isl_union_pw_multi_aff_get_space(
972 __isl_keep isl_union_pw_multi_aff *upma);
973 __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
974 __isl_keep isl_multi_pw_aff *mpa);
975 __isl_give isl_space *isl_multi_pw_aff_get_space(
976 __isl_keep isl_multi_pw_aff *mpa);
977 __isl_give isl_space *
978 isl_multi_union_pw_aff_get_domain_space(
979 __isl_keep isl_multi_union_pw_aff *mupa);
980 __isl_give isl_space *
981 isl_multi_union_pw_aff_get_space(
982 __isl_keep isl_multi_union_pw_aff *mupa);
984 #include <isl/point.h>
985 __isl_give isl_space *isl_point_get_space(
986 __isl_keep isl_point *pnt);
988 The number of dimensions of a given type of space
989 may be read off from a space or an object that lives
990 in a space using the following functions.
991 In case of C<isl_space_dim>, type may be
992 C<isl_dim_param>, C<isl_dim_in> (only for relations),
993 C<isl_dim_out> (only for relations), C<isl_dim_set>
994 (only for sets) or C<isl_dim_all>.
996 #include <isl/space.h>
997 unsigned isl_space_dim(__isl_keep isl_space *space,
998 enum isl_dim_type type);
1000 #include <isl/local_space.h>
1001 int isl_local_space_dim(__isl_keep isl_local_space *ls,
1002 enum isl_dim_type type);
1004 #include <isl/set.h>
1005 unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1006 enum isl_dim_type type);
1007 unsigned isl_set_dim(__isl_keep isl_set *set,
1008 enum isl_dim_type type);
1010 #include <isl/union_set.h>
1011 unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1012 enum isl_dim_type type);
1014 #include <isl/map.h>
1015 unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1016 enum isl_dim_type type);
1017 unsigned isl_map_dim(__isl_keep isl_map *map,
1018 enum isl_dim_type type);
1020 #include <isl/union_map.h>
1021 unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1022 enum isl_dim_type type);
1024 #include <isl/val.h>
1025 unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1026 enum isl_dim_type type);
1028 #include <isl/aff.h>
1029 int isl_aff_dim(__isl_keep isl_aff *aff,
1030 enum isl_dim_type type);
1031 unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1032 enum isl_dim_type type);
1033 unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1034 enum isl_dim_type type);
1035 unsigned isl_pw_multi_aff_dim(
1036 __isl_keep isl_pw_multi_aff *pma,
1037 enum isl_dim_type type);
1038 unsigned isl_multi_pw_aff_dim(
1039 __isl_keep isl_multi_pw_aff *mpa,
1040 enum isl_dim_type type);
1041 unsigned isl_union_pw_aff_dim(
1042 __isl_keep isl_union_pw_aff *upa,
1043 enum isl_dim_type type);
1044 unsigned isl_union_pw_multi_aff_dim(
1045 __isl_keep isl_union_pw_multi_aff *upma,
1046 enum isl_dim_type type);
1047 unsigned isl_multi_union_pw_aff_dim(
1048 __isl_keep isl_multi_union_pw_aff *mupa,
1049 enum isl_dim_type type);
1051 #include <isl/polynomial.h>
1052 unsigned isl_union_pw_qpolynomial_dim(
1053 __isl_keep isl_union_pw_qpolynomial *upwqp,
1054 enum isl_dim_type type);
1055 unsigned isl_union_pw_qpolynomial_fold_dim(
1056 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1057 enum isl_dim_type type);
1059 Note that an C<isl_union_set>, an C<isl_union_map>,
1060 an C<isl_union_pw_multi_aff>,
1061 an C<isl_union_pw_qpolynomial> and
1062 an C<isl_union_pw_qpolynomial_fold>
1063 only have parameters.
1065 The identifiers or names of the individual dimensions of spaces
1066 may be set or read off using the following functions on spaces
1067 or objects that live in spaces.
1068 These functions are mostly useful to obtain the identifiers, positions
1069 or names of the parameters. Identifiers of individual dimensions are
1070 essentially only useful for printing. They are ignored by all other
1071 operations and may not be preserved across those operations.
1073 #include <isl/space.h>
1074 __isl_give isl_space *isl_space_set_dim_id(
1075 __isl_take isl_space *space,
1076 enum isl_dim_type type, unsigned pos,
1077 __isl_take isl_id *id);
1078 int isl_space_has_dim_id(__isl_keep isl_space *space,
1079 enum isl_dim_type type, unsigned pos);
1080 __isl_give isl_id *isl_space_get_dim_id(
1081 __isl_keep isl_space *space,
1082 enum isl_dim_type type, unsigned pos);
1083 __isl_give isl_space *isl_space_set_dim_name(
1084 __isl_take isl_space *space,
1085 enum isl_dim_type type, unsigned pos,
1086 __isl_keep const char *name);
1087 int isl_space_has_dim_name(__isl_keep isl_space *space,
1088 enum isl_dim_type type, unsigned pos);
1089 __isl_keep const char *isl_space_get_dim_name(
1090 __isl_keep isl_space *space,
1091 enum isl_dim_type type, unsigned pos);
1093 #include <isl/local_space.h>
1094 __isl_give isl_local_space *isl_local_space_set_dim_id(
1095 __isl_take isl_local_space *ls,
1096 enum isl_dim_type type, unsigned pos,
1097 __isl_take isl_id *id);
1098 int isl_local_space_has_dim_id(
1099 __isl_keep isl_local_space *ls,
1100 enum isl_dim_type type, unsigned pos);
1101 __isl_give isl_id *isl_local_space_get_dim_id(
1102 __isl_keep isl_local_space *ls,
1103 enum isl_dim_type type, unsigned pos);
1104 __isl_give isl_local_space *isl_local_space_set_dim_name(
1105 __isl_take isl_local_space *ls,
1106 enum isl_dim_type type, unsigned pos, const char *s);
1107 int isl_local_space_has_dim_name(
1108 __isl_keep isl_local_space *ls,
1109 enum isl_dim_type type, unsigned pos)
1110 const char *isl_local_space_get_dim_name(
1111 __isl_keep isl_local_space *ls,
1112 enum isl_dim_type type, unsigned pos);
1114 #include <isl/constraint.h>
1115 const char *isl_constraint_get_dim_name(
1116 __isl_keep isl_constraint *constraint,
1117 enum isl_dim_type type, unsigned pos);
1119 #include <isl/set.h>
1120 __isl_give isl_id *isl_basic_set_get_dim_id(
1121 __isl_keep isl_basic_set *bset,
1122 enum isl_dim_type type, unsigned pos);
1123 __isl_give isl_set *isl_set_set_dim_id(
1124 __isl_take isl_set *set, enum isl_dim_type type,
1125 unsigned pos, __isl_take isl_id *id);
1126 int isl_set_has_dim_id(__isl_keep isl_set *set,
1127 enum isl_dim_type type, unsigned pos);
1128 __isl_give isl_id *isl_set_get_dim_id(
1129 __isl_keep isl_set *set, enum isl_dim_type type,
1131 const char *isl_basic_set_get_dim_name(
1132 __isl_keep isl_basic_set *bset,
1133 enum isl_dim_type type, unsigned pos);
1134 int isl_set_has_dim_name(__isl_keep isl_set *set,
1135 enum isl_dim_type type, unsigned pos);
1136 const char *isl_set_get_dim_name(
1137 __isl_keep isl_set *set,
1138 enum isl_dim_type type, unsigned pos);
1140 #include <isl/map.h>
1141 __isl_give isl_map *isl_map_set_dim_id(
1142 __isl_take isl_map *map, enum isl_dim_type type,
1143 unsigned pos, __isl_take isl_id *id);
1144 int isl_basic_map_has_dim_id(
1145 __isl_keep isl_basic_map *bmap,
1146 enum isl_dim_type type, unsigned pos);
1147 int isl_map_has_dim_id(__isl_keep isl_map *map,
1148 enum isl_dim_type type, unsigned pos);
1149 __isl_give isl_id *isl_map_get_dim_id(
1150 __isl_keep isl_map *map, enum isl_dim_type type,
1152 __isl_give isl_id *isl_union_map_get_dim_id(
1153 __isl_keep isl_union_map *umap,
1154 enum isl_dim_type type, unsigned pos);
1155 const char *isl_basic_map_get_dim_name(
1156 __isl_keep isl_basic_map *bmap,
1157 enum isl_dim_type type, unsigned pos);
1158 int isl_map_has_dim_name(__isl_keep isl_map *map,
1159 enum isl_dim_type type, unsigned pos);
1160 const char *isl_map_get_dim_name(
1161 __isl_keep isl_map *map,
1162 enum isl_dim_type type, unsigned pos);
1164 #include <isl/val.h>
1165 __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1166 __isl_take isl_multi_val *mv,
1167 enum isl_dim_type type, unsigned pos,
1168 __isl_take isl_id *id);
1169 __isl_give isl_id *isl_multi_val_get_dim_id(
1170 __isl_keep isl_multi_val *mv,
1171 enum isl_dim_type type, unsigned pos);
1172 __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1173 __isl_take isl_multi_val *mv,
1174 enum isl_dim_type type, unsigned pos, const char *s);
1176 #include <isl/aff.h>
1177 __isl_give isl_aff *isl_aff_set_dim_id(
1178 __isl_take isl_aff *aff, enum isl_dim_type type,
1179 unsigned pos, __isl_take isl_id *id);
1180 __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1181 __isl_take isl_multi_aff *maff,
1182 enum isl_dim_type type, unsigned pos,
1183 __isl_take isl_id *id);
1184 __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1185 __isl_take isl_pw_aff *pma,
1186 enum isl_dim_type type, unsigned pos,
1187 __isl_take isl_id *id);
1188 __isl_give isl_multi_pw_aff *
1189 isl_multi_pw_aff_set_dim_id(
1190 __isl_take isl_multi_pw_aff *mpa,
1191 enum isl_dim_type type, unsigned pos,
1192 __isl_take isl_id *id);
1193 __isl_give isl_multi_union_pw_aff *
1194 isl_multi_union_pw_aff_set_dim_id(
1195 __isl_take isl_multi_union_pw_aff *mupa,
1196 enum isl_dim_type type, unsigned pos,
1197 __isl_take isl_id *id);
1198 __isl_give isl_id *isl_multi_aff_get_dim_id(
1199 __isl_keep isl_multi_aff *ma,
1200 enum isl_dim_type type, unsigned pos);
1201 int isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1202 enum isl_dim_type type, unsigned pos);
1203 __isl_give isl_id *isl_pw_aff_get_dim_id(
1204 __isl_keep isl_pw_aff *pa,
1205 enum isl_dim_type type, unsigned pos);
1206 __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1207 __isl_keep isl_pw_multi_aff *pma,
1208 enum isl_dim_type type, unsigned pos);
1209 __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1210 __isl_keep isl_multi_pw_aff *mpa,
1211 enum isl_dim_type type, unsigned pos);
1212 __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1213 __isl_keep isl_multi_union_pw_aff *mupa,
1214 enum isl_dim_type type, unsigned pos);
1215 __isl_give isl_aff *isl_aff_set_dim_name(
1216 __isl_take isl_aff *aff, enum isl_dim_type type,
1217 unsigned pos, const char *s);
1218 __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1219 __isl_take isl_multi_aff *maff,
1220 enum isl_dim_type type, unsigned pos, const char *s);
1221 __isl_give isl_multi_pw_aff *
1222 isl_multi_pw_aff_set_dim_name(
1223 __isl_take isl_multi_pw_aff *mpa,
1224 enum isl_dim_type type, unsigned pos, const char *s);
1225 __isl_give isl_union_pw_aff *
1226 isl_union_pw_aff_set_dim_name(
1227 __isl_take isl_union_pw_aff *upa,
1228 enum isl_dim_type type, unsigned pos,
1230 __isl_give isl_union_pw_multi_aff *
1231 isl_union_pw_multi_aff_set_dim_name(
1232 __isl_take isl_union_pw_multi_aff *upma,
1233 enum isl_dim_type type, unsigned pos,
1235 __isl_give isl_multi_union_pw_aff *
1236 isl_multi_union_pw_aff_set_dim_name(
1237 __isl_take isl_multi_union_pw_aff *mupa,
1238 enum isl_dim_type type, unsigned pos,
1239 const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1240 enum isl_dim_type type, unsigned pos);
1241 const char *isl_pw_aff_get_dim_name(
1242 __isl_keep isl_pw_aff *pa,
1243 enum isl_dim_type type, unsigned pos);
1244 const char *isl_pw_multi_aff_get_dim_name(
1245 __isl_keep isl_pw_multi_aff *pma,
1246 enum isl_dim_type type, unsigned pos);
1248 #include <isl/polynomial.h>
1249 __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1250 __isl_take isl_qpolynomial *qp,
1251 enum isl_dim_type type, unsigned pos,
1253 __isl_give isl_pw_qpolynomial *
1254 isl_pw_qpolynomial_set_dim_name(
1255 __isl_take isl_pw_qpolynomial *pwqp,
1256 enum isl_dim_type type, unsigned pos,
1258 __isl_give isl_pw_qpolynomial_fold *
1259 isl_pw_qpolynomial_fold_set_dim_name(
1260 __isl_take isl_pw_qpolynomial_fold *pwf,
1261 enum isl_dim_type type, unsigned pos,
1263 __isl_give isl_union_pw_qpolynomial *
1264 isl_union_pw_qpolynomial_set_dim_name(
1265 __isl_take isl_union_pw_qpolynomial *upwqp,
1266 enum isl_dim_type type, unsigned pos,
1268 __isl_give isl_union_pw_qpolynomial_fold *
1269 isl_union_pw_qpolynomial_fold_set_dim_name(
1270 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1271 enum isl_dim_type type, unsigned pos,
1274 Note that C<isl_space_get_name> returns a pointer to some internal
1275 data structure, so the result can only be used while the
1276 corresponding C<isl_space> is alive.
1277 Also note that every function that operates on two sets or relations
1278 requires that both arguments have the same parameters. This also
1279 means that if one of the arguments has named parameters, then the
1280 other needs to have named parameters too and the names need to match.
1281 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1282 arguments may have different parameters (as long as they are named),
1283 in which case the result will have as parameters the union of the parameters of
1286 Given the identifier or name of a dimension (typically a parameter),
1287 its position can be obtained from the following functions.
1289 #include <isl/space.h>
1290 int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1291 enum isl_dim_type type, __isl_keep isl_id *id);
1292 int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1293 enum isl_dim_type type, const char *name);
1295 #include <isl/local_space.h>
1296 int isl_local_space_find_dim_by_name(
1297 __isl_keep isl_local_space *ls,
1298 enum isl_dim_type type, const char *name);
1300 #include <isl/val.h>
1301 int isl_multi_val_find_dim_by_id(
1302 __isl_keep isl_multi_val *mv,
1303 enum isl_dim_type type, __isl_keep isl_id *id);
1304 int isl_multi_val_find_dim_by_name(
1305 __isl_keep isl_multi_val *mv,
1306 enum isl_dim_type type, const char *name);
1308 #include <isl/set.h>
1309 int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1310 enum isl_dim_type type, __isl_keep isl_id *id);
1311 int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1312 enum isl_dim_type type, const char *name);
1314 #include <isl/map.h>
1315 int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1316 enum isl_dim_type type, __isl_keep isl_id *id);
1317 int isl_basic_map_find_dim_by_name(
1318 __isl_keep isl_basic_map *bmap,
1319 enum isl_dim_type type, const char *name);
1320 int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1321 enum isl_dim_type type, const char *name);
1322 int isl_union_map_find_dim_by_name(
1323 __isl_keep isl_union_map *umap,
1324 enum isl_dim_type type, const char *name);
1326 #include <isl/aff.h>
1327 int isl_multi_aff_find_dim_by_id(
1328 __isl_keep isl_multi_aff *ma,
1329 enum isl_dim_type type, __isl_keep isl_id *id);
1330 int isl_multi_pw_aff_find_dim_by_id(
1331 __isl_keep isl_multi_pw_aff *mpa,
1332 enum isl_dim_type type, __isl_keep isl_id *id);
1333 int isl_multi_union_pw_aff_find_dim_by_id(
1334 __isl_keep isl_union_multi_pw_aff *mupa,
1335 enum isl_dim_type type, __isl_keep isl_id *id);
1336 int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1337 enum isl_dim_type type, const char *name);
1338 int isl_multi_aff_find_dim_by_name(
1339 __isl_keep isl_multi_aff *ma,
1340 enum isl_dim_type type, const char *name);
1341 int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1342 enum isl_dim_type type, const char *name);
1343 int isl_multi_pw_aff_find_dim_by_name(
1344 __isl_keep isl_multi_pw_aff *mpa,
1345 enum isl_dim_type type, const char *name);
1346 int isl_pw_multi_aff_find_dim_by_name(
1347 __isl_keep isl_pw_multi_aff *pma,
1348 enum isl_dim_type type, const char *name);
1349 int isl_union_pw_aff_find_dim_by_name(
1350 __isl_keep isl_union_pw_aff *upa,
1351 enum isl_dim_type type, const char *name);
1352 int isl_union_pw_multi_aff_find_dim_by_name(
1353 __isl_keep isl_union_pw_multi_aff *upma,
1354 enum isl_dim_type type, const char *name);
1355 int isl_multi_union_pw_aff_find_dim_by_name(
1356 __isl_keep isl_multi_union_pw_aff *mupa,
1357 enum isl_dim_type type, const char *name);
1359 #include <isl/polynomial.h>
1360 int isl_pw_qpolynomial_find_dim_by_name(
1361 __isl_keep isl_pw_qpolynomial *pwqp,
1362 enum isl_dim_type type, const char *name);
1363 int isl_pw_qpolynomial_fold_find_dim_by_name(
1364 __isl_keep isl_pw_qpolynomial_fold *pwf,
1365 enum isl_dim_type type, const char *name);
1366 int isl_union_pw_qpolynomial_find_dim_by_name(
1367 __isl_keep isl_union_pw_qpolynomial *upwqp,
1368 enum isl_dim_type type, const char *name);
1369 int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1370 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1371 enum isl_dim_type type, const char *name);
1373 The identifiers or names of entire spaces may be set or read off
1374 using the following functions.
1376 #include <isl/space.h>
1377 __isl_give isl_space *isl_space_set_tuple_id(
1378 __isl_take isl_space *space,
1379 enum isl_dim_type type, __isl_take isl_id *id);
1380 __isl_give isl_space *isl_space_reset_tuple_id(
1381 __isl_take isl_space *space, enum isl_dim_type type);
1382 int isl_space_has_tuple_id(__isl_keep isl_space *space,
1383 enum isl_dim_type type);
1384 __isl_give isl_id *isl_space_get_tuple_id(
1385 __isl_keep isl_space *space, enum isl_dim_type type);
1386 __isl_give isl_space *isl_space_set_tuple_name(
1387 __isl_take isl_space *space,
1388 enum isl_dim_type type, const char *s);
1389 int isl_space_has_tuple_name(__isl_keep isl_space *space,
1390 enum isl_dim_type type);
1391 const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1392 enum isl_dim_type type);
1394 #include <isl/local_space.h>
1395 __isl_give isl_local_space *isl_local_space_set_tuple_id(
1396 __isl_take isl_local_space *ls,
1397 enum isl_dim_type type, __isl_take isl_id *id);
1399 #include <isl/set.h>
1400 __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1401 __isl_take isl_basic_set *bset,
1402 __isl_take isl_id *id);
1403 __isl_give isl_set *isl_set_set_tuple_id(
1404 __isl_take isl_set *set, __isl_take isl_id *id);
1405 __isl_give isl_set *isl_set_reset_tuple_id(
1406 __isl_take isl_set *set);
1407 int isl_set_has_tuple_id(__isl_keep isl_set *set);
1408 __isl_give isl_id *isl_set_get_tuple_id(
1409 __isl_keep isl_set *set);
1410 __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1411 __isl_take isl_basic_set *set, const char *s);
1412 __isl_give isl_set *isl_set_set_tuple_name(
1413 __isl_take isl_set *set, const char *s);
1414 const char *isl_basic_set_get_tuple_name(
1415 __isl_keep isl_basic_set *bset);
1416 int isl_set_has_tuple_name(__isl_keep isl_set *set);
1417 const char *isl_set_get_tuple_name(
1418 __isl_keep isl_set *set);
1420 #include <isl/map.h>
1421 __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1422 __isl_take isl_basic_map *bmap,
1423 enum isl_dim_type type, __isl_take isl_id *id);
1424 __isl_give isl_map *isl_map_set_tuple_id(
1425 __isl_take isl_map *map, enum isl_dim_type type,
1426 __isl_take isl_id *id);
1427 __isl_give isl_map *isl_map_reset_tuple_id(
1428 __isl_take isl_map *map, enum isl_dim_type type);
1429 int isl_map_has_tuple_id(__isl_keep isl_map *map,
1430 enum isl_dim_type type);
1431 __isl_give isl_id *isl_map_get_tuple_id(
1432 __isl_keep isl_map *map, enum isl_dim_type type);
1433 __isl_give isl_map *isl_map_set_tuple_name(
1434 __isl_take isl_map *map,
1435 enum isl_dim_type type, const char *s);
1436 const char *isl_basic_map_get_tuple_name(
1437 __isl_keep isl_basic_map *bmap,
1438 enum isl_dim_type type);
1439 __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1440 __isl_take isl_basic_map *bmap,
1441 enum isl_dim_type type, const char *s);
1442 int isl_map_has_tuple_name(__isl_keep isl_map *map,
1443 enum isl_dim_type type);
1444 const char *isl_map_get_tuple_name(
1445 __isl_keep isl_map *map,
1446 enum isl_dim_type type);
1448 #include <isl/val.h>
1449 __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1450 __isl_take isl_multi_val *mv,
1451 enum isl_dim_type type, __isl_take isl_id *id);
1452 __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1453 __isl_take isl_multi_val *mv,
1454 enum isl_dim_type type);
1455 int isl_multi_val_has_tuple_id(__isl_keep isl_multi_val *mv,
1456 enum isl_dim_type type);
1457 __isl_give isl_id *isl_multi_val_get_tuple_id(
1458 __isl_keep isl_multi_val *mv,
1459 enum isl_dim_type type);
1460 __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1461 __isl_take isl_multi_val *mv,
1462 enum isl_dim_type type, const char *s);
1463 const char *isl_multi_val_get_tuple_name(
1464 __isl_keep isl_multi_val *mv,
1465 enum isl_dim_type type);
1467 #include <isl/aff.h>
1468 __isl_give isl_aff *isl_aff_set_tuple_id(
1469 __isl_take isl_aff *aff,
1470 enum isl_dim_type type, __isl_take isl_id *id);
1471 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1472 __isl_take isl_multi_aff *maff,
1473 enum isl_dim_type type, __isl_take isl_id *id);
1474 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1475 __isl_take isl_pw_aff *pwaff,
1476 enum isl_dim_type type, __isl_take isl_id *id);
1477 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1478 __isl_take isl_pw_multi_aff *pma,
1479 enum isl_dim_type type, __isl_take isl_id *id);
1480 __isl_give isl_multi_union_pw_aff *
1481 isl_multi_union_pw_aff_set_tuple_id(
1482 __isl_take isl_multi_union_pw_aff *mupa,
1483 enum isl_dim_type type, __isl_take isl_id *id);
1484 __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1485 __isl_take isl_multi_aff *ma,
1486 enum isl_dim_type type);
1487 __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1488 __isl_take isl_pw_aff *pa,
1489 enum isl_dim_type type);
1490 __isl_give isl_multi_pw_aff *
1491 isl_multi_pw_aff_reset_tuple_id(
1492 __isl_take isl_multi_pw_aff *mpa,
1493 enum isl_dim_type type);
1494 __isl_give isl_pw_multi_aff *
1495 isl_pw_multi_aff_reset_tuple_id(
1496 __isl_take isl_pw_multi_aff *pma,
1497 enum isl_dim_type type);
1498 __isl_give isl_multi_union_pw_aff *
1499 isl_multi_union_pw_aff_reset_tuple_id(
1500 __isl_take isl_multi_union_pw_aff *mupa,
1501 enum isl_dim_type type);
1502 int isl_multi_aff_has_tuple_id(__isl_keep isl_multi_aff *ma,
1503 enum isl_dim_type type);
1504 __isl_give isl_id *isl_multi_aff_get_tuple_id(
1505 __isl_keep isl_multi_aff *ma,
1506 enum isl_dim_type type);
1507 int isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1508 enum isl_dim_type type);
1509 __isl_give isl_id *isl_pw_aff_get_tuple_id(
1510 __isl_keep isl_pw_aff *pa,
1511 enum isl_dim_type type);
1512 int isl_pw_multi_aff_has_tuple_id(
1513 __isl_keep isl_pw_multi_aff *pma,
1514 enum isl_dim_type type);
1515 __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1516 __isl_keep isl_pw_multi_aff *pma,
1517 enum isl_dim_type type);
1518 int isl_multi_pw_aff_has_tuple_id(
1519 __isl_keep isl_multi_pw_aff *mpa,
1520 enum isl_dim_type type);
1521 __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1522 __isl_keep isl_multi_pw_aff *mpa,
1523 enum isl_dim_type type);
1524 int isl_multi_union_pw_aff_has_tuple_id(
1525 __isl_keep isl_multi_union_pw_aff *mupa,
1526 enum isl_dim_type type);
1527 __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1528 __isl_keep isl_multi_union_pw_aff *mupa,
1529 enum isl_dim_type type);
1530 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1531 __isl_take isl_multi_aff *maff,
1532 enum isl_dim_type type, const char *s);
1533 __isl_give isl_multi_pw_aff *
1534 isl_multi_pw_aff_set_tuple_name(
1535 __isl_take isl_multi_pw_aff *mpa,
1536 enum isl_dim_type type, const char *s);
1537 __isl_give isl_multi_union_pw_aff *
1538 isl_multi_union_pw_aff_set_tuple_name(
1539 __isl_take isl_multi_union_pw_aff *mupa,
1540 enum isl_dim_type type, const char *s);
1541 const char *isl_multi_aff_get_tuple_name(
1542 __isl_keep isl_multi_aff *multi,
1543 enum isl_dim_type type);
1544 int isl_pw_multi_aff_has_tuple_name(
1545 __isl_keep isl_pw_multi_aff *pma,
1546 enum isl_dim_type type);
1547 const char *isl_pw_multi_aff_get_tuple_name(
1548 __isl_keep isl_pw_multi_aff *pma,
1549 enum isl_dim_type type);
1550 const char *isl_multi_union_pw_aff_get_tuple_name(
1551 __isl_keep isl_multi_union_pw_aff *mupa,
1552 enum isl_dim_type type);
1554 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1555 or C<isl_dim_set>. As with C<isl_space_get_name>,
1556 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1558 Binary operations require the corresponding spaces of their arguments
1559 to have the same name.
1561 To keep the names of all parameters and tuples, but reset the user pointers
1562 of all the corresponding identifiers, use the following function.
1564 #include <isl/space.h>
1565 __isl_give isl_space *isl_space_reset_user(
1566 __isl_take isl_space *space);
1568 #include <isl/set.h>
1569 __isl_give isl_set *isl_set_reset_user(
1570 __isl_take isl_set *set);
1572 #include <isl/map.h>
1573 __isl_give isl_map *isl_map_reset_user(
1574 __isl_take isl_map *map);
1576 #include <isl/union_set.h>
1577 __isl_give isl_union_set *isl_union_set_reset_user(
1578 __isl_take isl_union_set *uset);
1580 #include <isl/union_map.h>
1581 __isl_give isl_union_map *isl_union_map_reset_user(
1582 __isl_take isl_union_map *umap);
1584 #include <isl/val.h>
1585 __isl_give isl_multi_val *isl_multi_val_reset_user(
1586 __isl_take isl_multi_val *mv);
1588 #include <isl/aff.h>
1589 __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1590 __isl_take isl_multi_aff *ma);
1591 __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1592 __isl_take isl_pw_aff *pa);
1593 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1594 __isl_take isl_multi_pw_aff *mpa);
1595 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1596 __isl_take isl_pw_multi_aff *pma);
1597 __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1598 __isl_take isl_union_pw_aff *upa);
1599 __isl_give isl_multi_union_pw_aff *
1600 isl_multi_union_pw_aff_reset_user(
1601 __isl_take isl_multi_union_pw_aff *mupa);
1602 __isl_give isl_union_pw_multi_aff *
1603 isl_union_pw_multi_aff_reset_user(
1604 __isl_take isl_union_pw_multi_aff *upma);
1606 #include <isl/polynomial.h>
1607 __isl_give isl_pw_qpolynomial *
1608 isl_pw_qpolynomial_reset_user(
1609 __isl_take isl_pw_qpolynomial *pwqp);
1610 __isl_give isl_union_pw_qpolynomial *
1611 isl_union_pw_qpolynomial_reset_user(
1612 __isl_take isl_union_pw_qpolynomial *upwqp);
1613 __isl_give isl_pw_qpolynomial_fold *
1614 isl_pw_qpolynomial_fold_reset_user(
1615 __isl_take isl_pw_qpolynomial_fold *pwf);
1616 __isl_give isl_union_pw_qpolynomial_fold *
1617 isl_union_pw_qpolynomial_fold_reset_user(
1618 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1620 Spaces can be nested. In particular, the domain of a set or
1621 the domain or range of a relation can be a nested relation.
1622 This process is also called I<wrapping>.
1623 The functions for detecting, constructing and deconstructing
1624 such nested spaces can be found in the wrapping properties
1625 of L</"Unary Properties">, the wrapping operations
1626 of L</"Unary Operations"> and the Cartesian product operations
1627 of L</"Basic Operations">.
1629 Spaces can be created from other spaces
1630 using the functions described in L</"Unary Operations">
1631 and L</"Binary Operations">.
1635 A local space is essentially a space with
1636 zero or more existentially quantified variables.
1637 The local space of various objects can be obtained
1638 using the following functions.
1640 #include <isl/constraint.h>
1641 __isl_give isl_local_space *isl_constraint_get_local_space(
1642 __isl_keep isl_constraint *constraint);
1644 #include <isl/set.h>
1645 __isl_give isl_local_space *isl_basic_set_get_local_space(
1646 __isl_keep isl_basic_set *bset);
1648 #include <isl/map.h>
1649 __isl_give isl_local_space *isl_basic_map_get_local_space(
1650 __isl_keep isl_basic_map *bmap);
1652 #include <isl/aff.h>
1653 __isl_give isl_local_space *isl_aff_get_domain_local_space(
1654 __isl_keep isl_aff *aff);
1655 __isl_give isl_local_space *isl_aff_get_local_space(
1656 __isl_keep isl_aff *aff);
1658 A new local space can be created from a space using
1660 #include <isl/local_space.h>
1661 __isl_give isl_local_space *isl_local_space_from_space(
1662 __isl_take isl_space *space);
1664 They can be inspected, modified, copied and freed using the following functions.
1666 #include <isl/local_space.h>
1667 int isl_local_space_is_params(
1668 __isl_keep isl_local_space *ls);
1669 int isl_local_space_is_set(__isl_keep isl_local_space *ls);
1670 __isl_give isl_space *isl_local_space_get_space(
1671 __isl_keep isl_local_space *ls);
1672 __isl_give isl_aff *isl_local_space_get_div(
1673 __isl_keep isl_local_space *ls, int pos);
1674 __isl_give isl_local_space *isl_local_space_copy(
1675 __isl_keep isl_local_space *ls);
1676 __isl_null isl_local_space *isl_local_space_free(
1677 __isl_take isl_local_space *ls);
1679 Note that C<isl_local_space_get_div> can only be used on local spaces
1682 Two local spaces can be compared using
1684 int isl_local_space_is_equal(__isl_keep isl_local_space *ls1,
1685 __isl_keep isl_local_space *ls2);
1687 Local spaces can be created from other local spaces
1688 using the functions described in L</"Unary Operations">
1689 and L</"Binary Operations">.
1691 =head2 Creating New Sets and Relations
1693 C<isl> has functions for creating some standard sets and relations.
1697 =item * Empty sets and relations
1699 __isl_give isl_basic_set *isl_basic_set_empty(
1700 __isl_take isl_space *space);
1701 __isl_give isl_basic_map *isl_basic_map_empty(
1702 __isl_take isl_space *space);
1703 __isl_give isl_set *isl_set_empty(
1704 __isl_take isl_space *space);
1705 __isl_give isl_map *isl_map_empty(
1706 __isl_take isl_space *space);
1707 __isl_give isl_union_set *isl_union_set_empty(
1708 __isl_take isl_space *space);
1709 __isl_give isl_union_map *isl_union_map_empty(
1710 __isl_take isl_space *space);
1712 For C<isl_union_set>s and C<isl_union_map>s, the space
1713 is only used to specify the parameters.
1715 =item * Universe sets and relations
1717 __isl_give isl_basic_set *isl_basic_set_universe(
1718 __isl_take isl_space *space);
1719 __isl_give isl_basic_map *isl_basic_map_universe(
1720 __isl_take isl_space *space);
1721 __isl_give isl_set *isl_set_universe(
1722 __isl_take isl_space *space);
1723 __isl_give isl_map *isl_map_universe(
1724 __isl_take isl_space *space);
1725 __isl_give isl_union_set *isl_union_set_universe(
1726 __isl_take isl_union_set *uset);
1727 __isl_give isl_union_map *isl_union_map_universe(
1728 __isl_take isl_union_map *umap);
1730 The sets and relations constructed by the functions above
1731 contain all integer values, while those constructed by the
1732 functions below only contain non-negative values.
1734 __isl_give isl_basic_set *isl_basic_set_nat_universe(
1735 __isl_take isl_space *space);
1736 __isl_give isl_basic_map *isl_basic_map_nat_universe(
1737 __isl_take isl_space *space);
1738 __isl_give isl_set *isl_set_nat_universe(
1739 __isl_take isl_space *space);
1740 __isl_give isl_map *isl_map_nat_universe(
1741 __isl_take isl_space *space);
1743 =item * Identity relations
1745 __isl_give isl_basic_map *isl_basic_map_identity(
1746 __isl_take isl_space *space);
1747 __isl_give isl_map *isl_map_identity(
1748 __isl_take isl_space *space);
1750 The number of input and output dimensions in C<space> needs
1753 =item * Lexicographic order
1755 __isl_give isl_map *isl_map_lex_lt(
1756 __isl_take isl_space *set_space);
1757 __isl_give isl_map *isl_map_lex_le(
1758 __isl_take isl_space *set_space);
1759 __isl_give isl_map *isl_map_lex_gt(
1760 __isl_take isl_space *set_space);
1761 __isl_give isl_map *isl_map_lex_ge(
1762 __isl_take isl_space *set_space);
1763 __isl_give isl_map *isl_map_lex_lt_first(
1764 __isl_take isl_space *space, unsigned n);
1765 __isl_give isl_map *isl_map_lex_le_first(
1766 __isl_take isl_space *space, unsigned n);
1767 __isl_give isl_map *isl_map_lex_gt_first(
1768 __isl_take isl_space *space, unsigned n);
1769 __isl_give isl_map *isl_map_lex_ge_first(
1770 __isl_take isl_space *space, unsigned n);
1772 The first four functions take a space for a B<set>
1773 and return relations that express that the elements in the domain
1774 are lexicographically less
1775 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1776 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1777 than the elements in the range.
1778 The last four functions take a space for a map
1779 and return relations that express that the first C<n> dimensions
1780 in the domain are lexicographically less
1781 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1782 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1783 than the first C<n> dimensions in the range.
1787 A basic set or relation can be converted to a set or relation
1788 using the following functions.
1790 __isl_give isl_set *isl_set_from_basic_set(
1791 __isl_take isl_basic_set *bset);
1792 __isl_give isl_map *isl_map_from_basic_map(
1793 __isl_take isl_basic_map *bmap);
1795 Sets and relations can be converted to union sets and relations
1796 using the following functions.
1798 __isl_give isl_union_set *isl_union_set_from_basic_set(
1799 __isl_take isl_basic_set *bset);
1800 __isl_give isl_union_map *isl_union_map_from_basic_map(
1801 __isl_take isl_basic_map *bmap);
1802 __isl_give isl_union_set *isl_union_set_from_set(
1803 __isl_take isl_set *set);
1804 __isl_give isl_union_map *isl_union_map_from_map(
1805 __isl_take isl_map *map);
1807 The inverse conversions below can only be used if the input
1808 union set or relation is known to contain elements in exactly one
1811 __isl_give isl_set *isl_set_from_union_set(
1812 __isl_take isl_union_set *uset);
1813 __isl_give isl_map *isl_map_from_union_map(
1814 __isl_take isl_union_map *umap);
1816 Sets and relations can be copied and freed again using the following
1819 __isl_give isl_basic_set *isl_basic_set_copy(
1820 __isl_keep isl_basic_set *bset);
1821 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1822 __isl_give isl_union_set *isl_union_set_copy(
1823 __isl_keep isl_union_set *uset);
1824 __isl_give isl_basic_map *isl_basic_map_copy(
1825 __isl_keep isl_basic_map *bmap);
1826 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1827 __isl_give isl_union_map *isl_union_map_copy(
1828 __isl_keep isl_union_map *umap);
1829 __isl_null isl_basic_set *isl_basic_set_free(
1830 __isl_take isl_basic_set *bset);
1831 __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1832 __isl_null isl_union_set *isl_union_set_free(
1833 __isl_take isl_union_set *uset);
1834 __isl_null isl_basic_map *isl_basic_map_free(
1835 __isl_take isl_basic_map *bmap);
1836 __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1837 __isl_null isl_union_map *isl_union_map_free(
1838 __isl_take isl_union_map *umap);
1840 Other sets and relations can be constructed by starting
1841 from a universe set or relation, adding equality and/or
1842 inequality constraints and then projecting out the
1843 existentially quantified variables, if any.
1844 Constraints can be constructed, manipulated and
1845 added to (or removed from) (basic) sets and relations
1846 using the following functions.
1848 #include <isl/constraint.h>
1849 __isl_give isl_constraint *isl_equality_alloc(
1850 __isl_take isl_local_space *ls);
1851 __isl_give isl_constraint *isl_inequality_alloc(
1852 __isl_take isl_local_space *ls);
1853 __isl_give isl_constraint *isl_constraint_set_constant_si(
1854 __isl_take isl_constraint *constraint, int v);
1855 __isl_give isl_constraint *isl_constraint_set_constant_val(
1856 __isl_take isl_constraint *constraint,
1857 __isl_take isl_val *v);
1858 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1859 __isl_take isl_constraint *constraint,
1860 enum isl_dim_type type, int pos, int v);
1861 __isl_give isl_constraint *
1862 isl_constraint_set_coefficient_val(
1863 __isl_take isl_constraint *constraint,
1864 enum isl_dim_type type, int pos,
1865 __isl_take isl_val *v);
1866 __isl_give isl_basic_map *isl_basic_map_add_constraint(
1867 __isl_take isl_basic_map *bmap,
1868 __isl_take isl_constraint *constraint);
1869 __isl_give isl_basic_set *isl_basic_set_add_constraint(
1870 __isl_take isl_basic_set *bset,
1871 __isl_take isl_constraint *constraint);
1872 __isl_give isl_map *isl_map_add_constraint(
1873 __isl_take isl_map *map,
1874 __isl_take isl_constraint *constraint);
1875 __isl_give isl_set *isl_set_add_constraint(
1876 __isl_take isl_set *set,
1877 __isl_take isl_constraint *constraint);
1878 __isl_give isl_basic_set *isl_basic_set_drop_constraint(
1879 __isl_take isl_basic_set *bset,
1880 __isl_take isl_constraint *constraint);
1882 For example, to create a set containing the even integers
1883 between 10 and 42, you would use the following code.
1886 isl_local_space *ls;
1888 isl_basic_set *bset;
1890 space = isl_space_set_alloc(ctx, 0, 2);
1891 bset = isl_basic_set_universe(isl_space_copy(space));
1892 ls = isl_local_space_from_space(space);
1894 c = isl_equality_alloc(isl_local_space_copy(ls));
1895 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1896 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1897 bset = isl_basic_set_add_constraint(bset, c);
1899 c = isl_inequality_alloc(isl_local_space_copy(ls));
1900 c = isl_constraint_set_constant_si(c, -10);
1901 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1902 bset = isl_basic_set_add_constraint(bset, c);
1904 c = isl_inequality_alloc(ls);
1905 c = isl_constraint_set_constant_si(c, 42);
1906 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1907 bset = isl_basic_set_add_constraint(bset, c);
1909 bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1913 isl_basic_set *bset;
1914 bset = isl_basic_set_read_from_str(ctx,
1915 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1917 A basic set or relation can also be constructed from two matrices
1918 describing the equalities and the inequalities.
1920 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1921 __isl_take isl_space *space,
1922 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1923 enum isl_dim_type c1,
1924 enum isl_dim_type c2, enum isl_dim_type c3,
1925 enum isl_dim_type c4);
1926 __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1927 __isl_take isl_space *space,
1928 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1929 enum isl_dim_type c1,
1930 enum isl_dim_type c2, enum isl_dim_type c3,
1931 enum isl_dim_type c4, enum isl_dim_type c5);
1933 The C<isl_dim_type> arguments indicate the order in which
1934 different kinds of variables appear in the input matrices
1935 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1936 C<isl_dim_set> and C<isl_dim_div> for sets and
1937 of C<isl_dim_cst>, C<isl_dim_param>,
1938 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1940 A (basic or union) set or relation can also be constructed from a
1941 (union) (piecewise) (multiple) affine expression
1942 or a list of affine expressions
1943 (See L</"Functions">).
1945 __isl_give isl_basic_map *isl_basic_map_from_aff(
1946 __isl_take isl_aff *aff);
1947 __isl_give isl_map *isl_map_from_aff(
1948 __isl_take isl_aff *aff);
1949 __isl_give isl_set *isl_set_from_pw_aff(
1950 __isl_take isl_pw_aff *pwaff);
1951 __isl_give isl_map *isl_map_from_pw_aff(
1952 __isl_take isl_pw_aff *pwaff);
1953 __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1954 __isl_take isl_space *domain_space,
1955 __isl_take isl_aff_list *list);
1956 __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
1957 __isl_take isl_multi_aff *maff)
1958 __isl_give isl_map *isl_map_from_multi_aff(
1959 __isl_take isl_multi_aff *maff)
1960 __isl_give isl_set *isl_set_from_pw_multi_aff(
1961 __isl_take isl_pw_multi_aff *pma);
1962 __isl_give isl_map *isl_map_from_pw_multi_aff(
1963 __isl_take isl_pw_multi_aff *pma);
1964 __isl_give isl_set *isl_set_from_multi_pw_aff(
1965 __isl_take isl_multi_pw_aff *mpa);
1966 __isl_give isl_map *isl_map_from_multi_pw_aff(
1967 __isl_take isl_multi_pw_aff *mpa);
1968 __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
1969 __isl_take isl_union_pw_aff *upa);
1970 __isl_give isl_union_map *
1971 isl_union_map_from_union_pw_multi_aff(
1972 __isl_take isl_union_pw_multi_aff *upma);
1973 __isl_give isl_union_map *
1974 isl_union_map_from_multi_union_pw_aff(
1975 __isl_take isl_multi_union_pw_aff *mupa);
1977 The C<domain_space> argument describes the domain of the resulting
1978 basic relation. It is required because the C<list> may consist
1979 of zero affine expressions.
1980 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
1981 is not allowed to be zero-dimensional. The domain of the result
1982 is the shared domain of the union piecewise affine elements.
1984 =head2 Inspecting Sets and Relations
1986 Usually, the user should not have to care about the actual constraints
1987 of the sets and maps, but should instead apply the abstract operations
1988 explained in the following sections.
1989 Occasionally, however, it may be required to inspect the individual
1990 coefficients of the constraints. This section explains how to do so.
1991 In these cases, it may also be useful to have C<isl> compute
1992 an explicit representation of the existentially quantified variables.
1994 __isl_give isl_set *isl_set_compute_divs(
1995 __isl_take isl_set *set);
1996 __isl_give isl_map *isl_map_compute_divs(
1997 __isl_take isl_map *map);
1998 __isl_give isl_union_set *isl_union_set_compute_divs(
1999 __isl_take isl_union_set *uset);
2000 __isl_give isl_union_map *isl_union_map_compute_divs(
2001 __isl_take isl_union_map *umap);
2003 This explicit representation defines the existentially quantified
2004 variables as integer divisions of the other variables, possibly
2005 including earlier existentially quantified variables.
2006 An explicitly represented existentially quantified variable therefore
2007 has a unique value when the values of the other variables are known.
2008 If, furthermore, the same existentials, i.e., existentials
2009 with the same explicit representations, should appear in the
2010 same order in each of the disjuncts of a set or map, then the user should call
2011 either of the following functions.
2013 __isl_give isl_set *isl_set_align_divs(
2014 __isl_take isl_set *set);
2015 __isl_give isl_map *isl_map_align_divs(
2016 __isl_take isl_map *map);
2018 Alternatively, the existentially quantified variables can be removed
2019 using the following functions, which compute an overapproximation.
2021 __isl_give isl_basic_set *isl_basic_set_remove_divs(
2022 __isl_take isl_basic_set *bset);
2023 __isl_give isl_basic_map *isl_basic_map_remove_divs(
2024 __isl_take isl_basic_map *bmap);
2025 __isl_give isl_set *isl_set_remove_divs(
2026 __isl_take isl_set *set);
2027 __isl_give isl_map *isl_map_remove_divs(
2028 __isl_take isl_map *map);
2030 It is also possible to only remove those divs that are defined
2031 in terms of a given range of dimensions or only those for which
2032 no explicit representation is known.
2034 __isl_give isl_basic_set *
2035 isl_basic_set_remove_divs_involving_dims(
2036 __isl_take isl_basic_set *bset,
2037 enum isl_dim_type type,
2038 unsigned first, unsigned n);
2039 __isl_give isl_basic_map *
2040 isl_basic_map_remove_divs_involving_dims(
2041 __isl_take isl_basic_map *bmap,
2042 enum isl_dim_type type,
2043 unsigned first, unsigned n);
2044 __isl_give isl_set *isl_set_remove_divs_involving_dims(
2045 __isl_take isl_set *set, enum isl_dim_type type,
2046 unsigned first, unsigned n);
2047 __isl_give isl_map *isl_map_remove_divs_involving_dims(
2048 __isl_take isl_map *map, enum isl_dim_type type,
2049 unsigned first, unsigned n);
2051 __isl_give isl_basic_set *
2052 isl_basic_set_remove_unknown_divs(
2053 __isl_take isl_basic_set *bset);
2054 __isl_give isl_set *isl_set_remove_unknown_divs(
2055 __isl_take isl_set *set);
2056 __isl_give isl_map *isl_map_remove_unknown_divs(
2057 __isl_take isl_map *map);
2059 To iterate over all the sets or maps in a union set or map, use
2061 int isl_union_set_foreach_set(__isl_keep isl_union_set *uset,
2062 int (*fn)(__isl_take isl_set *set, void *user),
2064 int isl_union_map_foreach_map(__isl_keep isl_union_map *umap,
2065 int (*fn)(__isl_take isl_map *map, void *user),
2068 The number of sets or maps in a union set or map can be obtained
2071 int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2072 int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2074 To extract the set or map in a given space from a union, use
2076 __isl_give isl_set *isl_union_set_extract_set(
2077 __isl_keep isl_union_set *uset,
2078 __isl_take isl_space *space);
2079 __isl_give isl_map *isl_union_map_extract_map(
2080 __isl_keep isl_union_map *umap,
2081 __isl_take isl_space *space);
2083 To iterate over all the basic sets or maps in a set or map, use
2085 int isl_set_foreach_basic_set(__isl_keep isl_set *set,
2086 int (*fn)(__isl_take isl_basic_set *bset, void *user),
2088 int isl_map_foreach_basic_map(__isl_keep isl_map *map,
2089 int (*fn)(__isl_take isl_basic_map *bmap, void *user),
2092 The callback function C<fn> should return 0 if successful and
2093 -1 if an error occurs. In the latter case, or if any other error
2094 occurs, the above functions will return -1.
2096 It should be noted that C<isl> does not guarantee that
2097 the basic sets or maps passed to C<fn> are disjoint.
2098 If this is required, then the user should call one of
2099 the following functions first.
2101 __isl_give isl_set *isl_set_make_disjoint(
2102 __isl_take isl_set *set);
2103 __isl_give isl_map *isl_map_make_disjoint(
2104 __isl_take isl_map *map);
2106 The number of basic sets in a set can be obtained
2107 or the number of basic maps in a map can be obtained
2110 #include <isl/set.h>
2111 int isl_set_n_basic_set(__isl_keep isl_set *set);
2113 #include <isl/map.h>
2114 int isl_map_n_basic_map(__isl_keep isl_map *map);
2116 To iterate over the constraints of a basic set or map, use
2118 #include <isl/constraint.h>
2120 int isl_basic_set_n_constraint(
2121 __isl_keep isl_basic_set *bset);
2122 int isl_basic_set_foreach_constraint(
2123 __isl_keep isl_basic_set *bset,
2124 int (*fn)(__isl_take isl_constraint *c, void *user),
2126 int isl_basic_map_n_constraint(
2127 __isl_keep isl_basic_map *bmap);
2128 int isl_basic_map_foreach_constraint(
2129 __isl_keep isl_basic_map *bmap,
2130 int (*fn)(__isl_take isl_constraint *c, void *user),
2132 __isl_null isl_constraint *isl_constraint_free(
2133 __isl_take isl_constraint *c);
2135 Again, the callback function C<fn> should return 0 if successful and
2136 -1 if an error occurs. In the latter case, or if any other error
2137 occurs, the above functions will return -1.
2138 The constraint C<c> represents either an equality or an inequality.
2139 Use the following function to find out whether a constraint
2140 represents an equality. If not, it represents an inequality.
2142 int isl_constraint_is_equality(
2143 __isl_keep isl_constraint *constraint);
2145 It is also possible to obtain a list of constraints from a basic
2148 #include <isl/constraint.h>
2149 __isl_give isl_constraint_list *
2150 isl_basic_map_get_constraint_list(
2151 __isl_keep isl_basic_map *bmap);
2152 __isl_give isl_constraint_list *
2153 isl_basic_set_get_constraint_list(
2154 __isl_keep isl_basic_set *bset);
2156 These functions require that all existentially quantified variables
2157 have an explicit representation.
2158 The returned list can be manipulated using the functions in L<"Lists">.
2160 The coefficients of the constraints can be inspected using
2161 the following functions.
2163 int isl_constraint_is_lower_bound(
2164 __isl_keep isl_constraint *constraint,
2165 enum isl_dim_type type, unsigned pos);
2166 int isl_constraint_is_upper_bound(
2167 __isl_keep isl_constraint *constraint,
2168 enum isl_dim_type type, unsigned pos);
2169 __isl_give isl_val *isl_constraint_get_constant_val(
2170 __isl_keep isl_constraint *constraint);
2171 __isl_give isl_val *isl_constraint_get_coefficient_val(
2172 __isl_keep isl_constraint *constraint,
2173 enum isl_dim_type type, int pos);
2175 The explicit representations of the existentially quantified
2176 variables can be inspected using the following function.
2177 Note that the user is only allowed to use this function
2178 if the inspected set or map is the result of a call
2179 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2180 The existentially quantified variable is equal to the floor
2181 of the returned affine expression. The affine expression
2182 itself can be inspected using the functions in
2185 __isl_give isl_aff *isl_constraint_get_div(
2186 __isl_keep isl_constraint *constraint, int pos);
2188 To obtain the constraints of a basic set or map in matrix
2189 form, use the following functions.
2191 __isl_give isl_mat *isl_basic_set_equalities_matrix(
2192 __isl_keep isl_basic_set *bset,
2193 enum isl_dim_type c1, enum isl_dim_type c2,
2194 enum isl_dim_type c3, enum isl_dim_type c4);
2195 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2196 __isl_keep isl_basic_set *bset,
2197 enum isl_dim_type c1, enum isl_dim_type c2,
2198 enum isl_dim_type c3, enum isl_dim_type c4);
2199 __isl_give isl_mat *isl_basic_map_equalities_matrix(
2200 __isl_keep isl_basic_map *bmap,
2201 enum isl_dim_type c1,
2202 enum isl_dim_type c2, enum isl_dim_type c3,
2203 enum isl_dim_type c4, enum isl_dim_type c5);
2204 __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2205 __isl_keep isl_basic_map *bmap,
2206 enum isl_dim_type c1,
2207 enum isl_dim_type c2, enum isl_dim_type c3,
2208 enum isl_dim_type c4, enum isl_dim_type c5);
2210 The C<isl_dim_type> arguments dictate the order in which
2211 different kinds of variables appear in the resulting matrix.
2212 For set inputs, they should be a permutation of
2213 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2214 For map inputs, they should be a permutation of
2215 C<isl_dim_cst>, C<isl_dim_param>,
2216 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2220 Points are elements of a set. They can be used to construct
2221 simple sets (boxes) or they can be used to represent the
2222 individual elements of a set.
2223 The zero point (the origin) can be created using
2225 __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2227 The coordinates of a point can be inspected, set and changed
2230 __isl_give isl_val *isl_point_get_coordinate_val(
2231 __isl_keep isl_point *pnt,
2232 enum isl_dim_type type, int pos);
2233 __isl_give isl_point *isl_point_set_coordinate_val(
2234 __isl_take isl_point *pnt,
2235 enum isl_dim_type type, int pos,
2236 __isl_take isl_val *v);
2238 __isl_give isl_point *isl_point_add_ui(
2239 __isl_take isl_point *pnt,
2240 enum isl_dim_type type, int pos, unsigned val);
2241 __isl_give isl_point *isl_point_sub_ui(
2242 __isl_take isl_point *pnt,
2243 enum isl_dim_type type, int pos, unsigned val);
2245 Points can be copied or freed using
2247 __isl_give isl_point *isl_point_copy(
2248 __isl_keep isl_point *pnt);
2249 void isl_point_free(__isl_take isl_point *pnt);
2251 A singleton set can be created from a point using
2253 __isl_give isl_basic_set *isl_basic_set_from_point(
2254 __isl_take isl_point *pnt);
2255 __isl_give isl_set *isl_set_from_point(
2256 __isl_take isl_point *pnt);
2258 and a box can be created from two opposite extremal points using
2260 __isl_give isl_basic_set *isl_basic_set_box_from_points(
2261 __isl_take isl_point *pnt1,
2262 __isl_take isl_point *pnt2);
2263 __isl_give isl_set *isl_set_box_from_points(
2264 __isl_take isl_point *pnt1,
2265 __isl_take isl_point *pnt2);
2267 All elements of a B<bounded> (union) set can be enumerated using
2268 the following functions.
2270 int isl_set_foreach_point(__isl_keep isl_set *set,
2271 int (*fn)(__isl_take isl_point *pnt, void *user),
2273 int isl_union_set_foreach_point(__isl_keep isl_union_set *uset,
2274 int (*fn)(__isl_take isl_point *pnt, void *user),
2277 The function C<fn> is called for each integer point in
2278 C<set> with as second argument the last argument of
2279 the C<isl_set_foreach_point> call. The function C<fn>
2280 should return C<0> on success and C<-1> on failure.
2281 In the latter case, C<isl_set_foreach_point> will stop
2282 enumerating and return C<-1> as well.
2283 If the enumeration is performed successfully and to completion,
2284 then C<isl_set_foreach_point> returns C<0>.
2286 To obtain a single point of a (basic) set, use
2288 __isl_give isl_point *isl_basic_set_sample_point(
2289 __isl_take isl_basic_set *bset);
2290 __isl_give isl_point *isl_set_sample_point(
2291 __isl_take isl_set *set);
2293 If C<set> does not contain any (integer) points, then the
2294 resulting point will be ``void'', a property that can be
2297 int isl_point_is_void(__isl_keep isl_point *pnt);
2301 Besides sets and relation, C<isl> also supports various types of functions.
2302 Each of these types is derived from the value type (see L</"Values">)
2303 or from one of two primitive function types
2304 through the application of zero or more type constructors.
2305 We first describe the primitive type and then we describe
2306 the types derived from these primitive types.
2308 =head3 Primitive Functions
2310 C<isl> support two primitive function types, quasi-affine
2311 expressions and quasipolynomials.
2312 A quasi-affine expression is defined either over a parameter
2313 space or over a set and is composed of integer constants,
2314 parameters and set variables, addition, subtraction and
2315 integer division by an integer constant.
2316 For example, the quasi-affine expression
2318 [n] -> { [x] -> [2*floor((4 n + x)/9] }
2320 maps C<x> to C<2*floor((4 n + x)/9>.
2321 A quasipolynomial is a polynomial expression in quasi-affine
2322 expression. That is, it additionally allows for multiplication.
2323 Note, though, that it is not allowed to construct an integer
2324 division of an expression involving multiplications.
2325 Here is an example of a quasipolynomial that is not
2326 quasi-affine expression
2328 [n] -> { [x] -> (n*floor((4 n + x)/9) }
2330 Note that the external representations of quasi-affine expressions
2331 and quasipolynomials are different. Quasi-affine expressions
2332 use a notation with square brackets just like binary relations,
2333 while quasipolynomials do not. This might change at some point.
2335 If a primitive function is defined over a parameter space,
2336 then the space of the function itself is that of a set.
2337 If it is defined over a set, then the space of the function
2338 is that of a relation. In both cases, the set space (or
2339 the output space) is single-dimensional, anonymous and unstructured.
2340 To create functions with multiple dimensions or with other kinds
2341 of set or output spaces, use multiple expressions
2342 (see L</"Multiple Expressions">).
2346 =item * Quasi-affine Expressions
2348 Besides the expressions described above, a quasi-affine
2349 expression can also be set to NaN. Such expressions
2350 typically represent a failure to represent a result
2351 as a quasi-affine expression.
2353 The zero quasi affine expression or the quasi affine expression
2354 that is equal to a given value or
2355 a specified dimension on a given domain can be created using
2357 #include <isl/aff.h>
2358 __isl_give isl_aff *isl_aff_zero_on_domain(
2359 __isl_take isl_local_space *ls);
2360 __isl_give isl_aff *isl_aff_val_on_domain(
2361 __isl_take isl_local_space *ls,
2362 __isl_take isl_val *val);
2363 __isl_give isl_aff *isl_aff_var_on_domain(
2364 __isl_take isl_local_space *ls,
2365 enum isl_dim_type type, unsigned pos);
2366 __isl_give isl_aff *isl_aff_nan_on_domain(
2367 __isl_take isl_local_space *ls);
2369 Quasi affine expressions can be copied and freed using
2371 #include <isl/aff.h>
2372 __isl_give isl_aff *isl_aff_copy(
2373 __isl_keep isl_aff *aff);
2374 __isl_null isl_aff *isl_aff_free(
2375 __isl_take isl_aff *aff);
2377 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2378 using the following function. The constraint is required to have
2379 a non-zero coefficient for the specified dimension.
2381 #include <isl/constraint.h>
2382 __isl_give isl_aff *isl_constraint_get_bound(
2383 __isl_keep isl_constraint *constraint,
2384 enum isl_dim_type type, int pos);
2386 The entire affine expression of the constraint can also be extracted
2387 using the following function.
2389 #include <isl/constraint.h>
2390 __isl_give isl_aff *isl_constraint_get_aff(
2391 __isl_keep isl_constraint *constraint);
2393 Conversely, an equality constraint equating
2394 the affine expression to zero or an inequality constraint enforcing
2395 the affine expression to be non-negative, can be constructed using
2397 __isl_give isl_constraint *isl_equality_from_aff(
2398 __isl_take isl_aff *aff);
2399 __isl_give isl_constraint *isl_inequality_from_aff(
2400 __isl_take isl_aff *aff);
2402 The coefficients and the integer divisions of an affine expression
2403 can be inspected using the following functions.
2405 #include <isl/aff.h>
2406 __isl_give isl_val *isl_aff_get_constant_val(
2407 __isl_keep isl_aff *aff);
2408 __isl_give isl_val *isl_aff_get_coefficient_val(
2409 __isl_keep isl_aff *aff,
2410 enum isl_dim_type type, int pos);
2411 int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2412 enum isl_dim_type type, int pos);
2413 __isl_give isl_val *isl_aff_get_denominator_val(
2414 __isl_keep isl_aff *aff);
2415 __isl_give isl_aff *isl_aff_get_div(
2416 __isl_keep isl_aff *aff, int pos);
2418 They can be modified using the following functions.
2420 #include <isl/aff.h>
2421 __isl_give isl_aff *isl_aff_set_constant_si(
2422 __isl_take isl_aff *aff, int v);
2423 __isl_give isl_aff *isl_aff_set_constant_val(
2424 __isl_take isl_aff *aff, __isl_take isl_val *v);
2425 __isl_give isl_aff *isl_aff_set_coefficient_si(
2426 __isl_take isl_aff *aff,
2427 enum isl_dim_type type, int pos, int v);
2428 __isl_give isl_aff *isl_aff_set_coefficient_val(
2429 __isl_take isl_aff *aff,
2430 enum isl_dim_type type, int pos,
2431 __isl_take isl_val *v);
2433 __isl_give isl_aff *isl_aff_add_constant_si(
2434 __isl_take isl_aff *aff, int v);
2435 __isl_give isl_aff *isl_aff_add_constant_val(
2436 __isl_take isl_aff *aff, __isl_take isl_val *v);
2437 __isl_give isl_aff *isl_aff_add_constant_num_si(
2438 __isl_take isl_aff *aff, int v);
2439 __isl_give isl_aff *isl_aff_add_coefficient_si(
2440 __isl_take isl_aff *aff,
2441 enum isl_dim_type type, int pos, int v);
2442 __isl_give isl_aff *isl_aff_add_coefficient_val(
2443 __isl_take isl_aff *aff,
2444 enum isl_dim_type type, int pos,
2445 __isl_take isl_val *v);
2447 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2448 set the I<numerator> of the constant or coefficient, while
2449 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2450 the constant or coefficient as a whole.
2451 The C<add_constant> and C<add_coefficient> functions add an integer
2452 or rational value to
2453 the possibly rational constant or coefficient.
2454 The C<add_constant_num> functions add an integer value to
2457 =item * Quasipolynomials
2459 Some simple quasipolynomials can be created using the following functions.
2461 #include <isl/polynomial.h>
2462 __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2463 __isl_take isl_space *domain);
2464 __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2465 __isl_take isl_space *domain);
2466 __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2467 __isl_take isl_space *domain);
2468 __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2469 __isl_take isl_space *domain);
2470 __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2471 __isl_take isl_space *domain);
2472 __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2473 __isl_take isl_space *domain,
2474 __isl_take isl_val *val);
2475 __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2476 __isl_take isl_space *domain,
2477 enum isl_dim_type type, unsigned pos);
2478 __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2479 __isl_take isl_aff *aff);
2481 Recall that the space in which a quasipolynomial lives is a map space
2482 with a one-dimensional range. The C<domain> argument in some of
2483 the functions above corresponds to the domain of this map space.
2485 Quasipolynomials can be copied and freed again using the following
2488 #include <isl/polynomial.h>
2489 __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2490 __isl_keep isl_qpolynomial *qp);
2491 __isl_null isl_qpolynomial *isl_qpolynomial_free(
2492 __isl_take isl_qpolynomial *qp);
2494 The constant term of a quasipolynomial can be extracted using
2496 __isl_give isl_val *isl_qpolynomial_get_constant_val(
2497 __isl_keep isl_qpolynomial *qp);
2499 To iterate over all terms in a quasipolynomial,
2502 int isl_qpolynomial_foreach_term(
2503 __isl_keep isl_qpolynomial *qp,
2504 int (*fn)(__isl_take isl_term *term,
2505 void *user), void *user);
2507 The terms themselves can be inspected and freed using
2510 unsigned isl_term_dim(__isl_keep isl_term *term,
2511 enum isl_dim_type type);
2512 __isl_give isl_val *isl_term_get_coefficient_val(
2513 __isl_keep isl_term *term);
2514 int isl_term_get_exp(__isl_keep isl_term *term,
2515 enum isl_dim_type type, unsigned pos);
2516 __isl_give isl_aff *isl_term_get_div(
2517 __isl_keep isl_term *term, unsigned pos);
2518 void isl_term_free(__isl_take isl_term *term);
2520 Each term is a product of parameters, set variables and
2521 integer divisions. The function C<isl_term_get_exp>
2522 returns the exponent of a given dimensions in the given term.
2528 A reduction represents a maximum or a minimum of its
2530 The only reduction type defined by C<isl> is
2531 C<isl_qpolynomial_fold>.
2533 There are currently no functions to directly create such
2534 objects, but they do appear in the piecewise quasipolynomial
2535 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2537 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2539 Reductions can be copied and freed using
2540 the following functions.
2542 #include <isl/polynomial.h>
2543 __isl_give isl_qpolynomial_fold *
2544 isl_qpolynomial_fold_copy(
2545 __isl_keep isl_qpolynomial_fold *fold);
2546 void isl_qpolynomial_fold_free(
2547 __isl_take isl_qpolynomial_fold *fold);
2549 To iterate over all quasipolynomials in a reduction, use
2551 int isl_qpolynomial_fold_foreach_qpolynomial(
2552 __isl_keep isl_qpolynomial_fold *fold,
2553 int (*fn)(__isl_take isl_qpolynomial *qp,
2554 void *user), void *user);
2556 =head3 Multiple Expressions
2558 A multiple expression represents a sequence of zero or
2559 more base expressions, all defined on the same domain space.
2560 The domain space of the multiple expression is the same
2561 as that of the base expressions, but the range space
2562 can be any space. In case the base expressions have
2563 a set space, the corresponding multiple expression
2564 also has a set space.
2565 Objects of the value type do not have an associated space.
2566 The space of a multiple value is therefore always a set space.
2567 Similarly, the space of a multiple union piecewise
2568 affine expression is always a set space.
2570 The multiple expression types defined by C<isl>
2571 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2572 C<isl_multi_union_pw_aff>.
2574 A multiple expression with the value zero for
2575 each output (or set) dimension can be created
2576 using the following functions.
2578 #include <isl/val.h>
2579 __isl_give isl_multi_val *isl_multi_val_zero(
2580 __isl_take isl_space *space);
2582 #include <isl/aff.h>
2583 __isl_give isl_multi_aff *isl_multi_aff_zero(
2584 __isl_take isl_space *space);
2585 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2586 __isl_take isl_space *space);
2587 __isl_give isl_multi_union_pw_aff *
2588 isl_multi_union_pw_aff_zero(
2589 __isl_take isl_space *space);
2591 Since there is no canonical way of representing a zero
2592 value of type C<isl_union_pw_aff>, the space passed
2593 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2595 An identity function can be created using the following
2596 functions. The space needs to be that of a relation
2597 with the same number of input and output dimensions.
2599 #include <isl/aff.h>
2600 __isl_give isl_multi_aff *isl_multi_aff_identity(
2601 __isl_take isl_space *space);
2602 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2603 __isl_take isl_space *space);
2605 A function that performs a projection on a universe
2606 relation or set can be created using the following functions.
2607 See also the corresponding
2608 projection operations in L</"Unary Operations">.
2610 #include <isl/aff.h>
2611 __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2612 __isl_take isl_space *space);
2613 __isl_give isl_multi_aff *isl_multi_aff_range_map(
2614 __isl_take isl_space *space);
2615 __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2616 __isl_take isl_space *space,
2617 enum isl_dim_type type,
2618 unsigned first, unsigned n);
2620 A multiple expression can be created from a single
2621 base expression using the following functions.
2622 The space of the created multiple expression is the same
2623 as that of the base expression, except for
2624 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2625 lives in a parameter space and the output lives
2626 in a single-dimensional set space.
2628 #include <isl/aff.h>
2629 __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2630 __isl_take isl_aff *aff);
2631 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2632 __isl_take isl_pw_aff *pa);
2633 __isl_give isl_multi_union_pw_aff *
2634 isl_multi_union_pw_aff_from_union_pw_aff(
2635 __isl_take isl_union_pw_aff *upa);
2637 A multiple expression can be created from a list
2638 of base expression in a specified space.
2639 The domain of this space needs to be the same
2640 as the domains of the base expressions in the list.
2641 If the base expressions have a set space (or no associated space),
2642 then this space also needs to be a set space.
2644 #include <isl/val.h>
2645 __isl_give isl_multi_val *isl_multi_val_from_val_list(
2646 __isl_take isl_space *space,
2647 __isl_take isl_val_list *list);
2649 #include <isl/aff.h>
2650 __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2651 __isl_take isl_space *space,
2652 __isl_take isl_aff_list *list);
2653 __isl_give isl_multi_union_pw_aff *
2654 isl_multi_union_pw_aff_from_union_pw_aff_list(
2655 __isl_take isl_space *space,
2656 __isl_take isl_union_pw_aff_list *list);
2658 As a convenience, a multiple piecewise expression can
2659 also be created from a multiple expression.
2660 Each piecewise expression in the result has a single
2663 #include <isl/aff.h>
2664 __isl_give isl_multi_pw_aff *
2665 isl_multi_pw_aff_from_multi_aff(
2666 __isl_take isl_multi_aff *ma);
2668 Similarly, a multiple union expression can be
2669 created from a multiple expression.
2671 #include <isl/aff.h>
2672 __isl_give isl_multi_union_pw_aff *
2673 isl_multi_union_pw_aff_from_multi_aff(
2674 __isl_take isl_multi_aff *ma);
2675 __isl_give isl_multi_union_pw_aff *
2676 isl_multi_union_pw_aff_from_multi_pw_aff(
2677 __isl_take isl_multi_pw_aff *mpa);
2679 A multiple quasi-affine expression can be created from
2680 a multiple value with a given domain space using the following
2683 #include <isl/aff.h>
2684 __isl_give isl_multi_aff *
2685 isl_multi_aff_multi_val_on_space(
2686 __isl_take isl_space *space,
2687 __isl_take isl_multi_val *mv);
2690 a multiple union piecewise affine expression can be created from
2691 a multiple value with a given domain or
2692 a multiple affine expression with a given domain
2693 using the following functions.
2695 #include <isl/aff.h>
2696 __isl_give isl_multi_union_pw_aff *
2697 isl_multi_union_pw_aff_multi_val_on_domain(
2698 __isl_take isl_union_set *domain,
2699 __isl_take isl_multi_val *mv);
2700 __isl_give isl_multi_union_pw_aff *
2701 isl_multi_union_pw_aff_multi_aff_on_domain(
2702 __isl_take isl_union_set *domain,
2703 __isl_take isl_multi_aff *ma);
2705 Multiple expressions can be copied and freed using
2706 the following functions.
2708 #include <isl/val.h>
2709 __isl_give isl_multi_val *isl_multi_val_copy(
2710 __isl_keep isl_multi_val *mv);
2711 __isl_null isl_multi_val *isl_multi_val_free(
2712 __isl_take isl_multi_val *mv);
2714 #include <isl/aff.h>
2715 __isl_give isl_multi_aff *isl_multi_aff_copy(
2716 __isl_keep isl_multi_aff *maff);
2717 __isl_null isl_multi_aff *isl_multi_aff_free(
2718 __isl_take isl_multi_aff *maff);
2719 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2720 __isl_keep isl_multi_pw_aff *mpa);
2721 __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2722 __isl_take isl_multi_pw_aff *mpa);
2723 __isl_give isl_multi_union_pw_aff *
2724 isl_multi_union_pw_aff_copy(
2725 __isl_keep isl_multi_union_pw_aff *mupa);
2726 __isl_null isl_multi_union_pw_aff *
2727 isl_multi_union_pw_aff_free(
2728 __isl_take isl_multi_union_pw_aff *mupa);
2730 The base expression at a given position of a multiple
2731 expression can be extracted using the following functions.
2733 #include <isl/val.h>
2734 __isl_give isl_val *isl_multi_val_get_val(
2735 __isl_keep isl_multi_val *mv, int pos);
2737 #include <isl/aff.h>
2738 __isl_give isl_aff *isl_multi_aff_get_aff(
2739 __isl_keep isl_multi_aff *multi, int pos);
2740 __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2741 __isl_keep isl_multi_pw_aff *mpa, int pos);
2742 __isl_give isl_union_pw_aff *
2743 isl_multi_union_pw_aff_get_union_pw_aff(
2744 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2746 It can be replaced using the following functions.
2748 #include <isl/val.h>
2749 __isl_give isl_multi_val *isl_multi_val_set_val(
2750 __isl_take isl_multi_val *mv, int pos,
2751 __isl_take isl_val *val);
2753 #include <isl/aff.h>
2754 __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2755 __isl_take isl_multi_aff *multi, int pos,
2756 __isl_take isl_aff *aff);
2757 __isl_give isl_multi_union_pw_aff *
2758 isl_multi_union_pw_aff_set_union_pw_aff(
2759 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2760 __isl_take isl_union_pw_aff *upa);
2762 As a convenience, a sequence of base expressions that have
2763 their domains in a given space can be extracted from a sequence
2764 of union expressions using the following function.
2766 #include <isl/aff.h>
2767 __isl_give isl_multi_pw_aff *
2768 isl_multi_union_pw_aff_extract_multi_pw_aff(
2769 __isl_keep isl_multi_union_pw_aff *mupa,
2770 __isl_take isl_space *space);
2772 Note that there is a difference between C<isl_multi_union_pw_aff>
2773 and C<isl_union_pw_multi_aff> objects. The first is a sequence
2774 of unions of piecewise expressions, while the second is a union
2775 of piecewise sequences. In particular, multiple affine expressions
2776 in an C<isl_union_pw_multi_aff> may live in different spaces,
2777 while there is only a single multiple expression in
2778 an C<isl_multi_union_pw_aff>, which can therefore only live
2779 in a single space. This means that not every
2780 C<isl_union_pw_multi_aff> can be converted to
2781 an C<isl_multi_union_pw_aff>. Conversely, a zero-dimensional
2782 C<isl_multi_union_pw_aff> carries no information
2783 about any possible domain and therefore cannot be converted
2784 to an C<isl_union_pw_multi_aff>. Moreover, the elements
2785 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2786 while each multiple expression inside an C<isl_union_pw_multi_aff>
2787 has a single domain. The conversion of an C<isl_union_pw_multi_aff>
2788 of dimension greater than one may therefore not be exact.
2789 The following functions can
2790 be used to perform these conversions when they are possible.
2792 #include <isl/aff.h>
2793 __isl_give isl_multi_union_pw_aff *
2794 isl_multi_union_pw_aff_from_union_pw_multi_aff(
2795 __isl_take isl_union_pw_multi_aff *upma);
2796 __isl_give isl_union_pw_multi_aff *
2797 isl_union_pw_multi_aff_from_multi_union_pw_aff(
2798 __isl_take isl_multi_union_pw_aff *mupa);
2800 =head3 Piecewise Expressions
2802 A piecewise expression is an expression that is described
2803 using zero or more base expression defined over the same
2804 number of cells in the domain space of the base expressions.
2805 All base expressions are defined over the same
2806 domain space and the cells are disjoint.
2807 The space of a piecewise expression is the same as
2808 that of the base expressions.
2809 If the union of the cells is a strict subset of the domain
2810 space, then the value of the piecewise expression outside
2811 this union is different for types derived from quasi-affine
2812 expressions and those derived from quasipolynomials.
2813 Piecewise expressions derived from quasi-affine expressions
2814 are considered to be undefined outside the union of their cells.
2815 Piecewise expressions derived from quasipolynomials
2816 are considered to be zero outside the union of their cells.
2818 Piecewise quasipolynomials are mainly used by the C<barvinok>
2819 library for representing the number of elements in a parametric set or map.
2820 For example, the piecewise quasipolynomial
2822 [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2824 represents the number of points in the map
2826 [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2828 The piecewise expression types defined by C<isl>
2829 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2830 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2832 A piecewise expression with no cells can be created using
2833 the following functions.
2835 #include <isl/aff.h>
2836 __isl_give isl_pw_aff *isl_pw_aff_empty(
2837 __isl_take isl_space *space);
2838 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2839 __isl_take isl_space *space);
2841 A piecewise expression with a single universe cell can be
2842 created using the following functions.
2844 #include <isl/aff.h>
2845 __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2846 __isl_take isl_aff *aff);
2847 __isl_give isl_pw_multi_aff *
2848 isl_pw_multi_aff_from_multi_aff(
2849 __isl_take isl_multi_aff *ma);
2851 #include <isl/polynomial.h>
2852 __isl_give isl_pw_qpolynomial *
2853 isl_pw_qpolynomial_from_qpolynomial(
2854 __isl_take isl_qpolynomial *qp);
2856 A piecewise expression with a single specified cell can be
2857 created using the following functions.
2859 #include <isl/aff.h>
2860 __isl_give isl_pw_aff *isl_pw_aff_alloc(
2861 __isl_take isl_set *set, __isl_take isl_aff *aff);
2862 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2863 __isl_take isl_set *set,
2864 __isl_take isl_multi_aff *maff);
2866 #include <isl/polynomial.h>
2867 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2868 __isl_take isl_set *set,
2869 __isl_take isl_qpolynomial *qp);
2871 The following convenience functions first create a base expression and
2872 then create a piecewise expression over a universe domain.
2874 #include <isl/aff.h>
2875 __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2876 __isl_take isl_local_space *ls);
2877 __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2878 __isl_take isl_local_space *ls,
2879 enum isl_dim_type type, unsigned pos);
2880 __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2881 __isl_take isl_local_space *ls);
2882 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2883 __isl_take isl_space *space);
2884 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2885 __isl_take isl_space *space);
2886 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2887 __isl_take isl_space *space);
2888 __isl_give isl_pw_multi_aff *
2889 isl_pw_multi_aff_project_out_map(
2890 __isl_take isl_space *space,
2891 enum isl_dim_type type,
2892 unsigned first, unsigned n);
2894 #include <isl/polynomial.h>
2895 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2896 __isl_take isl_space *space);
2898 The following convenience functions first create a base expression and
2899 then create a piecewise expression over a given domain.
2901 #include <isl/aff.h>
2902 __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2903 __isl_take isl_set *domain,
2904 __isl_take isl_val *v);
2905 __isl_give isl_pw_multi_aff *
2906 isl_pw_multi_aff_multi_val_on_domain(
2907 __isl_take isl_set *domain,
2908 __isl_take isl_multi_val *mv);
2910 As a convenience, a piecewise multiple expression can
2911 also be created from a piecewise expression.
2912 Each multiple expression in the result is derived
2913 from the corresponding base expression.
2915 #include <isl/aff.h>
2916 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2917 __isl_take isl_pw_aff *pa);
2919 Similarly, a piecewise quasipolynomial can be
2920 created from a piecewise quasi-affine expression using
2921 the following function.
2923 #include <isl/polynomial.h>
2924 __isl_give isl_pw_qpolynomial *
2925 isl_pw_qpolynomial_from_pw_aff(
2926 __isl_take isl_pw_aff *pwaff);
2928 Piecewise expressions can be copied and freed using the following functions.
2930 #include <isl/aff.h>
2931 __isl_give isl_pw_aff *isl_pw_aff_copy(
2932 __isl_keep isl_pw_aff *pwaff);
2933 __isl_null isl_pw_aff *isl_pw_aff_free(
2934 __isl_take isl_pw_aff *pwaff);
2935 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
2936 __isl_keep isl_pw_multi_aff *pma);
2937 __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
2938 __isl_take isl_pw_multi_aff *pma);
2940 #include <isl/polynomial.h>
2941 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
2942 __isl_keep isl_pw_qpolynomial *pwqp);
2943 __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
2944 __isl_take isl_pw_qpolynomial *pwqp);
2945 __isl_give isl_pw_qpolynomial_fold *
2946 isl_pw_qpolynomial_fold_copy(
2947 __isl_keep isl_pw_qpolynomial_fold *pwf);
2948 __isl_null isl_pw_qpolynomial_fold *
2949 isl_pw_qpolynomial_fold_free(
2950 __isl_take isl_pw_qpolynomial_fold *pwf);
2952 To iterate over the different cells of a piecewise expression,
2953 use the following functions.
2955 #include <isl/aff.h>
2956 int isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
2957 int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
2958 int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
2959 int (*fn)(__isl_take isl_set *set,
2960 __isl_take isl_aff *aff,
2961 void *user), void *user);
2962 int isl_pw_multi_aff_foreach_piece(
2963 __isl_keep isl_pw_multi_aff *pma,
2964 int (*fn)(__isl_take isl_set *set,
2965 __isl_take isl_multi_aff *maff,
2966 void *user), void *user);
2968 #include <isl/polynomial.h>
2969 int isl_pw_qpolynomial_foreach_piece(
2970 __isl_keep isl_pw_qpolynomial *pwqp,
2971 int (*fn)(__isl_take isl_set *set,
2972 __isl_take isl_qpolynomial *qp,
2973 void *user), void *user);
2974 int isl_pw_qpolynomial_foreach_lifted_piece(
2975 __isl_keep isl_pw_qpolynomial *pwqp,
2976 int (*fn)(__isl_take isl_set *set,
2977 __isl_take isl_qpolynomial *qp,
2978 void *user), void *user);
2979 int isl_pw_qpolynomial_fold_foreach_piece(
2980 __isl_keep isl_pw_qpolynomial_fold *pwf,
2981 int (*fn)(__isl_take isl_set *set,
2982 __isl_take isl_qpolynomial_fold *fold,
2983 void *user), void *user);
2984 int isl_pw_qpolynomial_fold_foreach_lifted_piece(
2985 __isl_keep isl_pw_qpolynomial_fold *pwf,
2986 int (*fn)(__isl_take isl_set *set,
2987 __isl_take isl_qpolynomial_fold *fold,
2988 void *user), void *user);
2990 As usual, the function C<fn> should return C<0> on success
2991 and C<-1> on failure. The difference between
2992 C<isl_pw_qpolynomial_foreach_piece> and
2993 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
2994 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
2995 compute unique representations for all existentially quantified
2996 variables and then turn these existentially quantified variables
2997 into extra set variables, adapting the associated quasipolynomial
2998 accordingly. This means that the C<set> passed to C<fn>
2999 will not have any existentially quantified variables, but that
3000 the dimensions of the sets may be different for different
3001 invocations of C<fn>.
3002 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3003 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3005 A piecewise expression consisting of the expressions at a given
3006 position of a piecewise multiple expression can be extracted
3007 using the following function.
3009 #include <isl/aff.h>
3010 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3011 __isl_keep isl_pw_multi_aff *pma, int pos);
3013 These expressions can be replaced using the following function.
3015 #include <isl/aff.h>
3016 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3017 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3018 __isl_take isl_pw_aff *pa);
3020 Note that there is a difference between C<isl_multi_pw_aff> and
3021 C<isl_pw_multi_aff> objects. The first is a sequence of piecewise
3022 affine expressions, while the second is a piecewise sequence
3023 of affine expressions. In particular, each of the piecewise
3024 affine expressions in an C<isl_multi_pw_aff> may have a different
3025 domain, while all multiple expressions associated to a cell
3026 in an C<isl_pw_multi_aff> have the same domain.
3027 It is possible to convert between the two, but when converting
3028 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3029 of the result is the intersection of the domains of the input.
3030 The reverse conversion is exact.
3032 #include <isl/aff.h>
3033 __isl_give isl_pw_multi_aff *
3034 isl_pw_multi_aff_from_multi_pw_aff(
3035 __isl_take isl_multi_pw_aff *mpa);
3036 __isl_give isl_multi_pw_aff *
3037 isl_multi_pw_aff_from_pw_multi_aff(
3038 __isl_take isl_pw_multi_aff *pma);
3040 =head3 Union Expressions
3042 A union expression collects base expressions defined
3043 over different domains. The space of a union expression
3044 is that of the shared parameter space.
3046 The union expression types defined by C<isl>
3047 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3048 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3050 An empty union expression can be created using the following functions.
3052 #include <isl/aff.h>
3053 __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3054 __isl_take isl_space *space);
3055 __isl_give isl_union_pw_multi_aff *
3056 isl_union_pw_multi_aff_empty(
3057 __isl_take isl_space *space);
3059 #include <isl/polynomial.h>
3060 __isl_give isl_union_pw_qpolynomial *
3061 isl_union_pw_qpolynomial_zero(
3062 __isl_take isl_space *space);
3064 A union expression containing a single base expression
3065 can be created using the following functions.
3067 #include <isl/aff.h>
3068 __isl_give isl_union_pw_aff *
3069 isl_union_pw_aff_from_pw_aff(
3070 __isl_take isl_pw_aff *pa);
3071 __isl_give isl_union_pw_multi_aff *
3072 isl_union_pw_multi_aff_from_aff(
3073 __isl_take isl_aff *aff);
3074 __isl_give isl_union_pw_multi_aff *
3075 isl_union_pw_multi_aff_from_pw_multi_aff(
3076 __isl_take isl_pw_multi_aff *pma);
3078 #include <isl/polynomial.h>
3079 __isl_give isl_union_pw_qpolynomial *
3080 isl_union_pw_qpolynomial_from_pw_qpolynomial(
3081 __isl_take isl_pw_qpolynomial *pwqp);
3083 The following functions create a base expression on each
3084 of the sets in the union set and collect the results.
3086 #include <isl/aff.h>
3087 __isl_give isl_union_pw_multi_aff *
3088 isl_union_pw_multi_aff_from_union_pw_aff(
3089 __isl_take isl_union_pw_aff *upa);
3090 __isl_give isl_union_pw_aff *
3091 isl_union_pw_multi_aff_get_union_pw_aff(
3092 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3093 __isl_give isl_union_pw_aff *
3094 isl_union_pw_aff_val_on_domain(
3095 __isl_take isl_union_set *domain,
3096 __isl_take isl_val *v);
3097 __isl_give isl_union_pw_multi_aff *
3098 isl_union_pw_multi_aff_multi_val_on_domain(
3099 __isl_take isl_union_set *domain,
3100 __isl_take isl_multi_val *mv);
3102 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3103 expression on a given domain can be created using the following
3106 #include <isl/aff.h>
3107 __isl_give isl_union_pw_aff *
3108 isl_union_pw_aff_aff_on_domain(
3109 __isl_take isl_union_set *domain,
3110 __isl_take isl_aff *aff);
3112 A base expression can be added to a union expression using
3113 the following functions.
3115 #include <isl/aff.h>
3116 __isl_give isl_union_pw_aff *
3117 isl_union_pw_aff_add_pw_aff(
3118 __isl_take isl_union_pw_aff *upa,
3119 __isl_take isl_pw_aff *pa);
3120 __isl_give isl_union_pw_multi_aff *
3121 isl_union_pw_multi_aff_add_pw_multi_aff(
3122 __isl_take isl_union_pw_multi_aff *upma,
3123 __isl_take isl_pw_multi_aff *pma);
3125 #include <isl/polynomial.h>
3126 __isl_give isl_union_pw_qpolynomial *
3127 isl_union_pw_qpolynomial_add_pw_qpolynomial(
3128 __isl_take isl_union_pw_qpolynomial *upwqp,
3129 __isl_take isl_pw_qpolynomial *pwqp);
3131 Union expressions can be copied and freed using
3132 the following functions.
3134 #include <isl/aff.h>
3135 __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3136 __isl_keep isl_union_pw_aff *upa);
3137 __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3138 __isl_take isl_union_pw_aff *upa);
3139 __isl_give isl_union_pw_multi_aff *
3140 isl_union_pw_multi_aff_copy(
3141 __isl_keep isl_union_pw_multi_aff *upma);
3142 __isl_null isl_union_pw_multi_aff *
3143 isl_union_pw_multi_aff_free(
3144 __isl_take isl_union_pw_multi_aff *upma);
3146 #include <isl/polynomial.h>
3147 __isl_give isl_union_pw_qpolynomial *
3148 isl_union_pw_qpolynomial_copy(
3149 __isl_keep isl_union_pw_qpolynomial *upwqp);
3150 __isl_null isl_union_pw_qpolynomial *
3151 isl_union_pw_qpolynomial_free(
3152 __isl_take isl_union_pw_qpolynomial *upwqp);
3153 __isl_give isl_union_pw_qpolynomial_fold *
3154 isl_union_pw_qpolynomial_fold_copy(
3155 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3156 __isl_null isl_union_pw_qpolynomial_fold *
3157 isl_union_pw_qpolynomial_fold_free(
3158 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3160 To iterate over the base expressions in a union expression,
3161 use the following functions.
3163 #include <isl/aff.h>
3164 int isl_union_pw_aff_n_pw_aff(
3165 __isl_keep isl_union_pw_aff *upa);
3166 int isl_union_pw_aff_foreach_pw_aff(
3167 __isl_keep isl_union_pw_aff *upa,
3168 int (*fn)(__isl_take isl_pw_aff *ma, void *user),
3170 int isl_union_pw_multi_aff_n_pw_multi_aff(
3171 __isl_keep isl_union_pw_multi_aff *upma);
3172 int isl_union_pw_multi_aff_foreach_pw_multi_aff(
3173 __isl_keep isl_union_pw_multi_aff *upma,
3174 int (*fn)(__isl_take isl_pw_multi_aff *pma,
3175 void *user), void *user);
3177 #include <isl/polynomial.h>
3178 int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3179 __isl_keep isl_union_pw_qpolynomial *upwqp);
3180 int isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3181 __isl_keep isl_union_pw_qpolynomial *upwqp,
3182 int (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3183 void *user), void *user);
3184 int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3185 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3186 int isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3187 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3188 int (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3189 void *user), void *user);
3191 To extract the base expression in a given space from a union, use
3192 the following functions.
3194 #include <isl/aff.h>
3195 __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3196 __isl_keep isl_union_pw_aff *upa,
3197 __isl_take isl_space *space);
3198 __isl_give isl_pw_multi_aff *
3199 isl_union_pw_multi_aff_extract_pw_multi_aff(
3200 __isl_keep isl_union_pw_multi_aff *upma,
3201 __isl_take isl_space *space);
3203 #include <isl/polynomial.h>
3204 __isl_give isl_pw_qpolynomial *
3205 isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3206 __isl_keep isl_union_pw_qpolynomial *upwqp,
3207 __isl_take isl_space *space);
3209 =head2 Input and Output
3211 For set and relation,
3212 C<isl> supports its own input/output format, which is similar
3213 to the C<Omega> format, but also supports the C<PolyLib> format
3215 For other object types, typically only an C<isl> format is supported.
3217 =head3 C<isl> format
3219 The C<isl> format is similar to that of C<Omega>, but has a different
3220 syntax for describing the parameters and allows for the definition
3221 of an existentially quantified variable as the integer division
3222 of an affine expression.
3223 For example, the set of integers C<i> between C<0> and C<n>
3224 such that C<i % 10 <= 6> can be described as
3226 [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3229 A set or relation can have several disjuncts, separated
3230 by the keyword C<or>. Each disjunct is either a conjunction
3231 of constraints or a projection (C<exists>) of a conjunction
3232 of constraints. The constraints are separated by the keyword
3235 =head3 C<PolyLib> format
3237 If the represented set is a union, then the first line
3238 contains a single number representing the number of disjuncts.
3239 Otherwise, a line containing the number C<1> is optional.
3241 Each disjunct is represented by a matrix of constraints.
3242 The first line contains two numbers representing
3243 the number of rows and columns,
3244 where the number of rows is equal to the number of constraints
3245 and the number of columns is equal to two plus the number of variables.
3246 The following lines contain the actual rows of the constraint matrix.
3247 In each row, the first column indicates whether the constraint
3248 is an equality (C<0>) or inequality (C<1>). The final column
3249 corresponds to the constant term.
3251 If the set is parametric, then the coefficients of the parameters
3252 appear in the last columns before the constant column.
3253 The coefficients of any existentially quantified variables appear
3254 between those of the set variables and those of the parameters.
3256 =head3 Extended C<PolyLib> format
3258 The extended C<PolyLib> format is nearly identical to the
3259 C<PolyLib> format. The only difference is that the line
3260 containing the number of rows and columns of a constraint matrix
3261 also contains four additional numbers:
3262 the number of output dimensions, the number of input dimensions,
3263 the number of local dimensions (i.e., the number of existentially
3264 quantified variables) and the number of parameters.
3265 For sets, the number of ``output'' dimensions is equal
3266 to the number of set dimensions, while the number of ``input''
3271 Objects can be read from input using the following functions.
3273 #include <isl/val.h>
3274 __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3276 __isl_give isl_multi_val *isl_multi_val_read_from_str(
3277 isl_ctx *ctx, const char *str);
3279 #include <isl/set.h>
3280 __isl_give isl_basic_set *isl_basic_set_read_from_file(
3281 isl_ctx *ctx, FILE *input);
3282 __isl_give isl_basic_set *isl_basic_set_read_from_str(
3283 isl_ctx *ctx, const char *str);
3284 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3286 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3289 #include <isl/map.h>
3290 __isl_give isl_basic_map *isl_basic_map_read_from_file(
3291 isl_ctx *ctx, FILE *input);
3292 __isl_give isl_basic_map *isl_basic_map_read_from_str(
3293 isl_ctx *ctx, const char *str);
3294 __isl_give isl_map *isl_map_read_from_file(
3295 isl_ctx *ctx, FILE *input);
3296 __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3299 #include <isl/union_set.h>
3300 __isl_give isl_union_set *isl_union_set_read_from_file(
3301 isl_ctx *ctx, FILE *input);
3302 __isl_give isl_union_set *isl_union_set_read_from_str(
3303 isl_ctx *ctx, const char *str);
3305 #include <isl/union_map.h>
3306 __isl_give isl_union_map *isl_union_map_read_from_file(
3307 isl_ctx *ctx, FILE *input);
3308 __isl_give isl_union_map *isl_union_map_read_from_str(
3309 isl_ctx *ctx, const char *str);
3311 #include <isl/aff.h>
3312 __isl_give isl_aff *isl_aff_read_from_str(
3313 isl_ctx *ctx, const char *str);
3314 __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3315 isl_ctx *ctx, const char *str);
3316 __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3317 isl_ctx *ctx, const char *str);
3318 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3319 isl_ctx *ctx, const char *str);
3320 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3321 isl_ctx *ctx, const char *str);
3322 __isl_give isl_union_pw_multi_aff *
3323 isl_union_pw_multi_aff_read_from_str(
3324 isl_ctx *ctx, const char *str);
3325 __isl_give isl_multi_union_pw_aff *
3326 isl_multi_union_pw_aff_read_from_str(
3327 isl_ctx *ctx, const char *str);
3329 #include <isl/polynomial.h>
3330 __isl_give isl_union_pw_qpolynomial *
3331 isl_union_pw_qpolynomial_read_from_str(
3332 isl_ctx *ctx, const char *str);
3334 For sets and relations,
3335 the input format is autodetected and may be either the C<PolyLib> format
3336 or the C<isl> format.
3340 Before anything can be printed, an C<isl_printer> needs to
3343 __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3345 __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3346 __isl_null isl_printer *isl_printer_free(
3347 __isl_take isl_printer *printer);
3348 __isl_give char *isl_printer_get_str(
3349 __isl_keep isl_printer *printer);
3351 The printer can be inspected using the following functions.
3353 FILE *isl_printer_get_file(
3354 __isl_keep isl_printer *printer);
3355 int isl_printer_get_output_format(
3356 __isl_keep isl_printer *p);
3357 int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3359 The behavior of the printer can be modified in various ways
3361 __isl_give isl_printer *isl_printer_set_output_format(
3362 __isl_take isl_printer *p, int output_format);
3363 __isl_give isl_printer *isl_printer_set_indent(
3364 __isl_take isl_printer *p, int indent);
3365 __isl_give isl_printer *isl_printer_set_indent_prefix(
3366 __isl_take isl_printer *p, const char *prefix);
3367 __isl_give isl_printer *isl_printer_indent(
3368 __isl_take isl_printer *p, int indent);
3369 __isl_give isl_printer *isl_printer_set_prefix(
3370 __isl_take isl_printer *p, const char *prefix);
3371 __isl_give isl_printer *isl_printer_set_suffix(
3372 __isl_take isl_printer *p, const char *suffix);
3373 __isl_give isl_printer *isl_printer_set_yaml_style(
3374 __isl_take isl_printer *p, int yaml_style);
3376 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3377 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3378 and defaults to C<ISL_FORMAT_ISL>.
3379 Each line in the output is prefixed by C<indent_prefix>,
3380 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3381 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3382 In the C<PolyLib> format output,
3383 the coefficients of the existentially quantified variables
3384 appear between those of the set variables and those
3386 The function C<isl_printer_indent> increases the indentation
3387 by the specified amount (which may be negative).
3388 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3389 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3392 To actually print something, use
3394 #include <isl/printer.h>
3395 __isl_give isl_printer *isl_printer_print_double(
3396 __isl_take isl_printer *p, double d);
3398 #include <isl/val.h>
3399 __isl_give isl_printer *isl_printer_print_val(
3400 __isl_take isl_printer *p, __isl_keep isl_val *v);
3402 #include <isl/set.h>
3403 __isl_give isl_printer *isl_printer_print_basic_set(
3404 __isl_take isl_printer *printer,
3405 __isl_keep isl_basic_set *bset);
3406 __isl_give isl_printer *isl_printer_print_set(
3407 __isl_take isl_printer *printer,
3408 __isl_keep isl_set *set);
3410 #include <isl/map.h>
3411 __isl_give isl_printer *isl_printer_print_basic_map(
3412 __isl_take isl_printer *printer,
3413 __isl_keep isl_basic_map *bmap);
3414 __isl_give isl_printer *isl_printer_print_map(
3415 __isl_take isl_printer *printer,
3416 __isl_keep isl_map *map);
3418 #include <isl/union_set.h>
3419 __isl_give isl_printer *isl_printer_print_union_set(
3420 __isl_take isl_printer *p,
3421 __isl_keep isl_union_set *uset);
3423 #include <isl/union_map.h>
3424 __isl_give isl_printer *isl_printer_print_union_map(
3425 __isl_take isl_printer *p,
3426 __isl_keep isl_union_map *umap);
3428 #include <isl/val.h>
3429 __isl_give isl_printer *isl_printer_print_multi_val(
3430 __isl_take isl_printer *p,
3431 __isl_keep isl_multi_val *mv);
3433 #include <isl/aff.h>
3434 __isl_give isl_printer *isl_printer_print_aff(
3435 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3436 __isl_give isl_printer *isl_printer_print_multi_aff(
3437 __isl_take isl_printer *p,
3438 __isl_keep isl_multi_aff *maff);
3439 __isl_give isl_printer *isl_printer_print_pw_aff(
3440 __isl_take isl_printer *p,
3441 __isl_keep isl_pw_aff *pwaff);
3442 __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3443 __isl_take isl_printer *p,
3444 __isl_keep isl_pw_multi_aff *pma);
3445 __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3446 __isl_take isl_printer *p,
3447 __isl_keep isl_multi_pw_aff *mpa);
3448 __isl_give isl_printer *isl_printer_print_union_pw_aff(
3449 __isl_take isl_printer *p,
3450 __isl_keep isl_union_pw_aff *upa);
3451 __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3452 __isl_take isl_printer *p,
3453 __isl_keep isl_union_pw_multi_aff *upma);
3454 __isl_give isl_printer *
3455 isl_printer_print_multi_union_pw_aff(
3456 __isl_take isl_printer *p,
3457 __isl_keep isl_multi_union_pw_aff *mupa);
3459 #include <isl/polynomial.h>
3460 __isl_give isl_printer *isl_printer_print_qpolynomial(
3461 __isl_take isl_printer *p,
3462 __isl_keep isl_qpolynomial *qp);
3463 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3464 __isl_take isl_printer *p,
3465 __isl_keep isl_pw_qpolynomial *pwqp);
3466 __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3467 __isl_take isl_printer *p,
3468 __isl_keep isl_union_pw_qpolynomial *upwqp);
3470 __isl_give isl_printer *
3471 isl_printer_print_pw_qpolynomial_fold(
3472 __isl_take isl_printer *p,
3473 __isl_keep isl_pw_qpolynomial_fold *pwf);
3474 __isl_give isl_printer *
3475 isl_printer_print_union_pw_qpolynomial_fold(
3476 __isl_take isl_printer *p,
3477 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3479 For C<isl_printer_print_qpolynomial>,
3480 C<isl_printer_print_pw_qpolynomial> and
3481 C<isl_printer_print_pw_qpolynomial_fold>,
3482 the output format of the printer
3483 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3484 For C<isl_printer_print_union_pw_qpolynomial> and
3485 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3487 In case of printing in C<ISL_FORMAT_C>, the user may want
3488 to set the names of all dimensions first.
3490 C<isl> also provides limited support for printing YAML documents,
3491 just enough for the internal use for printing such documents.
3493 #include <isl/printer.h>
3494 __isl_give isl_printer *isl_printer_yaml_start_mapping(
3495 __isl_take isl_printer *p);
3496 __isl_give isl_printer *isl_printer_yaml_end_mapping(
3497 __isl_take isl_printer *p);
3498 __isl_give isl_printer *isl_printer_yaml_start_sequence(
3499 __isl_take isl_printer *p);
3500 __isl_give isl_printer *isl_printer_yaml_end_sequence(
3501 __isl_take isl_printer *p);
3502 __isl_give isl_printer *isl_printer_yaml_next(
3503 __isl_take isl_printer *p);
3505 A document is started by a call to either
3506 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3507 Anything printed to the printer after such a call belong to the
3508 first key of the mapping or the first element in the sequence.
3509 The function C<isl_printer_yaml_next> moves to the value if
3510 we are currently printing a mapping key, the next key if we
3511 are printing a value or the next element if we are printing
3512 an element in a sequence.
3513 Nested mappings and sequences are initiated by the same
3514 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3515 Each call to these functions needs to have a corresponding call to
3516 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3518 When called on a file printer, the following function flushes
3519 the file. When called on a string printer, the buffer is cleared.
3521 __isl_give isl_printer *isl_printer_flush(
3522 __isl_take isl_printer *p);
3524 Alternatively, a string representation can be obtained
3525 directly using the following functions, which always print
3528 #include <isl/space.h>
3529 __isl_give char *isl_space_to_str(
3530 __isl_keep isl_space *space);
3532 #include <isl/val.h>
3533 __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3534 __isl_give char *isl_multi_val_to_str(
3535 __isl_keep isl_multi_val *mv);
3537 #include <isl/set.h>
3538 __isl_give char *isl_set_to_str(
3539 __isl_keep isl_set *set);
3541 #include <isl/union_set.h>
3542 __isl_give char *isl_union_set_to_str(
3543 __isl_keep isl_union_set *uset);
3545 #include <isl/map.h>
3546 __isl_give char *isl_map_to_str(
3547 __isl_keep isl_map *map);
3549 #include <isl/union_map.h>
3550 __isl_give char *isl_union_map_to_str(
3551 __isl_keep isl_union_map *umap);
3553 #include <isl/aff.h>
3554 __isl_give char *isl_multi_aff_to_str(
3555 __isl_keep isl_multi_aff *aff);
3556 __isl_give char *isl_union_pw_aff_to_str(
3557 __isl_keep isl_union_pw_aff *upa);
3558 __isl_give char *isl_union_pw_multi_aff_to_str(
3559 __isl_keep isl_union_pw_multi_aff *upma);
3560 __isl_give char *isl_multi_union_pw_aff_to_str(
3561 __isl_keep isl_multi_union_pw_aff *mupa);
3565 =head3 Unary Properties
3571 The following functions test whether the given set or relation
3572 contains any integer points. The ``plain'' variants do not perform
3573 any computations, but simply check if the given set or relation
3574 is already known to be empty.
3576 int isl_basic_set_plain_is_empty(__isl_keep isl_basic_set *bset);
3577 int isl_basic_set_is_empty(__isl_keep isl_basic_set *bset);
3578 int isl_set_plain_is_empty(__isl_keep isl_set *set);
3579 int isl_set_is_empty(__isl_keep isl_set *set);
3580 int isl_union_set_is_empty(__isl_keep isl_union_set *uset);
3581 int isl_basic_map_plain_is_empty(__isl_keep isl_basic_map *bmap);
3582 int isl_basic_map_is_empty(__isl_keep isl_basic_map *bmap);
3583 int isl_map_plain_is_empty(__isl_keep isl_map *map);
3584 int isl_map_is_empty(__isl_keep isl_map *map);
3585 int isl_union_map_is_empty(__isl_keep isl_union_map *umap);
3587 =item * Universality
3589 int isl_basic_set_is_universe(__isl_keep isl_basic_set *bset);
3590 int isl_basic_map_is_universe(__isl_keep isl_basic_map *bmap);
3591 int isl_set_plain_is_universe(__isl_keep isl_set *set);
3593 =item * Single-valuedness
3595 #include <isl/set.h>
3596 int isl_set_is_singleton(__isl_keep isl_set *set);
3598 #include <isl/map.h>
3599 int isl_basic_map_is_single_valued(
3600 __isl_keep isl_basic_map *bmap);
3601 int isl_map_plain_is_single_valued(
3602 __isl_keep isl_map *map);
3603 int isl_map_is_single_valued(__isl_keep isl_map *map);
3605 #include <isl/union_map.h>
3606 int isl_union_map_is_single_valued(__isl_keep isl_union_map *umap);
3610 int isl_map_plain_is_injective(__isl_keep isl_map *map);
3611 int isl_map_is_injective(__isl_keep isl_map *map);
3612 int isl_union_map_plain_is_injective(
3613 __isl_keep isl_union_map *umap);
3614 int isl_union_map_is_injective(
3615 __isl_keep isl_union_map *umap);
3619 int isl_map_is_bijective(__isl_keep isl_map *map);
3620 int isl_union_map_is_bijective(__isl_keep isl_union_map *umap);
3624 __isl_give isl_val *
3625 isl_basic_map_plain_get_val_if_fixed(
3626 __isl_keep isl_basic_map *bmap,
3627 enum isl_dim_type type, unsigned pos);
3628 __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3629 __isl_keep isl_set *set,
3630 enum isl_dim_type type, unsigned pos);
3631 __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3632 __isl_keep isl_map *map,
3633 enum isl_dim_type type, unsigned pos);
3635 If the set or relation obviously lies on a hyperplane where the given dimension
3636 has a fixed value, then return that value.
3637 Otherwise return NaN.
3641 int isl_set_dim_residue_class_val(
3642 __isl_keep isl_set *set,
3643 int pos, __isl_give isl_val **modulo,
3644 __isl_give isl_val **residue);
3646 Check if the values of the given set dimension are equal to a fixed
3647 value modulo some integer value. If so, assign the modulo to C<*modulo>
3648 and the fixed value to C<*residue>. If the given dimension attains only
3649 a single value, then assign C<0> to C<*modulo> and the fixed value to
3651 If the dimension does not attain only a single value and if no modulo
3652 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3656 To check whether the description of a set, relation or function depends
3657 on one or more given dimensions,
3658 the following functions can be used.
3660 #include <isl/constraint.h>
3661 int isl_constraint_involves_dims(
3662 __isl_keep isl_constraint *constraint,
3663 enum isl_dim_type type, unsigned first, unsigned n);
3665 #include <isl/set.h>
3666 int isl_basic_set_involves_dims(
3667 __isl_keep isl_basic_set *bset,
3668 enum isl_dim_type type, unsigned first, unsigned n);
3669 int isl_set_involves_dims(__isl_keep isl_set *set,
3670 enum isl_dim_type type, unsigned first, unsigned n);
3672 #include <isl/map.h>
3673 int isl_basic_map_involves_dims(
3674 __isl_keep isl_basic_map *bmap,
3675 enum isl_dim_type type, unsigned first, unsigned n);
3676 int isl_map_involves_dims(__isl_keep isl_map *map,
3677 enum isl_dim_type type, unsigned first, unsigned n);
3679 #include <isl/union_map.h>
3680 int isl_union_map_involves_dims(
3681 __isl_keep isl_union_map *umap,
3682 enum isl_dim_type type, unsigned first, unsigned n);
3684 #include <isl/aff.h>
3685 int isl_aff_involves_dims(__isl_keep isl_aff *aff,
3686 enum isl_dim_type type, unsigned first, unsigned n);
3687 int isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff,
3688 enum isl_dim_type type, unsigned first, unsigned n);
3689 int isl_multi_aff_involves_dims(
3690 __isl_keep isl_multi_aff *ma,
3691 enum isl_dim_type type, unsigned first, unsigned n);
3692 int isl_multi_pw_aff_involves_dims(
3693 __isl_keep isl_multi_pw_aff *mpa,
3694 enum isl_dim_type type, unsigned first, unsigned n);
3696 Similarly, the following functions can be used to check whether
3697 a given dimension is involved in any lower or upper bound.
3699 #include <isl/set.h>
3700 int isl_set_dim_has_any_lower_bound(__isl_keep isl_set *set,
3701 enum isl_dim_type type, unsigned pos);
3702 int isl_set_dim_has_any_upper_bound(__isl_keep isl_set *set,
3703 enum isl_dim_type type, unsigned pos);
3705 Note that these functions return true even if there is a bound on
3706 the dimension on only some of the basic sets of C<set>.
3707 To check if they have a bound for all of the basic sets in C<set>,
3708 use the following functions instead.
3710 #include <isl/set.h>
3711 int isl_set_dim_has_lower_bound(__isl_keep isl_set *set,
3712 enum isl_dim_type type, unsigned pos);
3713 int isl_set_dim_has_upper_bound(__isl_keep isl_set *set,
3714 enum isl_dim_type type, unsigned pos);
3718 To check whether a set is a parameter domain, use this function:
3720 int isl_set_is_params(__isl_keep isl_set *set);
3721 int isl_union_set_is_params(
3722 __isl_keep isl_union_set *uset);
3726 The following functions check whether the space of the given
3727 (basic) set or relation range is a wrapped relation.
3729 #include <isl/space.h>
3730 int isl_space_is_wrapping(
3731 __isl_keep isl_space *space);
3732 int isl_space_domain_is_wrapping(
3733 __isl_keep isl_space *space);
3734 int isl_space_range_is_wrapping(
3735 __isl_keep isl_space *space);
3737 #include <isl/set.h>
3738 int isl_basic_set_is_wrapping(
3739 __isl_keep isl_basic_set *bset);
3740 int isl_set_is_wrapping(__isl_keep isl_set *set);
3742 #include <isl/map.h>
3743 int isl_map_domain_is_wrapping(
3744 __isl_keep isl_map *map);
3745 int isl_map_range_is_wrapping(
3746 __isl_keep isl_map *map);
3748 #include <isl/val.h>
3749 int isl_multi_val_range_is_wrapping(
3750 __isl_keep isl_multi_val *mv);
3752 #include <isl/aff.h>
3753 int isl_multi_aff_range_is_wrapping(
3754 __isl_keep isl_multi_aff *ma);
3755 int isl_multi_pw_aff_range_is_wrapping(
3756 __isl_keep isl_multi_pw_aff *mpa);
3757 int isl_multi_union_pw_aff_range_is_wrapping(
3758 __isl_keep isl_multi_union_pw_aff *mupa);
3760 The input to C<isl_space_is_wrapping> should
3761 be the space of a set, while that of
3762 C<isl_space_domain_is_wrapping> and
3763 C<isl_space_range_is_wrapping> should be the space of a relation.
3765 =item * Internal Product
3767 int isl_basic_map_can_zip(
3768 __isl_keep isl_basic_map *bmap);
3769 int isl_map_can_zip(__isl_keep isl_map *map);
3771 Check whether the product of domain and range of the given relation
3773 i.e., whether both domain and range are nested relations.
3777 int isl_basic_map_can_curry(
3778 __isl_keep isl_basic_map *bmap);
3779 int isl_map_can_curry(__isl_keep isl_map *map);
3781 Check whether the domain of the (basic) relation is a wrapped relation.
3783 int isl_basic_map_can_uncurry(
3784 __isl_keep isl_basic_map *bmap);
3785 int isl_map_can_uncurry(__isl_keep isl_map *map);
3787 Check whether the range of the (basic) relation is a wrapped relation.
3789 =item * Special Values
3791 #include <isl/aff.h>
3792 int isl_aff_is_cst(__isl_keep isl_aff *aff);
3793 int isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3795 Check whether the given expression is a constant.
3797 #include <isl/aff.h>
3798 int isl_aff_is_nan(__isl_keep isl_aff *aff);
3799 int isl_pw_aff_involves_nan(__isl_keep isl_pw_aff *pa);
3801 Check whether the given expression is equal to or involves NaN.
3803 #include <isl/aff.h>
3804 int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
3806 Check whether the affine expression is obviously zero.
3810 =head3 Binary Properties
3816 The following functions check whether two objects
3817 represent the same set, relation or function.
3818 The C<plain> variants only return true if the objects
3819 are obviously the same. That is, they may return false
3820 even if the objects are the same, but they will never
3821 return true if the objects are not the same.
3823 #include <isl/set.h>
3824 int isl_basic_set_plain_is_equal(
3825 __isl_keep isl_basic_set *bset1,
3826 __isl_keep isl_basic_set *bset2);
3827 int isl_set_plain_is_equal(__isl_keep isl_set *set1,
3828 __isl_keep isl_set *set2);
3829 int isl_set_is_equal(__isl_keep isl_set *set1,
3830 __isl_keep isl_set *set2);
3832 #include <isl/map.h>
3833 int isl_basic_map_is_equal(
3834 __isl_keep isl_basic_map *bmap1,
3835 __isl_keep isl_basic_map *bmap2);
3836 int isl_map_is_equal(__isl_keep isl_map *map1,
3837 __isl_keep isl_map *map2);
3838 int isl_map_plain_is_equal(__isl_keep isl_map *map1,
3839 __isl_keep isl_map *map2);
3841 #include <isl/union_set.h>
3842 int isl_union_set_is_equal(
3843 __isl_keep isl_union_set *uset1,
3844 __isl_keep isl_union_set *uset2);
3846 #include <isl/union_map.h>
3847 int isl_union_map_is_equal(
3848 __isl_keep isl_union_map *umap1,
3849 __isl_keep isl_union_map *umap2);
3851 #include <isl/aff.h>
3852 int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1,
3853 __isl_keep isl_aff *aff2);
3854 int isl_multi_aff_plain_is_equal(
3855 __isl_keep isl_multi_aff *maff1,
3856 __isl_keep isl_multi_aff *maff2);
3857 int isl_pw_aff_plain_is_equal(
3858 __isl_keep isl_pw_aff *pwaff1,
3859 __isl_keep isl_pw_aff *pwaff2);
3860 int isl_pw_multi_aff_plain_is_equal(
3861 __isl_keep isl_pw_multi_aff *pma1,
3862 __isl_keep isl_pw_multi_aff *pma2);
3863 int isl_multi_pw_aff_plain_is_equal(
3864 __isl_keep isl_multi_pw_aff *mpa1,
3865 __isl_keep isl_multi_pw_aff *mpa2);
3866 int isl_multi_pw_aff_is_equal(
3867 __isl_keep isl_multi_pw_aff *mpa1,
3868 __isl_keep isl_multi_pw_aff *mpa2);
3869 int isl_union_pw_aff_plain_is_equal(
3870 __isl_keep isl_union_pw_aff *upa1,
3871 __isl_keep isl_union_pw_aff *upa2);
3872 int isl_union_pw_multi_aff_plain_is_equal(
3873 __isl_keep isl_union_pw_multi_aff *upma1,
3874 __isl_keep isl_union_pw_multi_aff *upma2);
3875 int isl_multi_union_pw_aff_plain_is_equal(
3876 __isl_keep isl_multi_union_pw_aff *mupa1,
3877 __isl_keep isl_multi_union_pw_aff *mupa2);
3879 #include <isl/polynomial.h>
3880 int isl_union_pw_qpolynomial_plain_is_equal(
3881 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3882 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3883 int isl_union_pw_qpolynomial_fold_plain_is_equal(
3884 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3885 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3887 =item * Disjointness
3889 #include <isl/set.h>
3890 int isl_basic_set_is_disjoint(
3891 __isl_keep isl_basic_set *bset1,
3892 __isl_keep isl_basic_set *bset2);
3893 int isl_set_plain_is_disjoint(__isl_keep isl_set *set1,
3894 __isl_keep isl_set *set2);
3895 int isl_set_is_disjoint(__isl_keep isl_set *set1,
3896 __isl_keep isl_set *set2);
3898 #include <isl/map.h>
3899 int isl_basic_map_is_disjoint(
3900 __isl_keep isl_basic_map *bmap1,
3901 __isl_keep isl_basic_map *bmap2);
3902 int isl_map_is_disjoint(__isl_keep isl_map *map1,
3903 __isl_keep isl_map *map2);
3905 #include <isl/union_set.h>
3906 int isl_union_set_is_disjoint(
3907 __isl_keep isl_union_set *uset1,
3908 __isl_keep isl_union_set *uset2);
3910 #include <isl/union_map.h>
3911 int isl_union_map_is_disjoint(
3912 __isl_keep isl_union_map *umap1,
3913 __isl_keep isl_union_map *umap2);
3917 int isl_basic_set_is_subset(
3918 __isl_keep isl_basic_set *bset1,
3919 __isl_keep isl_basic_set *bset2);
3920 int isl_set_is_subset(__isl_keep isl_set *set1,
3921 __isl_keep isl_set *set2);
3922 int isl_set_is_strict_subset(
3923 __isl_keep isl_set *set1,
3924 __isl_keep isl_set *set2);
3925 int isl_union_set_is_subset(
3926 __isl_keep isl_union_set *uset1,
3927 __isl_keep isl_union_set *uset2);
3928 int isl_union_set_is_strict_subset(
3929 __isl_keep isl_union_set *uset1,
3930 __isl_keep isl_union_set *uset2);
3931 int isl_basic_map_is_subset(
3932 __isl_keep isl_basic_map *bmap1,
3933 __isl_keep isl_basic_map *bmap2);
3934 int isl_basic_map_is_strict_subset(
3935 __isl_keep isl_basic_map *bmap1,
3936 __isl_keep isl_basic_map *bmap2);
3937 int isl_map_is_subset(
3938 __isl_keep isl_map *map1,
3939 __isl_keep isl_map *map2);
3940 int isl_map_is_strict_subset(
3941 __isl_keep isl_map *map1,
3942 __isl_keep isl_map *map2);
3943 int isl_union_map_is_subset(
3944 __isl_keep isl_union_map *umap1,
3945 __isl_keep isl_union_map *umap2);
3946 int isl_union_map_is_strict_subset(
3947 __isl_keep isl_union_map *umap1,
3948 __isl_keep isl_union_map *umap2);
3950 Check whether the first argument is a (strict) subset of the
3955 Every comparison function returns a negative value if the first
3956 argument is considered smaller than the second, a positive value
3957 if the first argument is considered greater and zero if the two
3958 constraints are considered the same by the comparison criterion.
3960 #include <isl/constraint.h>
3961 int isl_constraint_plain_cmp(
3962 __isl_keep isl_constraint *c1,
3963 __isl_keep isl_constraint *c2);
3965 This function is useful for sorting C<isl_constraint>s.
3966 The order depends on the internal representation of the inputs.
3967 The order is fixed over different calls to the function (assuming
3968 the internal representation of the inputs has not changed), but may
3969 change over different versions of C<isl>.
3971 #include <isl/constraint.h>
3972 int isl_constraint_cmp_last_non_zero(
3973 __isl_keep isl_constraint *c1,
3974 __isl_keep isl_constraint *c2);
3976 This function can be used to sort constraints that live in the same
3977 local space. Constraints that involve ``earlier'' dimensions or
3978 that have a smaller coefficient for the shared latest dimension
3979 are considered smaller than other constraints.
3980 This function only defines a B<partial> order.
3982 #include <isl/set.h>
3983 int isl_set_plain_cmp(__isl_keep isl_set *set1,
3984 __isl_keep isl_set *set2);
3986 This function is useful for sorting C<isl_set>s.
3987 The order depends on the internal representation of the inputs.
3988 The order is fixed over different calls to the function (assuming
3989 the internal representation of the inputs has not changed), but may
3990 change over different versions of C<isl>.
3992 #include <isl/aff.h>
3993 int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
3994 __isl_keep isl_pw_aff *pa2);
3996 The function C<isl_pw_aff_plain_cmp> can be used to sort
3997 C<isl_pw_aff>s. The order is not strictly defined.
3998 The current order sorts expressions that only involve
3999 earlier dimensions before those that involve later dimensions.
4003 =head2 Unary Operations
4009 __isl_give isl_set *isl_set_complement(
4010 __isl_take isl_set *set);
4011 __isl_give isl_map *isl_map_complement(
4012 __isl_take isl_map *map);
4016 #include <isl/space.h>
4017 __isl_give isl_space *isl_space_reverse(
4018 __isl_take isl_space *space);
4020 #include <isl/map.h>
4021 __isl_give isl_basic_map *isl_basic_map_reverse(
4022 __isl_take isl_basic_map *bmap);
4023 __isl_give isl_map *isl_map_reverse(
4024 __isl_take isl_map *map);
4026 #include <isl/union_map.h>
4027 __isl_give isl_union_map *isl_union_map_reverse(
4028 __isl_take isl_union_map *umap);
4032 #include <isl/space.h>
4033 __isl_give isl_space *isl_space_domain(
4034 __isl_take isl_space *space);
4035 __isl_give isl_space *isl_space_range(
4036 __isl_take isl_space *space);
4037 __isl_give isl_space *isl_space_params(
4038 __isl_take isl_space *space);
4040 #include <isl/local_space.h>
4041 __isl_give isl_local_space *isl_local_space_domain(
4042 __isl_take isl_local_space *ls);
4043 __isl_give isl_local_space *isl_local_space_range(
4044 __isl_take isl_local_space *ls);
4046 #include <isl/set.h>
4047 __isl_give isl_basic_set *isl_basic_set_project_out(
4048 __isl_take isl_basic_set *bset,
4049 enum isl_dim_type type, unsigned first, unsigned n);
4050 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4051 enum isl_dim_type type, unsigned first, unsigned n);
4052 __isl_give isl_basic_set *isl_basic_set_params(
4053 __isl_take isl_basic_set *bset);
4054 __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4056 #include <isl/map.h>
4057 __isl_give isl_basic_map *isl_basic_map_project_out(
4058 __isl_take isl_basic_map *bmap,
4059 enum isl_dim_type type, unsigned first, unsigned n);
4060 __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4061 enum isl_dim_type type, unsigned first, unsigned n);
4062 __isl_give isl_basic_set *isl_basic_map_domain(
4063 __isl_take isl_basic_map *bmap);
4064 __isl_give isl_basic_set *isl_basic_map_range(
4065 __isl_take isl_basic_map *bmap);
4066 __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4067 __isl_give isl_set *isl_map_domain(
4068 __isl_take isl_map *bmap);
4069 __isl_give isl_set *isl_map_range(
4070 __isl_take isl_map *map);
4072 #include <isl/union_set.h>
4073 __isl_give isl_union_set *isl_union_set_project_out(
4074 __isl_take isl_union_set *uset,
4075 enum isl_dim_type type,
4076 unsigned first, unsigned n);
4077 __isl_give isl_set *isl_union_set_params(
4078 __isl_take isl_union_set *uset);
4080 The function C<isl_union_set_project_out> can only project out
4083 #include <isl/union_map.h>
4084 __isl_give isl_union_map *isl_union_map_project_out(
4085 __isl_take isl_union_map *umap,
4086 enum isl_dim_type type, unsigned first, unsigned n);
4087 __isl_give isl_set *isl_union_map_params(
4088 __isl_take isl_union_map *umap);
4089 __isl_give isl_union_set *isl_union_map_domain(
4090 __isl_take isl_union_map *umap);
4091 __isl_give isl_union_set *isl_union_map_range(
4092 __isl_take isl_union_map *umap);
4094 The function C<isl_union_map_project_out> can only project out
4097 #include <isl/aff.h>
4098 __isl_give isl_aff *isl_aff_project_domain_on_params(
4099 __isl_take isl_aff *aff);
4100 __isl_give isl_pw_multi_aff *
4101 isl_pw_multi_aff_project_domain_on_params(
4102 __isl_take isl_pw_multi_aff *pma);
4103 __isl_give isl_set *isl_pw_aff_domain(
4104 __isl_take isl_pw_aff *pwaff);
4105 __isl_give isl_set *isl_pw_multi_aff_domain(
4106 __isl_take isl_pw_multi_aff *pma);
4107 __isl_give isl_set *isl_multi_pw_aff_domain(
4108 __isl_take isl_multi_pw_aff *mpa);
4109 __isl_give isl_union_set *isl_union_pw_aff_domain(
4110 __isl_take isl_union_pw_aff *upa);
4111 __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4112 __isl_take isl_union_pw_multi_aff *upma);
4113 __isl_give isl_union_set *
4114 isl_multi_union_pw_aff_domain(
4115 __isl_take isl_multi_union_pw_aff *mupa);
4116 __isl_give isl_set *isl_pw_aff_params(
4117 __isl_take isl_pw_aff *pwa);
4119 The function C<isl_multi_union_pw_aff_domain> requires its
4120 input to have at least one set dimension.
4122 #include <isl/polynomial.h>
4123 __isl_give isl_qpolynomial *
4124 isl_qpolynomial_project_domain_on_params(
4125 __isl_take isl_qpolynomial *qp);
4126 __isl_give isl_pw_qpolynomial *
4127 isl_pw_qpolynomial_project_domain_on_params(
4128 __isl_take isl_pw_qpolynomial *pwqp);
4129 __isl_give isl_pw_qpolynomial_fold *
4130 isl_pw_qpolynomial_fold_project_domain_on_params(
4131 __isl_take isl_pw_qpolynomial_fold *pwf);
4132 __isl_give isl_set *isl_pw_qpolynomial_domain(
4133 __isl_take isl_pw_qpolynomial *pwqp);
4134 __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4135 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4136 __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4137 __isl_take isl_union_pw_qpolynomial *upwqp);
4139 #include <isl/space.h>
4140 __isl_give isl_space *isl_space_domain_map(
4141 __isl_take isl_space *space);
4142 __isl_give isl_space *isl_space_range_map(
4143 __isl_take isl_space *space);
4145 #include <isl/map.h>
4146 __isl_give isl_map *isl_set_wrapped_domain_map(
4147 __isl_take isl_set *set);
4148 __isl_give isl_basic_map *isl_basic_map_domain_map(
4149 __isl_take isl_basic_map *bmap);
4150 __isl_give isl_basic_map *isl_basic_map_range_map(
4151 __isl_take isl_basic_map *bmap);
4152 __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4153 __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4155 #include <isl/union_map.h>
4156 __isl_give isl_union_map *isl_union_map_domain_map(
4157 __isl_take isl_union_map *umap);
4158 __isl_give isl_union_pw_multi_aff *
4159 isl_union_map_domain_map_union_pw_multi_aff(
4160 __isl_take isl_union_map *umap);
4161 __isl_give isl_union_map *isl_union_map_range_map(
4162 __isl_take isl_union_map *umap);
4163 __isl_give isl_union_map *
4164 isl_union_set_wrapped_domain_map(
4165 __isl_take isl_union_set *uset);
4167 The functions above construct a (basic, regular or union) relation
4168 that maps (a wrapped version of) the input relation to its domain or range.
4169 C<isl_set_wrapped_domain_map> maps the input set to the domain
4170 of its wrapped relation.
4174 __isl_give isl_basic_set *isl_basic_set_eliminate(
4175 __isl_take isl_basic_set *bset,
4176 enum isl_dim_type type,
4177 unsigned first, unsigned n);
4178 __isl_give isl_set *isl_set_eliminate(
4179 __isl_take isl_set *set, enum isl_dim_type type,
4180 unsigned first, unsigned n);
4181 __isl_give isl_basic_map *isl_basic_map_eliminate(
4182 __isl_take isl_basic_map *bmap,
4183 enum isl_dim_type type,
4184 unsigned first, unsigned n);
4185 __isl_give isl_map *isl_map_eliminate(
4186 __isl_take isl_map *map, enum isl_dim_type type,
4187 unsigned first, unsigned n);
4189 Eliminate the coefficients for the given dimensions from the constraints,
4190 without removing the dimensions.
4192 =item * Constructing a set from a parameter domain
4194 A zero-dimensional space or (basic) set can be constructed
4195 on a given parameter domain using the following functions.
4197 #include <isl/space.h>
4198 __isl_give isl_space *isl_space_set_from_params(
4199 __isl_take isl_space *space);
4201 #include <isl/set.h>
4202 __isl_give isl_basic_set *isl_basic_set_from_params(
4203 __isl_take isl_basic_set *bset);
4204 __isl_give isl_set *isl_set_from_params(
4205 __isl_take isl_set *set);
4207 =item * Constructing a relation from a set
4209 Create a relation with the given set as domain or range.
4210 The range or domain of the created relation is a zero-dimensional
4211 flat anonymous space.
4213 #include <isl/space.h>
4214 __isl_give isl_space *isl_space_from_domain(
4215 __isl_take isl_space *space);
4216 __isl_give isl_space *isl_space_from_range(
4217 __isl_take isl_space *space);
4218 __isl_give isl_space *isl_space_map_from_set(
4219 __isl_take isl_space *space);
4220 __isl_give isl_space *isl_space_map_from_domain_and_range(
4221 __isl_take isl_space *domain,
4222 __isl_take isl_space *range);
4224 #include <isl/local_space.h>
4225 __isl_give isl_local_space *isl_local_space_from_domain(
4226 __isl_take isl_local_space *ls);
4228 #include <isl/map.h>
4229 __isl_give isl_map *isl_map_from_domain(
4230 __isl_take isl_set *set);
4231 __isl_give isl_map *isl_map_from_range(
4232 __isl_take isl_set *set);
4234 #include <isl/val.h>
4235 __isl_give isl_multi_val *isl_multi_val_from_range(
4236 __isl_take isl_multi_val *mv);
4238 #include <isl/aff.h>
4239 __isl_give isl_multi_aff *isl_multi_aff_from_range(
4240 __isl_take isl_multi_aff *ma);
4241 __isl_give isl_pw_aff *isl_pw_aff_from_range(
4242 __isl_take isl_pw_aff *pwa);
4243 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4244 __isl_take isl_multi_pw_aff *mpa);
4245 __isl_give isl_multi_union_pw_aff *
4246 isl_multi_union_pw_aff_from_range(
4247 __isl_take isl_multi_union_pw_aff *mupa);
4248 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4249 __isl_take isl_set *set);
4250 __isl_give isl_union_pw_multi_aff *
4251 isl_union_pw_multi_aff_from_domain(
4252 __isl_take isl_union_set *uset);
4256 #include <isl/set.h>
4257 __isl_give isl_basic_set *isl_basic_set_fix_si(
4258 __isl_take isl_basic_set *bset,
4259 enum isl_dim_type type, unsigned pos, int value);
4260 __isl_give isl_basic_set *isl_basic_set_fix_val(
4261 __isl_take isl_basic_set *bset,
4262 enum isl_dim_type type, unsigned pos,
4263 __isl_take isl_val *v);
4264 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4265 enum isl_dim_type type, unsigned pos, int value);
4266 __isl_give isl_set *isl_set_fix_val(
4267 __isl_take isl_set *set,
4268 enum isl_dim_type type, unsigned pos,
4269 __isl_take isl_val *v);
4271 #include <isl/map.h>
4272 __isl_give isl_basic_map *isl_basic_map_fix_si(
4273 __isl_take isl_basic_map *bmap,
4274 enum isl_dim_type type, unsigned pos, int value);
4275 __isl_give isl_basic_map *isl_basic_map_fix_val(
4276 __isl_take isl_basic_map *bmap,
4277 enum isl_dim_type type, unsigned pos,
4278 __isl_take isl_val *v);
4279 __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4280 enum isl_dim_type type, unsigned pos, int value);
4281 __isl_give isl_map *isl_map_fix_val(
4282 __isl_take isl_map *map,
4283 enum isl_dim_type type, unsigned pos,
4284 __isl_take isl_val *v);
4286 #include <isl/aff.h>
4287 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4288 __isl_take isl_pw_multi_aff *pma,
4289 enum isl_dim_type type, unsigned pos, int value);
4291 #include <isl/polynomial.h>
4292 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4293 __isl_take isl_pw_qpolynomial *pwqp,
4294 enum isl_dim_type type, unsigned n,
4295 __isl_take isl_val *v);
4297 Intersect the set, relation or function domain
4298 with the hyperplane where the given
4299 dimension has the fixed given value.
4301 __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4302 __isl_take isl_basic_map *bmap,
4303 enum isl_dim_type type, unsigned pos, int value);
4304 __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4305 __isl_take isl_basic_map *bmap,
4306 enum isl_dim_type type, unsigned pos, int value);
4307 __isl_give isl_set *isl_set_lower_bound_si(
4308 __isl_take isl_set *set,
4309 enum isl_dim_type type, unsigned pos, int value);
4310 __isl_give isl_set *isl_set_lower_bound_val(
4311 __isl_take isl_set *set,
4312 enum isl_dim_type type, unsigned pos,
4313 __isl_take isl_val *value);
4314 __isl_give isl_map *isl_map_lower_bound_si(
4315 __isl_take isl_map *map,
4316 enum isl_dim_type type, unsigned pos, int value);
4317 __isl_give isl_set *isl_set_upper_bound_si(
4318 __isl_take isl_set *set,
4319 enum isl_dim_type type, unsigned pos, int value);
4320 __isl_give isl_set *isl_set_upper_bound_val(
4321 __isl_take isl_set *set,
4322 enum isl_dim_type type, unsigned pos,
4323 __isl_take isl_val *value);
4324 __isl_give isl_map *isl_map_upper_bound_si(
4325 __isl_take isl_map *map,
4326 enum isl_dim_type type, unsigned pos, int value);
4328 Intersect the set or relation with the half-space where the given
4329 dimension has a value bounded by the fixed given integer value.
4331 __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4332 enum isl_dim_type type1, int pos1,
4333 enum isl_dim_type type2, int pos2);
4334 __isl_give isl_basic_map *isl_basic_map_equate(
4335 __isl_take isl_basic_map *bmap,
4336 enum isl_dim_type type1, int pos1,
4337 enum isl_dim_type type2, int pos2);
4338 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4339 enum isl_dim_type type1, int pos1,
4340 enum isl_dim_type type2, int pos2);
4342 Intersect the set or relation with the hyperplane where the given
4343 dimensions are equal to each other.
4345 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4346 enum isl_dim_type type1, int pos1,
4347 enum isl_dim_type type2, int pos2);
4349 Intersect the relation with the hyperplane where the given
4350 dimensions have opposite values.
4352 __isl_give isl_map *isl_map_order_le(
4353 __isl_take isl_map *map,
4354 enum isl_dim_type type1, int pos1,
4355 enum isl_dim_type type2, int pos2);
4356 __isl_give isl_basic_map *isl_basic_map_order_ge(
4357 __isl_take isl_basic_map *bmap,
4358 enum isl_dim_type type1, int pos1,
4359 enum isl_dim_type type2, int pos2);
4360 __isl_give isl_map *isl_map_order_ge(
4361 __isl_take isl_map *map,
4362 enum isl_dim_type type1, int pos1,
4363 enum isl_dim_type type2, int pos2);
4364 __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4365 enum isl_dim_type type1, int pos1,
4366 enum isl_dim_type type2, int pos2);
4367 __isl_give isl_basic_map *isl_basic_map_order_gt(
4368 __isl_take isl_basic_map *bmap,
4369 enum isl_dim_type type1, int pos1,
4370 enum isl_dim_type type2, int pos2);
4371 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4372 enum isl_dim_type type1, int pos1,
4373 enum isl_dim_type type2, int pos2);
4375 Intersect the relation with the half-space where the given
4376 dimensions satisfy the given ordering.
4380 #include <isl/aff.h>
4381 __isl_give isl_basic_set *isl_aff_zero_basic_set(
4382 __isl_take isl_aff *aff);
4383 __isl_give isl_basic_set *isl_aff_neg_basic_set(
4384 __isl_take isl_aff *aff);
4385 __isl_give isl_set *isl_pw_aff_pos_set(
4386 __isl_take isl_pw_aff *pa);
4387 __isl_give isl_set *isl_pw_aff_nonneg_set(
4388 __isl_take isl_pw_aff *pwaff);
4389 __isl_give isl_set *isl_pw_aff_zero_set(
4390 __isl_take isl_pw_aff *pwaff);
4391 __isl_give isl_set *isl_pw_aff_non_zero_set(
4392 __isl_take isl_pw_aff *pwaff);
4393 __isl_give isl_union_set *
4394 isl_union_pw_aff_zero_union_set(
4395 __isl_take isl_union_pw_aff *upa);
4396 __isl_give isl_union_set *
4397 isl_multi_union_pw_aff_zero_union_set(
4398 __isl_take isl_multi_union_pw_aff *mupa);
4400 The function C<isl_aff_neg_basic_set> returns a basic set
4401 containing those elements in the domain space
4402 of C<aff> where C<aff> is negative.
4403 The function C<isl_pw_aff_nonneg_set> returns a set
4404 containing those elements in the domain
4405 of C<pwaff> where C<pwaff> is non-negative.
4406 The function C<isl_multi_union_pw_aff_zero_union_set>
4407 returns a union set containing those elements
4408 in the domains of its elements where they are all zero.
4412 __isl_give isl_map *isl_set_identity(
4413 __isl_take isl_set *set);
4414 __isl_give isl_union_map *isl_union_set_identity(
4415 __isl_take isl_union_set *uset);
4416 __isl_give isl_union_pw_multi_aff *
4417 isl_union_set_identity_union_pw_multi_aff(
4418 __isl_take isl_union_set *uset);
4420 Construct an identity relation on the given (union) set.
4422 =item * Function Extraction
4424 A piecewise quasi affine expression that is equal to 1 on a set
4425 and 0 outside the set can be created using the following function.
4427 #include <isl/aff.h>
4428 __isl_give isl_pw_aff *isl_set_indicator_function(
4429 __isl_take isl_set *set);
4431 A piecewise multiple quasi affine expression can be extracted
4432 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4433 and the C<isl_map> is single-valued.
4434 In case of a conversion from an C<isl_union_map>
4435 to an C<isl_union_pw_multi_aff>, these properties need to hold
4436 in each domain space.
4437 A conversion to a C<isl_multi_union_pw_aff> additionally
4438 requires that the input is non-empty and involves only a single
4441 #include <isl/aff.h>
4442 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4443 __isl_take isl_set *set);
4444 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4445 __isl_take isl_map *map);
4447 __isl_give isl_union_pw_multi_aff *
4448 isl_union_pw_multi_aff_from_union_set(
4449 __isl_take isl_union_set *uset);
4450 __isl_give isl_union_pw_multi_aff *
4451 isl_union_pw_multi_aff_from_union_map(
4452 __isl_take isl_union_map *umap);
4454 __isl_give isl_multi_union_pw_aff *
4455 isl_multi_union_pw_aff_from_union_map(
4456 __isl_take isl_union_map *umap);
4460 __isl_give isl_basic_set *isl_basic_map_deltas(
4461 __isl_take isl_basic_map *bmap);
4462 __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4463 __isl_give isl_union_set *isl_union_map_deltas(
4464 __isl_take isl_union_map *umap);
4466 These functions return a (basic) set containing the differences
4467 between image elements and corresponding domain elements in the input.
4469 __isl_give isl_basic_map *isl_basic_map_deltas_map(
4470 __isl_take isl_basic_map *bmap);
4471 __isl_give isl_map *isl_map_deltas_map(
4472 __isl_take isl_map *map);
4473 __isl_give isl_union_map *isl_union_map_deltas_map(
4474 __isl_take isl_union_map *umap);
4476 The functions above construct a (basic, regular or union) relation
4477 that maps (a wrapped version of) the input relation to its delta set.
4481 Simplify the representation of a set, relation or functions by trying
4482 to combine pairs of basic sets or relations into a single
4483 basic set or relation.
4485 #include <isl/set.h>
4486 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4488 #include <isl/map.h>
4489 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4491 #include <isl/union_set.h>
4492 __isl_give isl_union_set *isl_union_set_coalesce(
4493 __isl_take isl_union_set *uset);
4495 #include <isl/union_map.h>
4496 __isl_give isl_union_map *isl_union_map_coalesce(
4497 __isl_take isl_union_map *umap);
4499 #include <isl/aff.h>
4500 __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4501 __isl_take isl_pw_aff *pwqp);
4502 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4503 __isl_take isl_pw_multi_aff *pma);
4504 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4505 __isl_take isl_multi_pw_aff *mpa);
4506 __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4507 __isl_take isl_union_pw_aff *upa);
4508 __isl_give isl_union_pw_multi_aff *
4509 isl_union_pw_multi_aff_coalesce(
4510 __isl_take isl_union_pw_multi_aff *upma);
4512 #include <isl/polynomial.h>
4513 __isl_give isl_pw_qpolynomial_fold *
4514 isl_pw_qpolynomial_fold_coalesce(
4515 __isl_take isl_pw_qpolynomial_fold *pwf);
4516 __isl_give isl_union_pw_qpolynomial *
4517 isl_union_pw_qpolynomial_coalesce(
4518 __isl_take isl_union_pw_qpolynomial *upwqp);
4519 __isl_give isl_union_pw_qpolynomial_fold *
4520 isl_union_pw_qpolynomial_fold_coalesce(
4521 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4523 One of the methods for combining pairs of basic sets or relations
4524 can result in coefficients that are much larger than those that appear
4525 in the constraints of the input. By default, the coefficients are
4526 not allowed to grow larger, but this can be changed by unsetting
4527 the following option.
4529 int isl_options_set_coalesce_bounded_wrapping(
4530 isl_ctx *ctx, int val);
4531 int isl_options_get_coalesce_bounded_wrapping(
4534 =item * Detecting equalities
4536 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4537 __isl_take isl_basic_set *bset);
4538 __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4539 __isl_take isl_basic_map *bmap);
4540 __isl_give isl_set *isl_set_detect_equalities(
4541 __isl_take isl_set *set);
4542 __isl_give isl_map *isl_map_detect_equalities(
4543 __isl_take isl_map *map);
4544 __isl_give isl_union_set *isl_union_set_detect_equalities(
4545 __isl_take isl_union_set *uset);
4546 __isl_give isl_union_map *isl_union_map_detect_equalities(
4547 __isl_take isl_union_map *umap);
4549 Simplify the representation of a set or relation by detecting implicit
4552 =item * Removing redundant constraints
4554 #include <isl/set.h>
4555 __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4556 __isl_take isl_basic_set *bset);
4557 __isl_give isl_set *isl_set_remove_redundancies(
4558 __isl_take isl_set *set);
4560 #include <isl/union_set.h>
4561 __isl_give isl_union_set *
4562 isl_union_set_remove_redundancies(
4563 __isl_take isl_union_set *uset);
4565 #include <isl/map.h>
4566 __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4567 __isl_take isl_basic_map *bmap);
4568 __isl_give isl_map *isl_map_remove_redundancies(
4569 __isl_take isl_map *map);
4571 #include <isl/union_map.h>
4572 __isl_give isl_union_map *
4573 isl_union_map_remove_redundancies(
4574 __isl_take isl_union_map *umap);
4578 __isl_give isl_basic_set *isl_set_convex_hull(
4579 __isl_take isl_set *set);
4580 __isl_give isl_basic_map *isl_map_convex_hull(
4581 __isl_take isl_map *map);
4583 If the input set or relation has any existentially quantified
4584 variables, then the result of these operations is currently undefined.
4588 #include <isl/set.h>
4589 __isl_give isl_basic_set *
4590 isl_set_unshifted_simple_hull(
4591 __isl_take isl_set *set);
4592 __isl_give isl_basic_set *isl_set_simple_hull(
4593 __isl_take isl_set *set);
4594 __isl_give isl_basic_set *
4595 isl_set_unshifted_simple_hull_from_set_list(
4596 __isl_take isl_set *set,
4597 __isl_take isl_set_list *list);
4599 #include <isl/map.h>
4600 __isl_give isl_basic_map *
4601 isl_map_unshifted_simple_hull(
4602 __isl_take isl_map *map);
4603 __isl_give isl_basic_map *isl_map_simple_hull(
4604 __isl_take isl_map *map);
4605 __isl_give isl_basic_map *
4606 isl_map_unshifted_simple_hull_from_map_list(
4607 __isl_take isl_map *map,
4608 __isl_take isl_map_list *list);
4610 #include <isl/union_map.h>
4611 __isl_give isl_union_map *isl_union_map_simple_hull(
4612 __isl_take isl_union_map *umap);
4614 These functions compute a single basic set or relation
4615 that contains the whole input set or relation.
4616 In particular, the output is described by translates
4617 of the constraints describing the basic sets or relations in the input.
4618 In case of C<isl_set_unshifted_simple_hull>, only the original
4619 constraints are used, without any translation.
4620 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4621 C<isl_map_unshifted_simple_hull_from_map_list>, the
4622 constraints are taken from the elements of the second argument.
4626 (See \autoref{s:simple hull}.)
4632 __isl_give isl_basic_set *isl_basic_set_affine_hull(
4633 __isl_take isl_basic_set *bset);
4634 __isl_give isl_basic_set *isl_set_affine_hull(
4635 __isl_take isl_set *set);
4636 __isl_give isl_union_set *isl_union_set_affine_hull(
4637 __isl_take isl_union_set *uset);
4638 __isl_give isl_basic_map *isl_basic_map_affine_hull(
4639 __isl_take isl_basic_map *bmap);
4640 __isl_give isl_basic_map *isl_map_affine_hull(
4641 __isl_take isl_map *map);
4642 __isl_give isl_union_map *isl_union_map_affine_hull(
4643 __isl_take isl_union_map *umap);
4645 In case of union sets and relations, the affine hull is computed
4648 =item * Polyhedral hull
4650 __isl_give isl_basic_set *isl_set_polyhedral_hull(
4651 __isl_take isl_set *set);
4652 __isl_give isl_basic_map *isl_map_polyhedral_hull(
4653 __isl_take isl_map *map);
4654 __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4655 __isl_take isl_union_set *uset);
4656 __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4657 __isl_take isl_union_map *umap);
4659 These functions compute a single basic set or relation
4660 not involving any existentially quantified variables
4661 that contains the whole input set or relation.
4662 In case of union sets and relations, the polyhedral hull is computed
4665 =item * Other approximations
4667 #include <isl/set.h>
4668 __isl_give isl_basic_set *
4669 isl_basic_set_drop_constraints_involving_dims(
4670 __isl_take isl_basic_set *bset,
4671 enum isl_dim_type type,
4672 unsigned first, unsigned n);
4673 __isl_give isl_basic_set *
4674 isl_basic_set_drop_constraints_not_involving_dims(
4675 __isl_take isl_basic_set *bset,
4676 enum isl_dim_type type,
4677 unsigned first, unsigned n);
4678 __isl_give isl_set *
4679 isl_set_drop_constraints_involving_dims(
4680 __isl_take isl_set *set,
4681 enum isl_dim_type type,
4682 unsigned first, unsigned n);
4684 #include <isl/map.h>
4685 __isl_give isl_basic_map *
4686 isl_basic_map_drop_constraints_involving_dims(
4687 __isl_take isl_basic_map *bmap,
4688 enum isl_dim_type type,
4689 unsigned first, unsigned n);
4690 __isl_give isl_map *
4691 isl_map_drop_constraints_involving_dims(
4692 __isl_take isl_map *map,
4693 enum isl_dim_type type,
4694 unsigned first, unsigned n);
4696 These functions drop any constraints (not) involving the specified dimensions.
4697 Note that the result depends on the representation of the input.
4699 #include <isl/polynomial.h>
4700 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4701 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4702 __isl_give isl_union_pw_qpolynomial *
4703 isl_union_pw_qpolynomial_to_polynomial(
4704 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4706 Approximate each quasipolynomial by a polynomial. If C<sign> is positive,
4707 the polynomial will be an overapproximation. If C<sign> is negative,
4708 it will be an underapproximation. If C<sign> is zero, the approximation
4709 will lie somewhere in between.
4713 __isl_give isl_basic_set *isl_basic_set_sample(
4714 __isl_take isl_basic_set *bset);
4715 __isl_give isl_basic_set *isl_set_sample(
4716 __isl_take isl_set *set);
4717 __isl_give isl_basic_map *isl_basic_map_sample(
4718 __isl_take isl_basic_map *bmap);
4719 __isl_give isl_basic_map *isl_map_sample(
4720 __isl_take isl_map *map);
4722 If the input (basic) set or relation is non-empty, then return
4723 a singleton subset of the input. Otherwise, return an empty set.
4725 =item * Optimization
4727 #include <isl/ilp.h>
4728 __isl_give isl_val *isl_basic_set_max_val(
4729 __isl_keep isl_basic_set *bset,
4730 __isl_keep isl_aff *obj);
4731 __isl_give isl_val *isl_set_min_val(
4732 __isl_keep isl_set *set,
4733 __isl_keep isl_aff *obj);
4734 __isl_give isl_val *isl_set_max_val(
4735 __isl_keep isl_set *set,
4736 __isl_keep isl_aff *obj);
4738 Compute the minimum or maximum of the integer affine expression C<obj>
4739 over the points in C<set>, returning the result in C<opt>.
4740 The result is C<NULL> in case of an error, the optimal value in case
4741 there is one, negative infinity or infinity if the problem is unbounded and
4742 NaN if the problem is empty.
4744 =item * Parametric optimization
4746 __isl_give isl_pw_aff *isl_set_dim_min(
4747 __isl_take isl_set *set, int pos);
4748 __isl_give isl_pw_aff *isl_set_dim_max(
4749 __isl_take isl_set *set, int pos);
4750 __isl_give isl_pw_aff *isl_map_dim_max(
4751 __isl_take isl_map *map, int pos);
4753 Compute the minimum or maximum of the given set or output dimension
4754 as a function of the parameters (and input dimensions), but independently
4755 of the other set or output dimensions.
4756 For lexicographic optimization, see L<"Lexicographic Optimization">.
4760 The following functions compute either the set of (rational) coefficient
4761 values of valid constraints for the given set or the set of (rational)
4762 values satisfying the constraints with coefficients from the given set.
4763 Internally, these two sets of functions perform essentially the
4764 same operations, except that the set of coefficients is assumed to
4765 be a cone, while the set of values may be any polyhedron.
4766 The current implementation is based on the Farkas lemma and
4767 Fourier-Motzkin elimination, but this may change or be made optional
4768 in future. In particular, future implementations may use different
4769 dualization algorithms or skip the elimination step.
4771 __isl_give isl_basic_set *isl_basic_set_coefficients(
4772 __isl_take isl_basic_set *bset);
4773 __isl_give isl_basic_set *isl_set_coefficients(
4774 __isl_take isl_set *set);
4775 __isl_give isl_union_set *isl_union_set_coefficients(
4776 __isl_take isl_union_set *bset);
4777 __isl_give isl_basic_set *isl_basic_set_solutions(
4778 __isl_take isl_basic_set *bset);
4779 __isl_give isl_basic_set *isl_set_solutions(
4780 __isl_take isl_set *set);
4781 __isl_give isl_union_set *isl_union_set_solutions(
4782 __isl_take isl_union_set *bset);
4786 __isl_give isl_map *isl_map_fixed_power_val(
4787 __isl_take isl_map *map,
4788 __isl_take isl_val *exp);
4789 __isl_give isl_union_map *
4790 isl_union_map_fixed_power_val(
4791 __isl_take isl_union_map *umap,
4792 __isl_take isl_val *exp);
4794 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4795 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4796 of C<map> is computed.
4798 __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4800 __isl_give isl_union_map *isl_union_map_power(
4801 __isl_take isl_union_map *umap, int *exact);
4803 Compute a parametric representation for all positive powers I<k> of C<map>.
4804 The result maps I<k> to a nested relation corresponding to the
4805 I<k>th power of C<map>.
4806 The result may be an overapproximation. If the result is known to be exact,
4807 then C<*exact> is set to C<1>.
4809 =item * Transitive closure
4811 __isl_give isl_map *isl_map_transitive_closure(
4812 __isl_take isl_map *map, int *exact);
4813 __isl_give isl_union_map *isl_union_map_transitive_closure(
4814 __isl_take isl_union_map *umap, int *exact);
4816 Compute the transitive closure of C<map>.
4817 The result may be an overapproximation. If the result is known to be exact,
4818 then C<*exact> is set to C<1>.
4820 =item * Reaching path lengths
4822 __isl_give isl_map *isl_map_reaching_path_lengths(
4823 __isl_take isl_map *map, int *exact);
4825 Compute a relation that maps each element in the range of C<map>
4826 to the lengths of all paths composed of edges in C<map> that
4827 end up in the given element.
4828 The result may be an overapproximation. If the result is known to be exact,
4829 then C<*exact> is set to C<1>.
4830 To compute the I<maximal> path length, the resulting relation
4831 should be postprocessed by C<isl_map_lexmax>.
4832 In particular, if the input relation is a dependence relation
4833 (mapping sources to sinks), then the maximal path length corresponds
4834 to the free schedule.
4835 Note, however, that C<isl_map_lexmax> expects the maximum to be
4836 finite, so if the path lengths are unbounded (possibly due to
4837 the overapproximation), then you will get an error message.
4841 #include <isl/space.h>
4842 __isl_give isl_space *isl_space_wrap(
4843 __isl_take isl_space *space);
4844 __isl_give isl_space *isl_space_unwrap(
4845 __isl_take isl_space *space);
4847 #include <isl/local_space.h>
4848 __isl_give isl_local_space *isl_local_space_wrap(
4849 __isl_take isl_local_space *ls);
4851 #include <isl/set.h>
4852 __isl_give isl_basic_map *isl_basic_set_unwrap(
4853 __isl_take isl_basic_set *bset);
4854 __isl_give isl_map *isl_set_unwrap(
4855 __isl_take isl_set *set);
4857 #include <isl/map.h>
4858 __isl_give isl_basic_set *isl_basic_map_wrap(
4859 __isl_take isl_basic_map *bmap);
4860 __isl_give isl_set *isl_map_wrap(
4861 __isl_take isl_map *map);
4863 #include <isl/union_set.h>
4864 __isl_give isl_union_map *isl_union_set_unwrap(
4865 __isl_take isl_union_set *uset);
4867 #include <isl/union_map.h>
4868 __isl_give isl_union_set *isl_union_map_wrap(
4869 __isl_take isl_union_map *umap);
4871 The input to C<isl_space_unwrap> should
4872 be the space of a set, while that of
4873 C<isl_space_wrap> should be the space of a relation.
4874 Conversely, the output of C<isl_space_unwrap> is the space
4875 of a relation, while that of C<isl_space_wrap> is the space of a set.
4879 Remove any internal structure of domain (and range) of the given
4880 set or relation. If there is any such internal structure in the input,
4881 then the name of the space is also removed.
4883 #include <isl/local_space.h>
4884 __isl_give isl_local_space *
4885 isl_local_space_flatten_domain(
4886 __isl_take isl_local_space *ls);
4887 __isl_give isl_local_space *
4888 isl_local_space_flatten_range(
4889 __isl_take isl_local_space *ls);
4891 #include <isl/set.h>
4892 __isl_give isl_basic_set *isl_basic_set_flatten(
4893 __isl_take isl_basic_set *bset);
4894 __isl_give isl_set *isl_set_flatten(
4895 __isl_take isl_set *set);
4897 #include <isl/map.h>
4898 __isl_give isl_basic_map *isl_basic_map_flatten_domain(
4899 __isl_take isl_basic_map *bmap);
4900 __isl_give isl_basic_map *isl_basic_map_flatten_range(
4901 __isl_take isl_basic_map *bmap);
4902 __isl_give isl_map *isl_map_flatten_range(
4903 __isl_take isl_map *map);
4904 __isl_give isl_map *isl_map_flatten_domain(
4905 __isl_take isl_map *map);
4906 __isl_give isl_basic_map *isl_basic_map_flatten(
4907 __isl_take isl_basic_map *bmap);
4908 __isl_give isl_map *isl_map_flatten(
4909 __isl_take isl_map *map);
4911 #include <isl/val.h>
4912 __isl_give isl_multi_val *isl_multi_val_flatten_range(
4913 __isl_take isl_multi_val *mv);
4915 #include <isl/aff.h>
4916 __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
4917 __isl_take isl_multi_aff *ma);
4918 __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
4919 __isl_take isl_multi_aff *ma);
4920 __isl_give isl_multi_pw_aff *
4921 isl_multi_pw_aff_flatten_range(
4922 __isl_take isl_multi_pw_aff *mpa);
4923 __isl_give isl_multi_union_pw_aff *
4924 isl_multi_union_pw_aff_flatten_range(
4925 __isl_take isl_multi_union_pw_aff *mupa);
4927 #include <isl/map.h>
4928 __isl_give isl_map *isl_set_flatten_map(
4929 __isl_take isl_set *set);
4931 The function above constructs a relation
4932 that maps the input set to a flattened version of the set.
4936 Lift the input set to a space with extra dimensions corresponding
4937 to the existentially quantified variables in the input.
4938 In particular, the result lives in a wrapped map where the domain
4939 is the original space and the range corresponds to the original
4940 existentially quantified variables.
4942 #include <isl/set.h>
4943 __isl_give isl_basic_set *isl_basic_set_lift(
4944 __isl_take isl_basic_set *bset);
4945 __isl_give isl_set *isl_set_lift(
4946 __isl_take isl_set *set);
4947 __isl_give isl_union_set *isl_union_set_lift(
4948 __isl_take isl_union_set *uset);
4950 Given a local space that contains the existentially quantified
4951 variables of a set, a basic relation that, when applied to
4952 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
4953 can be constructed using the following function.
4955 #include <isl/local_space.h>
4956 __isl_give isl_basic_map *isl_local_space_lifting(
4957 __isl_take isl_local_space *ls);
4959 #include <isl/aff.h>
4960 __isl_give isl_multi_aff *isl_multi_aff_lift(
4961 __isl_take isl_multi_aff *maff,
4962 __isl_give isl_local_space **ls);
4964 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
4965 then it is assigned the local space that lies at the basis of
4966 the lifting applied.
4968 =item * Internal Product
4970 #include <isl/space.h>
4971 __isl_give isl_space *isl_space_zip(
4972 __isl_take isl_space *space);
4974 #include <isl/map.h>
4975 __isl_give isl_basic_map *isl_basic_map_zip(
4976 __isl_take isl_basic_map *bmap);
4977 __isl_give isl_map *isl_map_zip(
4978 __isl_take isl_map *map);
4980 #include <isl/union_map.h>
4981 __isl_give isl_union_map *isl_union_map_zip(
4982 __isl_take isl_union_map *umap);
4984 Given a relation with nested relations for domain and range,
4985 interchange the range of the domain with the domain of the range.
4989 #include <isl/space.h>
4990 __isl_give isl_space *isl_space_curry(
4991 __isl_take isl_space *space);
4992 __isl_give isl_space *isl_space_uncurry(
4993 __isl_take isl_space *space);
4995 #include <isl/map.h>
4996 __isl_give isl_basic_map *isl_basic_map_curry(
4997 __isl_take isl_basic_map *bmap);
4998 __isl_give isl_basic_map *isl_basic_map_uncurry(
4999 __isl_take isl_basic_map *bmap);
5000 __isl_give isl_map *isl_map_curry(
5001 __isl_take isl_map *map);
5002 __isl_give isl_map *isl_map_uncurry(
5003 __isl_take isl_map *map);
5005 #include <isl/union_map.h>
5006 __isl_give isl_union_map *isl_union_map_curry(
5007 __isl_take isl_union_map *umap);
5008 __isl_give isl_union_map *isl_union_map_uncurry(
5009 __isl_take isl_union_map *umap);
5011 Given a relation with a nested relation for domain,
5012 the C<curry> functions
5013 move the range of the nested relation out of the domain
5014 and use it as the domain of a nested relation in the range,
5015 with the original range as range of this nested relation.
5016 The C<uncurry> functions perform the inverse operation.
5018 =item * Aligning parameters
5020 Change the order of the parameters of the given set, relation
5022 such that the first parameters match those of C<model>.
5023 This may involve the introduction of extra parameters.
5024 All parameters need to be named.
5026 #include <isl/space.h>
5027 __isl_give isl_space *isl_space_align_params(
5028 __isl_take isl_space *space1,
5029 __isl_take isl_space *space2)
5031 #include <isl/set.h>
5032 __isl_give isl_basic_set *isl_basic_set_align_params(
5033 __isl_take isl_basic_set *bset,
5034 __isl_take isl_space *model);
5035 __isl_give isl_set *isl_set_align_params(
5036 __isl_take isl_set *set,
5037 __isl_take isl_space *model);
5039 #include <isl/map.h>
5040 __isl_give isl_basic_map *isl_basic_map_align_params(
5041 __isl_take isl_basic_map *bmap,
5042 __isl_take isl_space *model);
5043 __isl_give isl_map *isl_map_align_params(
5044 __isl_take isl_map *map,
5045 __isl_take isl_space *model);
5047 #include <isl/val.h>
5048 __isl_give isl_multi_val *isl_multi_val_align_params(
5049 __isl_take isl_multi_val *mv,
5050 __isl_take isl_space *model);
5052 #include <isl/aff.h>
5053 __isl_give isl_aff *isl_aff_align_params(
5054 __isl_take isl_aff *aff,
5055 __isl_take isl_space *model);
5056 __isl_give isl_multi_aff *isl_multi_aff_align_params(
5057 __isl_take isl_multi_aff *multi,
5058 __isl_take isl_space *model);
5059 __isl_give isl_pw_aff *isl_pw_aff_align_params(
5060 __isl_take isl_pw_aff *pwaff,
5061 __isl_take isl_space *model);
5062 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5063 __isl_take isl_pw_multi_aff *pma,
5064 __isl_take isl_space *model);
5065 __isl_give isl_union_pw_aff *
5066 isl_union_pw_aff_align_params(
5067 __isl_take isl_union_pw_aff *upa,
5068 __isl_take isl_space *model);
5069 __isl_give isl_union_pw_multi_aff *
5070 isl_union_pw_multi_aff_align_params(
5071 __isl_take isl_union_pw_multi_aff *upma,
5072 __isl_take isl_space *model);
5073 __isl_give isl_multi_union_pw_aff *
5074 isl_multi_union_pw_aff_align_params(
5075 __isl_take isl_multi_union_pw_aff *mupa,
5076 __isl_take isl_space *model);
5078 #include <isl/polynomial.h>
5079 __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5080 __isl_take isl_qpolynomial *qp,
5081 __isl_take isl_space *model);
5083 =item * Unary Arithmethic Operations
5085 #include <isl/val.h>
5086 __isl_give isl_multi_val *isl_multi_val_neg(
5087 __isl_take isl_multi_val *mv);
5089 #include <isl/aff.h>
5090 __isl_give isl_aff *isl_aff_neg(
5091 __isl_take isl_aff *aff);
5092 __isl_give isl_multi_aff *isl_multi_aff_neg(
5093 __isl_take isl_multi_aff *ma);
5094 __isl_give isl_pw_aff *isl_pw_aff_neg(
5095 __isl_take isl_pw_aff *pwaff);
5096 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5097 __isl_take isl_pw_multi_aff *pma);
5098 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5099 __isl_take isl_multi_pw_aff *mpa);
5100 __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5101 __isl_take isl_union_pw_aff *upa);
5102 __isl_give isl_union_pw_multi_aff *
5103 isl_union_pw_multi_aff_neg(
5104 __isl_take isl_union_pw_multi_aff *upma);
5105 __isl_give isl_multi_union_pw_aff *
5106 isl_multi_union_pw_aff_neg(
5107 __isl_take isl_multi_union_pw_aff *mupa);
5108 __isl_give isl_aff *isl_aff_ceil(
5109 __isl_take isl_aff *aff);
5110 __isl_give isl_pw_aff *isl_pw_aff_ceil(
5111 __isl_take isl_pw_aff *pwaff);
5112 __isl_give isl_aff *isl_aff_floor(
5113 __isl_take isl_aff *aff);
5114 __isl_give isl_multi_aff *isl_multi_aff_floor(
5115 __isl_take isl_multi_aff *ma);
5116 __isl_give isl_pw_aff *isl_pw_aff_floor(
5117 __isl_take isl_pw_aff *pwaff);
5118 __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5119 __isl_take isl_union_pw_aff *upa);
5120 __isl_give isl_multi_union_pw_aff *
5121 isl_multi_union_pw_aff_floor(
5122 __isl_take isl_multi_union_pw_aff *mupa);
5124 #include <isl/aff.h>
5125 __isl_give isl_pw_aff *isl_pw_aff_list_min(
5126 __isl_take isl_pw_aff_list *list);
5127 __isl_give isl_pw_aff *isl_pw_aff_list_max(
5128 __isl_take isl_pw_aff_list *list);
5130 #include <isl/polynomial.h>
5131 __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5132 __isl_take isl_qpolynomial *qp);
5133 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5134 __isl_take isl_pw_qpolynomial *pwqp);
5135 __isl_give isl_union_pw_qpolynomial *
5136 isl_union_pw_qpolynomial_neg(
5137 __isl_take isl_union_pw_qpolynomial *upwqp);
5138 __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5139 __isl_take isl_qpolynomial *qp,
5141 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5142 __isl_take isl_pw_qpolynomial *pwqp,
5147 The following functions evaluate a function in a point.
5149 #include <isl/polynomial.h>
5150 __isl_give isl_val *isl_pw_qpolynomial_eval(
5151 __isl_take isl_pw_qpolynomial *pwqp,
5152 __isl_take isl_point *pnt);
5153 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5154 __isl_take isl_pw_qpolynomial_fold *pwf,
5155 __isl_take isl_point *pnt);
5156 __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5157 __isl_take isl_union_pw_qpolynomial *upwqp,
5158 __isl_take isl_point *pnt);
5159 __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5160 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5161 __isl_take isl_point *pnt);
5163 =item * Dimension manipulation
5165 It is usually not advisable to directly change the (input or output)
5166 space of a set or a relation as this removes the name and the internal
5167 structure of the space. However, the functions below can be useful
5168 to add new parameters, assuming
5169 C<isl_set_align_params> and C<isl_map_align_params>
5172 #include <isl/space.h>
5173 __isl_give isl_space *isl_space_add_dims(
5174 __isl_take isl_space *space,
5175 enum isl_dim_type type, unsigned n);
5176 __isl_give isl_space *isl_space_insert_dims(
5177 __isl_take isl_space *space,
5178 enum isl_dim_type type, unsigned pos, unsigned n);
5179 __isl_give isl_space *isl_space_drop_dims(
5180 __isl_take isl_space *space,
5181 enum isl_dim_type type, unsigned first, unsigned n);
5182 __isl_give isl_space *isl_space_move_dims(
5183 __isl_take isl_space *space,
5184 enum isl_dim_type dst_type, unsigned dst_pos,
5185 enum isl_dim_type src_type, unsigned src_pos,
5188 #include <isl/local_space.h>
5189 __isl_give isl_local_space *isl_local_space_add_dims(
5190 __isl_take isl_local_space *ls,
5191 enum isl_dim_type type, unsigned n);
5192 __isl_give isl_local_space *isl_local_space_insert_dims(
5193 __isl_take isl_local_space *ls,
5194 enum isl_dim_type type, unsigned first, unsigned n);
5195 __isl_give isl_local_space *isl_local_space_drop_dims(
5196 __isl_take isl_local_space *ls,
5197 enum isl_dim_type type, unsigned first, unsigned n);
5199 #include <isl/set.h>
5200 __isl_give isl_basic_set *isl_basic_set_add_dims(
5201 __isl_take isl_basic_set *bset,
5202 enum isl_dim_type type, unsigned n);
5203 __isl_give isl_set *isl_set_add_dims(
5204 __isl_take isl_set *set,
5205 enum isl_dim_type type, unsigned n);
5206 __isl_give isl_basic_set *isl_basic_set_insert_dims(
5207 __isl_take isl_basic_set *bset,
5208 enum isl_dim_type type, unsigned pos,
5210 __isl_give isl_set *isl_set_insert_dims(
5211 __isl_take isl_set *set,
5212 enum isl_dim_type type, unsigned pos, unsigned n);
5213 __isl_give isl_basic_set *isl_basic_set_move_dims(
5214 __isl_take isl_basic_set *bset,
5215 enum isl_dim_type dst_type, unsigned dst_pos,
5216 enum isl_dim_type src_type, unsigned src_pos,
5218 __isl_give isl_set *isl_set_move_dims(
5219 __isl_take isl_set *set,
5220 enum isl_dim_type dst_type, unsigned dst_pos,
5221 enum isl_dim_type src_type, unsigned src_pos,
5224 #include <isl/map.h>
5225 __isl_give isl_map *isl_map_add_dims(
5226 __isl_take isl_map *map,
5227 enum isl_dim_type type, unsigned n);
5228 __isl_give isl_basic_map *isl_basic_map_insert_dims(
5229 __isl_take isl_basic_map *bmap,
5230 enum isl_dim_type type, unsigned pos,
5232 __isl_give isl_map *isl_map_insert_dims(
5233 __isl_take isl_map *map,
5234 enum isl_dim_type type, unsigned pos, unsigned n);
5235 __isl_give isl_basic_map *isl_basic_map_move_dims(
5236 __isl_take isl_basic_map *bmap,
5237 enum isl_dim_type dst_type, unsigned dst_pos,
5238 enum isl_dim_type src_type, unsigned src_pos,
5240 __isl_give isl_map *isl_map_move_dims(
5241 __isl_take isl_map *map,
5242 enum isl_dim_type dst_type, unsigned dst_pos,
5243 enum isl_dim_type src_type, unsigned src_pos,
5246 #include <isl/val.h>
5247 __isl_give isl_multi_val *isl_multi_val_insert_dims(
5248 __isl_take isl_multi_val *mv,
5249 enum isl_dim_type type, unsigned first, unsigned n);
5250 __isl_give isl_multi_val *isl_multi_val_add_dims(
5251 __isl_take isl_multi_val *mv,
5252 enum isl_dim_type type, unsigned n);
5253 __isl_give isl_multi_val *isl_multi_val_drop_dims(
5254 __isl_take isl_multi_val *mv,
5255 enum isl_dim_type type, unsigned first, unsigned n);
5257 #include <isl/aff.h>
5258 __isl_give isl_aff *isl_aff_insert_dims(
5259 __isl_take isl_aff *aff,
5260 enum isl_dim_type type, unsigned first, unsigned n);
5261 __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5262 __isl_take isl_multi_aff *ma,
5263 enum isl_dim_type type, unsigned first, unsigned n);
5264 __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5265 __isl_take isl_pw_aff *pwaff,
5266 enum isl_dim_type type, unsigned first, unsigned n);
5267 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5268 __isl_take isl_multi_pw_aff *mpa,
5269 enum isl_dim_type type, unsigned first, unsigned n);
5270 __isl_give isl_aff *isl_aff_add_dims(
5271 __isl_take isl_aff *aff,
5272 enum isl_dim_type type, unsigned n);
5273 __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5274 __isl_take isl_multi_aff *ma,
5275 enum isl_dim_type type, unsigned n);
5276 __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5277 __isl_take isl_pw_aff *pwaff,
5278 enum isl_dim_type type, unsigned n);
5279 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5280 __isl_take isl_multi_pw_aff *mpa,
5281 enum isl_dim_type type, unsigned n);
5282 __isl_give isl_aff *isl_aff_drop_dims(
5283 __isl_take isl_aff *aff,
5284 enum isl_dim_type type, unsigned first, unsigned n);
5285 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5286 __isl_take isl_multi_aff *maff,
5287 enum isl_dim_type type, unsigned first, unsigned n);
5288 __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5289 __isl_take isl_pw_aff *pwaff,
5290 enum isl_dim_type type, unsigned first, unsigned n);
5291 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5292 __isl_take isl_pw_multi_aff *pma,
5293 enum isl_dim_type type, unsigned first, unsigned n);
5294 __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5295 __isl_take isl_union_pw_aff *upa,
5296 enum isl_dim_type type, unsigned first, unsigned n);
5297 __isl_give isl_union_pw_multi_aff *
5298 isl_union_pw_multi_aff_drop_dims(
5299 __isl_take isl_union_pw_multi_aff *upma,
5300 enum isl_dim_type type,
5301 unsigned first, unsigned n);
5302 __isl_give isl_multi_union_pw_aff *
5303 isl_multi_union_pw_aff_drop_dims(
5304 __isl_take isl_multi_union_pw_aff *mupa,
5305 enum isl_dim_type type, unsigned first,
5307 __isl_give isl_aff *isl_aff_move_dims(
5308 __isl_take isl_aff *aff,
5309 enum isl_dim_type dst_type, unsigned dst_pos,
5310 enum isl_dim_type src_type, unsigned src_pos,
5312 __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5313 __isl_take isl_multi_aff *ma,
5314 enum isl_dim_type dst_type, unsigned dst_pos,
5315 enum isl_dim_type src_type, unsigned src_pos,
5317 __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5318 __isl_take isl_pw_aff *pa,
5319 enum isl_dim_type dst_type, unsigned dst_pos,
5320 enum isl_dim_type src_type, unsigned src_pos,
5322 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5323 __isl_take isl_multi_pw_aff *pma,
5324 enum isl_dim_type dst_type, unsigned dst_pos,
5325 enum isl_dim_type src_type, unsigned src_pos,
5328 #include <isl/polynomial.h>
5329 __isl_give isl_union_pw_qpolynomial *
5330 isl_union_pw_qpolynomial_drop_dims(
5331 __isl_take isl_union_pw_qpolynomial *upwqp,
5332 enum isl_dim_type type,
5333 unsigned first, unsigned n);
5334 __isl_give isl_union_pw_qpolynomial_fold *
5335 isl_union_pw_qpolynomial_fold_drop_dims(
5336 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5337 enum isl_dim_type type,
5338 unsigned first, unsigned n);
5340 The operations on union expressions can only manipulate parameters.
5344 =head2 Binary Operations
5346 The two arguments of a binary operation not only need to live
5347 in the same C<isl_ctx>, they currently also need to have
5348 the same (number of) parameters.
5350 =head3 Basic Operations
5354 =item * Intersection
5356 #include <isl/local_space.h>
5357 __isl_give isl_local_space *isl_local_space_intersect(
5358 __isl_take isl_local_space *ls1,
5359 __isl_take isl_local_space *ls2);
5361 #include <isl/set.h>
5362 __isl_give isl_basic_set *isl_basic_set_intersect_params(
5363 __isl_take isl_basic_set *bset1,
5364 __isl_take isl_basic_set *bset2);
5365 __isl_give isl_basic_set *isl_basic_set_intersect(
5366 __isl_take isl_basic_set *bset1,
5367 __isl_take isl_basic_set *bset2);
5368 __isl_give isl_basic_set *isl_basic_set_list_intersect(
5369 __isl_take struct isl_basic_set_list *list);
5370 __isl_give isl_set *isl_set_intersect_params(
5371 __isl_take isl_set *set,
5372 __isl_take isl_set *params);
5373 __isl_give isl_set *isl_set_intersect(
5374 __isl_take isl_set *set1,
5375 __isl_take isl_set *set2);
5377 #include <isl/map.h>
5378 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5379 __isl_take isl_basic_map *bmap,
5380 __isl_take isl_basic_set *bset);
5381 __isl_give isl_basic_map *isl_basic_map_intersect_range(
5382 __isl_take isl_basic_map *bmap,
5383 __isl_take isl_basic_set *bset);
5384 __isl_give isl_basic_map *isl_basic_map_intersect(
5385 __isl_take isl_basic_map *bmap1,
5386 __isl_take isl_basic_map *bmap2);
5387 __isl_give isl_basic_map *isl_basic_map_list_intersect(
5388 __isl_take isl_basic_map_list *list);
5389 __isl_give isl_map *isl_map_intersect_params(
5390 __isl_take isl_map *map,
5391 __isl_take isl_set *params);
5392 __isl_give isl_map *isl_map_intersect_domain(
5393 __isl_take isl_map *map,
5394 __isl_take isl_set *set);
5395 __isl_give isl_map *isl_map_intersect_range(
5396 __isl_take isl_map *map,
5397 __isl_take isl_set *set);
5398 __isl_give isl_map *isl_map_intersect(
5399 __isl_take isl_map *map1,
5400 __isl_take isl_map *map2);
5402 #include <isl/union_set.h>
5403 __isl_give isl_union_set *isl_union_set_intersect_params(
5404 __isl_take isl_union_set *uset,
5405 __isl_take isl_set *set);
5406 __isl_give isl_union_set *isl_union_set_intersect(
5407 __isl_take isl_union_set *uset1,
5408 __isl_take isl_union_set *uset2);
5410 #include <isl/union_map.h>
5411 __isl_give isl_union_map *isl_union_map_intersect_params(
5412 __isl_take isl_union_map *umap,
5413 __isl_take isl_set *set);
5414 __isl_give isl_union_map *isl_union_map_intersect_domain(
5415 __isl_take isl_union_map *umap,
5416 __isl_take isl_union_set *uset);
5417 __isl_give isl_union_map *isl_union_map_intersect_range(
5418 __isl_take isl_union_map *umap,
5419 __isl_take isl_union_set *uset);
5420 __isl_give isl_union_map *isl_union_map_intersect(
5421 __isl_take isl_union_map *umap1,
5422 __isl_take isl_union_map *umap2);
5424 #include <isl/aff.h>
5425 __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5426 __isl_take isl_pw_aff *pa,
5427 __isl_take isl_set *set);
5428 __isl_give isl_multi_pw_aff *
5429 isl_multi_pw_aff_intersect_domain(
5430 __isl_take isl_multi_pw_aff *mpa,
5431 __isl_take isl_set *domain);
5432 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5433 __isl_take isl_pw_multi_aff *pma,
5434 __isl_take isl_set *set);
5435 __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5436 __isl_take isl_union_pw_aff *upa,
5437 __isl_take isl_union_set *uset);
5438 __isl_give isl_union_pw_multi_aff *
5439 isl_union_pw_multi_aff_intersect_domain(
5440 __isl_take isl_union_pw_multi_aff *upma,
5441 __isl_take isl_union_set *uset);
5442 __isl_give isl_multi_union_pw_aff *
5443 isl_multi_union_pw_aff_intersect_domain(
5444 __isl_take isl_multi_union_pw_aff *mupa,
5445 __isl_take isl_union_set *uset);
5446 __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5447 __isl_take isl_pw_aff *pa,
5448 __isl_take isl_set *set);
5449 __isl_give isl_multi_pw_aff *
5450 isl_multi_pw_aff_intersect_params(
5451 __isl_take isl_multi_pw_aff *mpa,
5452 __isl_take isl_set *set);
5453 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5454 __isl_take isl_pw_multi_aff *pma,
5455 __isl_take isl_set *set);
5456 __isl_give isl_union_pw_aff *
5457 isl_union_pw_aff_intersect_params(
5458 __isl_take isl_union_pw_aff *upa,
5459 __isl_give isl_union_pw_multi_aff *
5460 isl_union_pw_multi_aff_intersect_params(
5461 __isl_take isl_union_pw_multi_aff *upma,
5462 __isl_take isl_set *set);
5463 __isl_give isl_multi_union_pw_aff *
5464 isl_multi_union_pw_aff_intersect_params(
5465 __isl_take isl_multi_union_pw_aff *mupa,
5466 __isl_take isl_set *params);
5467 isl_multi_union_pw_aff_intersect_range(
5468 __isl_take isl_multi_union_pw_aff *mupa,
5469 __isl_take isl_set *set);
5471 #include <isl/polynomial.h>
5472 __isl_give isl_pw_qpolynomial *
5473 isl_pw_qpolynomial_intersect_domain(
5474 __isl_take isl_pw_qpolynomial *pwpq,
5475 __isl_take isl_set *set);
5476 __isl_give isl_union_pw_qpolynomial *
5477 isl_union_pw_qpolynomial_intersect_domain(
5478 __isl_take isl_union_pw_qpolynomial *upwpq,
5479 __isl_take isl_union_set *uset);
5480 __isl_give isl_union_pw_qpolynomial_fold *
5481 isl_union_pw_qpolynomial_fold_intersect_domain(
5482 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5483 __isl_take isl_union_set *uset);
5484 __isl_give isl_pw_qpolynomial *
5485 isl_pw_qpolynomial_intersect_params(
5486 __isl_take isl_pw_qpolynomial *pwpq,
5487 __isl_take isl_set *set);
5488 __isl_give isl_pw_qpolynomial_fold *
5489 isl_pw_qpolynomial_fold_intersect_params(
5490 __isl_take isl_pw_qpolynomial_fold *pwf,
5491 __isl_take isl_set *set);
5492 __isl_give isl_union_pw_qpolynomial *
5493 isl_union_pw_qpolynomial_intersect_params(
5494 __isl_take isl_union_pw_qpolynomial *upwpq,
5495 __isl_take isl_set *set);
5496 __isl_give isl_union_pw_qpolynomial_fold *
5497 isl_union_pw_qpolynomial_fold_intersect_params(
5498 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5499 __isl_take isl_set *set);
5501 The second argument to the C<_params> functions needs to be
5502 a parametric (basic) set. For the other functions, a parametric set
5503 for either argument is only allowed if the other argument is
5504 a parametric set as well.
5505 The list passed to C<isl_basic_set_list_intersect> needs to have
5506 at least one element and all elements need to live in the same space.
5507 The function C<isl_multi_union_pw_aff_intersect_range>
5508 restricts the input function to those shared domain elements
5509 that map to the specified range.
5513 #include <isl/set.h>
5514 __isl_give isl_set *isl_basic_set_union(
5515 __isl_take isl_basic_set *bset1,
5516 __isl_take isl_basic_set *bset2);
5517 __isl_give isl_set *isl_set_union(
5518 __isl_take isl_set *set1,
5519 __isl_take isl_set *set2);
5521 #include <isl/map.h>
5522 __isl_give isl_map *isl_basic_map_union(
5523 __isl_take isl_basic_map *bmap1,
5524 __isl_take isl_basic_map *bmap2);
5525 __isl_give isl_map *isl_map_union(
5526 __isl_take isl_map *map1,
5527 __isl_take isl_map *map2);
5529 #include <isl/union_set.h>
5530 __isl_give isl_union_set *isl_union_set_union(
5531 __isl_take isl_union_set *uset1,
5532 __isl_take isl_union_set *uset2);
5533 __isl_give isl_union_set *isl_union_set_list_union(
5534 __isl_take isl_union_set_list *list);
5536 #include <isl/union_map.h>
5537 __isl_give isl_union_map *isl_union_map_union(
5538 __isl_take isl_union_map *umap1,
5539 __isl_take isl_union_map *umap2);
5541 =item * Set difference
5543 #include <isl/set.h>
5544 __isl_give isl_set *isl_set_subtract(
5545 __isl_take isl_set *set1,
5546 __isl_take isl_set *set2);
5548 #include <isl/map.h>
5549 __isl_give isl_map *isl_map_subtract(
5550 __isl_take isl_map *map1,
5551 __isl_take isl_map *map2);
5552 __isl_give isl_map *isl_map_subtract_domain(
5553 __isl_take isl_map *map,
5554 __isl_take isl_set *dom);
5555 __isl_give isl_map *isl_map_subtract_range(
5556 __isl_take isl_map *map,
5557 __isl_take isl_set *dom);
5559 #include <isl/union_set.h>
5560 __isl_give isl_union_set *isl_union_set_subtract(
5561 __isl_take isl_union_set *uset1,
5562 __isl_take isl_union_set *uset2);
5564 #include <isl/union_map.h>
5565 __isl_give isl_union_map *isl_union_map_subtract(
5566 __isl_take isl_union_map *umap1,
5567 __isl_take isl_union_map *umap2);
5568 __isl_give isl_union_map *isl_union_map_subtract_domain(
5569 __isl_take isl_union_map *umap,
5570 __isl_take isl_union_set *dom);
5571 __isl_give isl_union_map *isl_union_map_subtract_range(
5572 __isl_take isl_union_map *umap,
5573 __isl_take isl_union_set *dom);
5575 #include <isl/aff.h>
5576 __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5577 __isl_take isl_pw_aff *pa,
5578 __isl_take isl_set *set);
5579 __isl_give isl_pw_multi_aff *
5580 isl_pw_multi_aff_subtract_domain(
5581 __isl_take isl_pw_multi_aff *pma,
5582 __isl_take isl_set *set);
5583 __isl_give isl_union_pw_aff *
5584 isl_union_pw_aff_subtract_domain(
5585 __isl_take isl_union_pw_aff *upa,
5586 __isl_take isl_union_set *uset);
5587 __isl_give isl_union_pw_multi_aff *
5588 isl_union_pw_multi_aff_subtract_domain(
5589 __isl_take isl_union_pw_multi_aff *upma,
5590 __isl_take isl_set *set);
5592 #include <isl/polynomial.h>
5593 __isl_give isl_pw_qpolynomial *
5594 isl_pw_qpolynomial_subtract_domain(
5595 __isl_take isl_pw_qpolynomial *pwpq,
5596 __isl_take isl_set *set);
5597 __isl_give isl_pw_qpolynomial_fold *
5598 isl_pw_qpolynomial_fold_subtract_domain(
5599 __isl_take isl_pw_qpolynomial_fold *pwf,
5600 __isl_take isl_set *set);
5601 __isl_give isl_union_pw_qpolynomial *
5602 isl_union_pw_qpolynomial_subtract_domain(
5603 __isl_take isl_union_pw_qpolynomial *upwpq,
5604 __isl_take isl_union_set *uset);
5605 __isl_give isl_union_pw_qpolynomial_fold *
5606 isl_union_pw_qpolynomial_fold_subtract_domain(
5607 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5608 __isl_take isl_union_set *uset);
5612 #include <isl/space.h>
5613 __isl_give isl_space *isl_space_join(
5614 __isl_take isl_space *left,
5615 __isl_take isl_space *right);
5617 #include <isl/map.h>
5618 __isl_give isl_basic_set *isl_basic_set_apply(
5619 __isl_take isl_basic_set *bset,
5620 __isl_take isl_basic_map *bmap);
5621 __isl_give isl_set *isl_set_apply(
5622 __isl_take isl_set *set,
5623 __isl_take isl_map *map);
5624 __isl_give isl_union_set *isl_union_set_apply(
5625 __isl_take isl_union_set *uset,
5626 __isl_take isl_union_map *umap);
5627 __isl_give isl_basic_map *isl_basic_map_apply_domain(
5628 __isl_take isl_basic_map *bmap1,
5629 __isl_take isl_basic_map *bmap2);
5630 __isl_give isl_basic_map *isl_basic_map_apply_range(
5631 __isl_take isl_basic_map *bmap1,
5632 __isl_take isl_basic_map *bmap2);
5633 __isl_give isl_map *isl_map_apply_domain(
5634 __isl_take isl_map *map1,
5635 __isl_take isl_map *map2);
5636 __isl_give isl_map *isl_map_apply_range(
5637 __isl_take isl_map *map1,
5638 __isl_take isl_map *map2);
5640 #include <isl/union_map.h>
5641 __isl_give isl_union_map *isl_union_map_apply_domain(
5642 __isl_take isl_union_map *umap1,
5643 __isl_take isl_union_map *umap2);
5644 __isl_give isl_union_map *isl_union_map_apply_range(
5645 __isl_take isl_union_map *umap1,
5646 __isl_take isl_union_map *umap2);
5648 #include <isl/aff.h>
5649 __isl_give isl_union_pw_aff *
5650 isl_multi_union_pw_aff_apply_aff(
5651 __isl_take isl_multi_union_pw_aff *mupa,
5652 __isl_take isl_aff *aff);
5653 __isl_give isl_union_pw_aff *
5654 isl_multi_union_pw_aff_apply_pw_aff(
5655 __isl_take isl_multi_union_pw_aff *mupa,
5656 __isl_take isl_pw_aff *pa);
5657 __isl_give isl_multi_union_pw_aff *
5658 isl_multi_union_pw_aff_apply_multi_aff(
5659 __isl_take isl_multi_union_pw_aff *mupa,
5660 __isl_take isl_multi_aff *ma);
5661 __isl_give isl_multi_union_pw_aff *
5662 isl_multi_union_pw_aff_apply_pw_multi_aff(
5663 __isl_take isl_multi_union_pw_aff *mupa,
5664 __isl_take isl_pw_multi_aff *pma);
5666 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
5667 over the shared domain of the elements of the input. The dimension is
5668 required to be greater than zero.
5669 The C<isl_multi_union_pw_aff> argument of
5670 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
5671 but only if the range of the C<isl_multi_aff> argument
5672 is also zero-dimensional.
5673 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
5675 #include <isl/polynomial.h>
5676 __isl_give isl_pw_qpolynomial_fold *
5677 isl_set_apply_pw_qpolynomial_fold(
5678 __isl_take isl_set *set,
5679 __isl_take isl_pw_qpolynomial_fold *pwf,
5681 __isl_give isl_pw_qpolynomial_fold *
5682 isl_map_apply_pw_qpolynomial_fold(
5683 __isl_take isl_map *map,
5684 __isl_take isl_pw_qpolynomial_fold *pwf,
5686 __isl_give isl_union_pw_qpolynomial_fold *
5687 isl_union_set_apply_union_pw_qpolynomial_fold(
5688 __isl_take isl_union_set *uset,
5689 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5691 __isl_give isl_union_pw_qpolynomial_fold *
5692 isl_union_map_apply_union_pw_qpolynomial_fold(
5693 __isl_take isl_union_map *umap,
5694 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5697 The functions taking a map
5698 compose the given map with the given piecewise quasipolynomial reduction.
5699 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5700 over all elements in the intersection of the range of the map
5701 and the domain of the piecewise quasipolynomial reduction
5702 as a function of an element in the domain of the map.
5703 The functions taking a set compute a bound over all elements in the
5704 intersection of the set and the domain of the
5705 piecewise quasipolynomial reduction.
5709 #include <isl/set.h>
5710 __isl_give isl_basic_set *
5711 isl_basic_set_preimage_multi_aff(
5712 __isl_take isl_basic_set *bset,
5713 __isl_take isl_multi_aff *ma);
5714 __isl_give isl_set *isl_set_preimage_multi_aff(
5715 __isl_take isl_set *set,
5716 __isl_take isl_multi_aff *ma);
5717 __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5718 __isl_take isl_set *set,
5719 __isl_take isl_pw_multi_aff *pma);
5720 __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5721 __isl_take isl_set *set,
5722 __isl_take isl_multi_pw_aff *mpa);
5724 #include <isl/union_set.h>
5725 __isl_give isl_union_set *
5726 isl_union_set_preimage_multi_aff(
5727 __isl_take isl_union_set *uset,
5728 __isl_take isl_multi_aff *ma);
5729 __isl_give isl_union_set *
5730 isl_union_set_preimage_pw_multi_aff(
5731 __isl_take isl_union_set *uset,
5732 __isl_take isl_pw_multi_aff *pma);
5733 __isl_give isl_union_set *
5734 isl_union_set_preimage_union_pw_multi_aff(
5735 __isl_take isl_union_set *uset,
5736 __isl_take isl_union_pw_multi_aff *upma);
5738 #include <isl/map.h>
5739 __isl_give isl_basic_map *
5740 isl_basic_map_preimage_domain_multi_aff(
5741 __isl_take isl_basic_map *bmap,
5742 __isl_take isl_multi_aff *ma);
5743 __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5744 __isl_take isl_map *map,
5745 __isl_take isl_multi_aff *ma);
5746 __isl_give isl_map *isl_map_preimage_range_multi_aff(
5747 __isl_take isl_map *map,
5748 __isl_take isl_multi_aff *ma);
5749 __isl_give isl_map *
5750 isl_map_preimage_domain_pw_multi_aff(
5751 __isl_take isl_map *map,
5752 __isl_take isl_pw_multi_aff *pma);
5753 __isl_give isl_map *
5754 isl_map_preimage_range_pw_multi_aff(
5755 __isl_take isl_map *map,
5756 __isl_take isl_pw_multi_aff *pma);
5757 __isl_give isl_map *
5758 isl_map_preimage_domain_multi_pw_aff(
5759 __isl_take isl_map *map,
5760 __isl_take isl_multi_pw_aff *mpa);
5761 __isl_give isl_basic_map *
5762 isl_basic_map_preimage_range_multi_aff(
5763 __isl_take isl_basic_map *bmap,
5764 __isl_take isl_multi_aff *ma);
5766 #include <isl/union_map.h>
5767 __isl_give isl_union_map *
5768 isl_union_map_preimage_domain_multi_aff(
5769 __isl_take isl_union_map *umap,
5770 __isl_take isl_multi_aff *ma);
5771 __isl_give isl_union_map *
5772 isl_union_map_preimage_range_multi_aff(
5773 __isl_take isl_union_map *umap,
5774 __isl_take isl_multi_aff *ma);
5775 __isl_give isl_union_map *
5776 isl_union_map_preimage_domain_pw_multi_aff(
5777 __isl_take isl_union_map *umap,
5778 __isl_take isl_pw_multi_aff *pma);
5779 __isl_give isl_union_map *
5780 isl_union_map_preimage_range_pw_multi_aff(
5781 __isl_take isl_union_map *umap,
5782 __isl_take isl_pw_multi_aff *pma);
5783 __isl_give isl_union_map *
5784 isl_union_map_preimage_domain_union_pw_multi_aff(
5785 __isl_take isl_union_map *umap,
5786 __isl_take isl_union_pw_multi_aff *upma);
5787 __isl_give isl_union_map *
5788 isl_union_map_preimage_range_union_pw_multi_aff(
5789 __isl_take isl_union_map *umap,
5790 __isl_take isl_union_pw_multi_aff *upma);
5792 These functions compute the preimage of the given set or map domain/range under
5793 the given function. In other words, the expression is plugged
5794 into the set description or into the domain/range of the map.
5798 #include <isl/aff.h>
5799 __isl_give isl_aff *isl_aff_pullback_aff(
5800 __isl_take isl_aff *aff1,
5801 __isl_take isl_aff *aff2);
5802 __isl_give isl_aff *isl_aff_pullback_multi_aff(
5803 __isl_take isl_aff *aff,
5804 __isl_take isl_multi_aff *ma);
5805 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5806 __isl_take isl_pw_aff *pa,
5807 __isl_take isl_multi_aff *ma);
5808 __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5809 __isl_take isl_pw_aff *pa,
5810 __isl_take isl_pw_multi_aff *pma);
5811 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5812 __isl_take isl_pw_aff *pa,
5813 __isl_take isl_multi_pw_aff *mpa);
5814 __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5815 __isl_take isl_multi_aff *ma1,
5816 __isl_take isl_multi_aff *ma2);
5817 __isl_give isl_pw_multi_aff *
5818 isl_pw_multi_aff_pullback_multi_aff(
5819 __isl_take isl_pw_multi_aff *pma,
5820 __isl_take isl_multi_aff *ma);
5821 __isl_give isl_multi_pw_aff *
5822 isl_multi_pw_aff_pullback_multi_aff(
5823 __isl_take isl_multi_pw_aff *mpa,
5824 __isl_take isl_multi_aff *ma);
5825 __isl_give isl_pw_multi_aff *
5826 isl_pw_multi_aff_pullback_pw_multi_aff(
5827 __isl_take isl_pw_multi_aff *pma1,
5828 __isl_take isl_pw_multi_aff *pma2);
5829 __isl_give isl_multi_pw_aff *
5830 isl_multi_pw_aff_pullback_pw_multi_aff(
5831 __isl_take isl_multi_pw_aff *mpa,
5832 __isl_take isl_pw_multi_aff *pma);
5833 __isl_give isl_multi_pw_aff *
5834 isl_multi_pw_aff_pullback_multi_pw_aff(
5835 __isl_take isl_multi_pw_aff *mpa1,
5836 __isl_take isl_multi_pw_aff *mpa2);
5837 __isl_give isl_union_pw_aff *
5838 isl_union_pw_aff_pullback_union_pw_multi_aff(
5839 __isl_take isl_union_pw_aff *upa,
5840 __isl_take isl_union_pw_multi_aff *upma);
5841 __isl_give isl_union_pw_multi_aff *
5842 isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
5843 __isl_take isl_union_pw_multi_aff *upma1,
5844 __isl_take isl_union_pw_multi_aff *upma2);
5845 __isl_give isl_multi_union_pw_aff *
5846 isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
5847 __isl_take isl_multi_union_pw_aff *mupa,
5848 __isl_take isl_union_pw_multi_aff *upma);
5850 These functions precompose the first expression by the second function.
5851 In other words, the second function is plugged
5852 into the first expression.
5856 #include <isl/aff.h>
5857 __isl_give isl_basic_set *isl_aff_le_basic_set(
5858 __isl_take isl_aff *aff1,
5859 __isl_take isl_aff *aff2);
5860 __isl_give isl_basic_set *isl_aff_ge_basic_set(
5861 __isl_take isl_aff *aff1,
5862 __isl_take isl_aff *aff2);
5863 __isl_give isl_set *isl_pw_aff_eq_set(
5864 __isl_take isl_pw_aff *pwaff1,
5865 __isl_take isl_pw_aff *pwaff2);
5866 __isl_give isl_set *isl_pw_aff_ne_set(
5867 __isl_take isl_pw_aff *pwaff1,
5868 __isl_take isl_pw_aff *pwaff2);
5869 __isl_give isl_set *isl_pw_aff_le_set(
5870 __isl_take isl_pw_aff *pwaff1,
5871 __isl_take isl_pw_aff *pwaff2);
5872 __isl_give isl_set *isl_pw_aff_lt_set(
5873 __isl_take isl_pw_aff *pwaff1,
5874 __isl_take isl_pw_aff *pwaff2);
5875 __isl_give isl_set *isl_pw_aff_ge_set(
5876 __isl_take isl_pw_aff *pwaff1,
5877 __isl_take isl_pw_aff *pwaff2);
5878 __isl_give isl_set *isl_pw_aff_gt_set(
5879 __isl_take isl_pw_aff *pwaff1,
5880 __isl_take isl_pw_aff *pwaff2);
5882 __isl_give isl_set *isl_multi_aff_lex_le_set(
5883 __isl_take isl_multi_aff *ma1,
5884 __isl_take isl_multi_aff *ma2);
5885 __isl_give isl_set *isl_multi_aff_lex_ge_set(
5886 __isl_take isl_multi_aff *ma1,
5887 __isl_take isl_multi_aff *ma2);
5889 __isl_give isl_set *isl_pw_aff_list_eq_set(
5890 __isl_take isl_pw_aff_list *list1,
5891 __isl_take isl_pw_aff_list *list2);
5892 __isl_give isl_set *isl_pw_aff_list_ne_set(
5893 __isl_take isl_pw_aff_list *list1,
5894 __isl_take isl_pw_aff_list *list2);
5895 __isl_give isl_set *isl_pw_aff_list_le_set(
5896 __isl_take isl_pw_aff_list *list1,
5897 __isl_take isl_pw_aff_list *list2);
5898 __isl_give isl_set *isl_pw_aff_list_lt_set(
5899 __isl_take isl_pw_aff_list *list1,
5900 __isl_take isl_pw_aff_list *list2);
5901 __isl_give isl_set *isl_pw_aff_list_ge_set(
5902 __isl_take isl_pw_aff_list *list1,
5903 __isl_take isl_pw_aff_list *list2);
5904 __isl_give isl_set *isl_pw_aff_list_gt_set(
5905 __isl_take isl_pw_aff_list *list1,
5906 __isl_take isl_pw_aff_list *list2);
5908 The function C<isl_aff_ge_basic_set> returns a basic set
5909 containing those elements in the shared space
5910 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
5911 The function C<isl_pw_aff_ge_set> returns a set
5912 containing those elements in the shared domain
5913 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
5914 greater than or equal to C<pwaff2>.
5915 The function C<isl_multi_aff_lex_le_set> returns a set
5916 containing those elements in the shared domain space
5917 where C<ma1> is lexicographically smaller than or
5919 The functions operating on C<isl_pw_aff_list> apply the corresponding
5920 C<isl_pw_aff> function to each pair of elements in the two lists.
5922 #include <isl/aff.h>
5923 __isl_give isl_map *isl_pw_aff_eq_map(
5924 __isl_take isl_pw_aff *pa1,
5925 __isl_take isl_pw_aff *pa2);
5926 __isl_give isl_map *isl_pw_aff_lt_map(
5927 __isl_take isl_pw_aff *pa1,
5928 __isl_take isl_pw_aff *pa2);
5929 __isl_give isl_map *isl_pw_aff_gt_map(
5930 __isl_take isl_pw_aff *pa1,
5931 __isl_take isl_pw_aff *pa2);
5933 __isl_give isl_map *isl_multi_pw_aff_eq_map(
5934 __isl_take isl_multi_pw_aff *mpa1,
5935 __isl_take isl_multi_pw_aff *mpa2);
5936 __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
5937 __isl_take isl_multi_pw_aff *mpa1,
5938 __isl_take isl_multi_pw_aff *mpa2);
5939 __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
5940 __isl_take isl_multi_pw_aff *mpa1,
5941 __isl_take isl_multi_pw_aff *mpa2);
5943 These functions return a map between domain elements of the arguments
5944 where the function values satisfy the given relation.
5946 #include <isl/union_map.h>
5947 __isl_give isl_union_map *
5948 isl_union_map_eq_at_multi_union_pw_aff(
5949 __isl_take isl_union_map *umap,
5950 __isl_take isl_multi_union_pw_aff *mupa);
5951 __isl_give isl_union_map *
5952 isl_union_map_lex_lt_at_multi_union_pw_aff(
5953 __isl_take isl_union_map *umap,
5954 __isl_take isl_multi_union_pw_aff *mupa);
5955 __isl_give isl_union_map *
5956 isl_union_map_lex_gt_at_multi_union_pw_aff(
5957 __isl_take isl_union_map *umap,
5958 __isl_take isl_multi_union_pw_aff *mupa);
5960 These functions select the subset of elements in the union map
5961 that have an equal or lexicographically smaller function value.
5963 =item * Cartesian Product
5965 #include <isl/space.h>
5966 __isl_give isl_space *isl_space_product(
5967 __isl_take isl_space *space1,
5968 __isl_take isl_space *space2);
5969 __isl_give isl_space *isl_space_domain_product(
5970 __isl_take isl_space *space1,
5971 __isl_take isl_space *space2);
5972 __isl_give isl_space *isl_space_range_product(
5973 __isl_take isl_space *space1,
5974 __isl_take isl_space *space2);
5977 C<isl_space_product>, C<isl_space_domain_product>
5978 and C<isl_space_range_product> take pairs or relation spaces and
5979 produce a single relations space, where either the domain, the range
5980 or both domain and range are wrapped spaces of relations between
5981 the domains and/or ranges of the input spaces.
5982 If the product is only constructed over the domain or the range
5983 then the ranges or the domains of the inputs should be the same.
5984 The function C<isl_space_product> also accepts a pair of set spaces,
5985 in which case it returns a wrapped space of a relation between the
5988 #include <isl/set.h>
5989 __isl_give isl_set *isl_set_product(
5990 __isl_take isl_set *set1,
5991 __isl_take isl_set *set2);
5993 #include <isl/map.h>
5994 __isl_give isl_basic_map *isl_basic_map_domain_product(
5995 __isl_take isl_basic_map *bmap1,
5996 __isl_take isl_basic_map *bmap2);
5997 __isl_give isl_basic_map *isl_basic_map_range_product(
5998 __isl_take isl_basic_map *bmap1,
5999 __isl_take isl_basic_map *bmap2);
6000 __isl_give isl_basic_map *isl_basic_map_product(
6001 __isl_take isl_basic_map *bmap1,
6002 __isl_take isl_basic_map *bmap2);
6003 __isl_give isl_map *isl_map_domain_product(
6004 __isl_take isl_map *map1,
6005 __isl_take isl_map *map2);
6006 __isl_give isl_map *isl_map_range_product(
6007 __isl_take isl_map *map1,
6008 __isl_take isl_map *map2);
6009 __isl_give isl_map *isl_map_product(
6010 __isl_take isl_map *map1,
6011 __isl_take isl_map *map2);
6013 #include <isl/union_set.h>
6014 __isl_give isl_union_set *isl_union_set_product(
6015 __isl_take isl_union_set *uset1,
6016 __isl_take isl_union_set *uset2);
6018 #include <isl/union_map.h>
6019 __isl_give isl_union_map *isl_union_map_domain_product(
6020 __isl_take isl_union_map *umap1,
6021 __isl_take isl_union_map *umap2);
6022 __isl_give isl_union_map *isl_union_map_range_product(
6023 __isl_take isl_union_map *umap1,
6024 __isl_take isl_union_map *umap2);
6025 __isl_give isl_union_map *isl_union_map_product(
6026 __isl_take isl_union_map *umap1,
6027 __isl_take isl_union_map *umap2);
6029 #include <isl/val.h>
6030 __isl_give isl_multi_val *isl_multi_val_range_product(
6031 __isl_take isl_multi_val *mv1,
6032 __isl_take isl_multi_val *mv2);
6033 __isl_give isl_multi_val *isl_multi_val_product(
6034 __isl_take isl_multi_val *mv1,
6035 __isl_take isl_multi_val *mv2);
6037 #include <isl/aff.h>
6038 __isl_give isl_multi_aff *isl_multi_aff_range_product(
6039 __isl_take isl_multi_aff *ma1,
6040 __isl_take isl_multi_aff *ma2);
6041 __isl_give isl_multi_aff *isl_multi_aff_product(
6042 __isl_take isl_multi_aff *ma1,
6043 __isl_take isl_multi_aff *ma2);
6044 __isl_give isl_multi_pw_aff *
6045 isl_multi_pw_aff_range_product(
6046 __isl_take isl_multi_pw_aff *mpa1,
6047 __isl_take isl_multi_pw_aff *mpa2);
6048 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6049 __isl_take isl_multi_pw_aff *mpa1,
6050 __isl_take isl_multi_pw_aff *mpa2);
6051 __isl_give isl_pw_multi_aff *
6052 isl_pw_multi_aff_range_product(
6053 __isl_take isl_pw_multi_aff *pma1,
6054 __isl_take isl_pw_multi_aff *pma2);
6055 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6056 __isl_take isl_pw_multi_aff *pma1,
6057 __isl_take isl_pw_multi_aff *pma2);
6058 __isl_give isl_multi_union_pw_aff *
6059 isl_multi_union_pw_aff_range_product(
6060 __isl_take isl_multi_union_pw_aff *mupa1,
6061 __isl_take isl_multi_union_pw_aff *mupa2);
6063 The above functions compute the cross product of the given
6064 sets, relations or functions. The domains and ranges of the results
6065 are wrapped maps between domains and ranges of the inputs.
6066 To obtain a ``flat'' product, use the following functions
6069 #include <isl/set.h>
6070 __isl_give isl_basic_set *isl_basic_set_flat_product(
6071 __isl_take isl_basic_set *bset1,
6072 __isl_take isl_basic_set *bset2);
6073 __isl_give isl_set *isl_set_flat_product(
6074 __isl_take isl_set *set1,
6075 __isl_take isl_set *set2);
6077 #include <isl/map.h>
6078 __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6079 __isl_take isl_basic_map *bmap1,
6080 __isl_take isl_basic_map *bmap2);
6081 __isl_give isl_map *isl_map_flat_domain_product(
6082 __isl_take isl_map *map1,
6083 __isl_take isl_map *map2);
6084 __isl_give isl_map *isl_map_flat_range_product(
6085 __isl_take isl_map *map1,
6086 __isl_take isl_map *map2);
6087 __isl_give isl_basic_map *isl_basic_map_flat_product(
6088 __isl_take isl_basic_map *bmap1,
6089 __isl_take isl_basic_map *bmap2);
6090 __isl_give isl_map *isl_map_flat_product(
6091 __isl_take isl_map *map1,
6092 __isl_take isl_map *map2);
6094 #include <isl/union_map.h>
6095 __isl_give isl_union_map *
6096 isl_union_map_flat_domain_product(
6097 __isl_take isl_union_map *umap1,
6098 __isl_take isl_union_map *umap2);
6099 __isl_give isl_union_map *
6100 isl_union_map_flat_range_product(
6101 __isl_take isl_union_map *umap1,
6102 __isl_take isl_union_map *umap2);
6104 #include <isl/val.h>
6105 __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6106 __isl_take isl_multi_val *mv1,
6107 __isl_take isl_multi_aff *mv2);
6109 #include <isl/aff.h>
6110 __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6111 __isl_take isl_multi_aff *ma1,
6112 __isl_take isl_multi_aff *ma2);
6113 __isl_give isl_pw_multi_aff *
6114 isl_pw_multi_aff_flat_range_product(
6115 __isl_take isl_pw_multi_aff *pma1,
6116 __isl_take isl_pw_multi_aff *pma2);
6117 __isl_give isl_multi_pw_aff *
6118 isl_multi_pw_aff_flat_range_product(
6119 __isl_take isl_multi_pw_aff *mpa1,
6120 __isl_take isl_multi_pw_aff *mpa2);
6121 __isl_give isl_union_pw_multi_aff *
6122 isl_union_pw_multi_aff_flat_range_product(
6123 __isl_take isl_union_pw_multi_aff *upma1,
6124 __isl_take isl_union_pw_multi_aff *upma2);
6125 __isl_give isl_multi_union_pw_aff *
6126 isl_multi_union_pw_aff_flat_range_product(
6127 __isl_take isl_multi_union_pw_aff *mupa1,
6128 __isl_take isl_multi_union_pw_aff *mupa2);
6130 #include <isl/space.h>
6131 __isl_give isl_space *isl_space_factor_domain(
6132 __isl_take isl_space *space);
6133 __isl_give isl_space *isl_space_factor_range(
6134 __isl_take isl_space *space);
6135 __isl_give isl_space *isl_space_domain_factor_domain(
6136 __isl_take isl_space *space);
6137 __isl_give isl_space *isl_space_domain_factor_range(
6138 __isl_take isl_space *space);
6139 __isl_give isl_space *isl_space_range_factor_domain(
6140 __isl_take isl_space *space);
6141 __isl_give isl_space *isl_space_range_factor_range(
6142 __isl_take isl_space *space);
6144 The functions C<isl_space_range_factor_domain> and
6145 C<isl_space_range_factor_range> extract the two arguments from
6146 the result of a call to C<isl_space_range_product>.
6148 The arguments of a call to C<isl_map_range_product> can be extracted
6149 from the result using the following functions.
6151 #include <isl/map.h>
6152 __isl_give isl_map *isl_map_factor_domain(
6153 __isl_take isl_map *map);
6154 __isl_give isl_map *isl_map_factor_range(
6155 __isl_take isl_map *map);
6156 __isl_give isl_map *isl_map_domain_factor_domain(
6157 __isl_take isl_map *map);
6158 __isl_give isl_map *isl_map_domain_factor_range(
6159 __isl_take isl_map *map);
6160 __isl_give isl_map *isl_map_range_factor_domain(
6161 __isl_take isl_map *map);
6162 __isl_give isl_map *isl_map_range_factor_range(
6163 __isl_take isl_map *map);
6165 #include <isl/union_map.h>
6166 __isl_give isl_union_map *isl_union_map_factor_domain(
6167 __isl_take isl_union_map *umap);
6168 __isl_give isl_union_map *isl_union_map_factor_range(
6169 __isl_take isl_union_map *umap);
6170 __isl_give isl_union_map *
6171 isl_union_map_domain_factor_domain(
6172 __isl_take isl_union_map *umap);
6173 __isl_give isl_union_map *
6174 isl_union_map_domain_factor_range(
6175 __isl_take isl_union_map *umap);
6176 __isl_give isl_union_map *
6177 isl_union_map_range_factor_range(
6178 __isl_take isl_union_map *umap);
6180 #include <isl/val.h>
6181 __isl_give isl_multi_val *
6182 isl_multi_val_range_factor_domain(
6183 __isl_take isl_multi_val *mv);
6184 __isl_give isl_multi_val *
6185 isl_multi_val_range_factor_range(
6186 __isl_take isl_multi_val *mv);
6188 #include <isl/aff.h>
6189 __isl_give isl_multi_aff *
6190 isl_multi_aff_range_factor_domain(
6191 __isl_take isl_multi_aff *ma);
6192 __isl_give isl_multi_aff *
6193 isl_multi_aff_range_factor_range(
6194 __isl_take isl_multi_aff *ma);
6195 __isl_give isl_multi_pw_aff *
6196 isl_multi_pw_aff_range_factor_domain(
6197 __isl_take isl_multi_pw_aff *mpa);
6198 __isl_give isl_multi_pw_aff *
6199 isl_multi_pw_aff_range_factor_range(
6200 __isl_take isl_multi_pw_aff *mpa);
6201 __isl_give isl_multi_union_pw_aff *
6202 isl_multi_union_pw_aff_range_factor_domain(
6203 __isl_take isl_multi_union_pw_aff *mupa);
6204 __isl_give isl_multi_union_pw_aff *
6205 isl_multi_union_pw_aff_range_factor_range(
6206 __isl_take isl_multi_union_pw_aff *mupa);
6208 The splice functions are a generalization of the flat product functions,
6209 where the second argument may be inserted at any position inside
6210 the first argument rather than being placed at the end.
6212 #include <isl/val.h>
6213 __isl_give isl_multi_val *isl_multi_val_range_splice(
6214 __isl_take isl_multi_val *mv1, unsigned pos,
6215 __isl_take isl_multi_val *mv2);
6217 #include <isl/aff.h>
6218 __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6219 __isl_take isl_multi_aff *ma1, unsigned pos,
6220 __isl_take isl_multi_aff *ma2);
6221 __isl_give isl_multi_aff *isl_multi_aff_splice(
6222 __isl_take isl_multi_aff *ma1,
6223 unsigned in_pos, unsigned out_pos,
6224 __isl_take isl_multi_aff *ma2);
6225 __isl_give isl_multi_pw_aff *
6226 isl_multi_pw_aff_range_splice(
6227 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6228 __isl_take isl_multi_pw_aff *mpa2);
6229 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6230 __isl_take isl_multi_pw_aff *mpa1,
6231 unsigned in_pos, unsigned out_pos,
6232 __isl_take isl_multi_pw_aff *mpa2);
6233 __isl_give isl_multi_union_pw_aff *
6234 isl_multi_union_pw_aff_range_splice(
6235 __isl_take isl_multi_union_pw_aff *mupa1,
6237 __isl_take isl_multi_union_pw_aff *mupa2);
6239 =item * Simplification
6241 When applied to a set or relation,
6242 the gist operation returns a set or relation that has the
6243 same intersection with the context as the input set or relation.
6244 Any implicit equality in the intersection is made explicit in the result,
6245 while all inequalities that are redundant with respect to the intersection
6247 In case of union sets and relations, the gist operation is performed
6250 When applied to a function,
6251 the gist operation applies the set gist operation to each of
6252 the cells in the domain of the input piecewise expression.
6253 The context is also exploited
6254 to simplify the expression associated to each cell.
6256 #include <isl/set.h>
6257 __isl_give isl_basic_set *isl_basic_set_gist(
6258 __isl_take isl_basic_set *bset,
6259 __isl_take isl_basic_set *context);
6260 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6261 __isl_take isl_set *context);
6262 __isl_give isl_set *isl_set_gist_params(
6263 __isl_take isl_set *set,
6264 __isl_take isl_set *context);
6266 #include <isl/map.h>
6267 __isl_give isl_basic_map *isl_basic_map_gist(
6268 __isl_take isl_basic_map *bmap,
6269 __isl_take isl_basic_map *context);
6270 __isl_give isl_basic_map *isl_basic_map_gist_domain(
6271 __isl_take isl_basic_map *bmap,
6272 __isl_take isl_basic_set *context);
6273 __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6274 __isl_take isl_map *context);
6275 __isl_give isl_map *isl_map_gist_params(
6276 __isl_take isl_map *map,
6277 __isl_take isl_set *context);
6278 __isl_give isl_map *isl_map_gist_domain(
6279 __isl_take isl_map *map,
6280 __isl_take isl_set *context);
6281 __isl_give isl_map *isl_map_gist_range(
6282 __isl_take isl_map *map,
6283 __isl_take isl_set *context);
6285 #include <isl/union_set.h>
6286 __isl_give isl_union_set *isl_union_set_gist(
6287 __isl_take isl_union_set *uset,
6288 __isl_take isl_union_set *context);
6289 __isl_give isl_union_set *isl_union_set_gist_params(
6290 __isl_take isl_union_set *uset,
6291 __isl_take isl_set *set);
6293 #include <isl/union_map.h>
6294 __isl_give isl_union_map *isl_union_map_gist(
6295 __isl_take isl_union_map *umap,
6296 __isl_take isl_union_map *context);
6297 __isl_give isl_union_map *isl_union_map_gist_params(
6298 __isl_take isl_union_map *umap,
6299 __isl_take isl_set *set);
6300 __isl_give isl_union_map *isl_union_map_gist_domain(
6301 __isl_take isl_union_map *umap,
6302 __isl_take isl_union_set *uset);
6303 __isl_give isl_union_map *isl_union_map_gist_range(
6304 __isl_take isl_union_map *umap,
6305 __isl_take isl_union_set *uset);
6307 #include <isl/aff.h>
6308 __isl_give isl_aff *isl_aff_gist_params(
6309 __isl_take isl_aff *aff,
6310 __isl_take isl_set *context);
6311 __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6312 __isl_take isl_set *context);
6313 __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6314 __isl_take isl_multi_aff *maff,
6315 __isl_take isl_set *context);
6316 __isl_give isl_multi_aff *isl_multi_aff_gist(
6317 __isl_take isl_multi_aff *maff,
6318 __isl_take isl_set *context);
6319 __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6320 __isl_take isl_pw_aff *pwaff,
6321 __isl_take isl_set *context);
6322 __isl_give isl_pw_aff *isl_pw_aff_gist(
6323 __isl_take isl_pw_aff *pwaff,
6324 __isl_take isl_set *context);
6325 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6326 __isl_take isl_pw_multi_aff *pma,
6327 __isl_take isl_set *set);
6328 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6329 __isl_take isl_pw_multi_aff *pma,
6330 __isl_take isl_set *set);
6331 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6332 __isl_take isl_multi_pw_aff *mpa,
6333 __isl_take isl_set *set);
6334 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6335 __isl_take isl_multi_pw_aff *mpa,
6336 __isl_take isl_set *set);
6337 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6338 __isl_take isl_union_pw_aff *upa,
6339 __isl_take isl_union_set *context);
6340 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6341 __isl_take isl_union_pw_aff *upa,
6342 __isl_take isl_set *context);
6343 __isl_give isl_union_pw_multi_aff *
6344 isl_union_pw_multi_aff_gist_params(
6345 __isl_take isl_union_pw_multi_aff *upma,
6346 __isl_take isl_set *context);
6347 __isl_give isl_union_pw_multi_aff *
6348 isl_union_pw_multi_aff_gist(
6349 __isl_take isl_union_pw_multi_aff *upma,
6350 __isl_take isl_union_set *context);
6351 __isl_give isl_multi_union_pw_aff *
6352 isl_multi_union_pw_aff_gist_params(
6353 __isl_take isl_multi_union_pw_aff *aff,
6354 __isl_take isl_set *context);
6355 __isl_give isl_multi_union_pw_aff *
6356 isl_multi_union_pw_aff_gist(
6357 __isl_take isl_multi_union_pw_aff *aff,
6358 __isl_take isl_union_set *context);
6360 #include <isl/polynomial.h>
6361 __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6362 __isl_take isl_qpolynomial *qp,
6363 __isl_take isl_set *context);
6364 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6365 __isl_take isl_qpolynomial *qp,
6366 __isl_take isl_set *context);
6367 __isl_give isl_qpolynomial_fold *
6368 isl_qpolynomial_fold_gist_params(
6369 __isl_take isl_qpolynomial_fold *fold,
6370 __isl_take isl_set *context);
6371 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6372 __isl_take isl_qpolynomial_fold *fold,
6373 __isl_take isl_set *context);
6374 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6375 __isl_take isl_pw_qpolynomial *pwqp,
6376 __isl_take isl_set *context);
6377 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6378 __isl_take isl_pw_qpolynomial *pwqp,
6379 __isl_take isl_set *context);
6380 __isl_give isl_pw_qpolynomial_fold *
6381 isl_pw_qpolynomial_fold_gist(
6382 __isl_take isl_pw_qpolynomial_fold *pwf,
6383 __isl_take isl_set *context);
6384 __isl_give isl_pw_qpolynomial_fold *
6385 isl_pw_qpolynomial_fold_gist_params(
6386 __isl_take isl_pw_qpolynomial_fold *pwf,
6387 __isl_take isl_set *context);
6388 __isl_give isl_union_pw_qpolynomial *
6389 isl_union_pw_qpolynomial_gist_params(
6390 __isl_take isl_union_pw_qpolynomial *upwqp,
6391 __isl_take isl_set *context);
6392 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6393 __isl_take isl_union_pw_qpolynomial *upwqp,
6394 __isl_take isl_union_set *context);
6395 __isl_give isl_union_pw_qpolynomial_fold *
6396 isl_union_pw_qpolynomial_fold_gist(
6397 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6398 __isl_take isl_union_set *context);
6399 __isl_give isl_union_pw_qpolynomial_fold *
6400 isl_union_pw_qpolynomial_fold_gist_params(
6401 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6402 __isl_take isl_set *context);
6404 =item * Binary Arithmethic Operations
6406 #include <isl/val.h>
6407 __isl_give isl_multi_val *isl_multi_val_sub(
6408 __isl_take isl_multi_val *mv1,
6409 __isl_take isl_multi_val *mv2);
6411 #include <isl/aff.h>
6412 __isl_give isl_aff *isl_aff_add(
6413 __isl_take isl_aff *aff1,
6414 __isl_take isl_aff *aff2);
6415 __isl_give isl_multi_aff *isl_multi_aff_add(
6416 __isl_take isl_multi_aff *maff1,
6417 __isl_take isl_multi_aff *maff2);
6418 __isl_give isl_pw_aff *isl_pw_aff_add(
6419 __isl_take isl_pw_aff *pwaff1,
6420 __isl_take isl_pw_aff *pwaff2);
6421 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6422 __isl_take isl_pw_multi_aff *pma1,
6423 __isl_take isl_pw_multi_aff *pma2);
6424 __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6425 __isl_take isl_union_pw_aff *upa1,
6426 __isl_take isl_union_pw_aff *upa2);
6427 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6428 __isl_take isl_union_pw_multi_aff *upma1,
6429 __isl_take isl_union_pw_multi_aff *upma2);
6430 __isl_give isl_pw_aff *isl_pw_aff_min(
6431 __isl_take isl_pw_aff *pwaff1,
6432 __isl_take isl_pw_aff *pwaff2);
6433 __isl_give isl_pw_aff *isl_pw_aff_max(
6434 __isl_take isl_pw_aff *pwaff1,
6435 __isl_take isl_pw_aff *pwaff2);
6436 __isl_give isl_aff *isl_aff_sub(
6437 __isl_take isl_aff *aff1,
6438 __isl_take isl_aff *aff2);
6439 __isl_give isl_multi_aff *isl_multi_aff_sub(
6440 __isl_take isl_multi_aff *ma1,
6441 __isl_take isl_multi_aff *ma2);
6442 __isl_give isl_pw_aff *isl_pw_aff_sub(
6443 __isl_take isl_pw_aff *pwaff1,
6444 __isl_take isl_pw_aff *pwaff2);
6445 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6446 __isl_take isl_multi_pw_aff *mpa1,
6447 __isl_take isl_multi_pw_aff *mpa2);
6448 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6449 __isl_take isl_pw_multi_aff *pma1,
6450 __isl_take isl_pw_multi_aff *pma2);
6451 __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6452 __isl_take isl_union_pw_aff *upa1,
6453 __isl_take isl_union_pw_aff *upa2);
6454 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6455 __isl_take isl_union_pw_multi_aff *upma1,
6456 __isl_take isl_union_pw_multi_aff *upma2);
6457 __isl_give isl_multi_union_pw_aff *
6458 isl_multi_union_pw_aff_sub(
6459 __isl_take isl_multi_union_pw_aff *mupa1,
6460 __isl_take isl_multi_union_pw_aff *mupa2);
6462 C<isl_aff_sub> subtracts the second argument from the first.
6464 #include <isl/polynomial.h>
6465 __isl_give isl_qpolynomial *isl_qpolynomial_add(
6466 __isl_take isl_qpolynomial *qp1,
6467 __isl_take isl_qpolynomial *qp2);
6468 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6469 __isl_take isl_pw_qpolynomial *pwqp1,
6470 __isl_take isl_pw_qpolynomial *pwqp2);
6471 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6472 __isl_take isl_pw_qpolynomial *pwqp1,
6473 __isl_take isl_pw_qpolynomial *pwqp2);
6474 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6475 __isl_take isl_pw_qpolynomial_fold *pwf1,
6476 __isl_take isl_pw_qpolynomial_fold *pwf2);
6477 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6478 __isl_take isl_union_pw_qpolynomial *upwqp1,
6479 __isl_take isl_union_pw_qpolynomial *upwqp2);
6480 __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6481 __isl_take isl_qpolynomial *qp1,
6482 __isl_take isl_qpolynomial *qp2);
6483 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6484 __isl_take isl_pw_qpolynomial *pwqp1,
6485 __isl_take isl_pw_qpolynomial *pwqp2);
6486 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6487 __isl_take isl_union_pw_qpolynomial *upwqp1,
6488 __isl_take isl_union_pw_qpolynomial *upwqp2);
6489 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6490 __isl_take isl_pw_qpolynomial_fold *pwf1,
6491 __isl_take isl_pw_qpolynomial_fold *pwf2);
6492 __isl_give isl_union_pw_qpolynomial_fold *
6493 isl_union_pw_qpolynomial_fold_fold(
6494 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6495 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6497 #include <isl/aff.h>
6498 __isl_give isl_pw_aff *isl_pw_aff_union_add(
6499 __isl_take isl_pw_aff *pwaff1,
6500 __isl_take isl_pw_aff *pwaff2);
6501 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6502 __isl_take isl_pw_multi_aff *pma1,
6503 __isl_take isl_pw_multi_aff *pma2);
6504 __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6505 __isl_take isl_union_pw_aff *upa1,
6506 __isl_take isl_union_pw_aff *upa2);
6507 __isl_give isl_union_pw_multi_aff *
6508 isl_union_pw_multi_aff_union_add(
6509 __isl_take isl_union_pw_multi_aff *upma1,
6510 __isl_take isl_union_pw_multi_aff *upma2);
6511 __isl_give isl_multi_union_pw_aff *
6512 isl_multi_union_pw_aff_union_add(
6513 __isl_take isl_multi_union_pw_aff *mupa1,
6514 __isl_take isl_multi_union_pw_aff *mupa2);
6515 __isl_give isl_pw_aff *isl_pw_aff_union_min(
6516 __isl_take isl_pw_aff *pwaff1,
6517 __isl_take isl_pw_aff *pwaff2);
6518 __isl_give isl_pw_aff *isl_pw_aff_union_max(
6519 __isl_take isl_pw_aff *pwaff1,
6520 __isl_take isl_pw_aff *pwaff2);
6522 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6523 expression with a domain that is the union of those of C<pwaff1> and
6524 C<pwaff2> and such that on each cell, the quasi-affine expression is
6525 the maximum of those of C<pwaff1> and C<pwaff2>. If only one of
6526 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6527 associated expression is the defined one.
6528 This in contrast to the C<isl_pw_aff_max> function, which is
6529 only defined on the shared definition domain of the arguments.
6531 #include <isl/val.h>
6532 __isl_give isl_multi_val *isl_multi_val_add_val(
6533 __isl_take isl_multi_val *mv,
6534 __isl_take isl_val *v);
6535 __isl_give isl_multi_val *isl_multi_val_mod_val(
6536 __isl_take isl_multi_val *mv,
6537 __isl_take isl_val *v);
6538 __isl_give isl_multi_val *isl_multi_val_scale_val(
6539 __isl_take isl_multi_val *mv,
6540 __isl_take isl_val *v);
6541 __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6542 __isl_take isl_multi_val *mv,
6543 __isl_take isl_val *v);
6545 #include <isl/aff.h>
6546 __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6547 __isl_take isl_val *mod);
6548 __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6549 __isl_take isl_pw_aff *pa,
6550 __isl_take isl_val *mod);
6551 __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6552 __isl_take isl_union_pw_aff *upa,
6553 __isl_take isl_val *f);
6554 __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6555 __isl_take isl_val *v);
6556 __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6557 __isl_take isl_multi_aff *ma,
6558 __isl_take isl_val *v);
6559 __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6560 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6561 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6562 __isl_take isl_multi_pw_aff *mpa,
6563 __isl_take isl_val *v);
6564 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6565 __isl_take isl_pw_multi_aff *pma,
6566 __isl_take isl_val *v);
6567 __isl_give isl_union_pw_multi_aff *
6568 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6569 __isl_take isl_union_pw_aff *upa,
6570 __isl_take isl_val *f);
6571 isl_union_pw_multi_aff_scale_val(
6572 __isl_take isl_union_pw_multi_aff *upma,
6573 __isl_take isl_val *val);
6574 __isl_give isl_multi_union_pw_aff *
6575 isl_multi_union_pw_aff_scale_val(
6576 __isl_take isl_multi_union_pw_aff *mupa,
6577 __isl_take isl_val *v);
6578 __isl_give isl_aff *isl_aff_scale_down_ui(
6579 __isl_take isl_aff *aff, unsigned f);
6580 __isl_give isl_aff *isl_aff_scale_down_val(
6581 __isl_take isl_aff *aff, __isl_take isl_val *v);
6582 __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6583 __isl_take isl_multi_aff *ma,
6584 __isl_take isl_val *v);
6585 __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6586 __isl_take isl_pw_aff *pa,
6587 __isl_take isl_val *f);
6588 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6589 __isl_take isl_multi_pw_aff *mpa,
6590 __isl_take isl_val *v);
6591 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6592 __isl_take isl_pw_multi_aff *pma,
6593 __isl_take isl_val *v);
6594 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6595 __isl_take isl_union_pw_aff *upa,
6596 __isl_take isl_val *v);
6597 __isl_give isl_union_pw_multi_aff *
6598 isl_union_pw_multi_aff_scale_down_val(
6599 __isl_take isl_union_pw_multi_aff *upma,
6600 __isl_take isl_val *val);
6601 __isl_give isl_multi_union_pw_aff *
6602 isl_multi_union_pw_aff_scale_down_val(
6603 __isl_take isl_multi_union_pw_aff *mupa,
6604 __isl_take isl_val *v);
6606 #include <isl/polynomial.h>
6607 __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6608 __isl_take isl_qpolynomial *qp,
6609 __isl_take isl_val *v);
6610 __isl_give isl_qpolynomial_fold *
6611 isl_qpolynomial_fold_scale_val(
6612 __isl_take isl_qpolynomial_fold *fold,
6613 __isl_take isl_val *v);
6614 __isl_give isl_pw_qpolynomial *
6615 isl_pw_qpolynomial_scale_val(
6616 __isl_take isl_pw_qpolynomial *pwqp,
6617 __isl_take isl_val *v);
6618 __isl_give isl_pw_qpolynomial_fold *
6619 isl_pw_qpolynomial_fold_scale_val(
6620 __isl_take isl_pw_qpolynomial_fold *pwf,
6621 __isl_take isl_val *v);
6622 __isl_give isl_union_pw_qpolynomial *
6623 isl_union_pw_qpolynomial_scale_val(
6624 __isl_take isl_union_pw_qpolynomial *upwqp,
6625 __isl_take isl_val *v);
6626 __isl_give isl_union_pw_qpolynomial_fold *
6627 isl_union_pw_qpolynomial_fold_scale_val(
6628 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6629 __isl_take isl_val *v);
6630 __isl_give isl_qpolynomial *
6631 isl_qpolynomial_scale_down_val(
6632 __isl_take isl_qpolynomial *qp,
6633 __isl_take isl_val *v);
6634 __isl_give isl_qpolynomial_fold *
6635 isl_qpolynomial_fold_scale_down_val(
6636 __isl_take isl_qpolynomial_fold *fold,
6637 __isl_take isl_val *v);
6638 __isl_give isl_pw_qpolynomial *
6639 isl_pw_qpolynomial_scale_down_val(
6640 __isl_take isl_pw_qpolynomial *pwqp,
6641 __isl_take isl_val *v);
6642 __isl_give isl_pw_qpolynomial_fold *
6643 isl_pw_qpolynomial_fold_scale_down_val(
6644 __isl_take isl_pw_qpolynomial_fold *pwf,
6645 __isl_take isl_val *v);
6646 __isl_give isl_union_pw_qpolynomial *
6647 isl_union_pw_qpolynomial_scale_down_val(
6648 __isl_take isl_union_pw_qpolynomial *upwqp,
6649 __isl_take isl_val *v);
6650 __isl_give isl_union_pw_qpolynomial_fold *
6651 isl_union_pw_qpolynomial_fold_scale_down_val(
6652 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6653 __isl_take isl_val *v);
6655 #include <isl/val.h>
6656 __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6657 __isl_take isl_multi_val *mv1,
6658 __isl_take isl_multi_val *mv2);
6659 __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6660 __isl_take isl_multi_val *mv1,
6661 __isl_take isl_multi_val *mv2);
6662 __isl_give isl_multi_val *
6663 isl_multi_val_scale_down_multi_val(
6664 __isl_take isl_multi_val *mv1,
6665 __isl_take isl_multi_val *mv2);
6667 #include <isl/aff.h>
6668 __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6669 __isl_take isl_multi_aff *ma,
6670 __isl_take isl_multi_val *mv);
6671 __isl_give isl_multi_union_pw_aff *
6672 isl_multi_union_pw_aff_mod_multi_val(
6673 __isl_take isl_multi_union_pw_aff *upma,
6674 __isl_take isl_multi_val *mv);
6675 __isl_give isl_multi_pw_aff *
6676 isl_multi_pw_aff_mod_multi_val(
6677 __isl_take isl_multi_pw_aff *mpa,
6678 __isl_take isl_multi_val *mv);
6679 __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6680 __isl_take isl_multi_aff *ma,
6681 __isl_take isl_multi_val *mv);
6682 __isl_give isl_pw_multi_aff *
6683 isl_pw_multi_aff_scale_multi_val(
6684 __isl_take isl_pw_multi_aff *pma,
6685 __isl_take isl_multi_val *mv);
6686 __isl_give isl_multi_pw_aff *
6687 isl_multi_pw_aff_scale_multi_val(
6688 __isl_take isl_multi_pw_aff *mpa,
6689 __isl_take isl_multi_val *mv);
6690 __isl_give isl_multi_union_pw_aff *
6691 isl_multi_union_pw_aff_scale_multi_val(
6692 __isl_take isl_multi_union_pw_aff *mupa,
6693 __isl_take isl_multi_val *mv);
6694 __isl_give isl_union_pw_multi_aff *
6695 isl_union_pw_multi_aff_scale_multi_val(
6696 __isl_take isl_union_pw_multi_aff *upma,
6697 __isl_take isl_multi_val *mv);
6698 __isl_give isl_multi_aff *
6699 isl_multi_aff_scale_down_multi_val(
6700 __isl_take isl_multi_aff *ma,
6701 __isl_take isl_multi_val *mv);
6702 __isl_give isl_multi_pw_aff *
6703 isl_multi_pw_aff_scale_down_multi_val(
6704 __isl_take isl_multi_pw_aff *mpa,
6705 __isl_take isl_multi_val *mv);
6706 __isl_give isl_multi_union_pw_aff *
6707 isl_multi_union_pw_aff_scale_down_multi_val(
6708 __isl_take isl_multi_union_pw_aff *mupa,
6709 __isl_take isl_multi_val *mv);
6711 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6712 by the corresponding elements of C<mv>.
6714 #include <isl/aff.h>
6715 __isl_give isl_aff *isl_aff_mul(
6716 __isl_take isl_aff *aff1,
6717 __isl_take isl_aff *aff2);
6718 __isl_give isl_aff *isl_aff_div(
6719 __isl_take isl_aff *aff1,
6720 __isl_take isl_aff *aff2);
6721 __isl_give isl_pw_aff *isl_pw_aff_mul(
6722 __isl_take isl_pw_aff *pwaff1,
6723 __isl_take isl_pw_aff *pwaff2);
6724 __isl_give isl_pw_aff *isl_pw_aff_div(
6725 __isl_take isl_pw_aff *pa1,
6726 __isl_take isl_pw_aff *pa2);
6727 __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6728 __isl_take isl_pw_aff *pa1,
6729 __isl_take isl_pw_aff *pa2);
6730 __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6731 __isl_take isl_pw_aff *pa1,
6732 __isl_take isl_pw_aff *pa2);
6734 When multiplying two affine expressions, at least one of the two needs
6735 to be a constant. Similarly, when dividing an affine expression by another,
6736 the second expression needs to be a constant.
6737 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6738 rounding towards zero. C<isl_pw_aff_tdiv_r> computes the corresponding
6741 #include <isl/polynomial.h>
6742 __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6743 __isl_take isl_qpolynomial *qp1,
6744 __isl_take isl_qpolynomial *qp2);
6745 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6746 __isl_take isl_pw_qpolynomial *pwqp1,
6747 __isl_take isl_pw_qpolynomial *pwqp2);
6748 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6749 __isl_take isl_union_pw_qpolynomial *upwqp1,
6750 __isl_take isl_union_pw_qpolynomial *upwqp2);
6754 =head3 Lexicographic Optimization
6756 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6757 the following functions
6758 compute a set that contains the lexicographic minimum or maximum
6759 of the elements in C<set> (or C<bset>) for those values of the parameters
6760 that satisfy C<dom>.
6761 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6762 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6764 In other words, the union of the parameter values
6765 for which the result is non-empty and of C<*empty>
6768 #include <isl/set.h>
6769 __isl_give isl_set *isl_basic_set_partial_lexmin(
6770 __isl_take isl_basic_set *bset,
6771 __isl_take isl_basic_set *dom,
6772 __isl_give isl_set **empty);
6773 __isl_give isl_set *isl_basic_set_partial_lexmax(
6774 __isl_take isl_basic_set *bset,
6775 __isl_take isl_basic_set *dom,
6776 __isl_give isl_set **empty);
6777 __isl_give isl_set *isl_set_partial_lexmin(
6778 __isl_take isl_set *set, __isl_take isl_set *dom,
6779 __isl_give isl_set **empty);
6780 __isl_give isl_set *isl_set_partial_lexmax(
6781 __isl_take isl_set *set, __isl_take isl_set *dom,
6782 __isl_give isl_set **empty);
6784 Given a (basic) set C<set> (or C<bset>), the following functions simply
6785 return a set containing the lexicographic minimum or maximum
6786 of the elements in C<set> (or C<bset>).
6787 In case of union sets, the optimum is computed per space.
6789 #include <isl/set.h>
6790 __isl_give isl_set *isl_basic_set_lexmin(
6791 __isl_take isl_basic_set *bset);
6792 __isl_give isl_set *isl_basic_set_lexmax(
6793 __isl_take isl_basic_set *bset);
6794 __isl_give isl_set *isl_set_lexmin(
6795 __isl_take isl_set *set);
6796 __isl_give isl_set *isl_set_lexmax(
6797 __isl_take isl_set *set);
6798 __isl_give isl_union_set *isl_union_set_lexmin(
6799 __isl_take isl_union_set *uset);
6800 __isl_give isl_union_set *isl_union_set_lexmax(
6801 __isl_take isl_union_set *uset);
6803 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6804 the following functions
6805 compute a relation that maps each element of C<dom>
6806 to the single lexicographic minimum or maximum
6807 of the elements that are associated to that same
6808 element in C<map> (or C<bmap>).
6809 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6810 that contains the elements in C<dom> that do not map
6811 to any elements in C<map> (or C<bmap>).
6812 In other words, the union of the domain of the result and of C<*empty>
6815 #include <isl/map.h>
6816 __isl_give isl_map *isl_basic_map_partial_lexmax(
6817 __isl_take isl_basic_map *bmap,
6818 __isl_take isl_basic_set *dom,
6819 __isl_give isl_set **empty);
6820 __isl_give isl_map *isl_basic_map_partial_lexmin(
6821 __isl_take isl_basic_map *bmap,
6822 __isl_take isl_basic_set *dom,
6823 __isl_give isl_set **empty);
6824 __isl_give isl_map *isl_map_partial_lexmax(
6825 __isl_take isl_map *map, __isl_take isl_set *dom,
6826 __isl_give isl_set **empty);
6827 __isl_give isl_map *isl_map_partial_lexmin(
6828 __isl_take isl_map *map, __isl_take isl_set *dom,
6829 __isl_give isl_set **empty);
6831 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6832 return a map mapping each element in the domain of
6833 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6834 of all elements associated to that element.
6835 In case of union relations, the optimum is computed per space.
6837 #include <isl/map.h>
6838 __isl_give isl_map *isl_basic_map_lexmin(
6839 __isl_take isl_basic_map *bmap);
6840 __isl_give isl_map *isl_basic_map_lexmax(
6841 __isl_take isl_basic_map *bmap);
6842 __isl_give isl_map *isl_map_lexmin(
6843 __isl_take isl_map *map);
6844 __isl_give isl_map *isl_map_lexmax(
6845 __isl_take isl_map *map);
6846 __isl_give isl_union_map *isl_union_map_lexmin(
6847 __isl_take isl_union_map *umap);
6848 __isl_give isl_union_map *isl_union_map_lexmax(
6849 __isl_take isl_union_map *umap);
6851 The following functions return their result in the form of
6852 a piecewise multi-affine expression,
6853 but are otherwise equivalent to the corresponding functions
6854 returning a basic set or relation.
6856 #include <isl/set.h>
6857 __isl_give isl_pw_multi_aff *
6858 isl_basic_set_partial_lexmin_pw_multi_aff(
6859 __isl_take isl_basic_set *bset,
6860 __isl_take isl_basic_set *dom,
6861 __isl_give isl_set **empty);
6862 __isl_give isl_pw_multi_aff *
6863 isl_basic_set_partial_lexmax_pw_multi_aff(
6864 __isl_take isl_basic_set *bset,
6865 __isl_take isl_basic_set *dom,
6866 __isl_give isl_set **empty);
6867 __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6868 __isl_take isl_set *set);
6869 __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6870 __isl_take isl_set *set);
6872 #include <isl/map.h>
6873 __isl_give isl_pw_multi_aff *
6874 isl_basic_map_lexmin_pw_multi_aff(
6875 __isl_take isl_basic_map *bmap);
6876 __isl_give isl_pw_multi_aff *
6877 isl_basic_map_partial_lexmin_pw_multi_aff(
6878 __isl_take isl_basic_map *bmap,
6879 __isl_take isl_basic_set *dom,
6880 __isl_give isl_set **empty);
6881 __isl_give isl_pw_multi_aff *
6882 isl_basic_map_partial_lexmax_pw_multi_aff(
6883 __isl_take isl_basic_map *bmap,
6884 __isl_take isl_basic_set *dom,
6885 __isl_give isl_set **empty);
6886 __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
6887 __isl_take isl_map *map);
6888 __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
6889 __isl_take isl_map *map);
6891 The following functions return the lexicographic minimum or maximum
6892 on the shared domain of the inputs and the single defined function
6893 on those parts of the domain where only a single function is defined.
6895 #include <isl/aff.h>
6896 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
6897 __isl_take isl_pw_multi_aff *pma1,
6898 __isl_take isl_pw_multi_aff *pma2);
6899 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
6900 __isl_take isl_pw_multi_aff *pma1,
6901 __isl_take isl_pw_multi_aff *pma2);
6903 =head2 Ternary Operations
6905 #include <isl/aff.h>
6906 __isl_give isl_pw_aff *isl_pw_aff_cond(
6907 __isl_take isl_pw_aff *cond,
6908 __isl_take isl_pw_aff *pwaff_true,
6909 __isl_take isl_pw_aff *pwaff_false);
6911 The function C<isl_pw_aff_cond> performs a conditional operator
6912 and returns an expression that is equal to C<pwaff_true>
6913 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
6914 where C<cond> is zero.
6918 Lists are defined over several element types, including
6919 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
6920 C<isl_union_pw_multi_aff>, C<isl_constraint>,
6921 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
6922 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
6923 Here we take lists of C<isl_set>s as an example.
6924 Lists can be created, copied, modified and freed using the following functions.
6926 #include <isl/set.h>
6927 __isl_give isl_set_list *isl_set_list_from_set(
6928 __isl_take isl_set *el);
6929 __isl_give isl_set_list *isl_set_list_alloc(
6930 isl_ctx *ctx, int n);
6931 __isl_give isl_set_list *isl_set_list_copy(
6932 __isl_keep isl_set_list *list);
6933 __isl_give isl_set_list *isl_set_list_insert(
6934 __isl_take isl_set_list *list, unsigned pos,
6935 __isl_take isl_set *el);
6936 __isl_give isl_set_list *isl_set_list_add(
6937 __isl_take isl_set_list *list,
6938 __isl_take isl_set *el);
6939 __isl_give isl_set_list *isl_set_list_drop(
6940 __isl_take isl_set_list *list,
6941 unsigned first, unsigned n);
6942 __isl_give isl_set_list *isl_set_list_set_set(
6943 __isl_take isl_set_list *list, int index,
6944 __isl_take isl_set *set);
6945 __isl_give isl_set_list *isl_set_list_concat(
6946 __isl_take isl_set_list *list1,
6947 __isl_take isl_set_list *list2);
6948 __isl_give isl_set_list *isl_set_list_sort(
6949 __isl_take isl_set_list *list,
6950 int (*cmp)(__isl_keep isl_set *a,
6951 __isl_keep isl_set *b, void *user),
6953 __isl_null isl_set_list *isl_set_list_free(
6954 __isl_take isl_set_list *list);
6956 C<isl_set_list_alloc> creates an empty list with an initial capacity
6957 for C<n> elements. C<isl_set_list_insert> and C<isl_set_list_add>
6958 add elements to a list, increasing its capacity as needed.
6959 C<isl_set_list_from_set> creates a list with a single element.
6961 Lists can be inspected using the following functions.
6963 #include <isl/set.h>
6964 int isl_set_list_n_set(__isl_keep isl_set_list *list);
6965 __isl_give isl_set *isl_set_list_get_set(
6966 __isl_keep isl_set_list *list, int index);
6967 int isl_set_list_foreach(__isl_keep isl_set_list *list,
6968 int (*fn)(__isl_take isl_set *el, void *user),
6970 int isl_set_list_foreach_scc(__isl_keep isl_set_list *list,
6971 int (*follows)(__isl_keep isl_set *a,
6972 __isl_keep isl_set *b, void *user),
6974 int (*fn)(__isl_take isl_set *el, void *user),
6977 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
6978 strongly connected components of the graph with as vertices the elements
6979 of C<list> and a directed edge from vertex C<b> to vertex C<a>
6980 iff C<follows(a, b)> returns C<1>. The callbacks C<follows> and C<fn>
6981 should return C<-1> on error.
6983 Lists can be printed using
6985 #include <isl/set.h>
6986 __isl_give isl_printer *isl_printer_print_set_list(
6987 __isl_take isl_printer *p,
6988 __isl_keep isl_set_list *list);
6990 =head2 Associative arrays
6992 Associative arrays map isl objects of a specific type to isl objects
6993 of some (other) specific type. They are defined for several pairs
6994 of types, including (C<isl_map>, C<isl_basic_set>),
6995 (C<isl_id>, C<isl_ast_expr>) and.
6996 (C<isl_id>, C<isl_pw_aff>).
6997 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7000 Associative arrays can be created, copied and freed using
7001 the following functions.
7003 #include <isl/id_to_ast_expr.h>
7004 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7005 isl_ctx *ctx, int min_size);
7006 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7007 __isl_keep isl_id_to_ast_expr *id2expr);
7008 __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7009 __isl_take isl_id_to_ast_expr *id2expr);
7011 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7012 to specify the expected size of the associative array.
7013 The associative array will be grown automatically as needed.
7015 Associative arrays can be inspected using the following functions.
7017 #include <isl/id_to_ast_expr.h>
7018 int isl_id_to_ast_expr_has(
7019 __isl_keep isl_id_to_ast_expr *id2expr,
7020 __isl_keep isl_id *key);
7021 __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7022 __isl_keep isl_id_to_ast_expr *id2expr,
7023 __isl_take isl_id *key);
7024 int isl_id_to_ast_expr_foreach(
7025 __isl_keep isl_id_to_ast_expr *id2expr,
7026 int (*fn)(__isl_take isl_id *key,
7027 __isl_take isl_ast_expr *val, void *user),
7030 They can be modified using the following function.
7032 #include <isl/id_to_ast_expr.h>
7033 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7034 __isl_take isl_id_to_ast_expr *id2expr,
7035 __isl_take isl_id *key,
7036 __isl_take isl_ast_expr *val);
7037 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7038 __isl_take isl_id_to_ast_expr *id2expr,
7039 __isl_take isl_id *key);
7041 Associative arrays can be printed using the following function.
7043 #include <isl/id_to_ast_expr.h>
7044 __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7045 __isl_take isl_printer *p,
7046 __isl_keep isl_id_to_ast_expr *id2expr);
7050 Vectors can be created, copied and freed using the following functions.
7052 #include <isl/vec.h>
7053 __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7055 __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7056 __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7058 Note that the elements of a newly created vector may have arbitrary values.
7059 The elements can be changed and inspected using the following functions.
7061 int isl_vec_size(__isl_keep isl_vec *vec);
7062 __isl_give isl_val *isl_vec_get_element_val(
7063 __isl_keep isl_vec *vec, int pos);
7064 __isl_give isl_vec *isl_vec_set_element_si(
7065 __isl_take isl_vec *vec, int pos, int v);
7066 __isl_give isl_vec *isl_vec_set_element_val(
7067 __isl_take isl_vec *vec, int pos,
7068 __isl_take isl_val *v);
7069 __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7071 __isl_give isl_vec *isl_vec_set_val(
7072 __isl_take isl_vec *vec, __isl_take isl_val *v);
7073 int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7074 __isl_keep isl_vec *vec2, int pos);
7076 C<isl_vec_get_element> will return a negative value if anything went wrong.
7077 In that case, the value of C<*v> is undefined.
7079 The following function can be used to concatenate two vectors.
7081 __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7082 __isl_take isl_vec *vec2);
7086 Matrices can be created, copied and freed using the following functions.
7088 #include <isl/mat.h>
7089 __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7090 unsigned n_row, unsigned n_col);
7091 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7092 __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7094 Note that the elements of a newly created matrix may have arbitrary values.
7095 The elements can be changed and inspected using the following functions.
7097 int isl_mat_rows(__isl_keep isl_mat *mat);
7098 int isl_mat_cols(__isl_keep isl_mat *mat);
7099 __isl_give isl_val *isl_mat_get_element_val(
7100 __isl_keep isl_mat *mat, int row, int col);
7101 __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7102 int row, int col, int v);
7103 __isl_give isl_mat *isl_mat_set_element_val(
7104 __isl_take isl_mat *mat, int row, int col,
7105 __isl_take isl_val *v);
7107 C<isl_mat_get_element> will return a negative value if anything went wrong.
7108 In that case, the value of C<*v> is undefined.
7110 The following function can be used to compute the (right) inverse
7111 of a matrix, i.e., a matrix such that the product of the original
7112 and the inverse (in that order) is a multiple of the identity matrix.
7113 The input matrix is assumed to be of full row-rank.
7115 __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7117 The following function can be used to compute the (right) kernel
7118 (or null space) of a matrix, i.e., a matrix such that the product of
7119 the original and the kernel (in that order) is the zero matrix.
7121 __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7123 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7125 The following functions determine
7126 an upper or lower bound on a quasipolynomial over its domain.
7128 __isl_give isl_pw_qpolynomial_fold *
7129 isl_pw_qpolynomial_bound(
7130 __isl_take isl_pw_qpolynomial *pwqp,
7131 enum isl_fold type, int *tight);
7133 __isl_give isl_union_pw_qpolynomial_fold *
7134 isl_union_pw_qpolynomial_bound(
7135 __isl_take isl_union_pw_qpolynomial *upwqp,
7136 enum isl_fold type, int *tight);
7138 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7139 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7140 is the returned bound is known be tight, i.e., for each value
7141 of the parameters there is at least
7142 one element in the domain that reaches the bound.
7143 If the domain of C<pwqp> is not wrapping, then the bound is computed
7144 over all elements in that domain and the result has a purely parametric
7145 domain. If the domain of C<pwqp> is wrapping, then the bound is
7146 computed over the range of the wrapped relation. The domain of the
7147 wrapped relation becomes the domain of the result.
7149 =head2 Parametric Vertex Enumeration
7151 The parametric vertex enumeration described in this section
7152 is mainly intended to be used internally and by the C<barvinok>
7155 #include <isl/vertices.h>
7156 __isl_give isl_vertices *isl_basic_set_compute_vertices(
7157 __isl_keep isl_basic_set *bset);
7159 The function C<isl_basic_set_compute_vertices> performs the
7160 actual computation of the parametric vertices and the chamber
7161 decomposition and store the result in an C<isl_vertices> object.
7162 This information can be queried by either iterating over all
7163 the vertices or iterating over all the chambers or cells
7164 and then iterating over all vertices that are active on the chamber.
7166 int isl_vertices_foreach_vertex(
7167 __isl_keep isl_vertices *vertices,
7168 int (*fn)(__isl_take isl_vertex *vertex, void *user),
7171 int isl_vertices_foreach_cell(
7172 __isl_keep isl_vertices *vertices,
7173 int (*fn)(__isl_take isl_cell *cell, void *user),
7175 int isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7176 int (*fn)(__isl_take isl_vertex *vertex, void *user),
7179 Other operations that can be performed on an C<isl_vertices> object are
7182 int isl_vertices_get_n_vertices(
7183 __isl_keep isl_vertices *vertices);
7184 void isl_vertices_free(__isl_take isl_vertices *vertices);
7186 Vertices can be inspected and destroyed using the following functions.
7188 int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7189 __isl_give isl_basic_set *isl_vertex_get_domain(
7190 __isl_keep isl_vertex *vertex);
7191 __isl_give isl_multi_aff *isl_vertex_get_expr(
7192 __isl_keep isl_vertex *vertex);
7193 void isl_vertex_free(__isl_take isl_vertex *vertex);
7195 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7196 describing the vertex in terms of the parameters,
7197 while C<isl_vertex_get_domain> returns the activity domain
7200 Chambers can be inspected and destroyed using the following functions.
7202 __isl_give isl_basic_set *isl_cell_get_domain(
7203 __isl_keep isl_cell *cell);
7204 void isl_cell_free(__isl_take isl_cell *cell);
7206 =head1 Polyhedral Compilation Library
7208 This section collects functionality in C<isl> that has been specifically
7209 designed for use during polyhedral compilation.
7211 =head2 Schedule Trees
7213 A schedule tree is a structured representation of a schedule,
7214 assigning a relative order to a set of domain elements.
7215 The relative order expressed by the schedule tree is
7216 defined recursively. In particular, the order between
7217 two domain elements is determined by the node that is closest
7218 to the root that refers to both elements and that orders them apart.
7219 Each node in the tree is of one of several types.
7220 The root node is always of type C<isl_schedule_node_domain>
7221 and it describes the domain elements to which the schedule applies.
7222 The other types of nodes are as follows.
7226 =item C<isl_schedule_node_band>
7228 A band of schedule dimensions. Each schedule dimension is represented
7229 by a union piecewise quasi-affine expression. If this expression
7230 assigns a different value to two domain elements, while all previous
7231 schedule dimensions in the same band assign them the same value,
7232 then the two domain elements are ordered according to these two
7235 =item C<isl_schedule_node_filter>
7237 A filter node does not impose any ordering, but rather intersects
7238 the set of domain elements that the current subtree refers to
7239 with a given union set. The subtree of the filter node only
7240 refers to domain elements in the intersection.
7241 A filter node is typically only used a child of a sequence or
7244 =item C<isl_schedule_node_leaf>
7246 A leaf of the schedule tree. Leaf nodes do not impose any ordering.
7248 =item C<isl_schedule_node_sequence>
7250 A sequence node has one or more children, each of which is a filter node.
7251 The filters on these filter nodes form a partition of
7252 the domain elements that the current subtree refers to.
7253 If two domain elements appear in distinct filters then the sequence
7254 node orders them according to the child positions of the corresponding
7257 =item C<isl_schedule_node_set>
7259 A set node is similar to a sequence node, except that
7260 it expresses that domain elements appearing in distinct filters
7261 may have any order. The order of the children of a set node
7262 is therefore also immaterial.
7266 A schedule tree is encapsulated in an C<isl_schedule> object.
7267 The simplest such objects, those with a tree consisting of single domain node,
7268 can be created using the following functions with either an empty
7269 domain or a given domain.
7271 #include <isl/schedule.h>
7272 __isl_give isl_schedule *isl_schedule_empty(
7273 __isl_take isl_space *space);
7274 __isl_give isl_schedule *isl_schedule_from_domain(
7275 __isl_take isl_union_set *domain);
7277 The function C<isl_schedule_constraints_compute_schedule> described
7278 in L</"Scheduling"> can also be used to construct schedules.
7280 C<isl_schedule> objects may be copied and freed using the following functions.
7282 #include <isl/schedule.h>
7283 __isl_give isl_schedule *isl_schedule_copy(
7284 __isl_keep isl_schedule *sched);
7285 __isl_null isl_schedule *isl_schedule_free(
7286 __isl_take isl_schedule *sched);
7288 The following functions checks whether two C<isl_schedule> objects
7289 are obviously the same.
7291 #include <isl/schedule.h>
7292 int isl_schedule_plain_is_equal(
7293 __isl_keep isl_schedule *schedule1,
7294 __isl_keep isl_schedule *schedule2);
7296 The domain of the schedule, i.e., the domain described by the root node,
7297 can be obtained using the following function.
7299 #include <isl/schedule.h>
7300 __isl_give isl_union_set *isl_schedule_get_domain(
7301 __isl_keep isl_schedule *schedule);
7303 An extra top-level band node (right underneath the domain node) can
7304 be introduced into the schedule using the following function.
7306 #include <isl/schedule.h>
7307 __isl_give isl_schedule *
7308 isl_schedule_insert_partial_schedule(
7309 __isl_take isl_schedule *schedule,
7310 __isl_take isl_multi_union_pw_aff *partial);
7312 A schedule that combines two schedules either in the given
7313 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
7314 or an C<isl_schedule_node_set> node,
7315 can be created using the following functions.
7317 #include <isl/schedule.h>
7318 __isl_give isl_schedule *isl_schedule_sequence(
7319 __isl_take isl_schedule *schedule1,
7320 __isl_take isl_schedule *schedule2);
7321 __isl_give isl_schedule *isl_schedule_set(
7322 __isl_take isl_schedule *schedule1,
7323 __isl_take isl_schedule *schedule2);
7325 The domains of the two input schedules need to be disjoint.
7327 The following function resets the user pointers on all parameter
7328 and tuple identifiers referenced by the nodes of the given schedule.
7330 #include <isl/schedule.h>
7331 __isl_give isl_schedule *isl_schedule_reset_user(
7332 __isl_take isl_schedule *schedule);
7334 The following function aligns the parameters of all nodes
7335 in the given schedule to the given space.
7337 #include <isl/schedule.h>
7338 __isl_give isl_schedule *isl_schedule_align_params(
7339 __isl_take isl_schedule *schedule,
7340 __isl_take isl_space *space);
7342 An C<isl_union_map> representation of the schedule can be obtained
7343 from an C<isl_schedule> using the following function.
7345 #include <isl/schedule.h>
7346 __isl_give isl_union_map *isl_schedule_get_map(
7347 __isl_keep isl_schedule *sched);
7349 The resulting relation encodes the same relative ordering as
7350 the schedule by mapping the domain elements to a common schedule space.
7351 If the schedule_separate_components option is set, then the order
7352 of the children of a set node is explicitly encoded in the result.
7354 Schedules can be read from input using the following functions.
7356 #include <isl/schedule.h>
7357 __isl_give isl_schedule *isl_schedule_read_from_file(
7358 isl_ctx *ctx, FILE *input);
7359 __isl_give isl_schedule *isl_schedule_read_from_str(
7360 isl_ctx *ctx, const char *str);
7362 A representation of the schedule can be printed using
7364 #include <isl/schedule.h>
7365 __isl_give isl_printer *isl_printer_print_schedule(
7366 __isl_take isl_printer *p,
7367 __isl_keep isl_schedule *schedule);
7369 The schedule tree can be traversed through the use of
7370 C<isl_schedule_node> objects that point to a particular
7371 position in the schedule tree. Whenever a C<isl_schedule_node>
7372 is use to modify a node in the schedule tree, the original schedule
7373 tree is left untouched and the modifications are performed to a copy
7374 of the tree. The returned C<isl_schedule_node> then points to
7375 this modified copy of the tree.
7377 The root of the schedule tree can be obtained using the following function.
7379 #include <isl/schedule.h>
7380 __isl_give isl_schedule_node *isl_schedule_get_root(
7381 __isl_keep isl_schedule *schedule);
7383 A pointer to a newly created schedule tree with a single domain
7384 node can be created using the following function.
7386 #include <isl/schedule_node.h>
7387 __isl_give isl_schedule_node *
7388 isl_schedule_node_from_domain(
7389 __isl_take isl_union_set *domain);
7391 Schedule nodes can be copied and freed using the following functions.
7393 #include <isl/schedule_node.h>
7394 __isl_give isl_schedule_node *isl_schedule_node_copy(
7395 __isl_keep isl_schedule_node *node);
7396 __isl_null isl_schedule_node *isl_schedule_node_free(
7397 __isl_take isl_schedule_node *node);
7399 The following functions can be used to check if two schedule
7400 nodes point to the same position in the same schedule.
7402 #include <isl/schedule_node.h>
7403 int isl_schedule_node_is_equal(
7404 __isl_keep isl_schedule_node *node1,
7405 __isl_keep isl_schedule_node *node2);
7407 The following properties can be obtained from a schedule node.
7409 #include <isl/schedule_node.h>
7410 enum isl_schedule_node_type isl_schedule_node_get_type(
7411 __isl_keep isl_schedule_node *node);
7412 enum isl_schedule_node_type
7413 isl_schedule_node_get_parent_type(
7414 __isl_keep isl_schedule_node *node);
7415 __isl_give isl_schedule *isl_schedule_node_get_schedule(
7416 __isl_keep isl_schedule_node *node);
7418 The function C<isl_schedule_node_get_type> returns the type of
7419 the node, while C<isl_schedule_node_get_parent_type> returns
7420 type of the parent of the node, which is required to exist.
7421 The function C<isl_schedule_node_get_schedule> returns a copy
7422 to the schedule to which the node belongs.
7424 The following functions can be used to move the schedule node
7425 to a different position in the tree or to check if such a position
7428 #include <isl/schedule_node.h>
7429 int isl_schedule_node_has_parent(
7430 __isl_keep isl_schedule_node *node);
7431 __isl_give isl_schedule_node *isl_schedule_node_parent(
7432 __isl_take isl_schedule_node *node);
7433 __isl_give isl_schedule_node *isl_schedule_node_root(
7434 __isl_take isl_schedule_node *node);
7435 __isl_give isl_schedule_node *isl_schedule_node_ancestor(
7436 __isl_take isl_schedule_node *node,
7438 int isl_schedule_node_n_children(
7439 __isl_keep isl_schedule_node *node);
7440 __isl_give isl_schedule_node *isl_schedule_node_child(
7441 __isl_take isl_schedule_node *node, int pos);
7442 int isl_schedule_node_has_children(
7443 __isl_keep isl_schedule_node *node);
7444 __isl_give isl_schedule_node *isl_schedule_node_first_child(
7445 __isl_take isl_schedule_node *node);
7446 int isl_schedule_node_has_previous_sibling(
7447 __isl_keep isl_schedule_node *node);
7448 __isl_give isl_schedule_node *
7449 isl_schedule_node_previous_sibling(
7450 __isl_take isl_schedule_node *node);
7451 int isl_schedule_node_has_next_sibling(
7452 __isl_keep isl_schedule_node *node);
7453 __isl_give isl_schedule_node *
7454 isl_schedule_node_next_sibling(
7455 __isl_take isl_schedule_node *node);
7457 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
7458 is the node itself, the ancestor of generation 1 is its parent and so on.
7460 It is also possible to query the number of ancestors of a node,
7461 the position of the current node
7462 within the children of its parent or to obtain a copy of a given
7463 child without destroying the current node.
7465 #include <isl/schedule_node.h>
7466 int isl_schedule_node_get_tree_depth(
7467 __isl_keep isl_schedule_node *node);
7468 int isl_schedule_node_get_child_position(
7469 __isl_keep isl_schedule_node *node);
7470 __isl_give isl_schedule_node *isl_schedule_node_get_child(
7471 __isl_keep isl_schedule_node *node, int pos);
7473 All nodes in a schedule tree or
7474 all descendants of a specific node (including the node) can be visited
7475 in depth-first pre-order using the following functions.
7477 #include <isl/schedule.h>
7478 int isl_schedule_foreach_schedule_node(
7479 __isl_keep isl_schedule *sched,
7480 int (*fn)(__isl_keep isl_schedule_node *node,
7481 void *user), void *user);
7483 #include <isl/schedule_node.h>
7484 int isl_schedule_node_foreach_descendant(
7485 __isl_keep isl_schedule_node *node,
7486 int (*fn)(__isl_keep isl_schedule_node *node,
7487 void *user), void *user);
7489 The callback function is slightly different from the usual
7490 callbacks in that it not only indicates success (non-negative result)
7491 or failure (negative result), but also indicates whether the children
7492 of the given node should be visited. In particular, if the callback
7493 returns a positive value, then the children are visited, but if
7494 the callback returns zero, then the children are not visited.
7496 The following functions allows for a depth-first post-order
7497 traversal of the nodes in a schedule tree or
7498 of the descendants of a specific node (including the node
7499 itself), where the user callback is allowed to modify the
7502 #include <isl/schedule.h>
7503 __isl_give isl_schedule *isl_schedule_map_schedule_node(
7504 __isl_take isl_schedule *schedule,
7505 __isl_give isl_schedule_node *(*fn)(
7506 __isl_take isl_schedule_node *node,
7507 void *user), void *user);
7509 #include <isl/schedule_node.h>
7510 __isl_give isl_schedule_node *
7511 isl_schedule_node_map_descendant(
7512 __isl_take isl_schedule_node *node,
7513 __isl_give isl_schedule_node *(*fn)(
7514 __isl_take isl_schedule_node *node,
7515 void *user), void *user);
7517 The traversal continues from the node returned by the callback function.
7518 It is the responsibility of the user to ensure that this does not
7519 lead to an infinite loop. It is safest to always return a pointer
7520 to the same position (same ancestors and child positions) as the input node.
7522 The following function resets the user pointers on all parameter
7523 and tuple identifiers referenced by the given schedule node.
7525 #include <isl/schedule_node.h>
7526 __isl_give isl_schedule_node *isl_schedule_node_reset_user(
7527 __isl_take isl_schedule_node *node);
7529 The following function aligns the parameters of the given schedule
7530 node to the given space.
7532 #include <isl/schedule_node.h>
7533 __isl_give isl_schedule_node *
7534 isl_schedule_node_align_params(
7535 __isl_take isl_schedule_node *node,
7536 __isl_take isl_space *space);
7538 Several node types have their own functions for querying
7539 (and in some cases setting) some node type specific properties.
7541 #include <isl/schedule_node.h>
7542 __isl_give isl_space *isl_schedule_node_band_get_space(
7543 __isl_keep isl_schedule_node *node);
7544 __isl_give isl_multi_union_pw_aff *
7545 isl_schedule_node_band_get_partial_schedule(
7546 __isl_keep isl_schedule_node *node);
7547 __isl_give isl_union_map *
7548 isl_schedule_node_band_get_partial_schedule_union_map(
7549 __isl_keep isl_schedule_node *node);
7550 unsigned isl_schedule_node_band_n_member(
7551 __isl_keep isl_schedule_node *node);
7552 int isl_schedule_node_band_member_get_coincident(
7553 __isl_keep isl_schedule_node *node, int pos);
7554 __isl_give isl_schedule_node *
7555 isl_schedule_node_band_member_set_coincident(
7556 __isl_take isl_schedule_node *node, int pos,
7558 int isl_schedule_node_band_get_permutable(
7559 __isl_keep isl_schedule_node *node);
7560 __isl_give isl_schedule_node *
7561 isl_schedule_node_band_set_permutable(
7562 __isl_take isl_schedule_node *node, int permutable);
7564 The function C<isl_schedule_node_band_get_space> returns the space
7565 of the partial schedule of the band.
7566 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
7567 returns a representation of the partial schedule of the band node
7568 in the form of an C<isl_union_map>.
7569 The coincident and permutable properties are set by
7570 C<isl_schedule_constraints_compute_schedule> on the schedule tree
7572 A scheduling dimension is considered to be ``coincident''
7573 if it satisfies the coincidence constraints within its band.
7574 That is, if the dependence distances of the coincidence
7575 constraints are all zero in that direction (for fixed
7576 iterations of outer bands).
7577 A band is marked permutable if it was produced using the Pluto-like scheduler.
7578 Note that the scheduler may have to resort to a Feautrier style scheduling
7579 step even if the default scheduler is used.
7581 #include <isl/schedule_node.h>
7582 __isl_give isl_union_set *
7583 isl_schedule_node_domain_get_domain(
7584 __isl_keep isl_schedule_node *node);
7586 #include <isl/schedule_node.h>
7587 __isl_give isl_union_set *
7588 isl_schedule_node_filter_get_filter(
7589 __isl_keep isl_schedule_node *node);
7591 The following functions can be used to obtain an C<isl_union_pw_multi_aff>
7592 or C<isl_union_map> representation of partial schedules related to the node.
7594 #include <isl/schedule_node.h>
7595 __isl_give isl_union_pw_multi_aff *
7596 isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
7597 __isl_keep isl_schedule_node *node);
7598 __isl_give isl_union_map *
7599 isl_schedule_node_get_prefix_schedule_union_map(
7600 __isl_keep isl_schedule_node *node);
7601 __isl_give isl_union_map *
7602 isl_schedule_node_get_subtree_schedule_union_map(
7603 __isl_keep isl_schedule_node *node);
7605 In particular, the functions
7606 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
7607 and C<isl_schedule_node_get_prefix_schedule_union_map>
7608 return a relative ordering on the domain elements that reach the given
7609 node determined by its ancestors.
7610 The function C<isl_schedule_node_get_subtree_schedule_union_map>
7611 returns a representation of the partial schedule defined by the
7612 subtree rooted at the given node.
7614 The following function returns the union of universes in the spaces that
7615 contain elements that reach the given node.
7617 #include <isl/schedule_node.h>
7618 __isl_give isl_union_set *
7619 isl_schedule_node_get_universe_domain(
7620 __isl_keep isl_schedule_node *node);
7622 The following functions can be used to introduce additional nodes
7623 in the schedule tree. The new node is introduced at the point
7624 in the tree where the C<isl_schedule_node> points to and
7625 the results points to the new node.
7627 #include <isl/schedule_node.h>
7628 __isl_give isl_schedule_node *
7629 isl_schedule_node_insert_partial_schedule(
7630 __isl_take isl_schedule_node *node,
7631 __isl_take isl_multi_union_pw_aff *schedule);
7633 This function inserts a new band node with (the greatest integer
7634 part of) the given partial schedule.
7636 #include <isl/schedule_node.h>
7637 __isl_give isl_schedule_node *
7638 isl_schedule_node_insert_filter(
7639 __isl_take isl_schedule_node *node,
7640 __isl_take isl_union_set *filter);
7642 This function inserts a new filter node with the given filter.
7643 If the original node already pointed to a filter node, then the
7644 two filter nodes are merged into one.
7646 #include <isl/schedule_node.h>
7647 __isl_give isl_schedule_node *
7648 isl_schedule_node_insert_sequence(
7649 __isl_take isl_schedule_node *node,
7650 __isl_take isl_union_set_list *filters);
7651 __isl_give isl_schedule_node *
7652 isl_schedule_node_insert_set(
7653 __isl_take isl_schedule_node *node,
7654 __isl_take isl_union_set_list *filters);
7656 These functions insert a new sequence or set node with the given
7657 filters as children.
7659 The partial schedule of a band node can be scaled (down) using
7660 the following functions.
7662 #include <isl/schedule_node.h>
7663 __isl_give isl_schedule_node *
7664 isl_schedule_node_band_scale(
7665 __isl_take isl_schedule_node *node,
7666 __isl_take isl_multi_val *mv);
7667 __isl_give isl_schedule_node *
7668 isl_schedule_node_band_scale_down(
7669 __isl_take isl_schedule_node *node,
7670 __isl_take isl_multi_val *mv);
7672 The spaces of the two arguments need to match.
7673 After scaling, the partial schedule is replaced by its greatest
7674 integer part to ensure that the schedule remains integral.
7676 A band node can be tiled using the following function.
7678 #include <isl/schedule_node.h>
7679 __isl_give isl_schedule_node *isl_schedule_node_band_tile(
7680 __isl_take isl_schedule_node *node,
7681 __isl_take isl_multi_val *sizes);
7683 int isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
7685 int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
7686 int isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
7688 int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
7690 The C<isl_schedule_node_band_tile> function tiles
7691 the band using the given tile sizes inside its schedule.
7692 A new child band node is created to represent the point loops and it is
7693 inserted between the modified band and its children.
7694 The C<tile_scale_tile_loops> option specifies whether the tile
7695 loops iterators should be scaled by the tile sizes.
7696 If the C<tile_shift_point_loops> option is set, then the point loops
7697 are shifted to start at zero.
7699 A band node can be split into two nested band nodes
7700 using the following function.
7702 #include <isl/schedule_node.h>
7703 __isl_give isl_schedule_node *isl_schedule_node_band_split(
7704 __isl_take isl_schedule_node *node, int pos);
7706 The resulting outer band node contains the first C<pos> dimensions of
7707 the schedule of C<node> while the inner band contains the remaining dimensions.
7708 The schedules of the two band nodes live in anonymous spaces.
7710 A band node can be moved down to the leaves of the subtree rooted
7711 at the band node using the following function.
7713 #include <isl/schedule_node.h>
7714 __isl_give isl_schedule_node *isl_schedule_node_band_sink(
7715 __isl_take isl_schedule_node *node);
7717 The result points to the node in the resulting tree that is in the same
7718 position as the node pointed to by C<node> in the original tree.
7720 A representation of the schedule node can be printed using
7722 #include <isl/schedule_node.h>
7723 __isl_give isl_printer *isl_printer_print_schedule_node(
7724 __isl_take isl_printer *p,
7725 __isl_keep isl_schedule_node *node);
7727 =head2 Dependence Analysis
7729 C<isl> contains specialized functionality for performing
7730 array dataflow analysis. That is, given a I<sink> access relation
7731 and a collection of possible I<source> access relations,
7732 C<isl> can compute relations that describe
7733 for each iteration of the sink access, which iteration
7734 of which of the source access relations was the last
7735 to access the same data element before the given iteration
7737 The resulting dependence relations map source iterations
7738 to the corresponding sink iterations.
7739 To compute standard flow dependences, the sink should be
7740 a read, while the sources should be writes.
7741 If any of the source accesses are marked as being I<may>
7742 accesses, then there will be a dependence from the last
7743 I<must> access B<and> from any I<may> access that follows
7744 this last I<must> access.
7745 In particular, if I<all> sources are I<may> accesses,
7746 then memory based dependence analysis is performed.
7747 If, on the other hand, all sources are I<must> accesses,
7748 then value based dependence analysis is performed.
7750 #include <isl/flow.h>
7752 typedef int (*isl_access_level_before)(void *first, void *second);
7754 __isl_give isl_access_info *isl_access_info_alloc(
7755 __isl_take isl_map *sink,
7756 void *sink_user, isl_access_level_before fn,
7758 __isl_give isl_access_info *isl_access_info_add_source(
7759 __isl_take isl_access_info *acc,
7760 __isl_take isl_map *source, int must,
7762 __isl_null isl_access_info *isl_access_info_free(
7763 __isl_take isl_access_info *acc);
7765 __isl_give isl_flow *isl_access_info_compute_flow(
7766 __isl_take isl_access_info *acc);
7768 int isl_flow_foreach(__isl_keep isl_flow *deps,
7769 int (*fn)(__isl_take isl_map *dep, int must,
7770 void *dep_user, void *user),
7772 __isl_give isl_map *isl_flow_get_no_source(
7773 __isl_keep isl_flow *deps, int must);
7774 void isl_flow_free(__isl_take isl_flow *deps);
7776 The function C<isl_access_info_compute_flow> performs the actual
7777 dependence analysis. The other functions are used to construct
7778 the input for this function or to read off the output.
7780 The input is collected in an C<isl_access_info>, which can
7781 be created through a call to C<isl_access_info_alloc>.
7782 The arguments to this functions are the sink access relation
7783 C<sink>, a token C<sink_user> used to identify the sink
7784 access to the user, a callback function for specifying the
7785 relative order of source and sink accesses, and the number
7786 of source access relations that will be added.
7787 The callback function has type C<int (*)(void *first, void *second)>.
7788 The function is called with two user supplied tokens identifying
7789 either a source or the sink and it should return the shared nesting
7790 level and the relative order of the two accesses.
7791 In particular, let I<n> be the number of loops shared by
7792 the two accesses. If C<first> precedes C<second> textually,
7793 then the function should return I<2 * n + 1>; otherwise,
7794 it should return I<2 * n>.
7795 The sources can be added to the C<isl_access_info> by performing
7796 (at most) C<max_source> calls to C<isl_access_info_add_source>.
7797 C<must> indicates whether the source is a I<must> access
7798 or a I<may> access. Note that a multi-valued access relation
7799 should only be marked I<must> if every iteration in the domain
7800 of the relation accesses I<all> elements in its image.
7801 The C<source_user> token is again used to identify
7802 the source access. The range of the source access relation
7803 C<source> should have the same dimension as the range
7804 of the sink access relation.
7805 The C<isl_access_info_free> function should usually not be
7806 called explicitly, because it is called implicitly by
7807 C<isl_access_info_compute_flow>.
7809 The result of the dependence analysis is collected in an
7810 C<isl_flow>. There may be elements of
7811 the sink access for which no preceding source access could be
7812 found or for which all preceding sources are I<may> accesses.
7813 The relations containing these elements can be obtained through
7814 calls to C<isl_flow_get_no_source>, the first with C<must> set
7815 and the second with C<must> unset.
7816 In the case of standard flow dependence analysis,
7817 with the sink a read and the sources I<must> writes,
7818 the first relation corresponds to the reads from uninitialized
7819 array elements and the second relation is empty.
7820 The actual flow dependences can be extracted using
7821 C<isl_flow_foreach>. This function will call the user-specified
7822 callback function C<fn> for each B<non-empty> dependence between
7823 a source and the sink. The callback function is called
7824 with four arguments, the actual flow dependence relation
7825 mapping source iterations to sink iterations, a boolean that
7826 indicates whether it is a I<must> or I<may> dependence, a token
7827 identifying the source and an additional C<void *> with value
7828 equal to the third argument of the C<isl_flow_foreach> call.
7829 A dependence is marked I<must> if it originates from a I<must>
7830 source and if it is not followed by any I<may> sources.
7832 After finishing with an C<isl_flow>, the user should call
7833 C<isl_flow_free> to free all associated memory.
7835 A higher-level interface to dependence analysis is provided
7836 by the following function.
7838 #include <isl/flow.h>
7840 int isl_union_map_compute_flow(__isl_take isl_union_map *sink,
7841 __isl_take isl_union_map *must_source,
7842 __isl_take isl_union_map *may_source,
7843 __isl_take isl_union_map *schedule,
7844 __isl_give isl_union_map **must_dep,
7845 __isl_give isl_union_map **may_dep,
7846 __isl_give isl_union_map **must_no_source,
7847 __isl_give isl_union_map **may_no_source);
7849 The arrays are identified by the tuple names of the ranges
7850 of the accesses. The iteration domains by the tuple names
7851 of the domains of the accesses and of the schedule.
7852 The relative order of the iteration domains is given by the
7853 schedule. The relations returned through C<must_no_source>
7854 and C<may_no_source> are subsets of C<sink>.
7855 Any of C<must_dep>, C<may_dep>, C<must_no_source>
7856 or C<may_no_source> may be C<NULL>, but a C<NULL> value for
7857 any of the other arguments is treated as an error.
7859 =head3 Interaction with Dependence Analysis
7861 During the dependence analysis, we frequently need to perform
7862 the following operation. Given a relation between sink iterations
7863 and potential source iterations from a particular source domain,
7864 what is the last potential source iteration corresponding to each
7865 sink iteration. It can sometimes be convenient to adjust
7866 the set of potential source iterations before or after each such operation.
7867 The prototypical example is fuzzy array dataflow analysis,
7868 where we need to analyze if, based on data-dependent constraints,
7869 the sink iteration can ever be executed without one or more of
7870 the corresponding potential source iterations being executed.
7871 If so, we can introduce extra parameters and select an unknown
7872 but fixed source iteration from the potential source iterations.
7873 To be able to perform such manipulations, C<isl> provides the following
7876 #include <isl/flow.h>
7878 typedef __isl_give isl_restriction *(*isl_access_restrict)(
7879 __isl_keep isl_map *source_map,
7880 __isl_keep isl_set *sink, void *source_user,
7882 __isl_give isl_access_info *isl_access_info_set_restrict(
7883 __isl_take isl_access_info *acc,
7884 isl_access_restrict fn, void *user);
7886 The function C<isl_access_info_set_restrict> should be called
7887 before calling C<isl_access_info_compute_flow> and registers a callback function
7888 that will be called any time C<isl> is about to compute the last
7889 potential source. The first argument is the (reverse) proto-dependence,
7890 mapping sink iterations to potential source iterations.
7891 The second argument represents the sink iterations for which
7892 we want to compute the last source iteration.
7893 The third argument is the token corresponding to the source
7894 and the final argument is the token passed to C<isl_access_info_set_restrict>.
7895 The callback is expected to return a restriction on either the input or
7896 the output of the operation computing the last potential source.
7897 If the input needs to be restricted then restrictions are needed
7898 for both the source and the sink iterations. The sink iterations
7899 and the potential source iterations will be intersected with these sets.
7900 If the output needs to be restricted then only a restriction on the source
7901 iterations is required.
7902 If any error occurs, the callback should return C<NULL>.
7903 An C<isl_restriction> object can be created, freed and inspected
7904 using the following functions.
7906 #include <isl/flow.h>
7908 __isl_give isl_restriction *isl_restriction_input(
7909 __isl_take isl_set *source_restr,
7910 __isl_take isl_set *sink_restr);
7911 __isl_give isl_restriction *isl_restriction_output(
7912 __isl_take isl_set *source_restr);
7913 __isl_give isl_restriction *isl_restriction_none(
7914 __isl_take isl_map *source_map);
7915 __isl_give isl_restriction *isl_restriction_empty(
7916 __isl_take isl_map *source_map);
7917 __isl_null isl_restriction *isl_restriction_free(
7918 __isl_take isl_restriction *restr);
7920 C<isl_restriction_none> and C<isl_restriction_empty> are special
7921 cases of C<isl_restriction_input>. C<isl_restriction_none>
7922 is essentially equivalent to
7924 isl_restriction_input(isl_set_universe(
7925 isl_space_range(isl_map_get_space(source_map))),
7927 isl_space_domain(isl_map_get_space(source_map))));
7929 whereas C<isl_restriction_empty> is essentially equivalent to
7931 isl_restriction_input(isl_set_empty(
7932 isl_space_range(isl_map_get_space(source_map))),
7934 isl_space_domain(isl_map_get_space(source_map))));
7938 B<The functionality described in this section is fairly new
7939 and may be subject to change.>
7941 #include <isl/schedule.h>
7942 __isl_give isl_schedule *
7943 isl_schedule_constraints_compute_schedule(
7944 __isl_take isl_schedule_constraints *sc);
7946 The function C<isl_schedule_constraints_compute_schedule> can be
7947 used to compute a schedule that satisfies the given schedule constraints.
7948 These schedule constraints include the iteration domain for which
7949 a schedule should be computed and dependences between pairs of
7950 iterations. In particular, these dependences include
7951 I<validity> dependences and I<proximity> dependences.
7952 By default, the algorithm used to construct the schedule is similar
7953 to that of C<Pluto>.
7954 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
7956 The generated schedule respects all validity dependences.
7957 That is, all dependence distances over these dependences in the
7958 scheduled space are lexicographically positive.
7959 The default algorithm tries to ensure that the dependence distances
7960 over coincidence constraints are zero and to minimize the
7961 dependence distances over proximity dependences.
7962 Moreover, it tries to obtain sequences (bands) of schedule dimensions
7963 for groups of domains where the dependence distances over validity
7964 dependences have only non-negative values.
7965 When using Feautrier's algorithm, the coincidence and proximity constraints
7966 are only taken into account during the extension to a
7967 full-dimensional schedule.
7969 An C<isl_schedule_constraints> object can be constructed
7970 and manipulated using the following functions.
7972 #include <isl/schedule.h>
7973 __isl_give isl_schedule_constraints *
7974 isl_schedule_constraints_copy(
7975 __isl_keep isl_schedule_constraints *sc);
7976 __isl_give isl_schedule_constraints *
7977 isl_schedule_constraints_on_domain(
7978 __isl_take isl_union_set *domain);
7979 __isl_give isl_schedule_constraints *
7980 isl_schedule_constraints_set_context(
7981 __isl_take isl_schedule_constraints *sc,
7982 __isl_take isl_set *context);
7983 __isl_give isl_schedule_constraints *
7984 isl_schedule_constraints_set_validity(
7985 __isl_take isl_schedule_constraints *sc,
7986 __isl_take isl_union_map *validity);
7987 __isl_give isl_schedule_constraints *
7988 isl_schedule_constraints_set_coincidence(
7989 __isl_take isl_schedule_constraints *sc,
7990 __isl_take isl_union_map *coincidence);
7991 __isl_give isl_schedule_constraints *
7992 isl_schedule_constraints_set_proximity(
7993 __isl_take isl_schedule_constraints *sc,
7994 __isl_take isl_union_map *proximity);
7995 __isl_give isl_schedule_constraints *
7996 isl_schedule_constraints_set_conditional_validity(
7997 __isl_take isl_schedule_constraints *sc,
7998 __isl_take isl_union_map *condition,
7999 __isl_take isl_union_map *validity);
8000 __isl_null isl_schedule_constraints *
8001 isl_schedule_constraints_free(
8002 __isl_take isl_schedule_constraints *sc);
8004 The initial C<isl_schedule_constraints> object created by
8005 C<isl_schedule_constraints_on_domain> does not impose any constraints.
8006 That is, it has an empty set of dependences.
8007 The function C<isl_schedule_constraints_set_context> allows the user
8008 to specify additional constraints on the parameters that may
8009 be assumed to hold during the construction of the schedule.
8010 The function C<isl_schedule_constraints_set_validity> replaces the
8011 validity dependences, mapping domain elements I<i> to domain
8012 elements that should be scheduled after I<i>.
8013 The function C<isl_schedule_constraints_set_coincidence> replaces the
8014 coincidence dependences, mapping domain elements I<i> to domain
8015 elements that should be scheduled together with I<I>, if possible.
8016 The function C<isl_schedule_constraints_set_proximity> replaces the
8017 proximity dependences, mapping domain elements I<i> to domain
8018 elements that should be scheduled either before I<I>
8019 or as early as possible after I<i>.
8021 The function C<isl_schedule_constraints_set_conditional_validity>
8022 replaces the conditional validity constraints.
8023 A conditional validity constraint is only imposed when any of the corresponding
8024 conditions is satisfied, i.e., when any of them is non-zero.
8025 That is, the scheduler ensures that within each band if the dependence
8026 distances over the condition constraints are not all zero
8027 then all corresponding conditional validity constraints are respected.
8028 A conditional validity constraint corresponds to a condition
8029 if the two are adjacent, i.e., if the domain of one relation intersect
8030 the range of the other relation.
8031 The typical use case of conditional validity constraints is
8032 to allow order constraints between live ranges to be violated
8033 as long as the live ranges themselves are local to the band.
8034 To allow more fine-grained control over which conditions correspond
8035 to which conditional validity constraints, the domains and ranges
8036 of these relations may include I<tags>. That is, the domains and
8037 ranges of those relation may themselves be wrapped relations
8038 where the iteration domain appears in the domain of those wrapped relations
8039 and the range of the wrapped relations can be arbitrarily chosen
8040 by the user. Conditions and conditional validity constraints are only
8041 considered adjacent to each other if the entire wrapped relation matches.
8042 In particular, a relation with a tag will never be considered adjacent
8043 to a relation without a tag.
8045 The following function computes a schedule directly from
8046 an iteration domain and validity and proximity dependences
8047 and is implemented in terms of the functions described above.
8048 The use of C<isl_union_set_compute_schedule> is discouraged.
8050 #include <isl/schedule.h>
8051 __isl_give isl_schedule *isl_union_set_compute_schedule(
8052 __isl_take isl_union_set *domain,
8053 __isl_take isl_union_map *validity,
8054 __isl_take isl_union_map *proximity);
8056 The generated schedule represents a schedule tree.
8057 For more information on schedule trees, see
8058 L</"Schedule Trees">.
8062 #include <isl/schedule.h>
8063 int isl_options_set_schedule_max_coefficient(
8064 isl_ctx *ctx, int val);
8065 int isl_options_get_schedule_max_coefficient(
8067 int isl_options_set_schedule_max_constant_term(
8068 isl_ctx *ctx, int val);
8069 int isl_options_get_schedule_max_constant_term(
8071 int isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
8072 int isl_options_get_schedule_fuse(isl_ctx *ctx);
8073 int isl_options_set_schedule_maximize_band_depth(
8074 isl_ctx *ctx, int val);
8075 int isl_options_get_schedule_maximize_band_depth(
8077 int isl_options_set_schedule_outer_coincidence(
8078 isl_ctx *ctx, int val);
8079 int isl_options_get_schedule_outer_coincidence(
8081 int isl_options_set_schedule_split_scaled(
8082 isl_ctx *ctx, int val);
8083 int isl_options_get_schedule_split_scaled(
8085 int isl_options_set_schedule_algorithm(
8086 isl_ctx *ctx, int val);
8087 int isl_options_get_schedule_algorithm(
8089 int isl_options_set_schedule_separate_components(
8090 isl_ctx *ctx, int val);
8091 int isl_options_get_schedule_separate_components(
8096 =item * schedule_max_coefficient
8098 This option enforces that the coefficients for variable and parameter
8099 dimensions in the calculated schedule are not larger than the specified value.
8100 This option can significantly increase the speed of the scheduling calculation
8101 and may also prevent fusing of unrelated dimensions. A value of -1 means that
8102 this option does not introduce bounds on the variable or parameter
8105 =item * schedule_max_constant_term
8107 This option enforces that the constant coefficients in the calculated schedule
8108 are not larger than the maximal constant term. This option can significantly
8109 increase the speed of the scheduling calculation and may also prevent fusing of
8110 unrelated dimensions. A value of -1 means that this option does not introduce
8111 bounds on the constant coefficients.
8113 =item * schedule_fuse
8115 This option controls the level of fusion.
8116 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
8117 resulting schedule will be distributed as much as possible.
8118 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
8119 try to fuse loops in the resulting schedule.
8121 =item * schedule_maximize_band_depth
8123 If this option is set, we do not split bands at the point
8124 where we detect splitting is necessary. Instead, we
8125 backtrack and split bands as early as possible. This
8126 reduces the number of splits and maximizes the width of
8127 the bands. Wider bands give more possibilities for tiling.
8128 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
8129 then bands will be split as early as possible, even if there is no need.
8130 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
8132 =item * schedule_outer_coincidence
8134 If this option is set, then we try to construct schedules
8135 where the outermost scheduling dimension in each band
8136 satisfies the coincidence constraints.
8138 =item * schedule_split_scaled
8140 If this option is set, then we try to construct schedules in which the
8141 constant term is split off from the linear part if the linear parts of
8142 the scheduling rows for all nodes in the graphs have a common non-trivial
8144 The constant term is then placed in a separate band and the linear
8147 =item * schedule_algorithm
8149 Selects the scheduling algorithm to be used.
8150 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
8151 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
8153 =item * schedule_separate_components
8155 If this option is set then the function C<isl_schedule_get_map>
8156 will treat set nodes in the same way as sequence nodes.
8160 =head2 AST Generation
8162 This section describes the C<isl> functionality for generating
8163 ASTs that visit all the elements
8164 in a domain in an order specified by a schedule.
8165 In particular, given a C<isl_union_map>, an AST is generated
8166 that visits all the elements in the domain of the C<isl_union_map>
8167 according to the lexicographic order of the corresponding image
8168 element(s). If the range of the C<isl_union_map> consists of
8169 elements in more than one space, then each of these spaces is handled
8170 separately in an arbitrary order.
8171 It should be noted that the image elements only specify the I<order>
8172 in which the corresponding domain elements should be visited.
8173 No direct relation between the image elements and the loop iterators
8174 in the generated AST should be assumed.
8176 Each AST is generated within a build. The initial build
8177 simply specifies the constraints on the parameters (if any)
8178 and can be created, inspected, copied and freed using the following functions.
8180 #include <isl/ast_build.h>
8181 __isl_give isl_ast_build *isl_ast_build_from_context(
8182 __isl_take isl_set *set);
8183 __isl_give isl_ast_build *isl_ast_build_copy(
8184 __isl_keep isl_ast_build *build);
8185 __isl_null isl_ast_build *isl_ast_build_free(
8186 __isl_take isl_ast_build *build);
8188 The C<set> argument is usually a parameter set with zero or more parameters.
8189 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
8190 and L</"Fine-grained Control over AST Generation">.
8191 Finally, the AST itself can be constructed using the following
8194 #include <isl/ast_build.h>
8195 __isl_give isl_ast_node *isl_ast_build_ast_from_schedule(
8196 __isl_keep isl_ast_build *build,
8197 __isl_take isl_union_map *schedule);
8199 =head3 Inspecting the AST
8201 The basic properties of an AST node can be obtained as follows.
8203 #include <isl/ast.h>
8204 enum isl_ast_node_type isl_ast_node_get_type(
8205 __isl_keep isl_ast_node *node);
8207 The type of an AST node is one of
8208 C<isl_ast_node_for>,
8210 C<isl_ast_node_block> or
8211 C<isl_ast_node_user>.
8212 An C<isl_ast_node_for> represents a for node.
8213 An C<isl_ast_node_if> represents an if node.
8214 An C<isl_ast_node_block> represents a compound node.
8215 An C<isl_ast_node_user> represents an expression statement.
8216 An expression statement typically corresponds to a domain element, i.e.,
8217 one of the elements that is visited by the AST.
8219 Each type of node has its own additional properties.
8221 #include <isl/ast.h>
8222 __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
8223 __isl_keep isl_ast_node *node);
8224 __isl_give isl_ast_expr *isl_ast_node_for_get_init(
8225 __isl_keep isl_ast_node *node);
8226 __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
8227 __isl_keep isl_ast_node *node);
8228 __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
8229 __isl_keep isl_ast_node *node);
8230 __isl_give isl_ast_node *isl_ast_node_for_get_body(
8231 __isl_keep isl_ast_node *node);
8232 int isl_ast_node_for_is_degenerate(
8233 __isl_keep isl_ast_node *node);
8235 An C<isl_ast_for> is considered degenerate if it is known to execute
8238 #include <isl/ast.h>
8239 __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
8240 __isl_keep isl_ast_node *node);
8241 __isl_give isl_ast_node *isl_ast_node_if_get_then(
8242 __isl_keep isl_ast_node *node);
8243 int isl_ast_node_if_has_else(
8244 __isl_keep isl_ast_node *node);
8245 __isl_give isl_ast_node *isl_ast_node_if_get_else(
8246 __isl_keep isl_ast_node *node);
8248 __isl_give isl_ast_node_list *
8249 isl_ast_node_block_get_children(
8250 __isl_keep isl_ast_node *node);
8252 __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
8253 __isl_keep isl_ast_node *node);
8255 Each of the returned C<isl_ast_expr>s can in turn be inspected using
8256 the following functions.
8258 #include <isl/ast.h>
8259 enum isl_ast_expr_type isl_ast_expr_get_type(
8260 __isl_keep isl_ast_expr *expr);
8262 The type of an AST expression is one of
8264 C<isl_ast_expr_id> or
8265 C<isl_ast_expr_int>.
8266 An C<isl_ast_expr_op> represents the result of an operation.
8267 An C<isl_ast_expr_id> represents an identifier.
8268 An C<isl_ast_expr_int> represents an integer value.
8270 Each type of expression has its own additional properties.
8272 #include <isl/ast.h>
8273 enum isl_ast_op_type isl_ast_expr_get_op_type(
8274 __isl_keep isl_ast_expr *expr);
8275 int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
8276 __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
8277 __isl_keep isl_ast_expr *expr, int pos);
8278 int isl_ast_node_foreach_ast_op_type(
8279 __isl_keep isl_ast_node *node,
8280 int (*fn)(enum isl_ast_op_type type, void *user),
8283 C<isl_ast_expr_get_op_type> returns the type of the operation
8284 performed. C<isl_ast_expr_get_op_n_arg> returns the number of
8285 arguments. C<isl_ast_expr_get_op_arg> returns the specified
8287 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
8288 C<isl_ast_op_type> that appears in C<node>.
8289 The operation type is one of the following.
8293 =item C<isl_ast_op_and>
8295 Logical I<and> of two arguments.
8296 Both arguments can be evaluated.
8298 =item C<isl_ast_op_and_then>
8300 Logical I<and> of two arguments.
8301 The second argument can only be evaluated if the first evaluates to true.
8303 =item C<isl_ast_op_or>
8305 Logical I<or> of two arguments.
8306 Both arguments can be evaluated.
8308 =item C<isl_ast_op_or_else>
8310 Logical I<or> of two arguments.
8311 The second argument can only be evaluated if the first evaluates to false.
8313 =item C<isl_ast_op_max>
8315 Maximum of two or more arguments.
8317 =item C<isl_ast_op_min>
8319 Minimum of two or more arguments.
8321 =item C<isl_ast_op_minus>
8325 =item C<isl_ast_op_add>
8327 Sum of two arguments.
8329 =item C<isl_ast_op_sub>
8331 Difference of two arguments.
8333 =item C<isl_ast_op_mul>
8335 Product of two arguments.
8337 =item C<isl_ast_op_div>
8339 Exact division. That is, the result is known to be an integer.
8341 =item C<isl_ast_op_fdiv_q>
8343 Result of integer division, rounded towards negative
8346 =item C<isl_ast_op_pdiv_q>
8348 Result of integer division, where dividend is known to be non-negative.
8350 =item C<isl_ast_op_pdiv_r>
8352 Remainder of integer division, where dividend is known to be non-negative.
8354 =item C<isl_ast_op_zdiv_r>
8356 Equal to zero iff the remainder on integer division is zero.
8358 =item C<isl_ast_op_cond>
8360 Conditional operator defined on three arguments.
8361 If the first argument evaluates to true, then the result
8362 is equal to the second argument. Otherwise, the result
8363 is equal to the third argument.
8364 The second and third argument may only be evaluated if
8365 the first argument evaluates to true and false, respectively.
8366 Corresponds to C<a ? b : c> in C.
8368 =item C<isl_ast_op_select>
8370 Conditional operator defined on three arguments.
8371 If the first argument evaluates to true, then the result
8372 is equal to the second argument. Otherwise, the result
8373 is equal to the third argument.
8374 The second and third argument may be evaluated independently
8375 of the value of the first argument.
8376 Corresponds to C<a * b + (1 - a) * c> in C.
8378 =item C<isl_ast_op_eq>
8382 =item C<isl_ast_op_le>
8384 Less than or equal relation.
8386 =item C<isl_ast_op_lt>
8390 =item C<isl_ast_op_ge>
8392 Greater than or equal relation.
8394 =item C<isl_ast_op_gt>
8396 Greater than relation.
8398 =item C<isl_ast_op_call>
8401 The number of arguments of the C<isl_ast_expr> is one more than
8402 the number of arguments in the function call, the first argument
8403 representing the function being called.
8405 =item C<isl_ast_op_access>
8408 The number of arguments of the C<isl_ast_expr> is one more than
8409 the number of index expressions in the array access, the first argument
8410 representing the array being accessed.
8412 =item C<isl_ast_op_member>
8415 This operation has two arguments, a structure and the name of
8416 the member of the structure being accessed.
8420 #include <isl/ast.h>
8421 __isl_give isl_id *isl_ast_expr_get_id(
8422 __isl_keep isl_ast_expr *expr);
8424 Return the identifier represented by the AST expression.
8426 #include <isl/ast.h>
8427 __isl_give isl_val *isl_ast_expr_get_val(
8428 __isl_keep isl_ast_expr *expr);
8430 Return the integer represented by the AST expression.
8432 =head3 Properties of ASTs
8434 #include <isl/ast.h>
8435 int isl_ast_expr_is_equal(__isl_keep isl_ast_expr *expr1,
8436 __isl_keep isl_ast_expr *expr2);
8438 Check if two C<isl_ast_expr>s are equal to each other.
8440 =head3 Manipulating and printing the AST
8442 AST nodes can be copied and freed using the following functions.
8444 #include <isl/ast.h>
8445 __isl_give isl_ast_node *isl_ast_node_copy(
8446 __isl_keep isl_ast_node *node);
8447 __isl_null isl_ast_node *isl_ast_node_free(
8448 __isl_take isl_ast_node *node);
8450 AST expressions can be copied and freed using the following functions.
8452 #include <isl/ast.h>
8453 __isl_give isl_ast_expr *isl_ast_expr_copy(
8454 __isl_keep isl_ast_expr *expr);
8455 __isl_null isl_ast_expr *isl_ast_expr_free(
8456 __isl_take isl_ast_expr *expr);
8458 New AST expressions can be created either directly or within
8459 the context of an C<isl_ast_build>.
8461 #include <isl/ast.h>
8462 __isl_give isl_ast_expr *isl_ast_expr_from_val(
8463 __isl_take isl_val *v);
8464 __isl_give isl_ast_expr *isl_ast_expr_from_id(
8465 __isl_take isl_id *id);
8466 __isl_give isl_ast_expr *isl_ast_expr_neg(
8467 __isl_take isl_ast_expr *expr);
8468 __isl_give isl_ast_expr *isl_ast_expr_address_of(
8469 __isl_take isl_ast_expr *expr);
8470 __isl_give isl_ast_expr *isl_ast_expr_add(
8471 __isl_take isl_ast_expr *expr1,
8472 __isl_take isl_ast_expr *expr2);
8473 __isl_give isl_ast_expr *isl_ast_expr_sub(
8474 __isl_take isl_ast_expr *expr1,
8475 __isl_take isl_ast_expr *expr2);
8476 __isl_give isl_ast_expr *isl_ast_expr_mul(
8477 __isl_take isl_ast_expr *expr1,
8478 __isl_take isl_ast_expr *expr2);
8479 __isl_give isl_ast_expr *isl_ast_expr_div(
8480 __isl_take isl_ast_expr *expr1,
8481 __isl_take isl_ast_expr *expr2);
8482 __isl_give isl_ast_expr *isl_ast_expr_and(
8483 __isl_take isl_ast_expr *expr1,
8484 __isl_take isl_ast_expr *expr2)
8485 __isl_give isl_ast_expr *isl_ast_expr_or(
8486 __isl_take isl_ast_expr *expr1,
8487 __isl_take isl_ast_expr *expr2)
8488 __isl_give isl_ast_expr *isl_ast_expr_eq(
8489 __isl_take isl_ast_expr *expr1,
8490 __isl_take isl_ast_expr *expr2);
8491 __isl_give isl_ast_expr *isl_ast_expr_le(
8492 __isl_take isl_ast_expr *expr1,
8493 __isl_take isl_ast_expr *expr2);
8494 __isl_give isl_ast_expr *isl_ast_expr_lt(
8495 __isl_take isl_ast_expr *expr1,
8496 __isl_take isl_ast_expr *expr2);
8497 __isl_give isl_ast_expr *isl_ast_expr_ge(
8498 __isl_take isl_ast_expr *expr1,
8499 __isl_take isl_ast_expr *expr2);
8500 __isl_give isl_ast_expr *isl_ast_expr_gt(
8501 __isl_take isl_ast_expr *expr1,
8502 __isl_take isl_ast_expr *expr2);
8503 __isl_give isl_ast_expr *isl_ast_expr_access(
8504 __isl_take isl_ast_expr *array,
8505 __isl_take isl_ast_expr_list *indices);
8507 The function C<isl_ast_expr_address_of> can be applied to an
8508 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
8509 to represent the address of the C<isl_ast_expr_access>.
8511 #include <isl/ast_build.h>
8512 __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
8513 __isl_keep isl_ast_build *build,
8514 __isl_take isl_pw_aff *pa);
8515 __isl_give isl_ast_expr *
8516 isl_ast_build_access_from_pw_multi_aff(
8517 __isl_keep isl_ast_build *build,
8518 __isl_take isl_pw_multi_aff *pma);
8519 __isl_give isl_ast_expr *
8520 isl_ast_build_access_from_multi_pw_aff(
8521 __isl_keep isl_ast_build *build,
8522 __isl_take isl_multi_pw_aff *mpa);
8523 __isl_give isl_ast_expr *
8524 isl_ast_build_call_from_pw_multi_aff(
8525 __isl_keep isl_ast_build *build,
8526 __isl_take isl_pw_multi_aff *pma);
8527 __isl_give isl_ast_expr *
8528 isl_ast_build_call_from_multi_pw_aff(
8529 __isl_keep isl_ast_build *build,
8530 __isl_take isl_multi_pw_aff *mpa);
8532 The domains of C<pa>, C<mpa> and C<pma> should correspond
8533 to the schedule space of C<build>.
8534 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
8535 the function being called.
8536 If the accessed space is a nested relation, then it is taken
8537 to represent an access of the member specified by the range
8538 of this nested relation of the structure specified by the domain
8539 of the nested relation.
8541 The following functions can be used to modify an C<isl_ast_expr>.
8543 #include <isl/ast.h>
8544 __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
8545 __isl_take isl_ast_expr *expr, int pos,
8546 __isl_take isl_ast_expr *arg);
8548 Replace the argument of C<expr> at position C<pos> by C<arg>.
8550 #include <isl/ast.h>
8551 __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
8552 __isl_take isl_ast_expr *expr,
8553 __isl_take isl_id_to_ast_expr *id2expr);
8555 The function C<isl_ast_expr_substitute_ids> replaces the
8556 subexpressions of C<expr> of type C<isl_ast_expr_id>
8557 by the corresponding expression in C<id2expr>, if there is any.
8560 User specified data can be attached to an C<isl_ast_node> and obtained
8561 from the same C<isl_ast_node> using the following functions.
8563 #include <isl/ast.h>
8564 __isl_give isl_ast_node *isl_ast_node_set_annotation(
8565 __isl_take isl_ast_node *node,
8566 __isl_take isl_id *annotation);
8567 __isl_give isl_id *isl_ast_node_get_annotation(
8568 __isl_keep isl_ast_node *node);
8570 Basic printing can be performed using the following functions.
8572 #include <isl/ast.h>
8573 __isl_give isl_printer *isl_printer_print_ast_expr(
8574 __isl_take isl_printer *p,
8575 __isl_keep isl_ast_expr *expr);
8576 __isl_give isl_printer *isl_printer_print_ast_node(
8577 __isl_take isl_printer *p,
8578 __isl_keep isl_ast_node *node);
8579 __isl_give char *isl_ast_expr_to_str(
8580 __isl_keep isl_ast_expr *expr);
8582 More advanced printing can be performed using the following functions.
8584 #include <isl/ast.h>
8585 __isl_give isl_printer *isl_ast_op_type_print_macro(
8586 enum isl_ast_op_type type,
8587 __isl_take isl_printer *p);
8588 __isl_give isl_printer *isl_ast_node_print_macros(
8589 __isl_keep isl_ast_node *node,
8590 __isl_take isl_printer *p);
8591 __isl_give isl_printer *isl_ast_node_print(
8592 __isl_keep isl_ast_node *node,
8593 __isl_take isl_printer *p,
8594 __isl_take isl_ast_print_options *options);
8595 __isl_give isl_printer *isl_ast_node_for_print(
8596 __isl_keep isl_ast_node *node,
8597 __isl_take isl_printer *p,
8598 __isl_take isl_ast_print_options *options);
8599 __isl_give isl_printer *isl_ast_node_if_print(
8600 __isl_keep isl_ast_node *node,
8601 __isl_take isl_printer *p,
8602 __isl_take isl_ast_print_options *options);
8604 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
8605 C<isl> may print out an AST that makes use of macros such
8606 as C<floord>, C<min> and C<max>.
8607 C<isl_ast_op_type_print_macro> prints out the macro
8608 corresponding to a specific C<isl_ast_op_type>.
8609 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
8610 for expressions where these macros would be used and prints
8611 out the required macro definitions.
8612 Essentially, C<isl_ast_node_print_macros> calls
8613 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
8614 as function argument.
8615 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
8616 C<isl_ast_node_if_print> print an C<isl_ast_node>
8617 in C<ISL_FORMAT_C>, but allow for some extra control
8618 through an C<isl_ast_print_options> object.
8619 This object can be created using the following functions.
8621 #include <isl/ast.h>
8622 __isl_give isl_ast_print_options *
8623 isl_ast_print_options_alloc(isl_ctx *ctx);
8624 __isl_give isl_ast_print_options *
8625 isl_ast_print_options_copy(
8626 __isl_keep isl_ast_print_options *options);
8627 __isl_null isl_ast_print_options *
8628 isl_ast_print_options_free(
8629 __isl_take isl_ast_print_options *options);
8631 __isl_give isl_ast_print_options *
8632 isl_ast_print_options_set_print_user(
8633 __isl_take isl_ast_print_options *options,
8634 __isl_give isl_printer *(*print_user)(
8635 __isl_take isl_printer *p,
8636 __isl_take isl_ast_print_options *options,
8637 __isl_keep isl_ast_node *node, void *user),
8639 __isl_give isl_ast_print_options *
8640 isl_ast_print_options_set_print_for(
8641 __isl_take isl_ast_print_options *options,
8642 __isl_give isl_printer *(*print_for)(
8643 __isl_take isl_printer *p,
8644 __isl_take isl_ast_print_options *options,
8645 __isl_keep isl_ast_node *node, void *user),
8648 The callback set by C<isl_ast_print_options_set_print_user>
8649 is called whenever a node of type C<isl_ast_node_user> needs to
8651 The callback set by C<isl_ast_print_options_set_print_for>
8652 is called whenever a node of type C<isl_ast_node_for> needs to
8654 Note that C<isl_ast_node_for_print> will I<not> call the
8655 callback set by C<isl_ast_print_options_set_print_for> on the node
8656 on which C<isl_ast_node_for_print> is called, but only on nested
8657 nodes of type C<isl_ast_node_for>. It is therefore safe to
8658 call C<isl_ast_node_for_print> from within the callback set by
8659 C<isl_ast_print_options_set_print_for>.
8661 The following option determines the type to be used for iterators
8662 while printing the AST.
8664 int isl_options_set_ast_iterator_type(
8665 isl_ctx *ctx, const char *val);
8666 const char *isl_options_get_ast_iterator_type(
8669 The AST printer only prints body nodes as blocks if these
8670 blocks cannot be safely omitted.
8671 For example, a C<for> node with one body node will not be
8672 surrounded with braces in C<ISL_FORMAT_C>.
8673 A block will always be printed by setting the following option.
8675 int isl_options_set_ast_always_print_block(isl_ctx *ctx,
8677 int isl_options_get_ast_always_print_block(isl_ctx *ctx);
8681 #include <isl/ast_build.h>
8682 int isl_options_set_ast_build_atomic_upper_bound(
8683 isl_ctx *ctx, int val);
8684 int isl_options_get_ast_build_atomic_upper_bound(
8686 int isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
8688 int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
8689 int isl_options_set_ast_build_exploit_nested_bounds(
8690 isl_ctx *ctx, int val);
8691 int isl_options_get_ast_build_exploit_nested_bounds(
8693 int isl_options_set_ast_build_group_coscheduled(
8694 isl_ctx *ctx, int val);
8695 int isl_options_get_ast_build_group_coscheduled(
8697 int isl_options_set_ast_build_scale_strides(
8698 isl_ctx *ctx, int val);
8699 int isl_options_get_ast_build_scale_strides(
8701 int isl_options_set_ast_build_allow_else(isl_ctx *ctx,
8703 int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
8704 int isl_options_set_ast_build_allow_or(isl_ctx *ctx,
8706 int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
8710 =item * ast_build_atomic_upper_bound
8712 Generate loop upper bounds that consist of the current loop iterator,
8713 an operator and an expression not involving the iterator.
8714 If this option is not set, then the current loop iterator may appear
8715 several times in the upper bound.
8716 For example, when this option is turned off, AST generation
8719 [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
8723 for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
8726 When the option is turned on, the following AST is generated
8728 for (int c0 = 0; c0 <= min(100, n); c0 += 1)
8731 =item * ast_build_prefer_pdiv
8733 If this option is turned off, then the AST generation will
8734 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
8735 operators, but no C<isl_ast_op_pdiv_q> or
8736 C<isl_ast_op_pdiv_r> operators.
8737 If this options is turned on, then C<isl> will try to convert
8738 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
8739 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
8741 =item * ast_build_exploit_nested_bounds
8743 Simplify conditions based on bounds of nested for loops.
8744 In particular, remove conditions that are implied by the fact
8745 that one or more nested loops have at least one iteration,
8746 meaning that the upper bound is at least as large as the lower bound.
8747 For example, when this option is turned off, AST generation
8750 [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
8756 for (int c0 = 0; c0 <= N; c0 += 1)
8757 for (int c1 = 0; c1 <= M; c1 += 1)
8760 When the option is turned on, the following AST is generated
8762 for (int c0 = 0; c0 <= N; c0 += 1)
8763 for (int c1 = 0; c1 <= M; c1 += 1)
8766 =item * ast_build_group_coscheduled
8768 If two domain elements are assigned the same schedule point, then
8769 they may be executed in any order and they may even appear in different
8770 loops. If this options is set, then the AST generator will make
8771 sure that coscheduled domain elements do not appear in separate parts
8772 of the AST. This is useful in case of nested AST generation
8773 if the outer AST generation is given only part of a schedule
8774 and the inner AST generation should handle the domains that are
8775 coscheduled by this initial part of the schedule together.
8776 For example if an AST is generated for a schedule
8778 { A[i] -> [0]; B[i] -> [0] }
8780 then the C<isl_ast_build_set_create_leaf> callback described
8781 below may get called twice, once for each domain.
8782 Setting this option ensures that the callback is only called once
8783 on both domains together.
8785 =item * ast_build_separation_bounds
8787 This option specifies which bounds to use during separation.
8788 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
8789 then all (possibly implicit) bounds on the current dimension will
8790 be used during separation.
8791 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
8792 then only those bounds that are explicitly available will
8793 be used during separation.
8795 =item * ast_build_scale_strides
8797 This option specifies whether the AST generator is allowed
8798 to scale down iterators of strided loops.
8800 =item * ast_build_allow_else
8802 This option specifies whether the AST generator is allowed
8803 to construct if statements with else branches.
8805 =item * ast_build_allow_or
8807 This option specifies whether the AST generator is allowed
8808 to construct if conditions with disjunctions.
8812 =head3 Fine-grained Control over AST Generation
8814 Besides specifying the constraints on the parameters,
8815 an C<isl_ast_build> object can be used to control
8816 various aspects of the AST generation process.
8817 The most prominent way of control is through ``options'',
8818 which can be set using the following function.
8820 #include <isl/ast_build.h>
8821 __isl_give isl_ast_build *
8822 isl_ast_build_set_options(
8823 __isl_take isl_ast_build *control,
8824 __isl_take isl_union_map *options);
8826 The options are encoded in an C<isl_union_map>.
8827 The domain of this union relation refers to the schedule domain,
8828 i.e., the range of the schedule passed to C<isl_ast_build_ast_from_schedule>.
8829 In the case of nested AST generation (see L</"Nested AST Generation">),
8830 the domain of C<options> should refer to the extra piece of the schedule.
8831 That is, it should be equal to the range of the wrapped relation in the
8832 range of the schedule.
8833 The range of the options can consist of elements in one or more spaces,
8834 the names of which determine the effect of the option.
8835 The values of the range typically also refer to the schedule dimension
8836 to which the option applies. In case of nested AST generation
8837 (see L</"Nested AST Generation">), these values refer to the position
8838 of the schedule dimension within the innermost AST generation.
8839 The constraints on the domain elements of
8840 the option should only refer to this dimension and earlier dimensions.
8841 We consider the following spaces.
8845 =item C<separation_class>
8847 This space is a wrapped relation between two one dimensional spaces.
8848 The input space represents the schedule dimension to which the option
8849 applies and the output space represents the separation class.
8850 While constructing a loop corresponding to the specified schedule
8851 dimension(s), the AST generator will try to generate separate loops
8852 for domain elements that are assigned different classes.
8853 If only some of the elements are assigned a class, then those elements
8854 that are not assigned any class will be treated as belonging to a class
8855 that is separate from the explicitly assigned classes.
8856 The typical use case for this option is to separate full tiles from
8858 The other options, described below, are applied after the separation
8861 As an example, consider the separation into full and partial tiles
8862 of a tiling of a triangular domain.
8863 Take, for example, the domain
8865 { A[i,j] : 0 <= i,j and i + j <= 100 }
8867 and a tiling into tiles of 10 by 10. The input to the AST generator
8868 is then the schedule
8870 { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
8873 Without any options, the following AST is generated
8875 for (int c0 = 0; c0 <= 10; c0 += 1)
8876 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
8877 for (int c2 = 10 * c0;
8878 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8880 for (int c3 = 10 * c1;
8881 c3 <= min(10 * c1 + 9, -c2 + 100);
8885 Separation into full and partial tiles can be obtained by assigning
8886 a class, say C<0>, to the full tiles. The full tiles are represented by those
8887 values of the first and second schedule dimensions for which there are
8888 values of the third and fourth dimensions to cover an entire tile.
8889 That is, we need to specify the following option
8891 { [a,b,c,d] -> separation_class[[0]->[0]] :
8892 exists b': 0 <= 10a,10b' and
8893 10a+9+10b'+9 <= 100;
8894 [a,b,c,d] -> separation_class[[1]->[0]] :
8895 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
8899 { [a, b, c, d] -> separation_class[[1] -> [0]] :
8900 a >= 0 and b >= 0 and b <= 8 - a;
8901 [a, b, c, d] -> separation_class[[0] -> [0]] :
8904 With this option, the generated AST is as follows
8907 for (int c0 = 0; c0 <= 8; c0 += 1) {
8908 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
8909 for (int c2 = 10 * c0;
8910 c2 <= 10 * c0 + 9; c2 += 1)
8911 for (int c3 = 10 * c1;
8912 c3 <= 10 * c1 + 9; c3 += 1)
8914 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
8915 for (int c2 = 10 * c0;
8916 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8918 for (int c3 = 10 * c1;
8919 c3 <= min(-c2 + 100, 10 * c1 + 9);
8923 for (int c0 = 9; c0 <= 10; c0 += 1)
8924 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
8925 for (int c2 = 10 * c0;
8926 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
8928 for (int c3 = 10 * c1;
8929 c3 <= min(10 * c1 + 9, -c2 + 100);
8936 This is a single-dimensional space representing the schedule dimension(s)
8937 to which ``separation'' should be applied. Separation tries to split
8938 a loop into several pieces if this can avoid the generation of guards
8940 See also the C<atomic> option.
8944 This is a single-dimensional space representing the schedule dimension(s)
8945 for which the domains should be considered ``atomic''. That is, the
8946 AST generator will make sure that any given domain space will only appear
8947 in a single loop at the specified level.
8949 Consider the following schedule
8951 { a[i] -> [i] : 0 <= i < 10;
8952 b[i] -> [i+1] : 0 <= i < 10 }
8954 If the following option is specified
8956 { [i] -> separate[x] }
8958 then the following AST will be generated
8962 for (int c0 = 1; c0 <= 9; c0 += 1) {
8969 If, on the other hand, the following option is specified
8971 { [i] -> atomic[x] }
8973 then the following AST will be generated
8975 for (int c0 = 0; c0 <= 10; c0 += 1) {
8982 If neither C<atomic> nor C<separate> is specified, then the AST generator
8983 may produce either of these two results or some intermediate form.
8987 This is a single-dimensional space representing the schedule dimension(s)
8988 that should be I<completely> unrolled.
8989 To obtain a partial unrolling, the user should apply an additional
8990 strip-mining to the schedule and fully unroll the inner loop.
8994 Additional control is available through the following functions.
8996 #include <isl/ast_build.h>
8997 __isl_give isl_ast_build *
8998 isl_ast_build_set_iterators(
8999 __isl_take isl_ast_build *control,
9000 __isl_take isl_id_list *iterators);
9002 The function C<isl_ast_build_set_iterators> allows the user to
9003 specify a list of iterator C<isl_id>s to be used as iterators.
9004 If the input schedule is injective, then
9005 the number of elements in this list should be as large as the dimension
9006 of the schedule space, but no direct correspondence should be assumed
9007 between dimensions and elements.
9008 If the input schedule is not injective, then an additional number
9009 of C<isl_id>s equal to the largest dimension of the input domains
9011 If the number of provided C<isl_id>s is insufficient, then additional
9012 names are automatically generated.
9014 #include <isl/ast_build.h>
9015 __isl_give isl_ast_build *
9016 isl_ast_build_set_create_leaf(
9017 __isl_take isl_ast_build *control,
9018 __isl_give isl_ast_node *(*fn)(
9019 __isl_take isl_ast_build *build,
9020 void *user), void *user);
9023 C<isl_ast_build_set_create_leaf> function allows for the
9024 specification of a callback that should be called whenever the AST
9025 generator arrives at an element of the schedule domain.
9026 The callback should return an AST node that should be inserted
9027 at the corresponding position of the AST. The default action (when
9028 the callback is not set) is to continue generating parts of the AST to scan
9029 all the domain elements associated to the schedule domain element
9030 and to insert user nodes, ``calling'' the domain element, for each of them.
9031 The C<build> argument contains the current state of the C<isl_ast_build>.
9032 To ease nested AST generation (see L</"Nested AST Generation">),
9033 all control information that is
9034 specific to the current AST generation such as the options and
9035 the callbacks has been removed from this C<isl_ast_build>.
9036 The callback would typically return the result of a nested
9038 user defined node created using the following function.
9040 #include <isl/ast.h>
9041 __isl_give isl_ast_node *isl_ast_node_alloc_user(
9042 __isl_take isl_ast_expr *expr);
9044 #include <isl/ast_build.h>
9045 __isl_give isl_ast_build *
9046 isl_ast_build_set_at_each_domain(
9047 __isl_take isl_ast_build *build,
9048 __isl_give isl_ast_node *(*fn)(
9049 __isl_take isl_ast_node *node,
9050 __isl_keep isl_ast_build *build,
9051 void *user), void *user);
9052 __isl_give isl_ast_build *
9053 isl_ast_build_set_before_each_for(
9054 __isl_take isl_ast_build *build,
9055 __isl_give isl_id *(*fn)(
9056 __isl_keep isl_ast_build *build,
9057 void *user), void *user);
9058 __isl_give isl_ast_build *
9059 isl_ast_build_set_after_each_for(
9060 __isl_take isl_ast_build *build,
9061 __isl_give isl_ast_node *(*fn)(
9062 __isl_take isl_ast_node *node,
9063 __isl_keep isl_ast_build *build,
9064 void *user), void *user);
9066 The callback set by C<isl_ast_build_set_at_each_domain> will
9067 be called for each domain AST node.
9068 The callbacks set by C<isl_ast_build_set_before_each_for>
9069 and C<isl_ast_build_set_after_each_for> will be called
9070 for each for AST node. The first will be called in depth-first
9071 pre-order, while the second will be called in depth-first post-order.
9072 Since C<isl_ast_build_set_before_each_for> is called before the for
9073 node is actually constructed, it is only passed an C<isl_ast_build>.
9074 The returned C<isl_id> will be added as an annotation (using
9075 C<isl_ast_node_set_annotation>) to the constructed for node.
9076 In particular, if the user has also specified an C<after_each_for>
9077 callback, then the annotation can be retrieved from the node passed to
9078 that callback using C<isl_ast_node_get_annotation>.
9079 All callbacks should C<NULL> on failure.
9080 The given C<isl_ast_build> can be used to create new
9081 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
9082 or C<isl_ast_build_call_from_pw_multi_aff>.
9084 =head3 Nested AST Generation
9086 C<isl> allows the user to create an AST within the context
9087 of another AST. These nested ASTs are created using the
9088 same C<isl_ast_build_ast_from_schedule> function that is used to create the
9089 outer AST. The C<build> argument should be an C<isl_ast_build>
9090 passed to a callback set by
9091 C<isl_ast_build_set_create_leaf>.
9092 The space of the range of the C<schedule> argument should refer
9093 to this build. In particular, the space should be a wrapped
9094 relation and the domain of this wrapped relation should be the
9095 same as that of the range of the schedule returned by
9096 C<isl_ast_build_get_schedule> below.
9097 In practice, the new schedule is typically
9098 created by calling C<isl_union_map_range_product> on the old schedule
9099 and some extra piece of the schedule.
9100 The space of the schedule domain is also available from
9101 the C<isl_ast_build>.
9103 #include <isl/ast_build.h>
9104 __isl_give isl_union_map *isl_ast_build_get_schedule(
9105 __isl_keep isl_ast_build *build);
9106 __isl_give isl_space *isl_ast_build_get_schedule_space(
9107 __isl_keep isl_ast_build *build);
9108 __isl_give isl_ast_build *isl_ast_build_restrict(
9109 __isl_take isl_ast_build *build,
9110 __isl_take isl_set *set);
9112 The C<isl_ast_build_get_schedule> function returns a (partial)
9113 schedule for the domains elements for which part of the AST still needs to
9114 be generated in the current build.
9115 In particular, the domain elements are mapped to those iterations of the loops
9116 enclosing the current point of the AST generation inside which
9117 the domain elements are executed.
9118 No direct correspondence between
9119 the input schedule and this schedule should be assumed.
9120 The space obtained from C<isl_ast_build_get_schedule_space> can be used
9121 to create a set for C<isl_ast_build_restrict> to intersect
9122 with the current build. In particular, the set passed to
9123 C<isl_ast_build_restrict> can have additional parameters.
9124 The ids of the set dimensions in the space returned by
9125 C<isl_ast_build_get_schedule_space> correspond to the
9126 iterators of the already generated loops.
9127 The user should not rely on the ids of the output dimensions
9128 of the relations in the union relation returned by
9129 C<isl_ast_build_get_schedule> having any particular value.
9133 Although C<isl> is mainly meant to be used as a library,
9134 it also contains some basic applications that use some
9135 of the functionality of C<isl>.
9136 The input may be specified in either the L<isl format>
9137 or the L<PolyLib format>.
9139 =head2 C<isl_polyhedron_sample>
9141 C<isl_polyhedron_sample> takes a polyhedron as input and prints
9142 an integer element of the polyhedron, if there is any.
9143 The first column in the output is the denominator and is always
9144 equal to 1. If the polyhedron contains no integer points,
9145 then a vector of length zero is printed.
9149 C<isl_pip> takes the same input as the C<example> program
9150 from the C<piplib> distribution, i.e., a set of constraints
9151 on the parameters, a line containing only -1 and finally a set
9152 of constraints on a parametric polyhedron.
9153 The coefficients of the parameters appear in the last columns
9154 (but before the final constant column).
9155 The output is the lexicographic minimum of the parametric polyhedron.
9156 As C<isl> currently does not have its own output format, the output
9157 is just a dump of the internal state.
9159 =head2 C<isl_polyhedron_minimize>
9161 C<isl_polyhedron_minimize> computes the minimum of some linear
9162 or affine objective function over the integer points in a polyhedron.
9163 If an affine objective function
9164 is given, then the constant should appear in the last column.
9166 =head2 C<isl_polytope_scan>
9168 Given a polytope, C<isl_polytope_scan> prints
9169 all integer points in the polytope.
9171 =head2 C<isl_codegen>
9173 Given a schedule, a context set and an options relation,
9174 C<isl_codegen> prints out an AST that scans the domain elements
9175 of the schedule in the order of their image(s) taking into account
9176 the constraints in the context set.