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 it 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 * The function C<isl_union_pw_multi_aff_add> now consistently
216 computes the sum on the shared definition domain.
217 The function C<isl_union_pw_multi_aff_union_add> has been added
218 to compute the sum on the union of definition domains.
219 The original behavior of C<isl_union_pw_multi_aff_add> was
220 confused and is no longer available.
222 =item * Band forests have been replaced by schedule trees.
224 =item * The function C<isl_union_map_compute_flow> has been
225 replaced by the function C<isl_union_access_info_compute_flow>.
226 Note that the may dependence relation returned by
227 C<isl_union_flow_get_may_dependence> is the union of
228 the two dependence relations returned by
229 C<isl_union_map_compute_flow>. Similarly for the no source relations.
230 The function C<isl_union_map_compute_flow> is still available
231 for backward compatibility, but it will be removed in the future.
233 =item * The function C<isl_basic_set_drop_constraint> has been
236 =item * The function C<isl_ast_build_ast_from_schedule> has been
237 renamed to C<isl_ast_build_node_from_schedule_map>.
238 The original name is still available
239 for backward compatibility, but it will be removed in the future.
241 =item * The C<separation_class> AST generation option has been
244 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
245 have been renamed to C<isl_constraint_alloc_equality> and
246 C<isl_constraint_alloc_inequality>. The original names have been
247 kept for backward compatibility, but they will be removed in the future.
249 =item * The C<schedule_fuse> option has been replaced
250 by the C<schedule_serialize_sccs> option. The effect
251 of setting the C<schedule_fuse> option to C<ISL_SCHEDULE_FUSE_MIN>
252 is now obtained by turning on the C<schedule_serialize_sccs> option.
258 C<isl> is released under the MIT license.
262 Permission is hereby granted, free of charge, to any person obtaining a copy of
263 this software and associated documentation files (the "Software"), to deal in
264 the Software without restriction, including without limitation the rights to
265 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
266 of the Software, and to permit persons to whom the Software is furnished to do
267 so, subject to the following conditions:
269 The above copyright notice and this permission notice shall be included in all
270 copies or substantial portions of the Software.
272 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
273 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
274 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
275 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
276 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
277 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
282 Note that by default C<isl> requires C<GMP>, which is released
283 under the GNU Lesser General Public License (LGPL). This means
284 that code linked against C<isl> is also linked against LGPL code.
286 When configuring with C<--with-int=imath> or C<--with-int=imath-32>, C<isl>
287 will link against C<imath>, a library for exact integer arithmetic released
288 under the MIT license.
292 The source of C<isl> can be obtained either as a tarball
293 or from the git repository. Both are available from
294 L<http://freshmeat.net/projects/isl/>.
295 The installation process depends on how you obtained
298 =head2 Installation from the git repository
302 =item 1 Clone or update the repository
304 The first time the source is obtained, you need to clone
307 git clone git://repo.or.cz/isl.git
309 To obtain updates, you need to pull in the latest changes
313 =item 2 Optionally get C<imath> submodule
315 To build C<isl> with C<imath>, you need to obtain the C<imath>
316 submodule by running in the git source tree of C<isl>
321 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
323 =item 2 Generate C<configure>
329 After performing the above steps, continue
330 with the L<Common installation instructions>.
332 =head2 Common installation instructions
336 =item 1 Obtain C<GMP>
338 By default, building C<isl> requires C<GMP>, including its headers files.
339 Your distribution may not provide these header files by default
340 and you may need to install a package called C<gmp-devel> or something
341 similar. Alternatively, C<GMP> can be built from
342 source, available from L<http://gmplib.org/>.
343 C<GMP> is not needed if you build C<isl> with C<imath>.
347 C<isl> uses the standard C<autoconf> C<configure> script.
352 optionally followed by some configure options.
353 A complete list of options can be obtained by running
357 Below we discuss some of the more common options.
363 Installation prefix for C<isl>
365 =item C<--with-int=[gmp|imath|imath-32]>
367 Select the integer library to be used by C<isl>, the default is C<gmp>.
368 With C<imath-32>, C<isl> will use 32 bit integers, but fall back to C<imath>
369 for values out of the 32 bit range. In most applications, C<isl> will run
370 fastest with the C<imath-32> option, followed by C<gmp> and C<imath>, the
373 =item C<--with-gmp-prefix>
375 Installation prefix for C<GMP> (architecture-independent files).
377 =item C<--with-gmp-exec-prefix>
379 Installation prefix for C<GMP> (architecture-dependent files).
387 =item 4 Install (optional)
393 =head1 Integer Set Library
395 =head2 Memory Management
397 Since a high-level operation on isl objects usually involves
398 several substeps and since the user is usually not interested in
399 the intermediate results, most functions that return a new object
400 will also release all the objects passed as arguments.
401 If the user still wants to use one or more of these arguments
402 after the function call, she should pass along a copy of the
403 object rather than the object itself.
404 The user is then responsible for making sure that the original
405 object gets used somewhere else or is explicitly freed.
407 The arguments and return values of all documented functions are
408 annotated to make clear which arguments are released and which
409 arguments are preserved. In particular, the following annotations
416 C<__isl_give> means that a new object is returned.
417 The user should make sure that the returned pointer is
418 used exactly once as a value for an C<__isl_take> argument.
419 In between, it can be used as a value for as many
420 C<__isl_keep> arguments as the user likes.
421 There is one exception, and that is the case where the
422 pointer returned is C<NULL>. Is this case, the user
423 is free to use it as an C<__isl_take> argument or not.
424 When applied to a C<char *>, the returned pointer needs to be
429 C<__isl_null> means that a C<NULL> value is returned.
433 C<__isl_take> means that the object the argument points to
434 is taken over by the function and may no longer be used
435 by the user as an argument to any other function.
436 The pointer value must be one returned by a function
437 returning an C<__isl_give> pointer.
438 If the user passes in a C<NULL> value, then this will
439 be treated as an error in the sense that the function will
440 not perform its usual operation. However, it will still
441 make sure that all the other C<__isl_take> arguments
446 C<__isl_keep> means that the function will only use the object
447 temporarily. After the function has finished, the user
448 can still use it as an argument to other functions.
449 A C<NULL> value will be treated in the same way as
450 a C<NULL> value for an C<__isl_take> argument.
451 This annotation may also be used on return values of
452 type C<const char *>, in which case the returned pointer should
453 not be freed by the user and is only valid until the object
454 from which it was derived is updated or freed.
458 =head2 Initialization
460 All manipulations of integer sets and relations occur within
461 the context of an C<isl_ctx>.
462 A given C<isl_ctx> can only be used within a single thread.
463 All arguments of a function are required to have been allocated
464 within the same context.
465 There are currently no functions available for moving an object
466 from one C<isl_ctx> to another C<isl_ctx>. This means that
467 there is currently no way of safely moving an object from one
468 thread to another, unless the whole C<isl_ctx> is moved.
470 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
471 freed using C<isl_ctx_free>.
472 All objects allocated within an C<isl_ctx> should be freed
473 before the C<isl_ctx> itself is freed.
475 isl_ctx *isl_ctx_alloc();
476 void isl_ctx_free(isl_ctx *ctx);
478 The user can impose a bound on the number of low-level I<operations>
479 that can be performed by an C<isl_ctx>. This bound can be set and
480 retrieved using the following functions. A bound of zero means that
481 no bound is imposed. The number of operations performed can be
482 reset using C<isl_ctx_reset_operations>. Note that the number
483 of low-level operations needed to perform a high-level computation
484 may differ significantly across different versions
485 of C<isl>, but it should be the same across different platforms
486 for the same version of C<isl>.
488 Warning: This feature is experimental. C<isl> has good support to abort and
489 bail out during the computation, but this feature may exercise error code paths
490 that are normally not used that much. Consequently, it is not unlikely that
491 hidden bugs will be exposed.
493 void isl_ctx_set_max_operations(isl_ctx *ctx,
494 unsigned long max_operations);
495 unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
496 void isl_ctx_reset_operations(isl_ctx *ctx);
498 In order to be able to create an object in the same context
499 as another object, most object types (described later in
500 this document) provide a function to obtain the context
501 in which the object was created.
504 isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
505 isl_ctx *isl_multi_val_get_ctx(
506 __isl_keep isl_multi_val *mv);
509 isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
511 #include <isl/local_space.h>
512 isl_ctx *isl_local_space_get_ctx(
513 __isl_keep isl_local_space *ls);
516 isl_ctx *isl_set_list_get_ctx(
517 __isl_keep isl_set_list *list);
520 isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
521 isl_ctx *isl_multi_aff_get_ctx(
522 __isl_keep isl_multi_aff *maff);
523 isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
524 isl_ctx *isl_pw_multi_aff_get_ctx(
525 __isl_keep isl_pw_multi_aff *pma);
526 isl_ctx *isl_multi_pw_aff_get_ctx(
527 __isl_keep isl_multi_pw_aff *mpa);
528 isl_ctx *isl_union_pw_aff_get_ctx(
529 __isl_keep isl_union_pw_aff *upa);
530 isl_ctx *isl_union_pw_multi_aff_get_ctx(
531 __isl_keep isl_union_pw_multi_aff *upma);
532 isl_ctx *isl_multi_union_pw_aff_get_ctx(
533 __isl_keep isl_multi_union_pw_aff *mupa);
535 #include <isl/id_to_ast_expr.h>
536 isl_ctx *isl_id_to_ast_expr_get_ctx(
537 __isl_keep isl_id_to_ast_expr *id2expr);
539 #include <isl/point.h>
540 isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
543 isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
546 isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
548 #include <isl/vertices.h>
549 isl_ctx *isl_vertices_get_ctx(
550 __isl_keep isl_vertices *vertices);
551 isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
552 isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
554 #include <isl/flow.h>
555 isl_ctx *isl_restriction_get_ctx(
556 __isl_keep isl_restriction *restr);
557 isl_ctx *isl_union_access_info_get_ctx(
558 __isl_keep isl_union_access_info *access);
559 isl_ctx *isl_union_flow_get_ctx(
560 __isl_keep isl_union_flow *flow);
562 #include <isl/schedule.h>
563 isl_ctx *isl_schedule_get_ctx(
564 __isl_keep isl_schedule *sched);
565 isl_ctx *isl_schedule_constraints_get_ctx(
566 __isl_keep isl_schedule_constraints *sc);
568 #include <isl/schedule_node.h>
569 isl_ctx *isl_schedule_node_get_ctx(
570 __isl_keep isl_schedule_node *node);
572 #include <isl/band.h>
573 isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
575 #include <isl/ast_build.h>
576 isl_ctx *isl_ast_build_get_ctx(
577 __isl_keep isl_ast_build *build);
580 isl_ctx *isl_ast_expr_get_ctx(
581 __isl_keep isl_ast_expr *expr);
582 isl_ctx *isl_ast_node_get_ctx(
583 __isl_keep isl_ast_node *node);
587 C<isl> uses two special return types for functions that either return
588 a boolean or that in principle do not return anything.
589 In particular, the C<isl_bool> type has three possible values:
590 C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
591 C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
592 C<isl_bool_error> (a negative integer value), indicating that something
594 The C<isl_stat> type has two possible values:
595 C<isl_stat_ok> (the integer value zero), indicating a successful
597 C<isl_stat_error> (a negative integer value), indicating that something
599 See L</"Error Handling"> for more information on
600 C<isl_bool_error> and C<isl_stat_error>.
604 An C<isl_val> represents an integer value, a rational value
605 or one of three special values, infinity, negative infinity and NaN.
606 Some predefined values can be created using the following functions.
609 __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
610 __isl_give isl_val *isl_val_one(isl_ctx *ctx);
611 __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
612 __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
613 __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
614 __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
616 Specific integer values can be created using the following functions.
619 __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
621 __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
623 __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
624 size_t n, size_t size, const void *chunks);
626 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
627 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
628 The least significant digit is assumed to be stored first.
630 Value objects can be copied and freed using the following functions.
633 __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
634 __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
636 They can be inspected using the following functions.
639 long isl_val_get_num_si(__isl_keep isl_val *v);
640 long isl_val_get_den_si(__isl_keep isl_val *v);
641 __isl_give isl_val *isl_val_get_den_val(
642 __isl_keep isl_val *v);
643 double isl_val_get_d(__isl_keep isl_val *v);
644 size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
646 int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
647 size_t size, void *chunks);
649 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
650 of C<size> bytes needed to store the absolute value of the
652 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
653 which is assumed to have been preallocated by the caller.
654 The least significant digit is stored first.
655 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
656 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
657 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
659 An C<isl_val> can be modified using the following function.
662 __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
665 The following unary properties are defined on C<isl_val>s.
668 int isl_val_sgn(__isl_keep isl_val *v);
669 isl_bool isl_val_is_zero(__isl_keep isl_val *v);
670 isl_bool isl_val_is_one(__isl_keep isl_val *v);
671 isl_bool isl_val_is_negone(__isl_keep isl_val *v);
672 isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
673 isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
674 isl_bool isl_val_is_pos(__isl_keep isl_val *v);
675 isl_bool isl_val_is_neg(__isl_keep isl_val *v);
676 isl_bool isl_val_is_int(__isl_keep isl_val *v);
677 isl_bool isl_val_is_rat(__isl_keep isl_val *v);
678 isl_bool isl_val_is_nan(__isl_keep isl_val *v);
679 isl_bool isl_val_is_infty(__isl_keep isl_val *v);
680 isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
682 Note that the sign of NaN is undefined.
684 The following binary properties are defined on pairs of C<isl_val>s.
687 isl_bool isl_val_lt(__isl_keep isl_val *v1,
688 __isl_keep isl_val *v2);
689 isl_bool isl_val_le(__isl_keep isl_val *v1,
690 __isl_keep isl_val *v2);
691 isl_bool isl_val_gt(__isl_keep isl_val *v1,
692 __isl_keep isl_val *v2);
693 isl_bool isl_val_ge(__isl_keep isl_val *v1,
694 __isl_keep isl_val *v2);
695 isl_bool isl_val_eq(__isl_keep isl_val *v1,
696 __isl_keep isl_val *v2);
697 isl_bool isl_val_ne(__isl_keep isl_val *v1,
698 __isl_keep isl_val *v2);
699 isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
700 __isl_keep isl_val *v2);
702 The function C<isl_val_abs_eq> checks whether its two arguments
703 are equal in absolute value.
705 For integer C<isl_val>s we additionally have the following binary property.
708 isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
709 __isl_keep isl_val *v2);
711 An C<isl_val> can also be compared to an integer using the following
712 function. The result is undefined for NaN.
715 int isl_val_cmp_si(__isl_keep isl_val *v, long i);
717 The following unary operations are available on C<isl_val>s.
720 __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
721 __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
722 __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
723 __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
724 __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
725 __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
726 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
728 The following binary operations are available on C<isl_val>s.
731 __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
732 __isl_take isl_val *v2);
733 __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
734 __isl_take isl_val *v2);
735 __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
736 __isl_take isl_val *v2);
737 __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
739 __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
740 __isl_take isl_val *v2);
741 __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
743 __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
744 __isl_take isl_val *v2);
745 __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
747 __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
748 __isl_take isl_val *v2);
750 On integer values, we additionally have the following operations.
753 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
754 __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
755 __isl_take isl_val *v2);
756 __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
757 __isl_take isl_val *v2);
758 __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
759 __isl_take isl_val *v2, __isl_give isl_val **x,
760 __isl_give isl_val **y);
762 The function C<isl_val_gcdext> returns the greatest common divisor g
763 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
764 that C<*x> * C<v1> + C<*y> * C<v2> = g.
766 =head3 GMP specific functions
768 These functions are only available if C<isl> has been compiled with C<GMP>
771 Specific integer and rational values can be created from C<GMP> values using
772 the following functions.
774 #include <isl/val_gmp.h>
775 __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
777 __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
778 const mpz_t n, const mpz_t d);
780 The numerator and denominator of a rational value can be extracted as
781 C<GMP> values using the following functions.
783 #include <isl/val_gmp.h>
784 int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
785 int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
787 =head2 Sets and Relations
789 C<isl> uses six types of objects for representing sets and relations,
790 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
791 C<isl_union_set> and C<isl_union_map>.
792 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
793 can be described as a conjunction of affine constraints, while
794 C<isl_set> and C<isl_map> represent unions of
795 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
796 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
797 to live in the same space. C<isl_union_set>s and C<isl_union_map>s
798 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
799 where spaces are considered different if they have a different number
800 of dimensions and/or different names (see L<"Spaces">).
801 The difference between sets and relations (maps) is that sets have
802 one set of variables, while relations have two sets of variables,
803 input variables and output variables.
805 =head2 Error Handling
807 C<isl> supports different ways to react in case a runtime error is triggered.
808 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
809 with two maps that have incompatible spaces. There are three possible ways
810 to react on error: to warn, to continue or to abort.
812 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
813 the last error in the corresponding C<isl_ctx> and the function in which the
814 error was triggered returns a value indicating that some error has
815 occurred. In case of functions returning a pointer, this value is
816 C<NULL>. In case of functions returning an C<isl_bool> or an
817 C<isl_stat>, this valus is C<isl_bool_error> or C<isl_stat_error>.
818 An error does not corrupt internal state,
819 such that isl can continue to be used. C<isl> also provides functions to
820 read the last error and to reset the memory that stores the last error. The
821 last error is only stored for information purposes. Its presence does not
822 change the behavior of C<isl>. Hence, resetting an error is not required to
823 continue to use isl, but only to observe new errors.
826 enum isl_error isl_ctx_last_error(isl_ctx *ctx);
827 void isl_ctx_reset_error(isl_ctx *ctx);
829 Another option is to continue on error. This is similar to warn on error mode,
830 except that C<isl> does not print any warning. This allows a program to
831 implement its own error reporting.
833 The last option is to directly abort the execution of the program from within
834 the isl library. This makes it obviously impossible to recover from an error,
835 but it allows to directly spot the error location. By aborting on error,
836 debuggers break at the location the error occurred and can provide a stack
837 trace. Other tools that automatically provide stack traces on abort or that do
838 not want to continue execution after an error was triggered may also prefer to
841 The on error behavior of isl can be specified by calling
842 C<isl_options_set_on_error> or by setting the command line option
843 C<--isl-on-error>. Valid arguments for the function call are
844 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
845 choices for the command line option are C<warn>, C<continue> and C<abort>.
846 It is also possible to query the current error mode.
848 #include <isl/options.h>
849 isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
850 int isl_options_get_on_error(isl_ctx *ctx);
854 Identifiers are used to identify both individual dimensions
855 and tuples of dimensions. They consist of an optional name and an optional
856 user pointer. The name and the user pointer cannot both be C<NULL>, however.
857 Identifiers with the same name but different pointer values
858 are considered to be distinct.
859 Similarly, identifiers with different names but the same pointer value
860 are also considered to be distinct.
861 Equal identifiers are represented using the same object.
862 Pairs of identifiers can therefore be tested for equality using the
864 Identifiers can be constructed, copied, freed, inspected and printed
865 using the following functions.
868 __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
869 __isl_keep const char *name, void *user);
870 __isl_give isl_id *isl_id_set_free_user(
871 __isl_take isl_id *id,
872 __isl_give void (*free_user)(void *user));
873 __isl_give isl_id *isl_id_copy(isl_id *id);
874 __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
876 void *isl_id_get_user(__isl_keep isl_id *id);
877 __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
879 __isl_give isl_printer *isl_printer_print_id(
880 __isl_take isl_printer *p, __isl_keep isl_id *id);
882 The callback set by C<isl_id_set_free_user> is called on the user
883 pointer when the last reference to the C<isl_id> is freed.
884 Note that C<isl_id_get_name> returns a pointer to some internal
885 data structure, so the result can only be used while the
886 corresponding C<isl_id> is alive.
890 Whenever a new set, relation or similar object is created from scratch,
891 the space in which it lives needs to be specified using an C<isl_space>.
892 Each space involves zero or more parameters and zero, one or two
893 tuples of set or input/output dimensions. The parameters and dimensions
894 are identified by an C<isl_dim_type> and a position.
895 The type C<isl_dim_param> refers to parameters,
896 the type C<isl_dim_set> refers to set dimensions (for spaces
897 with a single tuple of dimensions) and the types C<isl_dim_in>
898 and C<isl_dim_out> refer to input and output dimensions
899 (for spaces with two tuples of dimensions).
900 Local spaces (see L</"Local Spaces">) also contain dimensions
901 of type C<isl_dim_div>.
902 Note that parameters are only identified by their position within
903 a given object. Across different objects, parameters are (usually)
904 identified by their names or identifiers. Only unnamed parameters
905 are identified by their positions across objects. The use of unnamed
906 parameters is discouraged.
908 #include <isl/space.h>
909 __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
910 unsigned nparam, unsigned n_in, unsigned n_out);
911 __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
913 __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
914 unsigned nparam, unsigned dim);
915 __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
916 __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
918 The space used for creating a parameter domain
919 needs to be created using C<isl_space_params_alloc>.
920 For other sets, the space
921 needs to be created using C<isl_space_set_alloc>, while
922 for a relation, the space
923 needs to be created using C<isl_space_alloc>.
925 To check whether a given space is that of a set or a map
926 or whether it is a parameter space, use these functions:
928 #include <isl/space.h>
929 isl_bool isl_space_is_params(__isl_keep isl_space *space);
930 isl_bool isl_space_is_set(__isl_keep isl_space *space);
931 isl_bool isl_space_is_map(__isl_keep isl_space *space);
933 Spaces can be compared using the following functions:
935 #include <isl/space.h>
936 isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
937 __isl_keep isl_space *space2);
938 isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
939 __isl_keep isl_space *space2);
940 isl_bool isl_space_is_range(__isl_keep isl_space *space1,
941 __isl_keep isl_space *space2);
942 isl_bool isl_space_tuple_is_equal(
943 __isl_keep isl_space *space1,
944 enum isl_dim_type type1,
945 __isl_keep isl_space *space2,
946 enum isl_dim_type type2);
948 C<isl_space_is_domain> checks whether the first argument is equal
949 to the domain of the second argument. This requires in particular that
950 the first argument is a set space and that the second argument
951 is a map space. C<isl_space_tuple_is_equal> checks whether the given
952 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
953 spaces are the same. That is, it checks if they have the same
954 identifier (if any), the same dimension and the same internal structure
957 It is often useful to create objects that live in the
958 same space as some other object. This can be accomplished
959 by creating the new objects
960 (see L</"Creating New Sets and Relations"> or
961 L</"Functions">) based on the space
962 of the original object.
965 __isl_give isl_space *isl_basic_set_get_space(
966 __isl_keep isl_basic_set *bset);
967 __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
969 #include <isl/union_set.h>
970 __isl_give isl_space *isl_union_set_get_space(
971 __isl_keep isl_union_set *uset);
974 __isl_give isl_space *isl_basic_map_get_space(
975 __isl_keep isl_basic_map *bmap);
976 __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
978 #include <isl/union_map.h>
979 __isl_give isl_space *isl_union_map_get_space(
980 __isl_keep isl_union_map *umap);
982 #include <isl/constraint.h>
983 __isl_give isl_space *isl_constraint_get_space(
984 __isl_keep isl_constraint *constraint);
986 #include <isl/polynomial.h>
987 __isl_give isl_space *isl_qpolynomial_get_domain_space(
988 __isl_keep isl_qpolynomial *qp);
989 __isl_give isl_space *isl_qpolynomial_get_space(
990 __isl_keep isl_qpolynomial *qp);
991 __isl_give isl_space *isl_qpolynomial_fold_get_space(
992 __isl_keep isl_qpolynomial_fold *fold);
993 __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
994 __isl_keep isl_pw_qpolynomial *pwqp);
995 __isl_give isl_space *isl_pw_qpolynomial_get_space(
996 __isl_keep isl_pw_qpolynomial *pwqp);
997 __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
998 __isl_keep isl_pw_qpolynomial_fold *pwf);
999 __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1000 __isl_keep isl_pw_qpolynomial_fold *pwf);
1001 __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1002 __isl_keep isl_union_pw_qpolynomial *upwqp);
1003 __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1004 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1006 #include <isl/val.h>
1007 __isl_give isl_space *isl_multi_val_get_space(
1008 __isl_keep isl_multi_val *mv);
1010 #include <isl/aff.h>
1011 __isl_give isl_space *isl_aff_get_domain_space(
1012 __isl_keep isl_aff *aff);
1013 __isl_give isl_space *isl_aff_get_space(
1014 __isl_keep isl_aff *aff);
1015 __isl_give isl_space *isl_pw_aff_get_domain_space(
1016 __isl_keep isl_pw_aff *pwaff);
1017 __isl_give isl_space *isl_pw_aff_get_space(
1018 __isl_keep isl_pw_aff *pwaff);
1019 __isl_give isl_space *isl_multi_aff_get_domain_space(
1020 __isl_keep isl_multi_aff *maff);
1021 __isl_give isl_space *isl_multi_aff_get_space(
1022 __isl_keep isl_multi_aff *maff);
1023 __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1024 __isl_keep isl_pw_multi_aff *pma);
1025 __isl_give isl_space *isl_pw_multi_aff_get_space(
1026 __isl_keep isl_pw_multi_aff *pma);
1027 __isl_give isl_space *isl_union_pw_aff_get_space(
1028 __isl_keep isl_union_pw_aff *upa);
1029 __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1030 __isl_keep isl_union_pw_multi_aff *upma);
1031 __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1032 __isl_keep isl_multi_pw_aff *mpa);
1033 __isl_give isl_space *isl_multi_pw_aff_get_space(
1034 __isl_keep isl_multi_pw_aff *mpa);
1035 __isl_give isl_space *
1036 isl_multi_union_pw_aff_get_domain_space(
1037 __isl_keep isl_multi_union_pw_aff *mupa);
1038 __isl_give isl_space *
1039 isl_multi_union_pw_aff_get_space(
1040 __isl_keep isl_multi_union_pw_aff *mupa);
1042 #include <isl/point.h>
1043 __isl_give isl_space *isl_point_get_space(
1044 __isl_keep isl_point *pnt);
1046 The number of dimensions of a given type of space
1047 may be read off from a space or an object that lives
1048 in a space using the following functions.
1049 In case of C<isl_space_dim>, type may be
1050 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1051 C<isl_dim_out> (only for relations), C<isl_dim_set>
1052 (only for sets) or C<isl_dim_all>.
1054 #include <isl/space.h>
1055 unsigned isl_space_dim(__isl_keep isl_space *space,
1056 enum isl_dim_type type);
1058 #include <isl/local_space.h>
1059 int isl_local_space_dim(__isl_keep isl_local_space *ls,
1060 enum isl_dim_type type);
1062 #include <isl/set.h>
1063 unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1064 enum isl_dim_type type);
1065 unsigned isl_set_dim(__isl_keep isl_set *set,
1066 enum isl_dim_type type);
1068 #include <isl/union_set.h>
1069 unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1070 enum isl_dim_type type);
1072 #include <isl/map.h>
1073 unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1074 enum isl_dim_type type);
1075 unsigned isl_map_dim(__isl_keep isl_map *map,
1076 enum isl_dim_type type);
1078 #include <isl/union_map.h>
1079 unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1080 enum isl_dim_type type);
1082 #include <isl/val.h>
1083 unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1084 enum isl_dim_type type);
1086 #include <isl/aff.h>
1087 int isl_aff_dim(__isl_keep isl_aff *aff,
1088 enum isl_dim_type type);
1089 unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1090 enum isl_dim_type type);
1091 unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1092 enum isl_dim_type type);
1093 unsigned isl_pw_multi_aff_dim(
1094 __isl_keep isl_pw_multi_aff *pma,
1095 enum isl_dim_type type);
1096 unsigned isl_multi_pw_aff_dim(
1097 __isl_keep isl_multi_pw_aff *mpa,
1098 enum isl_dim_type type);
1099 unsigned isl_union_pw_aff_dim(
1100 __isl_keep isl_union_pw_aff *upa,
1101 enum isl_dim_type type);
1102 unsigned isl_union_pw_multi_aff_dim(
1103 __isl_keep isl_union_pw_multi_aff *upma,
1104 enum isl_dim_type type);
1105 unsigned isl_multi_union_pw_aff_dim(
1106 __isl_keep isl_multi_union_pw_aff *mupa,
1107 enum isl_dim_type type);
1109 #include <isl/polynomial.h>
1110 unsigned isl_union_pw_qpolynomial_dim(
1111 __isl_keep isl_union_pw_qpolynomial *upwqp,
1112 enum isl_dim_type type);
1113 unsigned isl_union_pw_qpolynomial_fold_dim(
1114 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1115 enum isl_dim_type type);
1117 Note that an C<isl_union_set>, an C<isl_union_map>,
1118 an C<isl_union_pw_multi_aff>,
1119 an C<isl_union_pw_qpolynomial> and
1120 an C<isl_union_pw_qpolynomial_fold>
1121 only have parameters.
1123 The identifiers or names of the individual dimensions of spaces
1124 may be set or read off using the following functions on spaces
1125 or objects that live in spaces.
1126 These functions are mostly useful to obtain the identifiers, positions
1127 or names of the parameters. Identifiers of individual dimensions are
1128 essentially only useful for printing. They are ignored by all other
1129 operations and may not be preserved across those operations.
1131 #include <isl/space.h>
1132 __isl_give isl_space *isl_space_set_dim_id(
1133 __isl_take isl_space *space,
1134 enum isl_dim_type type, unsigned pos,
1135 __isl_take isl_id *id);
1136 isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1137 enum isl_dim_type type, unsigned pos);
1138 __isl_give isl_id *isl_space_get_dim_id(
1139 __isl_keep isl_space *space,
1140 enum isl_dim_type type, unsigned pos);
1141 __isl_give isl_space *isl_space_set_dim_name(
1142 __isl_take isl_space *space,
1143 enum isl_dim_type type, unsigned pos,
1144 __isl_keep const char *name);
1145 isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1146 enum isl_dim_type type, unsigned pos);
1147 __isl_keep const char *isl_space_get_dim_name(
1148 __isl_keep isl_space *space,
1149 enum isl_dim_type type, unsigned pos);
1151 #include <isl/local_space.h>
1152 __isl_give isl_local_space *isl_local_space_set_dim_id(
1153 __isl_take isl_local_space *ls,
1154 enum isl_dim_type type, unsigned pos,
1155 __isl_take isl_id *id);
1156 isl_bool isl_local_space_has_dim_id(
1157 __isl_keep isl_local_space *ls,
1158 enum isl_dim_type type, unsigned pos);
1159 __isl_give isl_id *isl_local_space_get_dim_id(
1160 __isl_keep isl_local_space *ls,
1161 enum isl_dim_type type, unsigned pos);
1162 __isl_give isl_local_space *isl_local_space_set_dim_name(
1163 __isl_take isl_local_space *ls,
1164 enum isl_dim_type type, unsigned pos, const char *s);
1165 isl_bool isl_local_space_has_dim_name(
1166 __isl_keep isl_local_space *ls,
1167 enum isl_dim_type type, unsigned pos)
1168 const char *isl_local_space_get_dim_name(
1169 __isl_keep isl_local_space *ls,
1170 enum isl_dim_type type, unsigned pos);
1172 #include <isl/constraint.h>
1173 const char *isl_constraint_get_dim_name(
1174 __isl_keep isl_constraint *constraint,
1175 enum isl_dim_type type, unsigned pos);
1177 #include <isl/set.h>
1178 __isl_give isl_id *isl_basic_set_get_dim_id(
1179 __isl_keep isl_basic_set *bset,
1180 enum isl_dim_type type, unsigned pos);
1181 __isl_give isl_set *isl_set_set_dim_id(
1182 __isl_take isl_set *set, enum isl_dim_type type,
1183 unsigned pos, __isl_take isl_id *id);
1184 isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1185 enum isl_dim_type type, unsigned pos);
1186 __isl_give isl_id *isl_set_get_dim_id(
1187 __isl_keep isl_set *set, enum isl_dim_type type,
1189 const char *isl_basic_set_get_dim_name(
1190 __isl_keep isl_basic_set *bset,
1191 enum isl_dim_type type, unsigned pos);
1192 isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1193 enum isl_dim_type type, unsigned pos);
1194 const char *isl_set_get_dim_name(
1195 __isl_keep isl_set *set,
1196 enum isl_dim_type type, unsigned pos);
1198 #include <isl/map.h>
1199 __isl_give isl_map *isl_map_set_dim_id(
1200 __isl_take isl_map *map, enum isl_dim_type type,
1201 unsigned pos, __isl_take isl_id *id);
1202 isl_bool isl_basic_map_has_dim_id(
1203 __isl_keep isl_basic_map *bmap,
1204 enum isl_dim_type type, unsigned pos);
1205 isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1206 enum isl_dim_type type, unsigned pos);
1207 __isl_give isl_id *isl_map_get_dim_id(
1208 __isl_keep isl_map *map, enum isl_dim_type type,
1210 __isl_give isl_id *isl_union_map_get_dim_id(
1211 __isl_keep isl_union_map *umap,
1212 enum isl_dim_type type, unsigned pos);
1213 const char *isl_basic_map_get_dim_name(
1214 __isl_keep isl_basic_map *bmap,
1215 enum isl_dim_type type, unsigned pos);
1216 isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1217 enum isl_dim_type type, unsigned pos);
1218 const char *isl_map_get_dim_name(
1219 __isl_keep isl_map *map,
1220 enum isl_dim_type type, unsigned pos);
1222 #include <isl/val.h>
1223 __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1224 __isl_take isl_multi_val *mv,
1225 enum isl_dim_type type, unsigned pos,
1226 __isl_take isl_id *id);
1227 __isl_give isl_id *isl_multi_val_get_dim_id(
1228 __isl_keep isl_multi_val *mv,
1229 enum isl_dim_type type, unsigned pos);
1230 __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1231 __isl_take isl_multi_val *mv,
1232 enum isl_dim_type type, unsigned pos, const char *s);
1234 #include <isl/aff.h>
1235 __isl_give isl_aff *isl_aff_set_dim_id(
1236 __isl_take isl_aff *aff, enum isl_dim_type type,
1237 unsigned pos, __isl_take isl_id *id);
1238 __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1239 __isl_take isl_multi_aff *maff,
1240 enum isl_dim_type type, unsigned pos,
1241 __isl_take isl_id *id);
1242 __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1243 __isl_take isl_pw_aff *pma,
1244 enum isl_dim_type type, unsigned pos,
1245 __isl_take isl_id *id);
1246 __isl_give isl_multi_pw_aff *
1247 isl_multi_pw_aff_set_dim_id(
1248 __isl_take isl_multi_pw_aff *mpa,
1249 enum isl_dim_type type, unsigned pos,
1250 __isl_take isl_id *id);
1251 __isl_give isl_multi_union_pw_aff *
1252 isl_multi_union_pw_aff_set_dim_id(
1253 __isl_take isl_multi_union_pw_aff *mupa,
1254 enum isl_dim_type type, unsigned pos,
1255 __isl_take isl_id *id);
1256 __isl_give isl_id *isl_multi_aff_get_dim_id(
1257 __isl_keep isl_multi_aff *ma,
1258 enum isl_dim_type type, unsigned pos);
1259 isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1260 enum isl_dim_type type, unsigned pos);
1261 __isl_give isl_id *isl_pw_aff_get_dim_id(
1262 __isl_keep isl_pw_aff *pa,
1263 enum isl_dim_type type, unsigned pos);
1264 __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1265 __isl_keep isl_pw_multi_aff *pma,
1266 enum isl_dim_type type, unsigned pos);
1267 __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1268 __isl_keep isl_multi_pw_aff *mpa,
1269 enum isl_dim_type type, unsigned pos);
1270 __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1271 __isl_keep isl_multi_union_pw_aff *mupa,
1272 enum isl_dim_type type, unsigned pos);
1273 __isl_give isl_aff *isl_aff_set_dim_name(
1274 __isl_take isl_aff *aff, enum isl_dim_type type,
1275 unsigned pos, const char *s);
1276 __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1277 __isl_take isl_multi_aff *maff,
1278 enum isl_dim_type type, unsigned pos, const char *s);
1279 __isl_give isl_multi_pw_aff *
1280 isl_multi_pw_aff_set_dim_name(
1281 __isl_take isl_multi_pw_aff *mpa,
1282 enum isl_dim_type type, unsigned pos, const char *s);
1283 __isl_give isl_union_pw_aff *
1284 isl_union_pw_aff_set_dim_name(
1285 __isl_take isl_union_pw_aff *upa,
1286 enum isl_dim_type type, unsigned pos,
1288 __isl_give isl_union_pw_multi_aff *
1289 isl_union_pw_multi_aff_set_dim_name(
1290 __isl_take isl_union_pw_multi_aff *upma,
1291 enum isl_dim_type type, unsigned pos,
1293 __isl_give isl_multi_union_pw_aff *
1294 isl_multi_union_pw_aff_set_dim_name(
1295 __isl_take isl_multi_union_pw_aff *mupa,
1296 enum isl_dim_type type, unsigned pos,
1297 const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1298 enum isl_dim_type type, unsigned pos);
1299 const char *isl_pw_aff_get_dim_name(
1300 __isl_keep isl_pw_aff *pa,
1301 enum isl_dim_type type, unsigned pos);
1302 const char *isl_pw_multi_aff_get_dim_name(
1303 __isl_keep isl_pw_multi_aff *pma,
1304 enum isl_dim_type type, unsigned pos);
1306 #include <isl/polynomial.h>
1307 __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1308 __isl_take isl_qpolynomial *qp,
1309 enum isl_dim_type type, unsigned pos,
1311 __isl_give isl_pw_qpolynomial *
1312 isl_pw_qpolynomial_set_dim_name(
1313 __isl_take isl_pw_qpolynomial *pwqp,
1314 enum isl_dim_type type, unsigned pos,
1316 __isl_give isl_pw_qpolynomial_fold *
1317 isl_pw_qpolynomial_fold_set_dim_name(
1318 __isl_take isl_pw_qpolynomial_fold *pwf,
1319 enum isl_dim_type type, unsigned pos,
1321 __isl_give isl_union_pw_qpolynomial *
1322 isl_union_pw_qpolynomial_set_dim_name(
1323 __isl_take isl_union_pw_qpolynomial *upwqp,
1324 enum isl_dim_type type, unsigned pos,
1326 __isl_give isl_union_pw_qpolynomial_fold *
1327 isl_union_pw_qpolynomial_fold_set_dim_name(
1328 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1329 enum isl_dim_type type, unsigned pos,
1332 Note that C<isl_space_get_name> returns a pointer to some internal
1333 data structure, so the result can only be used while the
1334 corresponding C<isl_space> is alive.
1335 Also note that every function that operates on two sets or relations
1336 requires that both arguments have the same parameters. This also
1337 means that if one of the arguments has named parameters, then the
1338 other needs to have named parameters too and the names need to match.
1339 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1340 arguments may have different parameters (as long as they are named),
1341 in which case the result will have as parameters the union of the parameters of
1344 Given the identifier or name of a dimension (typically a parameter),
1345 its position can be obtained from the following functions.
1347 #include <isl/space.h>
1348 int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1349 enum isl_dim_type type, __isl_keep isl_id *id);
1350 int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1351 enum isl_dim_type type, const char *name);
1353 #include <isl/local_space.h>
1354 int isl_local_space_find_dim_by_name(
1355 __isl_keep isl_local_space *ls,
1356 enum isl_dim_type type, const char *name);
1358 #include <isl/val.h>
1359 int isl_multi_val_find_dim_by_id(
1360 __isl_keep isl_multi_val *mv,
1361 enum isl_dim_type type, __isl_keep isl_id *id);
1362 int isl_multi_val_find_dim_by_name(
1363 __isl_keep isl_multi_val *mv,
1364 enum isl_dim_type type, const char *name);
1366 #include <isl/set.h>
1367 int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1368 enum isl_dim_type type, __isl_keep isl_id *id);
1369 int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1370 enum isl_dim_type type, const char *name);
1372 #include <isl/map.h>
1373 int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1374 enum isl_dim_type type, __isl_keep isl_id *id);
1375 int isl_basic_map_find_dim_by_name(
1376 __isl_keep isl_basic_map *bmap,
1377 enum isl_dim_type type, const char *name);
1378 int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1379 enum isl_dim_type type, const char *name);
1380 int isl_union_map_find_dim_by_name(
1381 __isl_keep isl_union_map *umap,
1382 enum isl_dim_type type, const char *name);
1384 #include <isl/aff.h>
1385 int isl_multi_aff_find_dim_by_id(
1386 __isl_keep isl_multi_aff *ma,
1387 enum isl_dim_type type, __isl_keep isl_id *id);
1388 int isl_multi_pw_aff_find_dim_by_id(
1389 __isl_keep isl_multi_pw_aff *mpa,
1390 enum isl_dim_type type, __isl_keep isl_id *id);
1391 int isl_multi_union_pw_aff_find_dim_by_id(
1392 __isl_keep isl_union_multi_pw_aff *mupa,
1393 enum isl_dim_type type, __isl_keep isl_id *id);
1394 int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1395 enum isl_dim_type type, const char *name);
1396 int isl_multi_aff_find_dim_by_name(
1397 __isl_keep isl_multi_aff *ma,
1398 enum isl_dim_type type, const char *name);
1399 int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1400 enum isl_dim_type type, const char *name);
1401 int isl_multi_pw_aff_find_dim_by_name(
1402 __isl_keep isl_multi_pw_aff *mpa,
1403 enum isl_dim_type type, const char *name);
1404 int isl_pw_multi_aff_find_dim_by_name(
1405 __isl_keep isl_pw_multi_aff *pma,
1406 enum isl_dim_type type, const char *name);
1407 int isl_union_pw_aff_find_dim_by_name(
1408 __isl_keep isl_union_pw_aff *upa,
1409 enum isl_dim_type type, const char *name);
1410 int isl_union_pw_multi_aff_find_dim_by_name(
1411 __isl_keep isl_union_pw_multi_aff *upma,
1412 enum isl_dim_type type, const char *name);
1413 int isl_multi_union_pw_aff_find_dim_by_name(
1414 __isl_keep isl_multi_union_pw_aff *mupa,
1415 enum isl_dim_type type, const char *name);
1417 #include <isl/polynomial.h>
1418 int isl_pw_qpolynomial_find_dim_by_name(
1419 __isl_keep isl_pw_qpolynomial *pwqp,
1420 enum isl_dim_type type, const char *name);
1421 int isl_pw_qpolynomial_fold_find_dim_by_name(
1422 __isl_keep isl_pw_qpolynomial_fold *pwf,
1423 enum isl_dim_type type, const char *name);
1424 int isl_union_pw_qpolynomial_find_dim_by_name(
1425 __isl_keep isl_union_pw_qpolynomial *upwqp,
1426 enum isl_dim_type type, const char *name);
1427 int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1428 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1429 enum isl_dim_type type, const char *name);
1431 The identifiers or names of entire spaces may be set or read off
1432 using the following functions.
1434 #include <isl/space.h>
1435 __isl_give isl_space *isl_space_set_tuple_id(
1436 __isl_take isl_space *space,
1437 enum isl_dim_type type, __isl_take isl_id *id);
1438 __isl_give isl_space *isl_space_reset_tuple_id(
1439 __isl_take isl_space *space, enum isl_dim_type type);
1440 isl_bool isl_space_has_tuple_id(
1441 __isl_keep isl_space *space,
1442 enum isl_dim_type type);
1443 __isl_give isl_id *isl_space_get_tuple_id(
1444 __isl_keep isl_space *space, enum isl_dim_type type);
1445 __isl_give isl_space *isl_space_set_tuple_name(
1446 __isl_take isl_space *space,
1447 enum isl_dim_type type, const char *s);
1448 isl_bool isl_space_has_tuple_name(
1449 __isl_keep isl_space *space,
1450 enum isl_dim_type type);
1451 const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1452 enum isl_dim_type type);
1454 #include <isl/local_space.h>
1455 __isl_give isl_local_space *isl_local_space_set_tuple_id(
1456 __isl_take isl_local_space *ls,
1457 enum isl_dim_type type, __isl_take isl_id *id);
1459 #include <isl/set.h>
1460 __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1461 __isl_take isl_basic_set *bset,
1462 __isl_take isl_id *id);
1463 __isl_give isl_set *isl_set_set_tuple_id(
1464 __isl_take isl_set *set, __isl_take isl_id *id);
1465 __isl_give isl_set *isl_set_reset_tuple_id(
1466 __isl_take isl_set *set);
1467 isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1468 __isl_give isl_id *isl_set_get_tuple_id(
1469 __isl_keep isl_set *set);
1470 __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1471 __isl_take isl_basic_set *set, const char *s);
1472 __isl_give isl_set *isl_set_set_tuple_name(
1473 __isl_take isl_set *set, const char *s);
1474 const char *isl_basic_set_get_tuple_name(
1475 __isl_keep isl_basic_set *bset);
1476 isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1477 const char *isl_set_get_tuple_name(
1478 __isl_keep isl_set *set);
1480 #include <isl/map.h>
1481 __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1482 __isl_take isl_basic_map *bmap,
1483 enum isl_dim_type type, __isl_take isl_id *id);
1484 __isl_give isl_map *isl_map_set_tuple_id(
1485 __isl_take isl_map *map, enum isl_dim_type type,
1486 __isl_take isl_id *id);
1487 __isl_give isl_map *isl_map_reset_tuple_id(
1488 __isl_take isl_map *map, enum isl_dim_type type);
1489 isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1490 enum isl_dim_type type);
1491 __isl_give isl_id *isl_map_get_tuple_id(
1492 __isl_keep isl_map *map, enum isl_dim_type type);
1493 __isl_give isl_map *isl_map_set_tuple_name(
1494 __isl_take isl_map *map,
1495 enum isl_dim_type type, const char *s);
1496 const char *isl_basic_map_get_tuple_name(
1497 __isl_keep isl_basic_map *bmap,
1498 enum isl_dim_type type);
1499 __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1500 __isl_take isl_basic_map *bmap,
1501 enum isl_dim_type type, const char *s);
1502 isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1503 enum isl_dim_type type);
1504 const char *isl_map_get_tuple_name(
1505 __isl_keep isl_map *map,
1506 enum isl_dim_type type);
1508 #include <isl/val.h>
1509 __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1510 __isl_take isl_multi_val *mv,
1511 enum isl_dim_type type, __isl_take isl_id *id);
1512 __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1513 __isl_take isl_multi_val *mv,
1514 enum isl_dim_type type);
1515 isl_bool isl_multi_val_has_tuple_id(
1516 __isl_keep isl_multi_val *mv,
1517 enum isl_dim_type type);
1518 __isl_give isl_id *isl_multi_val_get_tuple_id(
1519 __isl_keep isl_multi_val *mv,
1520 enum isl_dim_type type);
1521 __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1522 __isl_take isl_multi_val *mv,
1523 enum isl_dim_type type, const char *s);
1524 const char *isl_multi_val_get_tuple_name(
1525 __isl_keep isl_multi_val *mv,
1526 enum isl_dim_type type);
1528 #include <isl/aff.h>
1529 __isl_give isl_aff *isl_aff_set_tuple_id(
1530 __isl_take isl_aff *aff,
1531 enum isl_dim_type type, __isl_take isl_id *id);
1532 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1533 __isl_take isl_multi_aff *maff,
1534 enum isl_dim_type type, __isl_take isl_id *id);
1535 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1536 __isl_take isl_pw_aff *pwaff,
1537 enum isl_dim_type type, __isl_take isl_id *id);
1538 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1539 __isl_take isl_pw_multi_aff *pma,
1540 enum isl_dim_type type, __isl_take isl_id *id);
1541 __isl_give isl_multi_union_pw_aff *
1542 isl_multi_union_pw_aff_set_tuple_id(
1543 __isl_take isl_multi_union_pw_aff *mupa,
1544 enum isl_dim_type type, __isl_take isl_id *id);
1545 __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1546 __isl_take isl_multi_aff *ma,
1547 enum isl_dim_type type);
1548 __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1549 __isl_take isl_pw_aff *pa,
1550 enum isl_dim_type type);
1551 __isl_give isl_multi_pw_aff *
1552 isl_multi_pw_aff_reset_tuple_id(
1553 __isl_take isl_multi_pw_aff *mpa,
1554 enum isl_dim_type type);
1555 __isl_give isl_pw_multi_aff *
1556 isl_pw_multi_aff_reset_tuple_id(
1557 __isl_take isl_pw_multi_aff *pma,
1558 enum isl_dim_type type);
1559 __isl_give isl_multi_union_pw_aff *
1560 isl_multi_union_pw_aff_reset_tuple_id(
1561 __isl_take isl_multi_union_pw_aff *mupa,
1562 enum isl_dim_type type);
1563 isl_bool isl_multi_aff_has_tuple_id(
1564 __isl_keep isl_multi_aff *ma,
1565 enum isl_dim_type type);
1566 __isl_give isl_id *isl_multi_aff_get_tuple_id(
1567 __isl_keep isl_multi_aff *ma,
1568 enum isl_dim_type type);
1569 isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1570 enum isl_dim_type type);
1571 __isl_give isl_id *isl_pw_aff_get_tuple_id(
1572 __isl_keep isl_pw_aff *pa,
1573 enum isl_dim_type type);
1574 isl_bool isl_pw_multi_aff_has_tuple_id(
1575 __isl_keep isl_pw_multi_aff *pma,
1576 enum isl_dim_type type);
1577 __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1578 __isl_keep isl_pw_multi_aff *pma,
1579 enum isl_dim_type type);
1580 isl_bool isl_multi_pw_aff_has_tuple_id(
1581 __isl_keep isl_multi_pw_aff *mpa,
1582 enum isl_dim_type type);
1583 __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1584 __isl_keep isl_multi_pw_aff *mpa,
1585 enum isl_dim_type type);
1586 isl_bool isl_multi_union_pw_aff_has_tuple_id(
1587 __isl_keep isl_multi_union_pw_aff *mupa,
1588 enum isl_dim_type type);
1589 __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1590 __isl_keep isl_multi_union_pw_aff *mupa,
1591 enum isl_dim_type type);
1592 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1593 __isl_take isl_multi_aff *maff,
1594 enum isl_dim_type type, const char *s);
1595 __isl_give isl_multi_pw_aff *
1596 isl_multi_pw_aff_set_tuple_name(
1597 __isl_take isl_multi_pw_aff *mpa,
1598 enum isl_dim_type type, const char *s);
1599 __isl_give isl_multi_union_pw_aff *
1600 isl_multi_union_pw_aff_set_tuple_name(
1601 __isl_take isl_multi_union_pw_aff *mupa,
1602 enum isl_dim_type type, const char *s);
1603 const char *isl_multi_aff_get_tuple_name(
1604 __isl_keep isl_multi_aff *multi,
1605 enum isl_dim_type type);
1606 isl_bool isl_pw_multi_aff_has_tuple_name(
1607 __isl_keep isl_pw_multi_aff *pma,
1608 enum isl_dim_type type);
1609 const char *isl_pw_multi_aff_get_tuple_name(
1610 __isl_keep isl_pw_multi_aff *pma,
1611 enum isl_dim_type type);
1612 const char *isl_multi_union_pw_aff_get_tuple_name(
1613 __isl_keep isl_multi_union_pw_aff *mupa,
1614 enum isl_dim_type type);
1616 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1617 or C<isl_dim_set>. As with C<isl_space_get_name>,
1618 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1620 Binary operations require the corresponding spaces of their arguments
1621 to have the same name.
1623 To keep the names of all parameters and tuples, but reset the user pointers
1624 of all the corresponding identifiers, use the following function.
1626 #include <isl/space.h>
1627 __isl_give isl_space *isl_space_reset_user(
1628 __isl_take isl_space *space);
1630 #include <isl/set.h>
1631 __isl_give isl_set *isl_set_reset_user(
1632 __isl_take isl_set *set);
1634 #include <isl/map.h>
1635 __isl_give isl_map *isl_map_reset_user(
1636 __isl_take isl_map *map);
1638 #include <isl/union_set.h>
1639 __isl_give isl_union_set *isl_union_set_reset_user(
1640 __isl_take isl_union_set *uset);
1642 #include <isl/union_map.h>
1643 __isl_give isl_union_map *isl_union_map_reset_user(
1644 __isl_take isl_union_map *umap);
1646 #include <isl/val.h>
1647 __isl_give isl_multi_val *isl_multi_val_reset_user(
1648 __isl_take isl_multi_val *mv);
1650 #include <isl/aff.h>
1651 __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1652 __isl_take isl_multi_aff *ma);
1653 __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1654 __isl_take isl_pw_aff *pa);
1655 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1656 __isl_take isl_multi_pw_aff *mpa);
1657 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1658 __isl_take isl_pw_multi_aff *pma);
1659 __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1660 __isl_take isl_union_pw_aff *upa);
1661 __isl_give isl_multi_union_pw_aff *
1662 isl_multi_union_pw_aff_reset_user(
1663 __isl_take isl_multi_union_pw_aff *mupa);
1664 __isl_give isl_union_pw_multi_aff *
1665 isl_union_pw_multi_aff_reset_user(
1666 __isl_take isl_union_pw_multi_aff *upma);
1668 #include <isl/polynomial.h>
1669 __isl_give isl_pw_qpolynomial *
1670 isl_pw_qpolynomial_reset_user(
1671 __isl_take isl_pw_qpolynomial *pwqp);
1672 __isl_give isl_union_pw_qpolynomial *
1673 isl_union_pw_qpolynomial_reset_user(
1674 __isl_take isl_union_pw_qpolynomial *upwqp);
1675 __isl_give isl_pw_qpolynomial_fold *
1676 isl_pw_qpolynomial_fold_reset_user(
1677 __isl_take isl_pw_qpolynomial_fold *pwf);
1678 __isl_give isl_union_pw_qpolynomial_fold *
1679 isl_union_pw_qpolynomial_fold_reset_user(
1680 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1682 Spaces can be nested. In particular, the domain of a set or
1683 the domain or range of a relation can be a nested relation.
1684 This process is also called I<wrapping>.
1685 The functions for detecting, constructing and deconstructing
1686 such nested spaces can be found in the wrapping properties
1687 of L</"Unary Properties">, the wrapping operations
1688 of L</"Unary Operations"> and the Cartesian product operations
1689 of L</"Basic Operations">.
1691 Spaces can be created from other spaces
1692 using the functions described in L</"Unary Operations">
1693 and L</"Binary Operations">.
1697 A local space is essentially a space with
1698 zero or more existentially quantified variables.
1699 The local space of various objects can be obtained
1700 using the following functions.
1702 #include <isl/constraint.h>
1703 __isl_give isl_local_space *isl_constraint_get_local_space(
1704 __isl_keep isl_constraint *constraint);
1706 #include <isl/set.h>
1707 __isl_give isl_local_space *isl_basic_set_get_local_space(
1708 __isl_keep isl_basic_set *bset);
1710 #include <isl/map.h>
1711 __isl_give isl_local_space *isl_basic_map_get_local_space(
1712 __isl_keep isl_basic_map *bmap);
1714 #include <isl/aff.h>
1715 __isl_give isl_local_space *isl_aff_get_domain_local_space(
1716 __isl_keep isl_aff *aff);
1717 __isl_give isl_local_space *isl_aff_get_local_space(
1718 __isl_keep isl_aff *aff);
1720 A new local space can be created from a space using
1722 #include <isl/local_space.h>
1723 __isl_give isl_local_space *isl_local_space_from_space(
1724 __isl_take isl_space *space);
1726 They can be inspected, modified, copied and freed using the following functions.
1728 #include <isl/local_space.h>
1729 isl_bool isl_local_space_is_params(
1730 __isl_keep isl_local_space *ls);
1731 isl_bool isl_local_space_is_set(
1732 __isl_keep isl_local_space *ls);
1733 __isl_give isl_space *isl_local_space_get_space(
1734 __isl_keep isl_local_space *ls);
1735 __isl_give isl_aff *isl_local_space_get_div(
1736 __isl_keep isl_local_space *ls, int pos);
1737 __isl_give isl_local_space *isl_local_space_copy(
1738 __isl_keep isl_local_space *ls);
1739 __isl_null isl_local_space *isl_local_space_free(
1740 __isl_take isl_local_space *ls);
1742 Note that C<isl_local_space_get_div> can only be used on local spaces
1745 Two local spaces can be compared using
1747 isl_bool isl_local_space_is_equal(
1748 __isl_keep isl_local_space *ls1,
1749 __isl_keep isl_local_space *ls2);
1751 Local spaces can be created from other local spaces
1752 using the functions described in L</"Unary Operations">
1753 and L</"Binary Operations">.
1755 =head2 Creating New Sets and Relations
1757 C<isl> has functions for creating some standard sets and relations.
1761 =item * Empty sets and relations
1763 __isl_give isl_basic_set *isl_basic_set_empty(
1764 __isl_take isl_space *space);
1765 __isl_give isl_basic_map *isl_basic_map_empty(
1766 __isl_take isl_space *space);
1767 __isl_give isl_set *isl_set_empty(
1768 __isl_take isl_space *space);
1769 __isl_give isl_map *isl_map_empty(
1770 __isl_take isl_space *space);
1771 __isl_give isl_union_set *isl_union_set_empty(
1772 __isl_take isl_space *space);
1773 __isl_give isl_union_map *isl_union_map_empty(
1774 __isl_take isl_space *space);
1776 For C<isl_union_set>s and C<isl_union_map>s, the space
1777 is only used to specify the parameters.
1779 =item * Universe sets and relations
1781 __isl_give isl_basic_set *isl_basic_set_universe(
1782 __isl_take isl_space *space);
1783 __isl_give isl_basic_map *isl_basic_map_universe(
1784 __isl_take isl_space *space);
1785 __isl_give isl_set *isl_set_universe(
1786 __isl_take isl_space *space);
1787 __isl_give isl_map *isl_map_universe(
1788 __isl_take isl_space *space);
1789 __isl_give isl_union_set *isl_union_set_universe(
1790 __isl_take isl_union_set *uset);
1791 __isl_give isl_union_map *isl_union_map_universe(
1792 __isl_take isl_union_map *umap);
1794 The sets and relations constructed by the functions above
1795 contain all integer values, while those constructed by the
1796 functions below only contain non-negative values.
1798 __isl_give isl_basic_set *isl_basic_set_nat_universe(
1799 __isl_take isl_space *space);
1800 __isl_give isl_basic_map *isl_basic_map_nat_universe(
1801 __isl_take isl_space *space);
1802 __isl_give isl_set *isl_set_nat_universe(
1803 __isl_take isl_space *space);
1804 __isl_give isl_map *isl_map_nat_universe(
1805 __isl_take isl_space *space);
1807 =item * Identity relations
1809 __isl_give isl_basic_map *isl_basic_map_identity(
1810 __isl_take isl_space *space);
1811 __isl_give isl_map *isl_map_identity(
1812 __isl_take isl_space *space);
1814 The number of input and output dimensions in C<space> needs
1817 =item * Lexicographic order
1819 __isl_give isl_map *isl_map_lex_lt(
1820 __isl_take isl_space *set_space);
1821 __isl_give isl_map *isl_map_lex_le(
1822 __isl_take isl_space *set_space);
1823 __isl_give isl_map *isl_map_lex_gt(
1824 __isl_take isl_space *set_space);
1825 __isl_give isl_map *isl_map_lex_ge(
1826 __isl_take isl_space *set_space);
1827 __isl_give isl_map *isl_map_lex_lt_first(
1828 __isl_take isl_space *space, unsigned n);
1829 __isl_give isl_map *isl_map_lex_le_first(
1830 __isl_take isl_space *space, unsigned n);
1831 __isl_give isl_map *isl_map_lex_gt_first(
1832 __isl_take isl_space *space, unsigned n);
1833 __isl_give isl_map *isl_map_lex_ge_first(
1834 __isl_take isl_space *space, unsigned n);
1836 The first four functions take a space for a B<set>
1837 and return relations that express that the elements in the domain
1838 are lexicographically less
1839 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1840 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1841 than the elements in the range.
1842 The last four functions take a space for a map
1843 and return relations that express that the first C<n> dimensions
1844 in the domain are lexicographically less
1845 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1846 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1847 than the first C<n> dimensions in the range.
1851 A basic set or relation can be converted to a set or relation
1852 using the following functions.
1854 __isl_give isl_set *isl_set_from_basic_set(
1855 __isl_take isl_basic_set *bset);
1856 __isl_give isl_map *isl_map_from_basic_map(
1857 __isl_take isl_basic_map *bmap);
1859 Sets and relations can be converted to union sets and relations
1860 using the following functions.
1862 __isl_give isl_union_set *isl_union_set_from_basic_set(
1863 __isl_take isl_basic_set *bset);
1864 __isl_give isl_union_map *isl_union_map_from_basic_map(
1865 __isl_take isl_basic_map *bmap);
1866 __isl_give isl_union_set *isl_union_set_from_set(
1867 __isl_take isl_set *set);
1868 __isl_give isl_union_map *isl_union_map_from_map(
1869 __isl_take isl_map *map);
1871 The inverse conversions below can only be used if the input
1872 union set or relation is known to contain elements in exactly one
1875 __isl_give isl_set *isl_set_from_union_set(
1876 __isl_take isl_union_set *uset);
1877 __isl_give isl_map *isl_map_from_union_map(
1878 __isl_take isl_union_map *umap);
1880 Sets and relations can be copied and freed again using the following
1883 __isl_give isl_basic_set *isl_basic_set_copy(
1884 __isl_keep isl_basic_set *bset);
1885 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1886 __isl_give isl_union_set *isl_union_set_copy(
1887 __isl_keep isl_union_set *uset);
1888 __isl_give isl_basic_map *isl_basic_map_copy(
1889 __isl_keep isl_basic_map *bmap);
1890 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1891 __isl_give isl_union_map *isl_union_map_copy(
1892 __isl_keep isl_union_map *umap);
1893 __isl_null isl_basic_set *isl_basic_set_free(
1894 __isl_take isl_basic_set *bset);
1895 __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1896 __isl_null isl_union_set *isl_union_set_free(
1897 __isl_take isl_union_set *uset);
1898 __isl_null isl_basic_map *isl_basic_map_free(
1899 __isl_take isl_basic_map *bmap);
1900 __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1901 __isl_null isl_union_map *isl_union_map_free(
1902 __isl_take isl_union_map *umap);
1904 Other sets and relations can be constructed by starting
1905 from a universe set or relation, adding equality and/or
1906 inequality constraints and then projecting out the
1907 existentially quantified variables, if any.
1908 Constraints can be constructed, manipulated and
1909 added to (or removed from) (basic) sets and relations
1910 using the following functions.
1912 #include <isl/constraint.h>
1913 __isl_give isl_constraint *isl_constraint_alloc_equality(
1914 __isl_take isl_local_space *ls);
1915 __isl_give isl_constraint *isl_constraint_alloc_inequality(
1916 __isl_take isl_local_space *ls);
1917 __isl_give isl_constraint *isl_constraint_set_constant_si(
1918 __isl_take isl_constraint *constraint, int v);
1919 __isl_give isl_constraint *isl_constraint_set_constant_val(
1920 __isl_take isl_constraint *constraint,
1921 __isl_take isl_val *v);
1922 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1923 __isl_take isl_constraint *constraint,
1924 enum isl_dim_type type, int pos, int v);
1925 __isl_give isl_constraint *
1926 isl_constraint_set_coefficient_val(
1927 __isl_take isl_constraint *constraint,
1928 enum isl_dim_type type, int pos,
1929 __isl_take isl_val *v);
1930 __isl_give isl_basic_map *isl_basic_map_add_constraint(
1931 __isl_take isl_basic_map *bmap,
1932 __isl_take isl_constraint *constraint);
1933 __isl_give isl_basic_set *isl_basic_set_add_constraint(
1934 __isl_take isl_basic_set *bset,
1935 __isl_take isl_constraint *constraint);
1936 __isl_give isl_map *isl_map_add_constraint(
1937 __isl_take isl_map *map,
1938 __isl_take isl_constraint *constraint);
1939 __isl_give isl_set *isl_set_add_constraint(
1940 __isl_take isl_set *set,
1941 __isl_take isl_constraint *constraint);
1943 For example, to create a set containing the even integers
1944 between 10 and 42, you would use the following code.
1947 isl_local_space *ls;
1949 isl_basic_set *bset;
1951 space = isl_space_set_alloc(ctx, 0, 2);
1952 bset = isl_basic_set_universe(isl_space_copy(space));
1953 ls = isl_local_space_from_space(space);
1955 c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
1956 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1957 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1958 bset = isl_basic_set_add_constraint(bset, c);
1960 c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
1961 c = isl_constraint_set_constant_si(c, -10);
1962 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1963 bset = isl_basic_set_add_constraint(bset, c);
1965 c = isl_constraint_alloc_inequality(ls);
1966 c = isl_constraint_set_constant_si(c, 42);
1967 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1968 bset = isl_basic_set_add_constraint(bset, c);
1970 bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1974 isl_basic_set *bset;
1975 bset = isl_basic_set_read_from_str(ctx,
1976 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1978 A basic set or relation can also be constructed from two matrices
1979 describing the equalities and the inequalities.
1981 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1982 __isl_take isl_space *space,
1983 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1984 enum isl_dim_type c1,
1985 enum isl_dim_type c2, enum isl_dim_type c3,
1986 enum isl_dim_type c4);
1987 __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1988 __isl_take isl_space *space,
1989 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1990 enum isl_dim_type c1,
1991 enum isl_dim_type c2, enum isl_dim_type c3,
1992 enum isl_dim_type c4, enum isl_dim_type c5);
1994 The C<isl_dim_type> arguments indicate the order in which
1995 different kinds of variables appear in the input matrices
1996 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1997 C<isl_dim_set> and C<isl_dim_div> for sets and
1998 of C<isl_dim_cst>, C<isl_dim_param>,
1999 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2001 A (basic or union) set or relation can also be constructed from a
2002 (union) (piecewise) (multiple) affine expression
2003 or a list of affine expressions
2004 (See L</"Functions">).
2006 __isl_give isl_basic_map *isl_basic_map_from_aff(
2007 __isl_take isl_aff *aff);
2008 __isl_give isl_map *isl_map_from_aff(
2009 __isl_take isl_aff *aff);
2010 __isl_give isl_set *isl_set_from_pw_aff(
2011 __isl_take isl_pw_aff *pwaff);
2012 __isl_give isl_map *isl_map_from_pw_aff(
2013 __isl_take isl_pw_aff *pwaff);
2014 __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2015 __isl_take isl_space *domain_space,
2016 __isl_take isl_aff_list *list);
2017 __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2018 __isl_take isl_multi_aff *maff)
2019 __isl_give isl_map *isl_map_from_multi_aff(
2020 __isl_take isl_multi_aff *maff)
2021 __isl_give isl_set *isl_set_from_pw_multi_aff(
2022 __isl_take isl_pw_multi_aff *pma);
2023 __isl_give isl_map *isl_map_from_pw_multi_aff(
2024 __isl_take isl_pw_multi_aff *pma);
2025 __isl_give isl_set *isl_set_from_multi_pw_aff(
2026 __isl_take isl_multi_pw_aff *mpa);
2027 __isl_give isl_map *isl_map_from_multi_pw_aff(
2028 __isl_take isl_multi_pw_aff *mpa);
2029 __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2030 __isl_take isl_union_pw_aff *upa);
2031 __isl_give isl_union_map *
2032 isl_union_map_from_union_pw_multi_aff(
2033 __isl_take isl_union_pw_multi_aff *upma);
2034 __isl_give isl_union_map *
2035 isl_union_map_from_multi_union_pw_aff(
2036 __isl_take isl_multi_union_pw_aff *mupa);
2038 The C<domain_space> argument describes the domain of the resulting
2039 basic relation. It is required because the C<list> may consist
2040 of zero affine expressions.
2041 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2042 is not allowed to be zero-dimensional. The domain of the result
2043 is the shared domain of the union piecewise affine elements.
2045 =head2 Inspecting Sets and Relations
2047 Usually, the user should not have to care about the actual constraints
2048 of the sets and maps, but should instead apply the abstract operations
2049 explained in the following sections.
2050 Occasionally, however, it may be required to inspect the individual
2051 coefficients of the constraints. This section explains how to do so.
2052 In these cases, it may also be useful to have C<isl> compute
2053 an explicit representation of the existentially quantified variables.
2055 __isl_give isl_set *isl_set_compute_divs(
2056 __isl_take isl_set *set);
2057 __isl_give isl_map *isl_map_compute_divs(
2058 __isl_take isl_map *map);
2059 __isl_give isl_union_set *isl_union_set_compute_divs(
2060 __isl_take isl_union_set *uset);
2061 __isl_give isl_union_map *isl_union_map_compute_divs(
2062 __isl_take isl_union_map *umap);
2064 This explicit representation defines the existentially quantified
2065 variables as integer divisions of the other variables, possibly
2066 including earlier existentially quantified variables.
2067 An explicitly represented existentially quantified variable therefore
2068 has a unique value when the values of the other variables are known.
2069 If, furthermore, the same existentials, i.e., existentials
2070 with the same explicit representations, should appear in the
2071 same order in each of the disjuncts of a set or map, then the user should call
2072 either of the following functions.
2074 __isl_give isl_set *isl_set_align_divs(
2075 __isl_take isl_set *set);
2076 __isl_give isl_map *isl_map_align_divs(
2077 __isl_take isl_map *map);
2079 Alternatively, the existentially quantified variables can be removed
2080 using the following functions, which compute an overapproximation.
2082 __isl_give isl_basic_set *isl_basic_set_remove_divs(
2083 __isl_take isl_basic_set *bset);
2084 __isl_give isl_basic_map *isl_basic_map_remove_divs(
2085 __isl_take isl_basic_map *bmap);
2086 __isl_give isl_set *isl_set_remove_divs(
2087 __isl_take isl_set *set);
2088 __isl_give isl_map *isl_map_remove_divs(
2089 __isl_take isl_map *map);
2091 It is also possible to only remove those divs that are defined
2092 in terms of a given range of dimensions or only those for which
2093 no explicit representation is known.
2095 __isl_give isl_basic_set *
2096 isl_basic_set_remove_divs_involving_dims(
2097 __isl_take isl_basic_set *bset,
2098 enum isl_dim_type type,
2099 unsigned first, unsigned n);
2100 __isl_give isl_basic_map *
2101 isl_basic_map_remove_divs_involving_dims(
2102 __isl_take isl_basic_map *bmap,
2103 enum isl_dim_type type,
2104 unsigned first, unsigned n);
2105 __isl_give isl_set *isl_set_remove_divs_involving_dims(
2106 __isl_take isl_set *set, enum isl_dim_type type,
2107 unsigned first, unsigned n);
2108 __isl_give isl_map *isl_map_remove_divs_involving_dims(
2109 __isl_take isl_map *map, enum isl_dim_type type,
2110 unsigned first, unsigned n);
2112 __isl_give isl_basic_set *
2113 isl_basic_set_remove_unknown_divs(
2114 __isl_take isl_basic_set *bset);
2115 __isl_give isl_set *isl_set_remove_unknown_divs(
2116 __isl_take isl_set *set);
2117 __isl_give isl_map *isl_map_remove_unknown_divs(
2118 __isl_take isl_map *map);
2120 To iterate over all the sets or maps in a union set or map, use
2122 isl_stat isl_union_set_foreach_set(
2123 __isl_keep isl_union_set *uset,
2124 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2126 isl_stat isl_union_map_foreach_map(
2127 __isl_keep isl_union_map *umap,
2128 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2131 The number of sets or maps in a union set or map can be obtained
2134 int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2135 int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2137 To extract the set or map in a given space from a union, use
2139 __isl_give isl_set *isl_union_set_extract_set(
2140 __isl_keep isl_union_set *uset,
2141 __isl_take isl_space *space);
2142 __isl_give isl_map *isl_union_map_extract_map(
2143 __isl_keep isl_union_map *umap,
2144 __isl_take isl_space *space);
2146 To iterate over all the basic sets or maps in a set or map, use
2148 isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2149 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2152 isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2153 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2157 The callback function C<fn> should return 0 if successful and
2158 -1 if an error occurs. In the latter case, or if any other error
2159 occurs, the above functions will return -1.
2161 It should be noted that C<isl> does not guarantee that
2162 the basic sets or maps passed to C<fn> are disjoint.
2163 If this is required, then the user should call one of
2164 the following functions first.
2166 __isl_give isl_set *isl_set_make_disjoint(
2167 __isl_take isl_set *set);
2168 __isl_give isl_map *isl_map_make_disjoint(
2169 __isl_take isl_map *map);
2171 The number of basic sets in a set can be obtained
2172 or the number of basic maps in a map can be obtained
2175 #include <isl/set.h>
2176 int isl_set_n_basic_set(__isl_keep isl_set *set);
2178 #include <isl/map.h>
2179 int isl_map_n_basic_map(__isl_keep isl_map *map);
2181 It is also possible to obtain a list of basic sets from a set
2183 #include <isl/set.h>
2184 __isl_give isl_basic_set_list *isl_set_get_basic_set_list(
2185 __isl_keep isl_set *set);
2187 The returned list can be manipulated using the functions in L<"Lists">.
2189 To iterate over the constraints of a basic set or map, use
2191 #include <isl/constraint.h>
2193 int isl_basic_set_n_constraint(
2194 __isl_keep isl_basic_set *bset);
2195 isl_stat isl_basic_set_foreach_constraint(
2196 __isl_keep isl_basic_set *bset,
2197 isl_stat (*fn)(__isl_take isl_constraint *c,
2200 int isl_basic_map_n_constraint(
2201 __isl_keep isl_basic_map *bmap);
2202 isl_stat isl_basic_map_foreach_constraint(
2203 __isl_keep isl_basic_map *bmap,
2204 isl_stat (*fn)(__isl_take isl_constraint *c,
2207 __isl_null isl_constraint *isl_constraint_free(
2208 __isl_take isl_constraint *c);
2210 Again, the callback function C<fn> should return 0 if successful and
2211 -1 if an error occurs. In the latter case, or if any other error
2212 occurs, the above functions will return -1.
2213 The constraint C<c> represents either an equality or an inequality.
2214 Use the following function to find out whether a constraint
2215 represents an equality. If not, it represents an inequality.
2217 isl_bool isl_constraint_is_equality(
2218 __isl_keep isl_constraint *constraint);
2220 It is also possible to obtain a list of constraints from a basic
2223 #include <isl/constraint.h>
2224 __isl_give isl_constraint_list *
2225 isl_basic_map_get_constraint_list(
2226 __isl_keep isl_basic_map *bmap);
2227 __isl_give isl_constraint_list *
2228 isl_basic_set_get_constraint_list(
2229 __isl_keep isl_basic_set *bset);
2231 These functions require that all existentially quantified variables
2232 have an explicit representation.
2233 The returned list can be manipulated using the functions in L<"Lists">.
2235 The coefficients of the constraints can be inspected using
2236 the following functions.
2238 isl_bool isl_constraint_is_lower_bound(
2239 __isl_keep isl_constraint *constraint,
2240 enum isl_dim_type type, unsigned pos);
2241 isl_bool isl_constraint_is_upper_bound(
2242 __isl_keep isl_constraint *constraint,
2243 enum isl_dim_type type, unsigned pos);
2244 __isl_give isl_val *isl_constraint_get_constant_val(
2245 __isl_keep isl_constraint *constraint);
2246 __isl_give isl_val *isl_constraint_get_coefficient_val(
2247 __isl_keep isl_constraint *constraint,
2248 enum isl_dim_type type, int pos);
2250 The explicit representations of the existentially quantified
2251 variables can be inspected using the following function.
2252 Note that the user is only allowed to use this function
2253 if the inspected set or map is the result of a call
2254 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2255 The existentially quantified variable is equal to the floor
2256 of the returned affine expression. The affine expression
2257 itself can be inspected using the functions in
2260 __isl_give isl_aff *isl_constraint_get_div(
2261 __isl_keep isl_constraint *constraint, int pos);
2263 To obtain the constraints of a basic set or map in matrix
2264 form, use the following functions.
2266 __isl_give isl_mat *isl_basic_set_equalities_matrix(
2267 __isl_keep isl_basic_set *bset,
2268 enum isl_dim_type c1, enum isl_dim_type c2,
2269 enum isl_dim_type c3, enum isl_dim_type c4);
2270 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2271 __isl_keep isl_basic_set *bset,
2272 enum isl_dim_type c1, enum isl_dim_type c2,
2273 enum isl_dim_type c3, enum isl_dim_type c4);
2274 __isl_give isl_mat *isl_basic_map_equalities_matrix(
2275 __isl_keep isl_basic_map *bmap,
2276 enum isl_dim_type c1,
2277 enum isl_dim_type c2, enum isl_dim_type c3,
2278 enum isl_dim_type c4, enum isl_dim_type c5);
2279 __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2280 __isl_keep isl_basic_map *bmap,
2281 enum isl_dim_type c1,
2282 enum isl_dim_type c2, enum isl_dim_type c3,
2283 enum isl_dim_type c4, enum isl_dim_type c5);
2285 The C<isl_dim_type> arguments dictate the order in which
2286 different kinds of variables appear in the resulting matrix.
2287 For set inputs, they should be a permutation of
2288 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2289 For map inputs, they should be a permutation of
2290 C<isl_dim_cst>, C<isl_dim_param>,
2291 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2295 Points are elements of a set. They can be used to construct
2296 simple sets (boxes) or they can be used to represent the
2297 individual elements of a set.
2298 The zero point (the origin) can be created using
2300 __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2302 The coordinates of a point can be inspected, set and changed
2305 __isl_give isl_val *isl_point_get_coordinate_val(
2306 __isl_keep isl_point *pnt,
2307 enum isl_dim_type type, int pos);
2308 __isl_give isl_point *isl_point_set_coordinate_val(
2309 __isl_take isl_point *pnt,
2310 enum isl_dim_type type, int pos,
2311 __isl_take isl_val *v);
2313 __isl_give isl_point *isl_point_add_ui(
2314 __isl_take isl_point *pnt,
2315 enum isl_dim_type type, int pos, unsigned val);
2316 __isl_give isl_point *isl_point_sub_ui(
2317 __isl_take isl_point *pnt,
2318 enum isl_dim_type type, int pos, unsigned val);
2320 Points can be copied or freed using
2322 __isl_give isl_point *isl_point_copy(
2323 __isl_keep isl_point *pnt);
2324 void isl_point_free(__isl_take isl_point *pnt);
2326 A singleton set can be created from a point using
2328 __isl_give isl_basic_set *isl_basic_set_from_point(
2329 __isl_take isl_point *pnt);
2330 __isl_give isl_set *isl_set_from_point(
2331 __isl_take isl_point *pnt);
2333 and a box can be created from two opposite extremal points using
2335 __isl_give isl_basic_set *isl_basic_set_box_from_points(
2336 __isl_take isl_point *pnt1,
2337 __isl_take isl_point *pnt2);
2338 __isl_give isl_set *isl_set_box_from_points(
2339 __isl_take isl_point *pnt1,
2340 __isl_take isl_point *pnt2);
2342 All elements of a B<bounded> (union) set can be enumerated using
2343 the following functions.
2345 isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2346 isl_stat (*fn)(__isl_take isl_point *pnt,
2349 isl_stat isl_union_set_foreach_point(
2350 __isl_keep isl_union_set *uset,
2351 isl_stat (*fn)(__isl_take isl_point *pnt,
2355 The function C<fn> is called for each integer point in
2356 C<set> with as second argument the last argument of
2357 the C<isl_set_foreach_point> call. The function C<fn>
2358 should return C<0> on success and C<-1> on failure.
2359 In the latter case, C<isl_set_foreach_point> will stop
2360 enumerating and return C<-1> as well.
2361 If the enumeration is performed successfully and to completion,
2362 then C<isl_set_foreach_point> returns C<0>.
2364 To obtain a single point of a (basic) set, use
2366 __isl_give isl_point *isl_basic_set_sample_point(
2367 __isl_take isl_basic_set *bset);
2368 __isl_give isl_point *isl_set_sample_point(
2369 __isl_take isl_set *set);
2371 If C<set> does not contain any (integer) points, then the
2372 resulting point will be ``void'', a property that can be
2375 isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2379 Besides sets and relation, C<isl> also supports various types of functions.
2380 Each of these types is derived from the value type (see L</"Values">)
2381 or from one of two primitive function types
2382 through the application of zero or more type constructors.
2383 We first describe the primitive type and then we describe
2384 the types derived from these primitive types.
2386 =head3 Primitive Functions
2388 C<isl> support two primitive function types, quasi-affine
2389 expressions and quasipolynomials.
2390 A quasi-affine expression is defined either over a parameter
2391 space or over a set and is composed of integer constants,
2392 parameters and set variables, addition, subtraction and
2393 integer division by an integer constant.
2394 For example, the quasi-affine expression
2396 [n] -> { [x] -> [2*floor((4 n + x)/9] }
2398 maps C<x> to C<2*floor((4 n + x)/9>.
2399 A quasipolynomial is a polynomial expression in quasi-affine
2400 expression. That is, it additionally allows for multiplication.
2401 Note, though, that it is not allowed to construct an integer
2402 division of an expression involving multiplications.
2403 Here is an example of a quasipolynomial that is not
2404 quasi-affine expression
2406 [n] -> { [x] -> (n*floor((4 n + x)/9) }
2408 Note that the external representations of quasi-affine expressions
2409 and quasipolynomials are different. Quasi-affine expressions
2410 use a notation with square brackets just like binary relations,
2411 while quasipolynomials do not. This might change at some point.
2413 If a primitive function is defined over a parameter space,
2414 then the space of the function itself is that of a set.
2415 If it is defined over a set, then the space of the function
2416 is that of a relation. In both cases, the set space (or
2417 the output space) is single-dimensional, anonymous and unstructured.
2418 To create functions with multiple dimensions or with other kinds
2419 of set or output spaces, use multiple expressions
2420 (see L</"Multiple Expressions">).
2424 =item * Quasi-affine Expressions
2426 Besides the expressions described above, a quasi-affine
2427 expression can also be set to NaN. Such expressions
2428 typically represent a failure to represent a result
2429 as a quasi-affine expression.
2431 The zero quasi affine expression or the quasi affine expression
2432 that is equal to a given value or
2433 a specified dimension on a given domain can be created using
2435 #include <isl/aff.h>
2436 __isl_give isl_aff *isl_aff_zero_on_domain(
2437 __isl_take isl_local_space *ls);
2438 __isl_give isl_aff *isl_aff_val_on_domain(
2439 __isl_take isl_local_space *ls,
2440 __isl_take isl_val *val);
2441 __isl_give isl_aff *isl_aff_var_on_domain(
2442 __isl_take isl_local_space *ls,
2443 enum isl_dim_type type, unsigned pos);
2444 __isl_give isl_aff *isl_aff_nan_on_domain(
2445 __isl_take isl_local_space *ls);
2447 Quasi affine expressions can be copied and freed using
2449 #include <isl/aff.h>
2450 __isl_give isl_aff *isl_aff_copy(
2451 __isl_keep isl_aff *aff);
2452 __isl_null isl_aff *isl_aff_free(
2453 __isl_take isl_aff *aff);
2455 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2456 using the following function. The constraint is required to have
2457 a non-zero coefficient for the specified dimension.
2459 #include <isl/constraint.h>
2460 __isl_give isl_aff *isl_constraint_get_bound(
2461 __isl_keep isl_constraint *constraint,
2462 enum isl_dim_type type, int pos);
2464 The entire affine expression of the constraint can also be extracted
2465 using the following function.
2467 #include <isl/constraint.h>
2468 __isl_give isl_aff *isl_constraint_get_aff(
2469 __isl_keep isl_constraint *constraint);
2471 Conversely, an equality constraint equating
2472 the affine expression to zero or an inequality constraint enforcing
2473 the affine expression to be non-negative, can be constructed using
2475 __isl_give isl_constraint *isl_equality_from_aff(
2476 __isl_take isl_aff *aff);
2477 __isl_give isl_constraint *isl_inequality_from_aff(
2478 __isl_take isl_aff *aff);
2480 The coefficients and the integer divisions of an affine expression
2481 can be inspected using the following functions.
2483 #include <isl/aff.h>
2484 __isl_give isl_val *isl_aff_get_constant_val(
2485 __isl_keep isl_aff *aff);
2486 __isl_give isl_val *isl_aff_get_coefficient_val(
2487 __isl_keep isl_aff *aff,
2488 enum isl_dim_type type, int pos);
2489 int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2490 enum isl_dim_type type, int pos);
2491 __isl_give isl_val *isl_aff_get_denominator_val(
2492 __isl_keep isl_aff *aff);
2493 __isl_give isl_aff *isl_aff_get_div(
2494 __isl_keep isl_aff *aff, int pos);
2496 They can be modified using the following functions.
2498 #include <isl/aff.h>
2499 __isl_give isl_aff *isl_aff_set_constant_si(
2500 __isl_take isl_aff *aff, int v);
2501 __isl_give isl_aff *isl_aff_set_constant_val(
2502 __isl_take isl_aff *aff, __isl_take isl_val *v);
2503 __isl_give isl_aff *isl_aff_set_coefficient_si(
2504 __isl_take isl_aff *aff,
2505 enum isl_dim_type type, int pos, int v);
2506 __isl_give isl_aff *isl_aff_set_coefficient_val(
2507 __isl_take isl_aff *aff,
2508 enum isl_dim_type type, int pos,
2509 __isl_take isl_val *v);
2511 __isl_give isl_aff *isl_aff_add_constant_si(
2512 __isl_take isl_aff *aff, int v);
2513 __isl_give isl_aff *isl_aff_add_constant_val(
2514 __isl_take isl_aff *aff, __isl_take isl_val *v);
2515 __isl_give isl_aff *isl_aff_add_constant_num_si(
2516 __isl_take isl_aff *aff, int v);
2517 __isl_give isl_aff *isl_aff_add_coefficient_si(
2518 __isl_take isl_aff *aff,
2519 enum isl_dim_type type, int pos, int v);
2520 __isl_give isl_aff *isl_aff_add_coefficient_val(
2521 __isl_take isl_aff *aff,
2522 enum isl_dim_type type, int pos,
2523 __isl_take isl_val *v);
2525 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2526 set the I<numerator> of the constant or coefficient, while
2527 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2528 the constant or coefficient as a whole.
2529 The C<add_constant> and C<add_coefficient> functions add an integer
2530 or rational value to
2531 the possibly rational constant or coefficient.
2532 The C<add_constant_num> functions add an integer value to
2535 =item * Quasipolynomials
2537 Some simple quasipolynomials can be created using the following functions.
2539 #include <isl/polynomial.h>
2540 __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2541 __isl_take isl_space *domain);
2542 __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2543 __isl_take isl_space *domain);
2544 __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2545 __isl_take isl_space *domain);
2546 __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2547 __isl_take isl_space *domain);
2548 __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2549 __isl_take isl_space *domain);
2550 __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2551 __isl_take isl_space *domain,
2552 __isl_take isl_val *val);
2553 __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2554 __isl_take isl_space *domain,
2555 enum isl_dim_type type, unsigned pos);
2556 __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2557 __isl_take isl_aff *aff);
2559 Recall that the space in which a quasipolynomial lives is a map space
2560 with a one-dimensional range. The C<domain> argument in some of
2561 the functions above corresponds to the domain of this map space.
2563 Quasipolynomials can be copied and freed again using the following
2566 #include <isl/polynomial.h>
2567 __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2568 __isl_keep isl_qpolynomial *qp);
2569 __isl_null isl_qpolynomial *isl_qpolynomial_free(
2570 __isl_take isl_qpolynomial *qp);
2572 The constant term of a quasipolynomial can be extracted using
2574 __isl_give isl_val *isl_qpolynomial_get_constant_val(
2575 __isl_keep isl_qpolynomial *qp);
2577 To iterate over all terms in a quasipolynomial,
2580 isl_stat isl_qpolynomial_foreach_term(
2581 __isl_keep isl_qpolynomial *qp,
2582 isl_stat (*fn)(__isl_take isl_term *term,
2583 void *user), void *user);
2585 The terms themselves can be inspected and freed using
2588 unsigned isl_term_dim(__isl_keep isl_term *term,
2589 enum isl_dim_type type);
2590 __isl_give isl_val *isl_term_get_coefficient_val(
2591 __isl_keep isl_term *term);
2592 int isl_term_get_exp(__isl_keep isl_term *term,
2593 enum isl_dim_type type, unsigned pos);
2594 __isl_give isl_aff *isl_term_get_div(
2595 __isl_keep isl_term *term, unsigned pos);
2596 void isl_term_free(__isl_take isl_term *term);
2598 Each term is a product of parameters, set variables and
2599 integer divisions. The function C<isl_term_get_exp>
2600 returns the exponent of a given dimensions in the given term.
2606 A reduction represents a maximum or a minimum of its
2608 The only reduction type defined by C<isl> is
2609 C<isl_qpolynomial_fold>.
2611 There are currently no functions to directly create such
2612 objects, but they do appear in the piecewise quasipolynomial
2613 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2615 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2617 Reductions can be copied and freed using
2618 the following functions.
2620 #include <isl/polynomial.h>
2621 __isl_give isl_qpolynomial_fold *
2622 isl_qpolynomial_fold_copy(
2623 __isl_keep isl_qpolynomial_fold *fold);
2624 void isl_qpolynomial_fold_free(
2625 __isl_take isl_qpolynomial_fold *fold);
2627 To iterate over all quasipolynomials in a reduction, use
2629 isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2630 __isl_keep isl_qpolynomial_fold *fold,
2631 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2632 void *user), void *user);
2634 =head3 Multiple Expressions
2636 A multiple expression represents a sequence of zero or
2637 more base expressions, all defined on the same domain space.
2638 The domain space of the multiple expression is the same
2639 as that of the base expressions, but the range space
2640 can be any space. In case the base expressions have
2641 a set space, the corresponding multiple expression
2642 also has a set space.
2643 Objects of the value type do not have an associated space.
2644 The space of a multiple value is therefore always a set space.
2645 Similarly, the space of a multiple union piecewise
2646 affine expression is always a set space.
2648 The multiple expression types defined by C<isl>
2649 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2650 C<isl_multi_union_pw_aff>.
2652 A multiple expression with the value zero for
2653 each output (or set) dimension can be created
2654 using the following functions.
2656 #include <isl/val.h>
2657 __isl_give isl_multi_val *isl_multi_val_zero(
2658 __isl_take isl_space *space);
2660 #include <isl/aff.h>
2661 __isl_give isl_multi_aff *isl_multi_aff_zero(
2662 __isl_take isl_space *space);
2663 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2664 __isl_take isl_space *space);
2665 __isl_give isl_multi_union_pw_aff *
2666 isl_multi_union_pw_aff_zero(
2667 __isl_take isl_space *space);
2669 Since there is no canonical way of representing a zero
2670 value of type C<isl_union_pw_aff>, the space passed
2671 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2673 An identity function can be created using the following
2674 functions. The space needs to be that of a relation
2675 with the same number of input and output dimensions.
2677 #include <isl/aff.h>
2678 __isl_give isl_multi_aff *isl_multi_aff_identity(
2679 __isl_take isl_space *space);
2680 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2681 __isl_take isl_space *space);
2683 A function that performs a projection on a universe
2684 relation or set can be created using the following functions.
2685 See also the corresponding
2686 projection operations in L</"Unary Operations">.
2688 #include <isl/aff.h>
2689 __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2690 __isl_take isl_space *space);
2691 __isl_give isl_multi_aff *isl_multi_aff_range_map(
2692 __isl_take isl_space *space);
2693 __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2694 __isl_take isl_space *space,
2695 enum isl_dim_type type,
2696 unsigned first, unsigned n);
2698 A multiple expression can be created from a single
2699 base expression using the following functions.
2700 The space of the created multiple expression is the same
2701 as that of the base expression, except for
2702 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2703 lives in a parameter space and the output lives
2704 in a single-dimensional set space.
2706 #include <isl/aff.h>
2707 __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2708 __isl_take isl_aff *aff);
2709 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2710 __isl_take isl_pw_aff *pa);
2711 __isl_give isl_multi_union_pw_aff *
2712 isl_multi_union_pw_aff_from_union_pw_aff(
2713 __isl_take isl_union_pw_aff *upa);
2715 A multiple expression can be created from a list
2716 of base expression in a specified space.
2717 The domain of this space needs to be the same
2718 as the domains of the base expressions in the list.
2719 If the base expressions have a set space (or no associated space),
2720 then this space also needs to be a set space.
2722 #include <isl/val.h>
2723 __isl_give isl_multi_val *isl_multi_val_from_val_list(
2724 __isl_take isl_space *space,
2725 __isl_take isl_val_list *list);
2727 #include <isl/aff.h>
2728 __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2729 __isl_take isl_space *space,
2730 __isl_take isl_aff_list *list);
2731 __isl_give isl_multi_union_pw_aff *
2732 isl_multi_union_pw_aff_from_union_pw_aff_list(
2733 __isl_take isl_space *space,
2734 __isl_take isl_union_pw_aff_list *list);
2736 As a convenience, a multiple piecewise expression can
2737 also be created from a multiple expression.
2738 Each piecewise expression in the result has a single
2741 #include <isl/aff.h>
2742 __isl_give isl_multi_pw_aff *
2743 isl_multi_pw_aff_from_multi_aff(
2744 __isl_take isl_multi_aff *ma);
2746 Similarly, a multiple union expression can be
2747 created from a multiple expression.
2749 #include <isl/aff.h>
2750 __isl_give isl_multi_union_pw_aff *
2751 isl_multi_union_pw_aff_from_multi_aff(
2752 __isl_take isl_multi_aff *ma);
2753 __isl_give isl_multi_union_pw_aff *
2754 isl_multi_union_pw_aff_from_multi_pw_aff(
2755 __isl_take isl_multi_pw_aff *mpa);
2757 A multiple quasi-affine expression can be created from
2758 a multiple value with a given domain space using the following
2761 #include <isl/aff.h>
2762 __isl_give isl_multi_aff *
2763 isl_multi_aff_multi_val_on_space(
2764 __isl_take isl_space *space,
2765 __isl_take isl_multi_val *mv);
2768 a multiple union piecewise affine expression can be created from
2769 a multiple value with a given domain or
2770 a multiple affine expression with a given domain
2771 using the following functions.
2773 #include <isl/aff.h>
2774 __isl_give isl_multi_union_pw_aff *
2775 isl_multi_union_pw_aff_multi_val_on_domain(
2776 __isl_take isl_union_set *domain,
2777 __isl_take isl_multi_val *mv);
2778 __isl_give isl_multi_union_pw_aff *
2779 isl_multi_union_pw_aff_multi_aff_on_domain(
2780 __isl_take isl_union_set *domain,
2781 __isl_take isl_multi_aff *ma);
2783 Multiple expressions can be copied and freed using
2784 the following functions.
2786 #include <isl/val.h>
2787 __isl_give isl_multi_val *isl_multi_val_copy(
2788 __isl_keep isl_multi_val *mv);
2789 __isl_null isl_multi_val *isl_multi_val_free(
2790 __isl_take isl_multi_val *mv);
2792 #include <isl/aff.h>
2793 __isl_give isl_multi_aff *isl_multi_aff_copy(
2794 __isl_keep isl_multi_aff *maff);
2795 __isl_null isl_multi_aff *isl_multi_aff_free(
2796 __isl_take isl_multi_aff *maff);
2797 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2798 __isl_keep isl_multi_pw_aff *mpa);
2799 __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2800 __isl_take isl_multi_pw_aff *mpa);
2801 __isl_give isl_multi_union_pw_aff *
2802 isl_multi_union_pw_aff_copy(
2803 __isl_keep isl_multi_union_pw_aff *mupa);
2804 __isl_null isl_multi_union_pw_aff *
2805 isl_multi_union_pw_aff_free(
2806 __isl_take isl_multi_union_pw_aff *mupa);
2808 The base expression at a given position of a multiple
2809 expression can be extracted using the following functions.
2811 #include <isl/val.h>
2812 __isl_give isl_val *isl_multi_val_get_val(
2813 __isl_keep isl_multi_val *mv, int pos);
2815 #include <isl/aff.h>
2816 __isl_give isl_aff *isl_multi_aff_get_aff(
2817 __isl_keep isl_multi_aff *multi, int pos);
2818 __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2819 __isl_keep isl_multi_pw_aff *mpa, int pos);
2820 __isl_give isl_union_pw_aff *
2821 isl_multi_union_pw_aff_get_union_pw_aff(
2822 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2824 It can be replaced using the following functions.
2826 #include <isl/val.h>
2827 __isl_give isl_multi_val *isl_multi_val_set_val(
2828 __isl_take isl_multi_val *mv, int pos,
2829 __isl_take isl_val *val);
2831 #include <isl/aff.h>
2832 __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2833 __isl_take isl_multi_aff *multi, int pos,
2834 __isl_take isl_aff *aff);
2835 __isl_give isl_multi_union_pw_aff *
2836 isl_multi_union_pw_aff_set_union_pw_aff(
2837 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2838 __isl_take isl_union_pw_aff *upa);
2840 As a convenience, a sequence of base expressions that have
2841 their domains in a given space can be extracted from a sequence
2842 of union expressions using the following function.
2844 #include <isl/aff.h>
2845 __isl_give isl_multi_pw_aff *
2846 isl_multi_union_pw_aff_extract_multi_pw_aff(
2847 __isl_keep isl_multi_union_pw_aff *mupa,
2848 __isl_take isl_space *space);
2850 Note that there is a difference between C<isl_multi_union_pw_aff>
2851 and C<isl_union_pw_multi_aff> objects. The first is a sequence
2852 of unions of piecewise expressions, while the second is a union
2853 of piecewise sequences. In particular, multiple affine expressions
2854 in an C<isl_union_pw_multi_aff> may live in different spaces,
2855 while there is only a single multiple expression in
2856 an C<isl_multi_union_pw_aff>, which can therefore only live
2857 in a single space. This means that not every
2858 C<isl_union_pw_multi_aff> can be converted to
2859 an C<isl_multi_union_pw_aff>. Conversely, a zero-dimensional
2860 C<isl_multi_union_pw_aff> carries no information
2861 about any possible domain and therefore cannot be converted
2862 to an C<isl_union_pw_multi_aff>. Moreover, the elements
2863 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2864 while each multiple expression inside an C<isl_union_pw_multi_aff>
2865 has a single domain. The conversion of an C<isl_union_pw_multi_aff>
2866 of dimension greater than one may therefore not be exact.
2867 The following functions can
2868 be used to perform these conversions when they are possible.
2870 #include <isl/aff.h>
2871 __isl_give isl_multi_union_pw_aff *
2872 isl_multi_union_pw_aff_from_union_pw_multi_aff(
2873 __isl_take isl_union_pw_multi_aff *upma);
2874 __isl_give isl_union_pw_multi_aff *
2875 isl_union_pw_multi_aff_from_multi_union_pw_aff(
2876 __isl_take isl_multi_union_pw_aff *mupa);
2878 =head3 Piecewise Expressions
2880 A piecewise expression is an expression that is described
2881 using zero or more base expression defined over the same
2882 number of cells in the domain space of the base expressions.
2883 All base expressions are defined over the same
2884 domain space and the cells are disjoint.
2885 The space of a piecewise expression is the same as
2886 that of the base expressions.
2887 If the union of the cells is a strict subset of the domain
2888 space, then the value of the piecewise expression outside
2889 this union is different for types derived from quasi-affine
2890 expressions and those derived from quasipolynomials.
2891 Piecewise expressions derived from quasi-affine expressions
2892 are considered to be undefined outside the union of their cells.
2893 Piecewise expressions derived from quasipolynomials
2894 are considered to be zero outside the union of their cells.
2896 Piecewise quasipolynomials are mainly used by the C<barvinok>
2897 library for representing the number of elements in a parametric set or map.
2898 For example, the piecewise quasipolynomial
2900 [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2902 represents the number of points in the map
2904 [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2906 The piecewise expression types defined by C<isl>
2907 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2908 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2910 A piecewise expression with no cells can be created using
2911 the following functions.
2913 #include <isl/aff.h>
2914 __isl_give isl_pw_aff *isl_pw_aff_empty(
2915 __isl_take isl_space *space);
2916 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2917 __isl_take isl_space *space);
2919 A piecewise expression with a single universe cell can be
2920 created using the following functions.
2922 #include <isl/aff.h>
2923 __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2924 __isl_take isl_aff *aff);
2925 __isl_give isl_pw_multi_aff *
2926 isl_pw_multi_aff_from_multi_aff(
2927 __isl_take isl_multi_aff *ma);
2929 #include <isl/polynomial.h>
2930 __isl_give isl_pw_qpolynomial *
2931 isl_pw_qpolynomial_from_qpolynomial(
2932 __isl_take isl_qpolynomial *qp);
2934 A piecewise expression with a single specified cell can be
2935 created using the following functions.
2937 #include <isl/aff.h>
2938 __isl_give isl_pw_aff *isl_pw_aff_alloc(
2939 __isl_take isl_set *set, __isl_take isl_aff *aff);
2940 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2941 __isl_take isl_set *set,
2942 __isl_take isl_multi_aff *maff);
2944 #include <isl/polynomial.h>
2945 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2946 __isl_take isl_set *set,
2947 __isl_take isl_qpolynomial *qp);
2949 The following convenience functions first create a base expression and
2950 then create a piecewise expression over a universe domain.
2952 #include <isl/aff.h>
2953 __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2954 __isl_take isl_local_space *ls);
2955 __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2956 __isl_take isl_local_space *ls,
2957 enum isl_dim_type type, unsigned pos);
2958 __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2959 __isl_take isl_local_space *ls);
2960 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2961 __isl_take isl_space *space);
2962 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2963 __isl_take isl_space *space);
2964 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2965 __isl_take isl_space *space);
2966 __isl_give isl_pw_multi_aff *
2967 isl_pw_multi_aff_project_out_map(
2968 __isl_take isl_space *space,
2969 enum isl_dim_type type,
2970 unsigned first, unsigned n);
2972 #include <isl/polynomial.h>
2973 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2974 __isl_take isl_space *space);
2976 The following convenience functions first create a base expression and
2977 then create a piecewise expression over a given domain.
2979 #include <isl/aff.h>
2980 __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2981 __isl_take isl_set *domain,
2982 __isl_take isl_val *v);
2983 __isl_give isl_pw_multi_aff *
2984 isl_pw_multi_aff_multi_val_on_domain(
2985 __isl_take isl_set *domain,
2986 __isl_take isl_multi_val *mv);
2988 As a convenience, a piecewise multiple expression can
2989 also be created from a piecewise expression.
2990 Each multiple expression in the result is derived
2991 from the corresponding base expression.
2993 #include <isl/aff.h>
2994 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2995 __isl_take isl_pw_aff *pa);
2997 Similarly, a piecewise quasipolynomial can be
2998 created from a piecewise quasi-affine expression using
2999 the following function.
3001 #include <isl/polynomial.h>
3002 __isl_give isl_pw_qpolynomial *
3003 isl_pw_qpolynomial_from_pw_aff(
3004 __isl_take isl_pw_aff *pwaff);
3006 Piecewise expressions can be copied and freed using the following functions.
3008 #include <isl/aff.h>
3009 __isl_give isl_pw_aff *isl_pw_aff_copy(
3010 __isl_keep isl_pw_aff *pwaff);
3011 __isl_null isl_pw_aff *isl_pw_aff_free(
3012 __isl_take isl_pw_aff *pwaff);
3013 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3014 __isl_keep isl_pw_multi_aff *pma);
3015 __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3016 __isl_take isl_pw_multi_aff *pma);
3018 #include <isl/polynomial.h>
3019 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3020 __isl_keep isl_pw_qpolynomial *pwqp);
3021 __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3022 __isl_take isl_pw_qpolynomial *pwqp);
3023 __isl_give isl_pw_qpolynomial_fold *
3024 isl_pw_qpolynomial_fold_copy(
3025 __isl_keep isl_pw_qpolynomial_fold *pwf);
3026 __isl_null isl_pw_qpolynomial_fold *
3027 isl_pw_qpolynomial_fold_free(
3028 __isl_take isl_pw_qpolynomial_fold *pwf);
3030 To iterate over the different cells of a piecewise expression,
3031 use the following functions.
3033 #include <isl/aff.h>
3034 isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3035 int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3036 isl_stat isl_pw_aff_foreach_piece(
3037 __isl_keep isl_pw_aff *pwaff,
3038 isl_stat (*fn)(__isl_take isl_set *set,
3039 __isl_take isl_aff *aff,
3040 void *user), void *user);
3041 isl_stat isl_pw_multi_aff_foreach_piece(
3042 __isl_keep isl_pw_multi_aff *pma,
3043 isl_stat (*fn)(__isl_take isl_set *set,
3044 __isl_take isl_multi_aff *maff,
3045 void *user), void *user);
3047 #include <isl/polynomial.h>
3048 isl_stat isl_pw_qpolynomial_foreach_piece(
3049 __isl_keep isl_pw_qpolynomial *pwqp,
3050 isl_stat (*fn)(__isl_take isl_set *set,
3051 __isl_take isl_qpolynomial *qp,
3052 void *user), void *user);
3053 isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3054 __isl_keep isl_pw_qpolynomial *pwqp,
3055 isl_stat (*fn)(__isl_take isl_set *set,
3056 __isl_take isl_qpolynomial *qp,
3057 void *user), void *user);
3058 isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3059 __isl_keep isl_pw_qpolynomial_fold *pwf,
3060 isl_stat (*fn)(__isl_take isl_set *set,
3061 __isl_take isl_qpolynomial_fold *fold,
3062 void *user), void *user);
3063 isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3064 __isl_keep isl_pw_qpolynomial_fold *pwf,
3065 isl_stat (*fn)(__isl_take isl_set *set,
3066 __isl_take isl_qpolynomial_fold *fold,
3067 void *user), void *user);
3069 As usual, the function C<fn> should return C<0> on success
3070 and C<-1> on failure. The difference between
3071 C<isl_pw_qpolynomial_foreach_piece> and
3072 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3073 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3074 compute unique representations for all existentially quantified
3075 variables and then turn these existentially quantified variables
3076 into extra set variables, adapting the associated quasipolynomial
3077 accordingly. This means that the C<set> passed to C<fn>
3078 will not have any existentially quantified variables, but that
3079 the dimensions of the sets may be different for different
3080 invocations of C<fn>.
3081 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3082 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3084 A piecewise expression consisting of the expressions at a given
3085 position of a piecewise multiple expression can be extracted
3086 using the following function.
3088 #include <isl/aff.h>
3089 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3090 __isl_keep isl_pw_multi_aff *pma, int pos);
3092 These expressions can be replaced using the following function.
3094 #include <isl/aff.h>
3095 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3096 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3097 __isl_take isl_pw_aff *pa);
3099 Note that there is a difference between C<isl_multi_pw_aff> and
3100 C<isl_pw_multi_aff> objects. The first is a sequence of piecewise
3101 affine expressions, while the second is a piecewise sequence
3102 of affine expressions. In particular, each of the piecewise
3103 affine expressions in an C<isl_multi_pw_aff> may have a different
3104 domain, while all multiple expressions associated to a cell
3105 in an C<isl_pw_multi_aff> have the same domain.
3106 It is possible to convert between the two, but when converting
3107 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3108 of the result is the intersection of the domains of the input.
3109 The reverse conversion is exact.
3111 #include <isl/aff.h>
3112 __isl_give isl_pw_multi_aff *
3113 isl_pw_multi_aff_from_multi_pw_aff(
3114 __isl_take isl_multi_pw_aff *mpa);
3115 __isl_give isl_multi_pw_aff *
3116 isl_multi_pw_aff_from_pw_multi_aff(
3117 __isl_take isl_pw_multi_aff *pma);
3119 =head3 Union Expressions
3121 A union expression collects base expressions defined
3122 over different domains. The space of a union expression
3123 is that of the shared parameter space.
3125 The union expression types defined by C<isl>
3126 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3127 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3129 C<isl_union_pw_aff>,
3130 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>,
3131 there can be at most one base expression for a given domain space.
3133 C<isl_union_pw_multi_aff>,
3134 there can be multiple such expressions for a given domain space,
3135 but the domains of these expressions need to be disjoint.
3137 An empty union expression can be created using the following functions.
3139 #include <isl/aff.h>
3140 __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3141 __isl_take isl_space *space);
3142 __isl_give isl_union_pw_multi_aff *
3143 isl_union_pw_multi_aff_empty(
3144 __isl_take isl_space *space);
3146 #include <isl/polynomial.h>
3147 __isl_give isl_union_pw_qpolynomial *
3148 isl_union_pw_qpolynomial_zero(
3149 __isl_take isl_space *space);
3151 A union expression containing a single base expression
3152 can be created using the following functions.
3154 #include <isl/aff.h>
3155 __isl_give isl_union_pw_aff *
3156 isl_union_pw_aff_from_pw_aff(
3157 __isl_take isl_pw_aff *pa);
3158 __isl_give isl_union_pw_multi_aff *
3159 isl_union_pw_multi_aff_from_aff(
3160 __isl_take isl_aff *aff);
3161 __isl_give isl_union_pw_multi_aff *
3162 isl_union_pw_multi_aff_from_pw_multi_aff(
3163 __isl_take isl_pw_multi_aff *pma);
3165 #include <isl/polynomial.h>
3166 __isl_give isl_union_pw_qpolynomial *
3167 isl_union_pw_qpolynomial_from_pw_qpolynomial(
3168 __isl_take isl_pw_qpolynomial *pwqp);
3170 The following functions create a base expression on each
3171 of the sets in the union set and collect the results.
3173 #include <isl/aff.h>
3174 __isl_give isl_union_pw_multi_aff *
3175 isl_union_pw_multi_aff_from_union_pw_aff(
3176 __isl_take isl_union_pw_aff *upa);
3177 __isl_give isl_union_pw_aff *
3178 isl_union_pw_multi_aff_get_union_pw_aff(
3179 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3180 __isl_give isl_union_pw_aff *
3181 isl_union_pw_aff_val_on_domain(
3182 __isl_take isl_union_set *domain,
3183 __isl_take isl_val *v);
3184 __isl_give isl_union_pw_multi_aff *
3185 isl_union_pw_multi_aff_multi_val_on_domain(
3186 __isl_take isl_union_set *domain,
3187 __isl_take isl_multi_val *mv);
3189 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3190 expression on a given domain can be created using the following
3193 #include <isl/aff.h>
3194 __isl_give isl_union_pw_aff *
3195 isl_union_pw_aff_aff_on_domain(
3196 __isl_take isl_union_set *domain,
3197 __isl_take isl_aff *aff);
3199 A base expression can be added to a union expression using
3200 the following functions.
3202 #include <isl/aff.h>
3203 __isl_give isl_union_pw_aff *
3204 isl_union_pw_aff_add_pw_aff(
3205 __isl_take isl_union_pw_aff *upa,
3206 __isl_take isl_pw_aff *pa);
3207 __isl_give isl_union_pw_multi_aff *
3208 isl_union_pw_multi_aff_add_pw_multi_aff(
3209 __isl_take isl_union_pw_multi_aff *upma,
3210 __isl_take isl_pw_multi_aff *pma);
3212 #include <isl/polynomial.h>
3213 __isl_give isl_union_pw_qpolynomial *
3214 isl_union_pw_qpolynomial_add_pw_qpolynomial(
3215 __isl_take isl_union_pw_qpolynomial *upwqp,
3216 __isl_take isl_pw_qpolynomial *pwqp);
3218 Union expressions can be copied and freed using
3219 the following functions.
3221 #include <isl/aff.h>
3222 __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3223 __isl_keep isl_union_pw_aff *upa);
3224 __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3225 __isl_take isl_union_pw_aff *upa);
3226 __isl_give isl_union_pw_multi_aff *
3227 isl_union_pw_multi_aff_copy(
3228 __isl_keep isl_union_pw_multi_aff *upma);
3229 __isl_null isl_union_pw_multi_aff *
3230 isl_union_pw_multi_aff_free(
3231 __isl_take isl_union_pw_multi_aff *upma);
3233 #include <isl/polynomial.h>
3234 __isl_give isl_union_pw_qpolynomial *
3235 isl_union_pw_qpolynomial_copy(
3236 __isl_keep isl_union_pw_qpolynomial *upwqp);
3237 __isl_null isl_union_pw_qpolynomial *
3238 isl_union_pw_qpolynomial_free(
3239 __isl_take isl_union_pw_qpolynomial *upwqp);
3240 __isl_give isl_union_pw_qpolynomial_fold *
3241 isl_union_pw_qpolynomial_fold_copy(
3242 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3243 __isl_null isl_union_pw_qpolynomial_fold *
3244 isl_union_pw_qpolynomial_fold_free(
3245 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3247 To iterate over the base expressions in a union expression,
3248 use the following functions.
3250 #include <isl/aff.h>
3251 int isl_union_pw_aff_n_pw_aff(
3252 __isl_keep isl_union_pw_aff *upa);
3253 isl_stat isl_union_pw_aff_foreach_pw_aff(
3254 __isl_keep isl_union_pw_aff *upa,
3255 isl_stat (*fn)(__isl_take isl_pw_aff *ma,
3256 void *user), void *user);
3257 int isl_union_pw_multi_aff_n_pw_multi_aff(
3258 __isl_keep isl_union_pw_multi_aff *upma);
3259 isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3260 __isl_keep isl_union_pw_multi_aff *upma,
3261 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3262 void *user), void *user);
3264 #include <isl/polynomial.h>
3265 int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3266 __isl_keep isl_union_pw_qpolynomial *upwqp);
3267 isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3268 __isl_keep isl_union_pw_qpolynomial *upwqp,
3269 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3270 void *user), void *user);
3271 int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3272 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3273 isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3274 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3275 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3276 void *user), void *user);
3278 To extract the base expression in a given space from a union, use
3279 the following functions.
3281 #include <isl/aff.h>
3282 __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3283 __isl_keep isl_union_pw_aff *upa,
3284 __isl_take isl_space *space);
3285 __isl_give isl_pw_multi_aff *
3286 isl_union_pw_multi_aff_extract_pw_multi_aff(
3287 __isl_keep isl_union_pw_multi_aff *upma,
3288 __isl_take isl_space *space);
3290 #include <isl/polynomial.h>
3291 __isl_give isl_pw_qpolynomial *
3292 isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3293 __isl_keep isl_union_pw_qpolynomial *upwqp,
3294 __isl_take isl_space *space);
3296 =head2 Input and Output
3298 For set and relation,
3299 C<isl> supports its own input/output format, which is similar
3300 to the C<Omega> format, but also supports the C<PolyLib> format
3302 For other object types, typically only an C<isl> format is supported.
3304 =head3 C<isl> format
3306 The C<isl> format is similar to that of C<Omega>, but has a different
3307 syntax for describing the parameters and allows for the definition
3308 of an existentially quantified variable as the integer division
3309 of an affine expression.
3310 For example, the set of integers C<i> between C<0> and C<n>
3311 such that C<i % 10 <= 6> can be described as
3313 [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3316 A set or relation can have several disjuncts, separated
3317 by the keyword C<or>. Each disjunct is either a conjunction
3318 of constraints or a projection (C<exists>) of a conjunction
3319 of constraints. The constraints are separated by the keyword
3322 =head3 C<PolyLib> format
3324 If the represented set is a union, then the first line
3325 contains a single number representing the number of disjuncts.
3326 Otherwise, a line containing the number C<1> is optional.
3328 Each disjunct is represented by a matrix of constraints.
3329 The first line contains two numbers representing
3330 the number of rows and columns,
3331 where the number of rows is equal to the number of constraints
3332 and the number of columns is equal to two plus the number of variables.
3333 The following lines contain the actual rows of the constraint matrix.
3334 In each row, the first column indicates whether the constraint
3335 is an equality (C<0>) or inequality (C<1>). The final column
3336 corresponds to the constant term.
3338 If the set is parametric, then the coefficients of the parameters
3339 appear in the last columns before the constant column.
3340 The coefficients of any existentially quantified variables appear
3341 between those of the set variables and those of the parameters.
3343 =head3 Extended C<PolyLib> format
3345 The extended C<PolyLib> format is nearly identical to the
3346 C<PolyLib> format. The only difference is that the line
3347 containing the number of rows and columns of a constraint matrix
3348 also contains four additional numbers:
3349 the number of output dimensions, the number of input dimensions,
3350 the number of local dimensions (i.e., the number of existentially
3351 quantified variables) and the number of parameters.
3352 For sets, the number of ``output'' dimensions is equal
3353 to the number of set dimensions, while the number of ``input''
3358 Objects can be read from input using the following functions.
3360 #include <isl/val.h>
3361 __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3363 __isl_give isl_multi_val *isl_multi_val_read_from_str(
3364 isl_ctx *ctx, const char *str);
3366 #include <isl/set.h>
3367 __isl_give isl_basic_set *isl_basic_set_read_from_file(
3368 isl_ctx *ctx, FILE *input);
3369 __isl_give isl_basic_set *isl_basic_set_read_from_str(
3370 isl_ctx *ctx, const char *str);
3371 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3373 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3376 #include <isl/map.h>
3377 __isl_give isl_basic_map *isl_basic_map_read_from_file(
3378 isl_ctx *ctx, FILE *input);
3379 __isl_give isl_basic_map *isl_basic_map_read_from_str(
3380 isl_ctx *ctx, const char *str);
3381 __isl_give isl_map *isl_map_read_from_file(
3382 isl_ctx *ctx, FILE *input);
3383 __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3386 #include <isl/union_set.h>
3387 __isl_give isl_union_set *isl_union_set_read_from_file(
3388 isl_ctx *ctx, FILE *input);
3389 __isl_give isl_union_set *isl_union_set_read_from_str(
3390 isl_ctx *ctx, const char *str);
3392 #include <isl/union_map.h>
3393 __isl_give isl_union_map *isl_union_map_read_from_file(
3394 isl_ctx *ctx, FILE *input);
3395 __isl_give isl_union_map *isl_union_map_read_from_str(
3396 isl_ctx *ctx, const char *str);
3398 #include <isl/aff.h>
3399 __isl_give isl_aff *isl_aff_read_from_str(
3400 isl_ctx *ctx, const char *str);
3401 __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3402 isl_ctx *ctx, const char *str);
3403 __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3404 isl_ctx *ctx, const char *str);
3405 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3406 isl_ctx *ctx, const char *str);
3407 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3408 isl_ctx *ctx, const char *str);
3409 __isl_give isl_union_pw_multi_aff *
3410 isl_union_pw_multi_aff_read_from_str(
3411 isl_ctx *ctx, const char *str);
3412 __isl_give isl_multi_union_pw_aff *
3413 isl_multi_union_pw_aff_read_from_str(
3414 isl_ctx *ctx, const char *str);
3416 #include <isl/polynomial.h>
3417 __isl_give isl_union_pw_qpolynomial *
3418 isl_union_pw_qpolynomial_read_from_str(
3419 isl_ctx *ctx, const char *str);
3421 For sets and relations,
3422 the input format is autodetected and may be either the C<PolyLib> format
3423 or the C<isl> format.
3427 Before anything can be printed, an C<isl_printer> needs to
3430 __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3432 __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3433 __isl_null isl_printer *isl_printer_free(
3434 __isl_take isl_printer *printer);
3435 __isl_give char *isl_printer_get_str(
3436 __isl_keep isl_printer *printer);
3438 The printer can be inspected using the following functions.
3440 FILE *isl_printer_get_file(
3441 __isl_keep isl_printer *printer);
3442 int isl_printer_get_output_format(
3443 __isl_keep isl_printer *p);
3444 int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3446 The behavior of the printer can be modified in various ways
3448 __isl_give isl_printer *isl_printer_set_output_format(
3449 __isl_take isl_printer *p, int output_format);
3450 __isl_give isl_printer *isl_printer_set_indent(
3451 __isl_take isl_printer *p, int indent);
3452 __isl_give isl_printer *isl_printer_set_indent_prefix(
3453 __isl_take isl_printer *p, const char *prefix);
3454 __isl_give isl_printer *isl_printer_indent(
3455 __isl_take isl_printer *p, int indent);
3456 __isl_give isl_printer *isl_printer_set_prefix(
3457 __isl_take isl_printer *p, const char *prefix);
3458 __isl_give isl_printer *isl_printer_set_suffix(
3459 __isl_take isl_printer *p, const char *suffix);
3460 __isl_give isl_printer *isl_printer_set_yaml_style(
3461 __isl_take isl_printer *p, int yaml_style);
3463 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3464 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3465 and defaults to C<ISL_FORMAT_ISL>.
3466 Each line in the output is prefixed by C<indent_prefix>,
3467 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3468 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3469 In the C<PolyLib> format output,
3470 the coefficients of the existentially quantified variables
3471 appear between those of the set variables and those
3473 The function C<isl_printer_indent> increases the indentation
3474 by the specified amount (which may be negative).
3475 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3476 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3479 To actually print something, use
3481 #include <isl/printer.h>
3482 __isl_give isl_printer *isl_printer_print_double(
3483 __isl_take isl_printer *p, double d);
3485 #include <isl/val.h>
3486 __isl_give isl_printer *isl_printer_print_val(
3487 __isl_take isl_printer *p, __isl_keep isl_val *v);
3489 #include <isl/set.h>
3490 __isl_give isl_printer *isl_printer_print_basic_set(
3491 __isl_take isl_printer *printer,
3492 __isl_keep isl_basic_set *bset);
3493 __isl_give isl_printer *isl_printer_print_set(
3494 __isl_take isl_printer *printer,
3495 __isl_keep isl_set *set);
3497 #include <isl/map.h>
3498 __isl_give isl_printer *isl_printer_print_basic_map(
3499 __isl_take isl_printer *printer,
3500 __isl_keep isl_basic_map *bmap);
3501 __isl_give isl_printer *isl_printer_print_map(
3502 __isl_take isl_printer *printer,
3503 __isl_keep isl_map *map);
3505 #include <isl/union_set.h>
3506 __isl_give isl_printer *isl_printer_print_union_set(
3507 __isl_take isl_printer *p,
3508 __isl_keep isl_union_set *uset);
3510 #include <isl/union_map.h>
3511 __isl_give isl_printer *isl_printer_print_union_map(
3512 __isl_take isl_printer *p,
3513 __isl_keep isl_union_map *umap);
3515 #include <isl/val.h>
3516 __isl_give isl_printer *isl_printer_print_multi_val(
3517 __isl_take isl_printer *p,
3518 __isl_keep isl_multi_val *mv);
3520 #include <isl/aff.h>
3521 __isl_give isl_printer *isl_printer_print_aff(
3522 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3523 __isl_give isl_printer *isl_printer_print_multi_aff(
3524 __isl_take isl_printer *p,
3525 __isl_keep isl_multi_aff *maff);
3526 __isl_give isl_printer *isl_printer_print_pw_aff(
3527 __isl_take isl_printer *p,
3528 __isl_keep isl_pw_aff *pwaff);
3529 __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3530 __isl_take isl_printer *p,
3531 __isl_keep isl_pw_multi_aff *pma);
3532 __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3533 __isl_take isl_printer *p,
3534 __isl_keep isl_multi_pw_aff *mpa);
3535 __isl_give isl_printer *isl_printer_print_union_pw_aff(
3536 __isl_take isl_printer *p,
3537 __isl_keep isl_union_pw_aff *upa);
3538 __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3539 __isl_take isl_printer *p,
3540 __isl_keep isl_union_pw_multi_aff *upma);
3541 __isl_give isl_printer *
3542 isl_printer_print_multi_union_pw_aff(
3543 __isl_take isl_printer *p,
3544 __isl_keep isl_multi_union_pw_aff *mupa);
3546 #include <isl/polynomial.h>
3547 __isl_give isl_printer *isl_printer_print_qpolynomial(
3548 __isl_take isl_printer *p,
3549 __isl_keep isl_qpolynomial *qp);
3550 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3551 __isl_take isl_printer *p,
3552 __isl_keep isl_pw_qpolynomial *pwqp);
3553 __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3554 __isl_take isl_printer *p,
3555 __isl_keep isl_union_pw_qpolynomial *upwqp);
3557 __isl_give isl_printer *
3558 isl_printer_print_pw_qpolynomial_fold(
3559 __isl_take isl_printer *p,
3560 __isl_keep isl_pw_qpolynomial_fold *pwf);
3561 __isl_give isl_printer *
3562 isl_printer_print_union_pw_qpolynomial_fold(
3563 __isl_take isl_printer *p,
3564 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3566 For C<isl_printer_print_qpolynomial>,
3567 C<isl_printer_print_pw_qpolynomial> and
3568 C<isl_printer_print_pw_qpolynomial_fold>,
3569 the output format of the printer
3570 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3571 For C<isl_printer_print_union_pw_qpolynomial> and
3572 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3574 In case of printing in C<ISL_FORMAT_C>, the user may want
3575 to set the names of all dimensions first.
3577 C<isl> also provides limited support for printing YAML documents,
3578 just enough for the internal use for printing such documents.
3580 #include <isl/printer.h>
3581 __isl_give isl_printer *isl_printer_yaml_start_mapping(
3582 __isl_take isl_printer *p);
3583 __isl_give isl_printer *isl_printer_yaml_end_mapping(
3584 __isl_take isl_printer *p);
3585 __isl_give isl_printer *isl_printer_yaml_start_sequence(
3586 __isl_take isl_printer *p);
3587 __isl_give isl_printer *isl_printer_yaml_end_sequence(
3588 __isl_take isl_printer *p);
3589 __isl_give isl_printer *isl_printer_yaml_next(
3590 __isl_take isl_printer *p);
3592 A document is started by a call to either
3593 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3594 Anything printed to the printer after such a call belong to the
3595 first key of the mapping or the first element in the sequence.
3596 The function C<isl_printer_yaml_next> moves to the value if
3597 we are currently printing a mapping key, the next key if we
3598 are printing a value or the next element if we are printing
3599 an element in a sequence.
3600 Nested mappings and sequences are initiated by the same
3601 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3602 Each call to these functions needs to have a corresponding call to
3603 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3605 When called on a file printer, the following function flushes
3606 the file. When called on a string printer, the buffer is cleared.
3608 __isl_give isl_printer *isl_printer_flush(
3609 __isl_take isl_printer *p);
3611 Alternatively, a string representation can be obtained
3612 directly using the following functions, which always print
3615 #include <isl/space.h>
3616 __isl_give char *isl_space_to_str(
3617 __isl_keep isl_space *space);
3619 #include <isl/val.h>
3620 __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3621 __isl_give char *isl_multi_val_to_str(
3622 __isl_keep isl_multi_val *mv);
3624 #include <isl/set.h>
3625 __isl_give char *isl_set_to_str(
3626 __isl_keep isl_set *set);
3628 #include <isl/union_set.h>
3629 __isl_give char *isl_union_set_to_str(
3630 __isl_keep isl_union_set *uset);
3632 #include <isl/map.h>
3633 __isl_give char *isl_map_to_str(
3634 __isl_keep isl_map *map);
3636 #include <isl/union_map.h>
3637 __isl_give char *isl_union_map_to_str(
3638 __isl_keep isl_union_map *umap);
3640 #include <isl/aff.h>
3641 __isl_give char *isl_multi_aff_to_str(
3642 __isl_keep isl_multi_aff *aff);
3643 __isl_give char *isl_union_pw_aff_to_str(
3644 __isl_keep isl_union_pw_aff *upa);
3645 __isl_give char *isl_union_pw_multi_aff_to_str(
3646 __isl_keep isl_union_pw_multi_aff *upma);
3647 __isl_give char *isl_multi_union_pw_aff_to_str(
3648 __isl_keep isl_multi_union_pw_aff *mupa);
3652 =head3 Unary Properties
3658 The following functions test whether the given set or relation
3659 contains any integer points. The ``plain'' variants do not perform
3660 any computations, but simply check if the given set or relation
3661 is already known to be empty.
3663 isl_bool isl_basic_set_plain_is_empty(
3664 __isl_keep isl_basic_set *bset);
3665 isl_bool isl_basic_set_is_empty(
3666 __isl_keep isl_basic_set *bset);
3667 isl_bool isl_set_plain_is_empty(
3668 __isl_keep isl_set *set);
3669 isl_bool isl_set_is_empty(__isl_keep isl_set *set);
3670 isl_bool isl_union_set_is_empty(
3671 __isl_keep isl_union_set *uset);
3672 isl_bool isl_basic_map_plain_is_empty(
3673 __isl_keep isl_basic_map *bmap);
3674 isl_bool isl_basic_map_is_empty(
3675 __isl_keep isl_basic_map *bmap);
3676 isl_bool isl_map_plain_is_empty(
3677 __isl_keep isl_map *map);
3678 isl_bool isl_map_is_empty(__isl_keep isl_map *map);
3679 isl_bool isl_union_map_is_empty(
3680 __isl_keep isl_union_map *umap);
3682 =item * Universality
3684 isl_bool isl_basic_set_is_universe(
3685 __isl_keep isl_basic_set *bset);
3686 isl_bool isl_basic_map_is_universe(
3687 __isl_keep isl_basic_map *bmap);
3688 isl_bool isl_set_plain_is_universe(
3689 __isl_keep isl_set *set);
3690 isl_bool isl_map_plain_is_universe(
3691 __isl_keep isl_map *map);
3693 =item * Single-valuedness
3695 #include <isl/set.h>
3696 isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
3698 #include <isl/map.h>
3699 isl_bool isl_basic_map_is_single_valued(
3700 __isl_keep isl_basic_map *bmap);
3701 isl_bool isl_map_plain_is_single_valued(
3702 __isl_keep isl_map *map);
3703 isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
3705 #include <isl/union_map.h>
3706 isl_bool isl_union_map_is_single_valued(
3707 __isl_keep isl_union_map *umap);
3711 isl_bool isl_map_plain_is_injective(
3712 __isl_keep isl_map *map);
3713 isl_bool isl_map_is_injective(
3714 __isl_keep isl_map *map);
3715 isl_bool isl_union_map_plain_is_injective(
3716 __isl_keep isl_union_map *umap);
3717 isl_bool isl_union_map_is_injective(
3718 __isl_keep isl_union_map *umap);
3722 isl_bool isl_map_is_bijective(
3723 __isl_keep isl_map *map);
3724 isl_bool isl_union_map_is_bijective(
3725 __isl_keep isl_union_map *umap);
3729 __isl_give isl_val *
3730 isl_basic_map_plain_get_val_if_fixed(
3731 __isl_keep isl_basic_map *bmap,
3732 enum isl_dim_type type, unsigned pos);
3733 __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3734 __isl_keep isl_set *set,
3735 enum isl_dim_type type, unsigned pos);
3736 __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3737 __isl_keep isl_map *map,
3738 enum isl_dim_type type, unsigned pos);
3740 If the set or relation obviously lies on a hyperplane where the given dimension
3741 has a fixed value, then return that value.
3742 Otherwise return NaN.
3746 isl_stat isl_set_dim_residue_class_val(
3747 __isl_keep isl_set *set,
3748 int pos, __isl_give isl_val **modulo,
3749 __isl_give isl_val **residue);
3751 Check if the values of the given set dimension are equal to a fixed
3752 value modulo some integer value. If so, assign the modulo to C<*modulo>
3753 and the fixed value to C<*residue>. If the given dimension attains only
3754 a single value, then assign C<0> to C<*modulo> and the fixed value to
3756 If the dimension does not attain only a single value and if no modulo
3757 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3761 To check whether the description of a set, relation or function depends
3762 on one or more given dimensions,
3763 the following functions can be used.
3765 #include <isl/constraint.h>
3766 isl_bool isl_constraint_involves_dims(
3767 __isl_keep isl_constraint *constraint,
3768 enum isl_dim_type type, unsigned first, unsigned n);
3770 #include <isl/set.h>
3771 isl_bool isl_basic_set_involves_dims(
3772 __isl_keep isl_basic_set *bset,
3773 enum isl_dim_type type, unsigned first, unsigned n);
3774 isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
3775 enum isl_dim_type type, unsigned first, unsigned n);
3777 #include <isl/map.h>
3778 isl_bool isl_basic_map_involves_dims(
3779 __isl_keep isl_basic_map *bmap,
3780 enum isl_dim_type type, unsigned first, unsigned n);
3781 isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
3782 enum isl_dim_type type, unsigned first, unsigned n);
3784 #include <isl/union_map.h>
3785 isl_bool isl_union_map_involves_dims(
3786 __isl_keep isl_union_map *umap,
3787 enum isl_dim_type type, unsigned first, unsigned n);
3789 #include <isl/aff.h>
3790 isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
3791 enum isl_dim_type type, unsigned first, unsigned n);
3792 isl_bool isl_pw_aff_involves_dims(
3793 __isl_keep isl_pw_aff *pwaff,
3794 enum isl_dim_type type, unsigned first, unsigned n);
3795 isl_bool isl_multi_aff_involves_dims(
3796 __isl_keep isl_multi_aff *ma,
3797 enum isl_dim_type type, unsigned first, unsigned n);
3798 isl_bool isl_multi_pw_aff_involves_dims(
3799 __isl_keep isl_multi_pw_aff *mpa,
3800 enum isl_dim_type type, unsigned first, unsigned n);
3802 #include <isl/polynomial.h>
3803 isl_bool isl_qpolynomial_involves_dims(
3804 __isl_keep isl_qpolynomial *qp,
3805 enum isl_dim_type type, unsigned first, unsigned n);
3807 Similarly, the following functions can be used to check whether
3808 a given dimension is involved in any lower or upper bound.
3810 #include <isl/set.h>
3811 isl_bool isl_set_dim_has_any_lower_bound(
3812 __isl_keep isl_set *set,
3813 enum isl_dim_type type, unsigned pos);
3814 isl_bool isl_set_dim_has_any_upper_bound(
3815 __isl_keep isl_set *set,
3816 enum isl_dim_type type, unsigned pos);
3818 Note that these functions return true even if there is a bound on
3819 the dimension on only some of the basic sets of C<set>.
3820 To check if they have a bound for all of the basic sets in C<set>,
3821 use the following functions instead.
3823 #include <isl/set.h>
3824 isl_bool isl_set_dim_has_lower_bound(
3825 __isl_keep isl_set *set,
3826 enum isl_dim_type type, unsigned pos);
3827 isl_bool isl_set_dim_has_upper_bound(
3828 __isl_keep isl_set *set,
3829 enum isl_dim_type type, unsigned pos);
3833 To check whether a set is a parameter domain, use this function:
3835 isl_bool isl_set_is_params(__isl_keep isl_set *set);
3836 isl_bool isl_union_set_is_params(
3837 __isl_keep isl_union_set *uset);
3841 The following functions check whether the space of the given
3842 (basic) set or relation range is a wrapped relation.
3844 #include <isl/space.h>
3845 isl_bool isl_space_is_wrapping(
3846 __isl_keep isl_space *space);
3847 isl_bool isl_space_domain_is_wrapping(
3848 __isl_keep isl_space *space);
3849 isl_bool isl_space_range_is_wrapping(
3850 __isl_keep isl_space *space);
3852 #include <isl/set.h>
3853 isl_bool isl_basic_set_is_wrapping(
3854 __isl_keep isl_basic_set *bset);
3855 isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
3857 #include <isl/map.h>
3858 isl_bool isl_map_domain_is_wrapping(
3859 __isl_keep isl_map *map);
3860 isl_bool isl_map_range_is_wrapping(
3861 __isl_keep isl_map *map);
3863 #include <isl/val.h>
3864 isl_bool isl_multi_val_range_is_wrapping(
3865 __isl_keep isl_multi_val *mv);
3867 #include <isl/aff.h>
3868 isl_bool isl_multi_aff_range_is_wrapping(
3869 __isl_keep isl_multi_aff *ma);
3870 isl_bool isl_multi_pw_aff_range_is_wrapping(
3871 __isl_keep isl_multi_pw_aff *mpa);
3872 isl_bool isl_multi_union_pw_aff_range_is_wrapping(
3873 __isl_keep isl_multi_union_pw_aff *mupa);
3875 The input to C<isl_space_is_wrapping> should
3876 be the space of a set, while that of
3877 C<isl_space_domain_is_wrapping> and
3878 C<isl_space_range_is_wrapping> should be the space of a relation.
3880 =item * Internal Product
3882 isl_bool isl_basic_map_can_zip(
3883 __isl_keep isl_basic_map *bmap);
3884 isl_bool isl_map_can_zip(__isl_keep isl_map *map);
3886 Check whether the product of domain and range of the given relation
3888 i.e., whether both domain and range are nested relations.
3892 isl_bool isl_basic_map_can_curry(
3893 __isl_keep isl_basic_map *bmap);
3894 isl_bool isl_map_can_curry(__isl_keep isl_map *map);
3896 Check whether the domain of the (basic) relation is a wrapped relation.
3898 isl_bool isl_basic_map_can_uncurry(
3899 __isl_keep isl_basic_map *bmap);
3900 isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
3902 Check whether the range of the (basic) relation is a wrapped relation.
3904 =item * Special Values
3906 #include <isl/aff.h>
3907 isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
3908 isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3910 Check whether the given expression is a constant.
3912 #include <isl/aff.h>
3913 isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
3914 isl_bool isl_pw_aff_involves_nan(
3915 __isl_keep isl_pw_aff *pa);
3917 #include <isl/polynomial.h>
3918 isl_bool isl_qpolynomial_fold_is_nan(
3919 __isl_keep isl_qpolynomial_fold *fold);
3921 Check whether the given expression is equal to or involves NaN.
3923 #include <isl/aff.h>
3924 isl_bool isl_aff_plain_is_zero(
3925 __isl_keep isl_aff *aff);
3927 Check whether the affine expression is obviously zero.
3931 =head3 Binary Properties
3937 The following functions check whether two objects
3938 represent the same set, relation or function.
3939 The C<plain> variants only return true if the objects
3940 are obviously the same. That is, they may return false
3941 even if the objects are the same, but they will never
3942 return true if the objects are not the same.
3944 #include <isl/set.h>
3945 isl_bool isl_basic_set_plain_is_equal(
3946 __isl_keep isl_basic_set *bset1,
3947 __isl_keep isl_basic_set *bset2);
3948 isl_bool isl_basic_set_is_equal(
3949 __isl_keep isl_basic_set *bset1,
3950 __isl_keep isl_basic_set *bset2);
3951 isl_bool isl_set_plain_is_equal(
3952 __isl_keep isl_set *set1,
3953 __isl_keep isl_set *set2);
3954 isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
3955 __isl_keep isl_set *set2);
3957 #include <isl/map.h>
3958 isl_bool isl_basic_map_is_equal(
3959 __isl_keep isl_basic_map *bmap1,
3960 __isl_keep isl_basic_map *bmap2);
3961 isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
3962 __isl_keep isl_map *map2);
3963 isl_bool isl_map_plain_is_equal(
3964 __isl_keep isl_map *map1,
3965 __isl_keep isl_map *map2);
3967 #include <isl/union_set.h>
3968 isl_bool isl_union_set_is_equal(
3969 __isl_keep isl_union_set *uset1,
3970 __isl_keep isl_union_set *uset2);
3972 #include <isl/union_map.h>
3973 isl_bool isl_union_map_is_equal(
3974 __isl_keep isl_union_map *umap1,
3975 __isl_keep isl_union_map *umap2);
3977 #include <isl/aff.h>
3978 isl_bool isl_aff_plain_is_equal(
3979 __isl_keep isl_aff *aff1,
3980 __isl_keep isl_aff *aff2);
3981 isl_bool isl_multi_aff_plain_is_equal(
3982 __isl_keep isl_multi_aff *maff1,
3983 __isl_keep isl_multi_aff *maff2);
3984 isl_bool isl_pw_aff_plain_is_equal(
3985 __isl_keep isl_pw_aff *pwaff1,
3986 __isl_keep isl_pw_aff *pwaff2);
3987 isl_bool isl_pw_multi_aff_plain_is_equal(
3988 __isl_keep isl_pw_multi_aff *pma1,
3989 __isl_keep isl_pw_multi_aff *pma2);
3990 isl_bool isl_multi_pw_aff_plain_is_equal(
3991 __isl_keep isl_multi_pw_aff *mpa1,
3992 __isl_keep isl_multi_pw_aff *mpa2);
3993 isl_bool isl_multi_pw_aff_is_equal(
3994 __isl_keep isl_multi_pw_aff *mpa1,
3995 __isl_keep isl_multi_pw_aff *mpa2);
3996 isl_bool isl_union_pw_aff_plain_is_equal(
3997 __isl_keep isl_union_pw_aff *upa1,
3998 __isl_keep isl_union_pw_aff *upa2);
3999 isl_bool isl_union_pw_multi_aff_plain_is_equal(
4000 __isl_keep isl_union_pw_multi_aff *upma1,
4001 __isl_keep isl_union_pw_multi_aff *upma2);
4002 isl_bool isl_multi_union_pw_aff_plain_is_equal(
4003 __isl_keep isl_multi_union_pw_aff *mupa1,
4004 __isl_keep isl_multi_union_pw_aff *mupa2);
4006 #include <isl/polynomial.h>
4007 isl_bool isl_union_pw_qpolynomial_plain_is_equal(
4008 __isl_keep isl_union_pw_qpolynomial *upwqp1,
4009 __isl_keep isl_union_pw_qpolynomial *upwqp2);
4010 isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
4011 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
4012 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
4014 =item * Disjointness
4016 #include <isl/set.h>
4017 isl_bool isl_basic_set_is_disjoint(
4018 __isl_keep isl_basic_set *bset1,
4019 __isl_keep isl_basic_set *bset2);
4020 isl_bool isl_set_plain_is_disjoint(
4021 __isl_keep isl_set *set1,
4022 __isl_keep isl_set *set2);
4023 isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
4024 __isl_keep isl_set *set2);
4026 #include <isl/map.h>
4027 isl_bool isl_basic_map_is_disjoint(
4028 __isl_keep isl_basic_map *bmap1,
4029 __isl_keep isl_basic_map *bmap2);
4030 isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
4031 __isl_keep isl_map *map2);
4033 #include <isl/union_set.h>
4034 isl_bool isl_union_set_is_disjoint(
4035 __isl_keep isl_union_set *uset1,
4036 __isl_keep isl_union_set *uset2);
4038 #include <isl/union_map.h>
4039 isl_bool isl_union_map_is_disjoint(
4040 __isl_keep isl_union_map *umap1,
4041 __isl_keep isl_union_map *umap2);
4045 isl_bool isl_basic_set_is_subset(
4046 __isl_keep isl_basic_set *bset1,
4047 __isl_keep isl_basic_set *bset2);
4048 isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4049 __isl_keep isl_set *set2);
4050 isl_bool isl_set_is_strict_subset(
4051 __isl_keep isl_set *set1,
4052 __isl_keep isl_set *set2);
4053 isl_bool isl_union_set_is_subset(
4054 __isl_keep isl_union_set *uset1,
4055 __isl_keep isl_union_set *uset2);
4056 isl_bool isl_union_set_is_strict_subset(
4057 __isl_keep isl_union_set *uset1,
4058 __isl_keep isl_union_set *uset2);
4059 isl_bool isl_basic_map_is_subset(
4060 __isl_keep isl_basic_map *bmap1,
4061 __isl_keep isl_basic_map *bmap2);
4062 isl_bool isl_basic_map_is_strict_subset(
4063 __isl_keep isl_basic_map *bmap1,
4064 __isl_keep isl_basic_map *bmap2);
4065 isl_bool isl_map_is_subset(
4066 __isl_keep isl_map *map1,
4067 __isl_keep isl_map *map2);
4068 isl_bool isl_map_is_strict_subset(
4069 __isl_keep isl_map *map1,
4070 __isl_keep isl_map *map2);
4071 isl_bool isl_union_map_is_subset(
4072 __isl_keep isl_union_map *umap1,
4073 __isl_keep isl_union_map *umap2);
4074 isl_bool isl_union_map_is_strict_subset(
4075 __isl_keep isl_union_map *umap1,
4076 __isl_keep isl_union_map *umap2);
4078 Check whether the first argument is a (strict) subset of the
4083 Every comparison function returns a negative value if the first
4084 argument is considered smaller than the second, a positive value
4085 if the first argument is considered greater and zero if the two
4086 constraints are considered the same by the comparison criterion.
4088 #include <isl/constraint.h>
4089 int isl_constraint_plain_cmp(
4090 __isl_keep isl_constraint *c1,
4091 __isl_keep isl_constraint *c2);
4093 This function is useful for sorting C<isl_constraint>s.
4094 The order depends on the internal representation of the inputs.
4095 The order is fixed over different calls to the function (assuming
4096 the internal representation of the inputs has not changed), but may
4097 change over different versions of C<isl>.
4099 #include <isl/constraint.h>
4100 int isl_constraint_cmp_last_non_zero(
4101 __isl_keep isl_constraint *c1,
4102 __isl_keep isl_constraint *c2);
4104 This function can be used to sort constraints that live in the same
4105 local space. Constraints that involve ``earlier'' dimensions or
4106 that have a smaller coefficient for the shared latest dimension
4107 are considered smaller than other constraints.
4108 This function only defines a B<partial> order.
4110 #include <isl/set.h>
4111 int isl_set_plain_cmp(__isl_keep isl_set *set1,
4112 __isl_keep isl_set *set2);
4114 This function is useful for sorting C<isl_set>s.
4115 The order depends on the internal representation of the inputs.
4116 The order is fixed over different calls to the function (assuming
4117 the internal representation of the inputs has not changed), but may
4118 change over different versions of C<isl>.
4120 #include <isl/aff.h>
4121 int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4122 __isl_keep isl_pw_aff *pa2);
4124 The function C<isl_pw_aff_plain_cmp> can be used to sort
4125 C<isl_pw_aff>s. The order is not strictly defined.
4126 The current order sorts expressions that only involve
4127 earlier dimensions before those that involve later dimensions.
4131 =head2 Unary Operations
4137 __isl_give isl_set *isl_set_complement(
4138 __isl_take isl_set *set);
4139 __isl_give isl_map *isl_map_complement(
4140 __isl_take isl_map *map);
4144 #include <isl/space.h>
4145 __isl_give isl_space *isl_space_reverse(
4146 __isl_take isl_space *space);
4148 #include <isl/map.h>
4149 __isl_give isl_basic_map *isl_basic_map_reverse(
4150 __isl_take isl_basic_map *bmap);
4151 __isl_give isl_map *isl_map_reverse(
4152 __isl_take isl_map *map);
4154 #include <isl/union_map.h>
4155 __isl_give isl_union_map *isl_union_map_reverse(
4156 __isl_take isl_union_map *umap);
4160 #include <isl/space.h>
4161 __isl_give isl_space *isl_space_domain(
4162 __isl_take isl_space *space);
4163 __isl_give isl_space *isl_space_range(
4164 __isl_take isl_space *space);
4165 __isl_give isl_space *isl_space_params(
4166 __isl_take isl_space *space);
4168 #include <isl/local_space.h>
4169 __isl_give isl_local_space *isl_local_space_domain(
4170 __isl_take isl_local_space *ls);
4171 __isl_give isl_local_space *isl_local_space_range(
4172 __isl_take isl_local_space *ls);
4174 #include <isl/set.h>
4175 __isl_give isl_basic_set *isl_basic_set_project_out(
4176 __isl_take isl_basic_set *bset,
4177 enum isl_dim_type type, unsigned first, unsigned n);
4178 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4179 enum isl_dim_type type, unsigned first, unsigned n);
4180 __isl_give isl_basic_set *isl_basic_set_params(
4181 __isl_take isl_basic_set *bset);
4182 __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4184 #include <isl/map.h>
4185 __isl_give isl_basic_map *isl_basic_map_project_out(
4186 __isl_take isl_basic_map *bmap,
4187 enum isl_dim_type type, unsigned first, unsigned n);
4188 __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4189 enum isl_dim_type type, unsigned first, unsigned n);
4190 __isl_give isl_basic_set *isl_basic_map_domain(
4191 __isl_take isl_basic_map *bmap);
4192 __isl_give isl_basic_set *isl_basic_map_range(
4193 __isl_take isl_basic_map *bmap);
4194 __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4195 __isl_give isl_set *isl_map_domain(
4196 __isl_take isl_map *bmap);
4197 __isl_give isl_set *isl_map_range(
4198 __isl_take isl_map *map);
4200 #include <isl/union_set.h>
4201 __isl_give isl_union_set *isl_union_set_project_out(
4202 __isl_take isl_union_set *uset,
4203 enum isl_dim_type type,
4204 unsigned first, unsigned n);
4205 __isl_give isl_set *isl_union_set_params(
4206 __isl_take isl_union_set *uset);
4208 The function C<isl_union_set_project_out> can only project out
4211 #include <isl/union_map.h>
4212 __isl_give isl_union_map *isl_union_map_project_out(
4213 __isl_take isl_union_map *umap,
4214 enum isl_dim_type type, unsigned first, unsigned n);
4215 __isl_give isl_set *isl_union_map_params(
4216 __isl_take isl_union_map *umap);
4217 __isl_give isl_union_set *isl_union_map_domain(
4218 __isl_take isl_union_map *umap);
4219 __isl_give isl_union_set *isl_union_map_range(
4220 __isl_take isl_union_map *umap);
4222 The function C<isl_union_map_project_out> can only project out
4225 #include <isl/aff.h>
4226 __isl_give isl_aff *isl_aff_project_domain_on_params(
4227 __isl_take isl_aff *aff);
4228 __isl_give isl_pw_multi_aff *
4229 isl_pw_multi_aff_project_domain_on_params(
4230 __isl_take isl_pw_multi_aff *pma);
4231 __isl_give isl_set *isl_pw_aff_domain(
4232 __isl_take isl_pw_aff *pwaff);
4233 __isl_give isl_set *isl_pw_multi_aff_domain(
4234 __isl_take isl_pw_multi_aff *pma);
4235 __isl_give isl_set *isl_multi_pw_aff_domain(
4236 __isl_take isl_multi_pw_aff *mpa);
4237 __isl_give isl_union_set *isl_union_pw_aff_domain(
4238 __isl_take isl_union_pw_aff *upa);
4239 __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4240 __isl_take isl_union_pw_multi_aff *upma);
4241 __isl_give isl_union_set *
4242 isl_multi_union_pw_aff_domain(
4243 __isl_take isl_multi_union_pw_aff *mupa);
4244 __isl_give isl_set *isl_pw_aff_params(
4245 __isl_take isl_pw_aff *pwa);
4247 The function C<isl_multi_union_pw_aff_domain> requires its
4248 input to have at least one set dimension.
4250 #include <isl/polynomial.h>
4251 __isl_give isl_qpolynomial *
4252 isl_qpolynomial_project_domain_on_params(
4253 __isl_take isl_qpolynomial *qp);
4254 __isl_give isl_pw_qpolynomial *
4255 isl_pw_qpolynomial_project_domain_on_params(
4256 __isl_take isl_pw_qpolynomial *pwqp);
4257 __isl_give isl_pw_qpolynomial_fold *
4258 isl_pw_qpolynomial_fold_project_domain_on_params(
4259 __isl_take isl_pw_qpolynomial_fold *pwf);
4260 __isl_give isl_set *isl_pw_qpolynomial_domain(
4261 __isl_take isl_pw_qpolynomial *pwqp);
4262 __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4263 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4264 __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4265 __isl_take isl_union_pw_qpolynomial *upwqp);
4267 #include <isl/space.h>
4268 __isl_give isl_space *isl_space_domain_map(
4269 __isl_take isl_space *space);
4270 __isl_give isl_space *isl_space_range_map(
4271 __isl_take isl_space *space);
4273 #include <isl/map.h>
4274 __isl_give isl_map *isl_set_wrapped_domain_map(
4275 __isl_take isl_set *set);
4276 __isl_give isl_basic_map *isl_basic_map_domain_map(
4277 __isl_take isl_basic_map *bmap);
4278 __isl_give isl_basic_map *isl_basic_map_range_map(
4279 __isl_take isl_basic_map *bmap);
4280 __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4281 __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4283 #include <isl/union_map.h>
4284 __isl_give isl_union_map *isl_union_map_domain_map(
4285 __isl_take isl_union_map *umap);
4286 __isl_give isl_union_pw_multi_aff *
4287 isl_union_map_domain_map_union_pw_multi_aff(
4288 __isl_take isl_union_map *umap);
4289 __isl_give isl_union_map *isl_union_map_range_map(
4290 __isl_take isl_union_map *umap);
4291 __isl_give isl_union_map *
4292 isl_union_set_wrapped_domain_map(
4293 __isl_take isl_union_set *uset);
4295 The functions above construct a (basic, regular or union) relation
4296 that maps (a wrapped version of) the input relation to its domain or range.
4297 C<isl_set_wrapped_domain_map> maps the input set to the domain
4298 of its wrapped relation.
4302 __isl_give isl_basic_set *isl_basic_set_eliminate(
4303 __isl_take isl_basic_set *bset,
4304 enum isl_dim_type type,
4305 unsigned first, unsigned n);
4306 __isl_give isl_set *isl_set_eliminate(
4307 __isl_take isl_set *set, enum isl_dim_type type,
4308 unsigned first, unsigned n);
4309 __isl_give isl_basic_map *isl_basic_map_eliminate(
4310 __isl_take isl_basic_map *bmap,
4311 enum isl_dim_type type,
4312 unsigned first, unsigned n);
4313 __isl_give isl_map *isl_map_eliminate(
4314 __isl_take isl_map *map, enum isl_dim_type type,
4315 unsigned first, unsigned n);
4317 Eliminate the coefficients for the given dimensions from the constraints,
4318 without removing the dimensions.
4320 =item * Constructing a set from a parameter domain
4322 A zero-dimensional space or (basic) set can be constructed
4323 on a given parameter domain using the following functions.
4325 #include <isl/space.h>
4326 __isl_give isl_space *isl_space_set_from_params(
4327 __isl_take isl_space *space);
4329 #include <isl/set.h>
4330 __isl_give isl_basic_set *isl_basic_set_from_params(
4331 __isl_take isl_basic_set *bset);
4332 __isl_give isl_set *isl_set_from_params(
4333 __isl_take isl_set *set);
4335 =item * Constructing a relation from a set
4337 Create a relation with the given set as domain or range.
4338 The range or domain of the created relation is a zero-dimensional
4339 flat anonymous space.
4341 #include <isl/space.h>
4342 __isl_give isl_space *isl_space_from_domain(
4343 __isl_take isl_space *space);
4344 __isl_give isl_space *isl_space_from_range(
4345 __isl_take isl_space *space);
4346 __isl_give isl_space *isl_space_map_from_set(
4347 __isl_take isl_space *space);
4348 __isl_give isl_space *isl_space_map_from_domain_and_range(
4349 __isl_take isl_space *domain,
4350 __isl_take isl_space *range);
4352 #include <isl/local_space.h>
4353 __isl_give isl_local_space *isl_local_space_from_domain(
4354 __isl_take isl_local_space *ls);
4356 #include <isl/map.h>
4357 __isl_give isl_map *isl_map_from_domain(
4358 __isl_take isl_set *set);
4359 __isl_give isl_map *isl_map_from_range(
4360 __isl_take isl_set *set);
4362 #include <isl/val.h>
4363 __isl_give isl_multi_val *isl_multi_val_from_range(
4364 __isl_take isl_multi_val *mv);
4366 #include <isl/aff.h>
4367 __isl_give isl_multi_aff *isl_multi_aff_from_range(
4368 __isl_take isl_multi_aff *ma);
4369 __isl_give isl_pw_aff *isl_pw_aff_from_range(
4370 __isl_take isl_pw_aff *pwa);
4371 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4372 __isl_take isl_multi_pw_aff *mpa);
4373 __isl_give isl_multi_union_pw_aff *
4374 isl_multi_union_pw_aff_from_range(
4375 __isl_take isl_multi_union_pw_aff *mupa);
4376 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4377 __isl_take isl_set *set);
4378 __isl_give isl_union_pw_multi_aff *
4379 isl_union_pw_multi_aff_from_domain(
4380 __isl_take isl_union_set *uset);
4384 #include <isl/set.h>
4385 __isl_give isl_basic_set *isl_basic_set_fix_si(
4386 __isl_take isl_basic_set *bset,
4387 enum isl_dim_type type, unsigned pos, int value);
4388 __isl_give isl_basic_set *isl_basic_set_fix_val(
4389 __isl_take isl_basic_set *bset,
4390 enum isl_dim_type type, unsigned pos,
4391 __isl_take isl_val *v);
4392 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4393 enum isl_dim_type type, unsigned pos, int value);
4394 __isl_give isl_set *isl_set_fix_val(
4395 __isl_take isl_set *set,
4396 enum isl_dim_type type, unsigned pos,
4397 __isl_take isl_val *v);
4399 #include <isl/map.h>
4400 __isl_give isl_basic_map *isl_basic_map_fix_si(
4401 __isl_take isl_basic_map *bmap,
4402 enum isl_dim_type type, unsigned pos, int value);
4403 __isl_give isl_basic_map *isl_basic_map_fix_val(
4404 __isl_take isl_basic_map *bmap,
4405 enum isl_dim_type type, unsigned pos,
4406 __isl_take isl_val *v);
4407 __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4408 enum isl_dim_type type, unsigned pos, int value);
4409 __isl_give isl_map *isl_map_fix_val(
4410 __isl_take isl_map *map,
4411 enum isl_dim_type type, unsigned pos,
4412 __isl_take isl_val *v);
4414 #include <isl/aff.h>
4415 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4416 __isl_take isl_pw_multi_aff *pma,
4417 enum isl_dim_type type, unsigned pos, int value);
4419 #include <isl/polynomial.h>
4420 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4421 __isl_take isl_pw_qpolynomial *pwqp,
4422 enum isl_dim_type type, unsigned n,
4423 __isl_take isl_val *v);
4425 Intersect the set, relation or function domain
4426 with the hyperplane where the given
4427 dimension has the fixed given value.
4429 __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4430 __isl_take isl_basic_map *bmap,
4431 enum isl_dim_type type, unsigned pos, int value);
4432 __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4433 __isl_take isl_basic_map *bmap,
4434 enum isl_dim_type type, unsigned pos, int value);
4435 __isl_give isl_set *isl_set_lower_bound_si(
4436 __isl_take isl_set *set,
4437 enum isl_dim_type type, unsigned pos, int value);
4438 __isl_give isl_set *isl_set_lower_bound_val(
4439 __isl_take isl_set *set,
4440 enum isl_dim_type type, unsigned pos,
4441 __isl_take isl_val *value);
4442 __isl_give isl_map *isl_map_lower_bound_si(
4443 __isl_take isl_map *map,
4444 enum isl_dim_type type, unsigned pos, int value);
4445 __isl_give isl_set *isl_set_upper_bound_si(
4446 __isl_take isl_set *set,
4447 enum isl_dim_type type, unsigned pos, int value);
4448 __isl_give isl_set *isl_set_upper_bound_val(
4449 __isl_take isl_set *set,
4450 enum isl_dim_type type, unsigned pos,
4451 __isl_take isl_val *value);
4452 __isl_give isl_map *isl_map_upper_bound_si(
4453 __isl_take isl_map *map,
4454 enum isl_dim_type type, unsigned pos, int value);
4456 Intersect the set or relation with the half-space where the given
4457 dimension has a value bounded by the fixed given integer value.
4459 __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4460 enum isl_dim_type type1, int pos1,
4461 enum isl_dim_type type2, int pos2);
4462 __isl_give isl_basic_map *isl_basic_map_equate(
4463 __isl_take isl_basic_map *bmap,
4464 enum isl_dim_type type1, int pos1,
4465 enum isl_dim_type type2, int pos2);
4466 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4467 enum isl_dim_type type1, int pos1,
4468 enum isl_dim_type type2, int pos2);
4470 Intersect the set or relation with the hyperplane where the given
4471 dimensions are equal to each other.
4473 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4474 enum isl_dim_type type1, int pos1,
4475 enum isl_dim_type type2, int pos2);
4477 Intersect the relation with the hyperplane where the given
4478 dimensions have opposite values.
4480 __isl_give isl_map *isl_map_order_le(
4481 __isl_take isl_map *map,
4482 enum isl_dim_type type1, int pos1,
4483 enum isl_dim_type type2, int pos2);
4484 __isl_give isl_basic_map *isl_basic_map_order_ge(
4485 __isl_take isl_basic_map *bmap,
4486 enum isl_dim_type type1, int pos1,
4487 enum isl_dim_type type2, int pos2);
4488 __isl_give isl_map *isl_map_order_ge(
4489 __isl_take isl_map *map,
4490 enum isl_dim_type type1, int pos1,
4491 enum isl_dim_type type2, int pos2);
4492 __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4493 enum isl_dim_type type1, int pos1,
4494 enum isl_dim_type type2, int pos2);
4495 __isl_give isl_basic_map *isl_basic_map_order_gt(
4496 __isl_take isl_basic_map *bmap,
4497 enum isl_dim_type type1, int pos1,
4498 enum isl_dim_type type2, int pos2);
4499 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4500 enum isl_dim_type type1, int pos1,
4501 enum isl_dim_type type2, int pos2);
4503 Intersect the relation with the half-space where the given
4504 dimensions satisfy the given ordering.
4508 #include <isl/aff.h>
4509 __isl_give isl_basic_set *isl_aff_zero_basic_set(
4510 __isl_take isl_aff *aff);
4511 __isl_give isl_basic_set *isl_aff_neg_basic_set(
4512 __isl_take isl_aff *aff);
4513 __isl_give isl_set *isl_pw_aff_pos_set(
4514 __isl_take isl_pw_aff *pa);
4515 __isl_give isl_set *isl_pw_aff_nonneg_set(
4516 __isl_take isl_pw_aff *pwaff);
4517 __isl_give isl_set *isl_pw_aff_zero_set(
4518 __isl_take isl_pw_aff *pwaff);
4519 __isl_give isl_set *isl_pw_aff_non_zero_set(
4520 __isl_take isl_pw_aff *pwaff);
4521 __isl_give isl_union_set *
4522 isl_union_pw_aff_zero_union_set(
4523 __isl_take isl_union_pw_aff *upa);
4524 __isl_give isl_union_set *
4525 isl_multi_union_pw_aff_zero_union_set(
4526 __isl_take isl_multi_union_pw_aff *mupa);
4528 The function C<isl_aff_neg_basic_set> returns a basic set
4529 containing those elements in the domain space
4530 of C<aff> where C<aff> is negative.
4531 The function C<isl_pw_aff_nonneg_set> returns a set
4532 containing those elements in the domain
4533 of C<pwaff> where C<pwaff> is non-negative.
4534 The function C<isl_multi_union_pw_aff_zero_union_set>
4535 returns a union set containing those elements
4536 in the domains of its elements where they are all zero.
4540 __isl_give isl_map *isl_set_identity(
4541 __isl_take isl_set *set);
4542 __isl_give isl_union_map *isl_union_set_identity(
4543 __isl_take isl_union_set *uset);
4544 __isl_give isl_union_pw_multi_aff *
4545 isl_union_set_identity_union_pw_multi_aff(
4546 __isl_take isl_union_set *uset);
4548 Construct an identity relation on the given (union) set.
4550 =item * Function Extraction
4552 A piecewise quasi affine expression that is equal to 1 on a set
4553 and 0 outside the set can be created using the following function.
4555 #include <isl/aff.h>
4556 __isl_give isl_pw_aff *isl_set_indicator_function(
4557 __isl_take isl_set *set);
4559 A piecewise multiple quasi affine expression can be extracted
4560 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4561 and the C<isl_map> is single-valued.
4562 In case of a conversion from an C<isl_union_map>
4563 to an C<isl_union_pw_multi_aff>, these properties need to hold
4564 in each domain space.
4565 A conversion to a C<isl_multi_union_pw_aff> additionally
4566 requires that the input is non-empty and involves only a single
4569 #include <isl/aff.h>
4570 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4571 __isl_take isl_set *set);
4572 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4573 __isl_take isl_map *map);
4575 __isl_give isl_union_pw_multi_aff *
4576 isl_union_pw_multi_aff_from_union_set(
4577 __isl_take isl_union_set *uset);
4578 __isl_give isl_union_pw_multi_aff *
4579 isl_union_pw_multi_aff_from_union_map(
4580 __isl_take isl_union_map *umap);
4582 __isl_give isl_multi_union_pw_aff *
4583 isl_multi_union_pw_aff_from_union_map(
4584 __isl_take isl_union_map *umap);
4588 __isl_give isl_basic_set *isl_basic_map_deltas(
4589 __isl_take isl_basic_map *bmap);
4590 __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4591 __isl_give isl_union_set *isl_union_map_deltas(
4592 __isl_take isl_union_map *umap);
4594 These functions return a (basic) set containing the differences
4595 between image elements and corresponding domain elements in the input.
4597 __isl_give isl_basic_map *isl_basic_map_deltas_map(
4598 __isl_take isl_basic_map *bmap);
4599 __isl_give isl_map *isl_map_deltas_map(
4600 __isl_take isl_map *map);
4601 __isl_give isl_union_map *isl_union_map_deltas_map(
4602 __isl_take isl_union_map *umap);
4604 The functions above construct a (basic, regular or union) relation
4605 that maps (a wrapped version of) the input relation to its delta set.
4609 Simplify the representation of a set, relation or functions by trying
4610 to combine pairs of basic sets or relations into a single
4611 basic set or relation.
4613 #include <isl/set.h>
4614 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4616 #include <isl/map.h>
4617 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4619 #include <isl/union_set.h>
4620 __isl_give isl_union_set *isl_union_set_coalesce(
4621 __isl_take isl_union_set *uset);
4623 #include <isl/union_map.h>
4624 __isl_give isl_union_map *isl_union_map_coalesce(
4625 __isl_take isl_union_map *umap);
4627 #include <isl/aff.h>
4628 __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4629 __isl_take isl_pw_aff *pwqp);
4630 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4631 __isl_take isl_pw_multi_aff *pma);
4632 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4633 __isl_take isl_multi_pw_aff *mpa);
4634 __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4635 __isl_take isl_union_pw_aff *upa);
4636 __isl_give isl_union_pw_multi_aff *
4637 isl_union_pw_multi_aff_coalesce(
4638 __isl_take isl_union_pw_multi_aff *upma);
4639 __isl_give isl_multi_union_pw_aff *
4640 isl_multi_union_pw_aff_coalesce(
4641 __isl_take isl_multi_union_pw_aff *aff);
4643 #include <isl/polynomial.h>
4644 __isl_give isl_pw_qpolynomial_fold *
4645 isl_pw_qpolynomial_fold_coalesce(
4646 __isl_take isl_pw_qpolynomial_fold *pwf);
4647 __isl_give isl_union_pw_qpolynomial *
4648 isl_union_pw_qpolynomial_coalesce(
4649 __isl_take isl_union_pw_qpolynomial *upwqp);
4650 __isl_give isl_union_pw_qpolynomial_fold *
4651 isl_union_pw_qpolynomial_fold_coalesce(
4652 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4654 One of the methods for combining pairs of basic sets or relations
4655 can result in coefficients that are much larger than those that appear
4656 in the constraints of the input. By default, the coefficients are
4657 not allowed to grow larger, but this can be changed by unsetting
4658 the following option.
4660 isl_stat isl_options_set_coalesce_bounded_wrapping(
4661 isl_ctx *ctx, int val);
4662 int isl_options_get_coalesce_bounded_wrapping(
4665 =item * Detecting equalities
4667 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4668 __isl_take isl_basic_set *bset);
4669 __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4670 __isl_take isl_basic_map *bmap);
4671 __isl_give isl_set *isl_set_detect_equalities(
4672 __isl_take isl_set *set);
4673 __isl_give isl_map *isl_map_detect_equalities(
4674 __isl_take isl_map *map);
4675 __isl_give isl_union_set *isl_union_set_detect_equalities(
4676 __isl_take isl_union_set *uset);
4677 __isl_give isl_union_map *isl_union_map_detect_equalities(
4678 __isl_take isl_union_map *umap);
4680 Simplify the representation of a set or relation by detecting implicit
4683 =item * Removing redundant constraints
4685 #include <isl/set.h>
4686 __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4687 __isl_take isl_basic_set *bset);
4688 __isl_give isl_set *isl_set_remove_redundancies(
4689 __isl_take isl_set *set);
4691 #include <isl/union_set.h>
4692 __isl_give isl_union_set *
4693 isl_union_set_remove_redundancies(
4694 __isl_take isl_union_set *uset);
4696 #include <isl/map.h>
4697 __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4698 __isl_take isl_basic_map *bmap);
4699 __isl_give isl_map *isl_map_remove_redundancies(
4700 __isl_take isl_map *map);
4702 #include <isl/union_map.h>
4703 __isl_give isl_union_map *
4704 isl_union_map_remove_redundancies(
4705 __isl_take isl_union_map *umap);
4709 __isl_give isl_basic_set *isl_set_convex_hull(
4710 __isl_take isl_set *set);
4711 __isl_give isl_basic_map *isl_map_convex_hull(
4712 __isl_take isl_map *map);
4714 If the input set or relation has any existentially quantified
4715 variables, then the result of these operations is currently undefined.
4719 #include <isl/set.h>
4720 __isl_give isl_basic_set *
4721 isl_set_unshifted_simple_hull(
4722 __isl_take isl_set *set);
4723 __isl_give isl_basic_set *isl_set_simple_hull(
4724 __isl_take isl_set *set);
4725 __isl_give isl_basic_set *
4726 isl_set_unshifted_simple_hull_from_set_list(
4727 __isl_take isl_set *set,
4728 __isl_take isl_set_list *list);
4730 #include <isl/map.h>
4731 __isl_give isl_basic_map *
4732 isl_map_unshifted_simple_hull(
4733 __isl_take isl_map *map);
4734 __isl_give isl_basic_map *isl_map_simple_hull(
4735 __isl_take isl_map *map);
4736 __isl_give isl_basic_map *
4737 isl_map_unshifted_simple_hull_from_map_list(
4738 __isl_take isl_map *map,
4739 __isl_take isl_map_list *list);
4741 #include <isl/union_map.h>
4742 __isl_give isl_union_map *isl_union_map_simple_hull(
4743 __isl_take isl_union_map *umap);
4745 These functions compute a single basic set or relation
4746 that contains the whole input set or relation.
4747 In particular, the output is described by translates
4748 of the constraints describing the basic sets or relations in the input.
4749 In case of C<isl_set_unshifted_simple_hull>, only the original
4750 constraints are used, without any translation.
4751 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4752 C<isl_map_unshifted_simple_hull_from_map_list>, the
4753 constraints are taken from the elements of the second argument.
4757 (See \autoref{s:simple hull}.)
4763 __isl_give isl_basic_set *isl_basic_set_affine_hull(
4764 __isl_take isl_basic_set *bset);
4765 __isl_give isl_basic_set *isl_set_affine_hull(
4766 __isl_take isl_set *set);
4767 __isl_give isl_union_set *isl_union_set_affine_hull(
4768 __isl_take isl_union_set *uset);
4769 __isl_give isl_basic_map *isl_basic_map_affine_hull(
4770 __isl_take isl_basic_map *bmap);
4771 __isl_give isl_basic_map *isl_map_affine_hull(
4772 __isl_take isl_map *map);
4773 __isl_give isl_union_map *isl_union_map_affine_hull(
4774 __isl_take isl_union_map *umap);
4776 In case of union sets and relations, the affine hull is computed
4779 =item * Polyhedral hull
4781 __isl_give isl_basic_set *isl_set_polyhedral_hull(
4782 __isl_take isl_set *set);
4783 __isl_give isl_basic_map *isl_map_polyhedral_hull(
4784 __isl_take isl_map *map);
4785 __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4786 __isl_take isl_union_set *uset);
4787 __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4788 __isl_take isl_union_map *umap);
4790 These functions compute a single basic set or relation
4791 not involving any existentially quantified variables
4792 that contains the whole input set or relation.
4793 In case of union sets and relations, the polyhedral hull is computed
4796 =item * Other approximations
4798 #include <isl/set.h>
4799 __isl_give isl_basic_set *
4800 isl_basic_set_drop_constraints_involving_dims(
4801 __isl_take isl_basic_set *bset,
4802 enum isl_dim_type type,
4803 unsigned first, unsigned n);
4804 __isl_give isl_basic_set *
4805 isl_basic_set_drop_constraints_not_involving_dims(
4806 __isl_take isl_basic_set *bset,
4807 enum isl_dim_type type,
4808 unsigned first, unsigned n);
4809 __isl_give isl_set *
4810 isl_set_drop_constraints_involving_dims(
4811 __isl_take isl_set *set,
4812 enum isl_dim_type type,
4813 unsigned first, unsigned n);
4815 #include <isl/map.h>
4816 __isl_give isl_basic_map *
4817 isl_basic_map_drop_constraints_involving_dims(
4818 __isl_take isl_basic_map *bmap,
4819 enum isl_dim_type type,
4820 unsigned first, unsigned n);
4821 __isl_give isl_map *
4822 isl_map_drop_constraints_involving_dims(
4823 __isl_take isl_map *map,
4824 enum isl_dim_type type,
4825 unsigned first, unsigned n);
4827 These functions drop any constraints (not) involving the specified dimensions.
4828 Note that the result depends on the representation of the input.
4830 #include <isl/polynomial.h>
4831 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4832 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4833 __isl_give isl_union_pw_qpolynomial *
4834 isl_union_pw_qpolynomial_to_polynomial(
4835 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4837 Approximate each quasipolynomial by a polynomial. If C<sign> is positive,
4838 the polynomial will be an overapproximation. If C<sign> is negative,
4839 it will be an underapproximation. If C<sign> is zero, the approximation
4840 will lie somewhere in between.
4844 __isl_give isl_basic_set *isl_basic_set_sample(
4845 __isl_take isl_basic_set *bset);
4846 __isl_give isl_basic_set *isl_set_sample(
4847 __isl_take isl_set *set);
4848 __isl_give isl_basic_map *isl_basic_map_sample(
4849 __isl_take isl_basic_map *bmap);
4850 __isl_give isl_basic_map *isl_map_sample(
4851 __isl_take isl_map *map);
4853 If the input (basic) set or relation is non-empty, then return
4854 a singleton subset of the input. Otherwise, return an empty set.
4856 =item * Optimization
4858 #include <isl/ilp.h>
4859 __isl_give isl_val *isl_basic_set_max_val(
4860 __isl_keep isl_basic_set *bset,
4861 __isl_keep isl_aff *obj);
4862 __isl_give isl_val *isl_set_min_val(
4863 __isl_keep isl_set *set,
4864 __isl_keep isl_aff *obj);
4865 __isl_give isl_val *isl_set_max_val(
4866 __isl_keep isl_set *set,
4867 __isl_keep isl_aff *obj);
4869 Compute the minimum or maximum of the integer affine expression C<obj>
4870 over the points in C<set>, returning the result in C<opt>.
4871 The result is C<NULL> in case of an error, the optimal value in case
4872 there is one, negative infinity or infinity if the problem is unbounded and
4873 NaN if the problem is empty.
4875 =item * Parametric optimization
4877 __isl_give isl_pw_aff *isl_set_dim_min(
4878 __isl_take isl_set *set, int pos);
4879 __isl_give isl_pw_aff *isl_set_dim_max(
4880 __isl_take isl_set *set, int pos);
4881 __isl_give isl_pw_aff *isl_map_dim_max(
4882 __isl_take isl_map *map, int pos);
4884 Compute the minimum or maximum of the given set or output dimension
4885 as a function of the parameters (and input dimensions), but independently
4886 of the other set or output dimensions.
4887 For lexicographic optimization, see L<"Lexicographic Optimization">.
4891 The following functions compute either the set of (rational) coefficient
4892 values of valid constraints for the given set or the set of (rational)
4893 values satisfying the constraints with coefficients from the given set.
4894 Internally, these two sets of functions perform essentially the
4895 same operations, except that the set of coefficients is assumed to
4896 be a cone, while the set of values may be any polyhedron.
4897 The current implementation is based on the Farkas lemma and
4898 Fourier-Motzkin elimination, but this may change or be made optional
4899 in future. In particular, future implementations may use different
4900 dualization algorithms or skip the elimination step.
4902 __isl_give isl_basic_set *isl_basic_set_coefficients(
4903 __isl_take isl_basic_set *bset);
4904 __isl_give isl_basic_set *isl_set_coefficients(
4905 __isl_take isl_set *set);
4906 __isl_give isl_union_set *isl_union_set_coefficients(
4907 __isl_take isl_union_set *bset);
4908 __isl_give isl_basic_set *isl_basic_set_solutions(
4909 __isl_take isl_basic_set *bset);
4910 __isl_give isl_basic_set *isl_set_solutions(
4911 __isl_take isl_set *set);
4912 __isl_give isl_union_set *isl_union_set_solutions(
4913 __isl_take isl_union_set *bset);
4917 __isl_give isl_map *isl_map_fixed_power_val(
4918 __isl_take isl_map *map,
4919 __isl_take isl_val *exp);
4920 __isl_give isl_union_map *
4921 isl_union_map_fixed_power_val(
4922 __isl_take isl_union_map *umap,
4923 __isl_take isl_val *exp);
4925 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4926 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4927 of C<map> is computed.
4929 __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4931 __isl_give isl_union_map *isl_union_map_power(
4932 __isl_take isl_union_map *umap, int *exact);
4934 Compute a parametric representation for all positive powers I<k> of C<map>.
4935 The result maps I<k> to a nested relation corresponding to the
4936 I<k>th power of C<map>.
4937 The result may be an overapproximation. If the result is known to be exact,
4938 then C<*exact> is set to C<1>.
4940 =item * Transitive closure
4942 __isl_give isl_map *isl_map_transitive_closure(
4943 __isl_take isl_map *map, int *exact);
4944 __isl_give isl_union_map *isl_union_map_transitive_closure(
4945 __isl_take isl_union_map *umap, int *exact);
4947 Compute the transitive closure of C<map>.
4948 The result may be an overapproximation. If the result is known to be exact,
4949 then C<*exact> is set to C<1>.
4951 =item * Reaching path lengths
4953 __isl_give isl_map *isl_map_reaching_path_lengths(
4954 __isl_take isl_map *map, int *exact);
4956 Compute a relation that maps each element in the range of C<map>
4957 to the lengths of all paths composed of edges in C<map> that
4958 end up in the given element.
4959 The result may be an overapproximation. If the result is known to be exact,
4960 then C<*exact> is set to C<1>.
4961 To compute the I<maximal> path length, the resulting relation
4962 should be postprocessed by C<isl_map_lexmax>.
4963 In particular, if the input relation is a dependence relation
4964 (mapping sources to sinks), then the maximal path length corresponds
4965 to the free schedule.
4966 Note, however, that C<isl_map_lexmax> expects the maximum to be
4967 finite, so if the path lengths are unbounded (possibly due to
4968 the overapproximation), then you will get an error message.
4972 #include <isl/space.h>
4973 __isl_give isl_space *isl_space_wrap(
4974 __isl_take isl_space *space);
4975 __isl_give isl_space *isl_space_unwrap(
4976 __isl_take isl_space *space);
4978 #include <isl/local_space.h>
4979 __isl_give isl_local_space *isl_local_space_wrap(
4980 __isl_take isl_local_space *ls);
4982 #include <isl/set.h>
4983 __isl_give isl_basic_map *isl_basic_set_unwrap(
4984 __isl_take isl_basic_set *bset);
4985 __isl_give isl_map *isl_set_unwrap(
4986 __isl_take isl_set *set);
4988 #include <isl/map.h>
4989 __isl_give isl_basic_set *isl_basic_map_wrap(
4990 __isl_take isl_basic_map *bmap);
4991 __isl_give isl_set *isl_map_wrap(
4992 __isl_take isl_map *map);
4994 #include <isl/union_set.h>
4995 __isl_give isl_union_map *isl_union_set_unwrap(
4996 __isl_take isl_union_set *uset);
4998 #include <isl/union_map.h>
4999 __isl_give isl_union_set *isl_union_map_wrap(
5000 __isl_take isl_union_map *umap);
5002 The input to C<isl_space_unwrap> should
5003 be the space of a set, while that of
5004 C<isl_space_wrap> should be the space of a relation.
5005 Conversely, the output of C<isl_space_unwrap> is the space
5006 of a relation, while that of C<isl_space_wrap> is the space of a set.
5010 Remove any internal structure of domain (and range) of the given
5011 set or relation. If there is any such internal structure in the input,
5012 then the name of the space is also removed.
5014 #include <isl/local_space.h>
5015 __isl_give isl_local_space *
5016 isl_local_space_flatten_domain(
5017 __isl_take isl_local_space *ls);
5018 __isl_give isl_local_space *
5019 isl_local_space_flatten_range(
5020 __isl_take isl_local_space *ls);
5022 #include <isl/set.h>
5023 __isl_give isl_basic_set *isl_basic_set_flatten(
5024 __isl_take isl_basic_set *bset);
5025 __isl_give isl_set *isl_set_flatten(
5026 __isl_take isl_set *set);
5028 #include <isl/map.h>
5029 __isl_give isl_basic_map *isl_basic_map_flatten_domain(
5030 __isl_take isl_basic_map *bmap);
5031 __isl_give isl_basic_map *isl_basic_map_flatten_range(
5032 __isl_take isl_basic_map *bmap);
5033 __isl_give isl_map *isl_map_flatten_range(
5034 __isl_take isl_map *map);
5035 __isl_give isl_map *isl_map_flatten_domain(
5036 __isl_take isl_map *map);
5037 __isl_give isl_basic_map *isl_basic_map_flatten(
5038 __isl_take isl_basic_map *bmap);
5039 __isl_give isl_map *isl_map_flatten(
5040 __isl_take isl_map *map);
5042 #include <isl/val.h>
5043 __isl_give isl_multi_val *isl_multi_val_flatten_range(
5044 __isl_take isl_multi_val *mv);
5046 #include <isl/aff.h>
5047 __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5048 __isl_take isl_multi_aff *ma);
5049 __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5050 __isl_take isl_multi_aff *ma);
5051 __isl_give isl_multi_pw_aff *
5052 isl_multi_pw_aff_flatten_range(
5053 __isl_take isl_multi_pw_aff *mpa);
5054 __isl_give isl_multi_union_pw_aff *
5055 isl_multi_union_pw_aff_flatten_range(
5056 __isl_take isl_multi_union_pw_aff *mupa);
5058 #include <isl/map.h>
5059 __isl_give isl_map *isl_set_flatten_map(
5060 __isl_take isl_set *set);
5062 The function above constructs a relation
5063 that maps the input set to a flattened version of the set.
5067 Lift the input set to a space with extra dimensions corresponding
5068 to the existentially quantified variables in the input.
5069 In particular, the result lives in a wrapped map where the domain
5070 is the original space and the range corresponds to the original
5071 existentially quantified variables.
5073 #include <isl/set.h>
5074 __isl_give isl_basic_set *isl_basic_set_lift(
5075 __isl_take isl_basic_set *bset);
5076 __isl_give isl_set *isl_set_lift(
5077 __isl_take isl_set *set);
5078 __isl_give isl_union_set *isl_union_set_lift(
5079 __isl_take isl_union_set *uset);
5081 Given a local space that contains the existentially quantified
5082 variables of a set, a basic relation that, when applied to
5083 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
5084 can be constructed using the following function.
5086 #include <isl/local_space.h>
5087 __isl_give isl_basic_map *isl_local_space_lifting(
5088 __isl_take isl_local_space *ls);
5090 #include <isl/aff.h>
5091 __isl_give isl_multi_aff *isl_multi_aff_lift(
5092 __isl_take isl_multi_aff *maff,
5093 __isl_give isl_local_space **ls);
5095 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
5096 then it is assigned the local space that lies at the basis of
5097 the lifting applied.
5099 =item * Internal Product
5101 #include <isl/space.h>
5102 __isl_give isl_space *isl_space_zip(
5103 __isl_take isl_space *space);
5105 #include <isl/map.h>
5106 __isl_give isl_basic_map *isl_basic_map_zip(
5107 __isl_take isl_basic_map *bmap);
5108 __isl_give isl_map *isl_map_zip(
5109 __isl_take isl_map *map);
5111 #include <isl/union_map.h>
5112 __isl_give isl_union_map *isl_union_map_zip(
5113 __isl_take isl_union_map *umap);
5115 Given a relation with nested relations for domain and range,
5116 interchange the range of the domain with the domain of the range.
5120 #include <isl/space.h>
5121 __isl_give isl_space *isl_space_curry(
5122 __isl_take isl_space *space);
5123 __isl_give isl_space *isl_space_uncurry(
5124 __isl_take isl_space *space);
5126 #include <isl/map.h>
5127 __isl_give isl_basic_map *isl_basic_map_curry(
5128 __isl_take isl_basic_map *bmap);
5129 __isl_give isl_basic_map *isl_basic_map_uncurry(
5130 __isl_take isl_basic_map *bmap);
5131 __isl_give isl_map *isl_map_curry(
5132 __isl_take isl_map *map);
5133 __isl_give isl_map *isl_map_uncurry(
5134 __isl_take isl_map *map);
5136 #include <isl/union_map.h>
5137 __isl_give isl_union_map *isl_union_map_curry(
5138 __isl_take isl_union_map *umap);
5139 __isl_give isl_union_map *isl_union_map_uncurry(
5140 __isl_take isl_union_map *umap);
5142 Given a relation with a nested relation for domain,
5143 the C<curry> functions
5144 move the range of the nested relation out of the domain
5145 and use it as the domain of a nested relation in the range,
5146 with the original range as range of this nested relation.
5147 The C<uncurry> functions perform the inverse operation.
5149 =item * Aligning parameters
5151 Change the order of the parameters of the given set, relation
5153 such that the first parameters match those of C<model>.
5154 This may involve the introduction of extra parameters.
5155 All parameters need to be named.
5157 #include <isl/space.h>
5158 __isl_give isl_space *isl_space_align_params(
5159 __isl_take isl_space *space1,
5160 __isl_take isl_space *space2)
5162 #include <isl/set.h>
5163 __isl_give isl_basic_set *isl_basic_set_align_params(
5164 __isl_take isl_basic_set *bset,
5165 __isl_take isl_space *model);
5166 __isl_give isl_set *isl_set_align_params(
5167 __isl_take isl_set *set,
5168 __isl_take isl_space *model);
5170 #include <isl/map.h>
5171 __isl_give isl_basic_map *isl_basic_map_align_params(
5172 __isl_take isl_basic_map *bmap,
5173 __isl_take isl_space *model);
5174 __isl_give isl_map *isl_map_align_params(
5175 __isl_take isl_map *map,
5176 __isl_take isl_space *model);
5178 #include <isl/val.h>
5179 __isl_give isl_multi_val *isl_multi_val_align_params(
5180 __isl_take isl_multi_val *mv,
5181 __isl_take isl_space *model);
5183 #include <isl/aff.h>
5184 __isl_give isl_aff *isl_aff_align_params(
5185 __isl_take isl_aff *aff,
5186 __isl_take isl_space *model);
5187 __isl_give isl_multi_aff *isl_multi_aff_align_params(
5188 __isl_take isl_multi_aff *multi,
5189 __isl_take isl_space *model);
5190 __isl_give isl_pw_aff *isl_pw_aff_align_params(
5191 __isl_take isl_pw_aff *pwaff,
5192 __isl_take isl_space *model);
5193 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5194 __isl_take isl_pw_multi_aff *pma,
5195 __isl_take isl_space *model);
5196 __isl_give isl_union_pw_aff *
5197 isl_union_pw_aff_align_params(
5198 __isl_take isl_union_pw_aff *upa,
5199 __isl_take isl_space *model);
5200 __isl_give isl_union_pw_multi_aff *
5201 isl_union_pw_multi_aff_align_params(
5202 __isl_take isl_union_pw_multi_aff *upma,
5203 __isl_take isl_space *model);
5204 __isl_give isl_multi_union_pw_aff *
5205 isl_multi_union_pw_aff_align_params(
5206 __isl_take isl_multi_union_pw_aff *mupa,
5207 __isl_take isl_space *model);
5209 #include <isl/polynomial.h>
5210 __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5211 __isl_take isl_qpolynomial *qp,
5212 __isl_take isl_space *model);
5214 =item * Unary Arithmethic Operations
5216 #include <isl/val.h>
5217 __isl_give isl_multi_val *isl_multi_val_neg(
5218 __isl_take isl_multi_val *mv);
5220 #include <isl/aff.h>
5221 __isl_give isl_aff *isl_aff_neg(
5222 __isl_take isl_aff *aff);
5223 __isl_give isl_multi_aff *isl_multi_aff_neg(
5224 __isl_take isl_multi_aff *ma);
5225 __isl_give isl_pw_aff *isl_pw_aff_neg(
5226 __isl_take isl_pw_aff *pwaff);
5227 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5228 __isl_take isl_pw_multi_aff *pma);
5229 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5230 __isl_take isl_multi_pw_aff *mpa);
5231 __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5232 __isl_take isl_union_pw_aff *upa);
5233 __isl_give isl_union_pw_multi_aff *
5234 isl_union_pw_multi_aff_neg(
5235 __isl_take isl_union_pw_multi_aff *upma);
5236 __isl_give isl_multi_union_pw_aff *
5237 isl_multi_union_pw_aff_neg(
5238 __isl_take isl_multi_union_pw_aff *mupa);
5239 __isl_give isl_aff *isl_aff_ceil(
5240 __isl_take isl_aff *aff);
5241 __isl_give isl_pw_aff *isl_pw_aff_ceil(
5242 __isl_take isl_pw_aff *pwaff);
5243 __isl_give isl_aff *isl_aff_floor(
5244 __isl_take isl_aff *aff);
5245 __isl_give isl_multi_aff *isl_multi_aff_floor(
5246 __isl_take isl_multi_aff *ma);
5247 __isl_give isl_pw_aff *isl_pw_aff_floor(
5248 __isl_take isl_pw_aff *pwaff);
5249 __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5250 __isl_take isl_union_pw_aff *upa);
5251 __isl_give isl_multi_union_pw_aff *
5252 isl_multi_union_pw_aff_floor(
5253 __isl_take isl_multi_union_pw_aff *mupa);
5255 #include <isl/aff.h>
5256 __isl_give isl_pw_aff *isl_pw_aff_list_min(
5257 __isl_take isl_pw_aff_list *list);
5258 __isl_give isl_pw_aff *isl_pw_aff_list_max(
5259 __isl_take isl_pw_aff_list *list);
5261 #include <isl/polynomial.h>
5262 __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5263 __isl_take isl_qpolynomial *qp);
5264 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5265 __isl_take isl_pw_qpolynomial *pwqp);
5266 __isl_give isl_union_pw_qpolynomial *
5267 isl_union_pw_qpolynomial_neg(
5268 __isl_take isl_union_pw_qpolynomial *upwqp);
5269 __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5270 __isl_take isl_qpolynomial *qp,
5272 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5273 __isl_take isl_pw_qpolynomial *pwqp,
5278 The following functions evaluate a function in a point.
5280 #include <isl/polynomial.h>
5281 __isl_give isl_val *isl_pw_qpolynomial_eval(
5282 __isl_take isl_pw_qpolynomial *pwqp,
5283 __isl_take isl_point *pnt);
5284 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5285 __isl_take isl_pw_qpolynomial_fold *pwf,
5286 __isl_take isl_point *pnt);
5287 __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5288 __isl_take isl_union_pw_qpolynomial *upwqp,
5289 __isl_take isl_point *pnt);
5290 __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5291 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5292 __isl_take isl_point *pnt);
5294 =item * Dimension manipulation
5296 It is usually not advisable to directly change the (input or output)
5297 space of a set or a relation as this removes the name and the internal
5298 structure of the space. However, the functions below can be useful
5299 to add new parameters, assuming
5300 C<isl_set_align_params> and C<isl_map_align_params>
5303 #include <isl/space.h>
5304 __isl_give isl_space *isl_space_add_dims(
5305 __isl_take isl_space *space,
5306 enum isl_dim_type type, unsigned n);
5307 __isl_give isl_space *isl_space_insert_dims(
5308 __isl_take isl_space *space,
5309 enum isl_dim_type type, unsigned pos, unsigned n);
5310 __isl_give isl_space *isl_space_drop_dims(
5311 __isl_take isl_space *space,
5312 enum isl_dim_type type, unsigned first, unsigned n);
5313 __isl_give isl_space *isl_space_move_dims(
5314 __isl_take isl_space *space,
5315 enum isl_dim_type dst_type, unsigned dst_pos,
5316 enum isl_dim_type src_type, unsigned src_pos,
5319 #include <isl/local_space.h>
5320 __isl_give isl_local_space *isl_local_space_add_dims(
5321 __isl_take isl_local_space *ls,
5322 enum isl_dim_type type, unsigned n);
5323 __isl_give isl_local_space *isl_local_space_insert_dims(
5324 __isl_take isl_local_space *ls,
5325 enum isl_dim_type type, unsigned first, unsigned n);
5326 __isl_give isl_local_space *isl_local_space_drop_dims(
5327 __isl_take isl_local_space *ls,
5328 enum isl_dim_type type, unsigned first, unsigned n);
5330 #include <isl/set.h>
5331 __isl_give isl_basic_set *isl_basic_set_add_dims(
5332 __isl_take isl_basic_set *bset,
5333 enum isl_dim_type type, unsigned n);
5334 __isl_give isl_set *isl_set_add_dims(
5335 __isl_take isl_set *set,
5336 enum isl_dim_type type, unsigned n);
5337 __isl_give isl_basic_set *isl_basic_set_insert_dims(
5338 __isl_take isl_basic_set *bset,
5339 enum isl_dim_type type, unsigned pos,
5341 __isl_give isl_set *isl_set_insert_dims(
5342 __isl_take isl_set *set,
5343 enum isl_dim_type type, unsigned pos, unsigned n);
5344 __isl_give isl_basic_set *isl_basic_set_move_dims(
5345 __isl_take isl_basic_set *bset,
5346 enum isl_dim_type dst_type, unsigned dst_pos,
5347 enum isl_dim_type src_type, unsigned src_pos,
5349 __isl_give isl_set *isl_set_move_dims(
5350 __isl_take isl_set *set,
5351 enum isl_dim_type dst_type, unsigned dst_pos,
5352 enum isl_dim_type src_type, unsigned src_pos,
5355 #include <isl/map.h>
5356 __isl_give isl_basic_map *isl_basic_map_add_dims(
5357 __isl_take isl_basic_map *bmap,
5358 enum isl_dim_type type, unsigned n);
5359 __isl_give isl_map *isl_map_add_dims(
5360 __isl_take isl_map *map,
5361 enum isl_dim_type type, unsigned n);
5362 __isl_give isl_basic_map *isl_basic_map_insert_dims(
5363 __isl_take isl_basic_map *bmap,
5364 enum isl_dim_type type, unsigned pos,
5366 __isl_give isl_map *isl_map_insert_dims(
5367 __isl_take isl_map *map,
5368 enum isl_dim_type type, unsigned pos, unsigned n);
5369 __isl_give isl_basic_map *isl_basic_map_move_dims(
5370 __isl_take isl_basic_map *bmap,
5371 enum isl_dim_type dst_type, unsigned dst_pos,
5372 enum isl_dim_type src_type, unsigned src_pos,
5374 __isl_give isl_map *isl_map_move_dims(
5375 __isl_take isl_map *map,
5376 enum isl_dim_type dst_type, unsigned dst_pos,
5377 enum isl_dim_type src_type, unsigned src_pos,
5380 #include <isl/val.h>
5381 __isl_give isl_multi_val *isl_multi_val_insert_dims(
5382 __isl_take isl_multi_val *mv,
5383 enum isl_dim_type type, unsigned first, unsigned n);
5384 __isl_give isl_multi_val *isl_multi_val_add_dims(
5385 __isl_take isl_multi_val *mv,
5386 enum isl_dim_type type, unsigned n);
5387 __isl_give isl_multi_val *isl_multi_val_drop_dims(
5388 __isl_take isl_multi_val *mv,
5389 enum isl_dim_type type, unsigned first, unsigned n);
5391 #include <isl/aff.h>
5392 __isl_give isl_aff *isl_aff_insert_dims(
5393 __isl_take isl_aff *aff,
5394 enum isl_dim_type type, unsigned first, unsigned n);
5395 __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5396 __isl_take isl_multi_aff *ma,
5397 enum isl_dim_type type, unsigned first, unsigned n);
5398 __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5399 __isl_take isl_pw_aff *pwaff,
5400 enum isl_dim_type type, unsigned first, unsigned n);
5401 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5402 __isl_take isl_multi_pw_aff *mpa,
5403 enum isl_dim_type type, unsigned first, unsigned n);
5404 __isl_give isl_aff *isl_aff_add_dims(
5405 __isl_take isl_aff *aff,
5406 enum isl_dim_type type, unsigned n);
5407 __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5408 __isl_take isl_multi_aff *ma,
5409 enum isl_dim_type type, unsigned n);
5410 __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5411 __isl_take isl_pw_aff *pwaff,
5412 enum isl_dim_type type, unsigned n);
5413 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5414 __isl_take isl_multi_pw_aff *mpa,
5415 enum isl_dim_type type, unsigned n);
5416 __isl_give isl_aff *isl_aff_drop_dims(
5417 __isl_take isl_aff *aff,
5418 enum isl_dim_type type, unsigned first, unsigned n);
5419 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5420 __isl_take isl_multi_aff *maff,
5421 enum isl_dim_type type, unsigned first, unsigned n);
5422 __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5423 __isl_take isl_pw_aff *pwaff,
5424 enum isl_dim_type type, unsigned first, unsigned n);
5425 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5426 __isl_take isl_pw_multi_aff *pma,
5427 enum isl_dim_type type, unsigned first, unsigned n);
5428 __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5429 __isl_take isl_union_pw_aff *upa,
5430 enum isl_dim_type type, unsigned first, unsigned n);
5431 __isl_give isl_union_pw_multi_aff *
5432 isl_union_pw_multi_aff_drop_dims(
5433 __isl_take isl_union_pw_multi_aff *upma,
5434 enum isl_dim_type type,
5435 unsigned first, unsigned n);
5436 __isl_give isl_multi_union_pw_aff *
5437 isl_multi_union_pw_aff_drop_dims(
5438 __isl_take isl_multi_union_pw_aff *mupa,
5439 enum isl_dim_type type, unsigned first,
5441 __isl_give isl_aff *isl_aff_move_dims(
5442 __isl_take isl_aff *aff,
5443 enum isl_dim_type dst_type, unsigned dst_pos,
5444 enum isl_dim_type src_type, unsigned src_pos,
5446 __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5447 __isl_take isl_multi_aff *ma,
5448 enum isl_dim_type dst_type, unsigned dst_pos,
5449 enum isl_dim_type src_type, unsigned src_pos,
5451 __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5452 __isl_take isl_pw_aff *pa,
5453 enum isl_dim_type dst_type, unsigned dst_pos,
5454 enum isl_dim_type src_type, unsigned src_pos,
5456 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5457 __isl_take isl_multi_pw_aff *pma,
5458 enum isl_dim_type dst_type, unsigned dst_pos,
5459 enum isl_dim_type src_type, unsigned src_pos,
5462 #include <isl/polynomial.h>
5463 __isl_give isl_union_pw_qpolynomial *
5464 isl_union_pw_qpolynomial_drop_dims(
5465 __isl_take isl_union_pw_qpolynomial *upwqp,
5466 enum isl_dim_type type,
5467 unsigned first, unsigned n);
5468 __isl_give isl_union_pw_qpolynomial_fold *
5469 isl_union_pw_qpolynomial_fold_drop_dims(
5470 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5471 enum isl_dim_type type,
5472 unsigned first, unsigned n);
5474 The operations on union expressions can only manipulate parameters.
5478 =head2 Binary Operations
5480 The two arguments of a binary operation not only need to live
5481 in the same C<isl_ctx>, they currently also need to have
5482 the same (number of) parameters.
5484 =head3 Basic Operations
5488 =item * Intersection
5490 #include <isl/local_space.h>
5491 __isl_give isl_local_space *isl_local_space_intersect(
5492 __isl_take isl_local_space *ls1,
5493 __isl_take isl_local_space *ls2);
5495 #include <isl/set.h>
5496 __isl_give isl_basic_set *isl_basic_set_intersect_params(
5497 __isl_take isl_basic_set *bset1,
5498 __isl_take isl_basic_set *bset2);
5499 __isl_give isl_basic_set *isl_basic_set_intersect(
5500 __isl_take isl_basic_set *bset1,
5501 __isl_take isl_basic_set *bset2);
5502 __isl_give isl_basic_set *isl_basic_set_list_intersect(
5503 __isl_take struct isl_basic_set_list *list);
5504 __isl_give isl_set *isl_set_intersect_params(
5505 __isl_take isl_set *set,
5506 __isl_take isl_set *params);
5507 __isl_give isl_set *isl_set_intersect(
5508 __isl_take isl_set *set1,
5509 __isl_take isl_set *set2);
5511 #include <isl/map.h>
5512 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5513 __isl_take isl_basic_map *bmap,
5514 __isl_take isl_basic_set *bset);
5515 __isl_give isl_basic_map *isl_basic_map_intersect_range(
5516 __isl_take isl_basic_map *bmap,
5517 __isl_take isl_basic_set *bset);
5518 __isl_give isl_basic_map *isl_basic_map_intersect(
5519 __isl_take isl_basic_map *bmap1,
5520 __isl_take isl_basic_map *bmap2);
5521 __isl_give isl_basic_map *isl_basic_map_list_intersect(
5522 __isl_take isl_basic_map_list *list);
5523 __isl_give isl_map *isl_map_intersect_params(
5524 __isl_take isl_map *map,
5525 __isl_take isl_set *params);
5526 __isl_give isl_map *isl_map_intersect_domain(
5527 __isl_take isl_map *map,
5528 __isl_take isl_set *set);
5529 __isl_give isl_map *isl_map_intersect_range(
5530 __isl_take isl_map *map,
5531 __isl_take isl_set *set);
5532 __isl_give isl_map *isl_map_intersect(
5533 __isl_take isl_map *map1,
5534 __isl_take isl_map *map2);
5536 #include <isl/union_set.h>
5537 __isl_give isl_union_set *isl_union_set_intersect_params(
5538 __isl_take isl_union_set *uset,
5539 __isl_take isl_set *set);
5540 __isl_give isl_union_set *isl_union_set_intersect(
5541 __isl_take isl_union_set *uset1,
5542 __isl_take isl_union_set *uset2);
5544 #include <isl/union_map.h>
5545 __isl_give isl_union_map *isl_union_map_intersect_params(
5546 __isl_take isl_union_map *umap,
5547 __isl_take isl_set *set);
5548 __isl_give isl_union_map *isl_union_map_intersect_domain(
5549 __isl_take isl_union_map *umap,
5550 __isl_take isl_union_set *uset);
5551 __isl_give isl_union_map *isl_union_map_intersect_range(
5552 __isl_take isl_union_map *umap,
5553 __isl_take isl_union_set *uset);
5554 __isl_give isl_union_map *isl_union_map_intersect(
5555 __isl_take isl_union_map *umap1,
5556 __isl_take isl_union_map *umap2);
5558 #include <isl/aff.h>
5559 __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5560 __isl_take isl_pw_aff *pa,
5561 __isl_take isl_set *set);
5562 __isl_give isl_multi_pw_aff *
5563 isl_multi_pw_aff_intersect_domain(
5564 __isl_take isl_multi_pw_aff *mpa,
5565 __isl_take isl_set *domain);
5566 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5567 __isl_take isl_pw_multi_aff *pma,
5568 __isl_take isl_set *set);
5569 __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5570 __isl_take isl_union_pw_aff *upa,
5571 __isl_take isl_union_set *uset);
5572 __isl_give isl_union_pw_multi_aff *
5573 isl_union_pw_multi_aff_intersect_domain(
5574 __isl_take isl_union_pw_multi_aff *upma,
5575 __isl_take isl_union_set *uset);
5576 __isl_give isl_multi_union_pw_aff *
5577 isl_multi_union_pw_aff_intersect_domain(
5578 __isl_take isl_multi_union_pw_aff *mupa,
5579 __isl_take isl_union_set *uset);
5580 __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5581 __isl_take isl_pw_aff *pa,
5582 __isl_take isl_set *set);
5583 __isl_give isl_multi_pw_aff *
5584 isl_multi_pw_aff_intersect_params(
5585 __isl_take isl_multi_pw_aff *mpa,
5586 __isl_take isl_set *set);
5587 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5588 __isl_take isl_pw_multi_aff *pma,
5589 __isl_take isl_set *set);
5590 __isl_give isl_union_pw_aff *
5591 isl_union_pw_aff_intersect_params(
5592 __isl_take isl_union_pw_aff *upa,
5593 __isl_give isl_union_pw_multi_aff *
5594 isl_union_pw_multi_aff_intersect_params(
5595 __isl_take isl_union_pw_multi_aff *upma,
5596 __isl_take isl_set *set);
5597 __isl_give isl_multi_union_pw_aff *
5598 isl_multi_union_pw_aff_intersect_params(
5599 __isl_take isl_multi_union_pw_aff *mupa,
5600 __isl_take isl_set *params);
5601 isl_multi_union_pw_aff_intersect_range(
5602 __isl_take isl_multi_union_pw_aff *mupa,
5603 __isl_take isl_set *set);
5605 #include <isl/polynomial.h>
5606 __isl_give isl_pw_qpolynomial *
5607 isl_pw_qpolynomial_intersect_domain(
5608 __isl_take isl_pw_qpolynomial *pwpq,
5609 __isl_take isl_set *set);
5610 __isl_give isl_union_pw_qpolynomial *
5611 isl_union_pw_qpolynomial_intersect_domain(
5612 __isl_take isl_union_pw_qpolynomial *upwpq,
5613 __isl_take isl_union_set *uset);
5614 __isl_give isl_union_pw_qpolynomial_fold *
5615 isl_union_pw_qpolynomial_fold_intersect_domain(
5616 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5617 __isl_take isl_union_set *uset);
5618 __isl_give isl_pw_qpolynomial *
5619 isl_pw_qpolynomial_intersect_params(
5620 __isl_take isl_pw_qpolynomial *pwpq,
5621 __isl_take isl_set *set);
5622 __isl_give isl_pw_qpolynomial_fold *
5623 isl_pw_qpolynomial_fold_intersect_params(
5624 __isl_take isl_pw_qpolynomial_fold *pwf,
5625 __isl_take isl_set *set);
5626 __isl_give isl_union_pw_qpolynomial *
5627 isl_union_pw_qpolynomial_intersect_params(
5628 __isl_take isl_union_pw_qpolynomial *upwpq,
5629 __isl_take isl_set *set);
5630 __isl_give isl_union_pw_qpolynomial_fold *
5631 isl_union_pw_qpolynomial_fold_intersect_params(
5632 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5633 __isl_take isl_set *set);
5635 The second argument to the C<_params> functions needs to be
5636 a parametric (basic) set. For the other functions, a parametric set
5637 for either argument is only allowed if the other argument is
5638 a parametric set as well.
5639 The list passed to C<isl_basic_set_list_intersect> needs to have
5640 at least one element and all elements need to live in the same space.
5641 The function C<isl_multi_union_pw_aff_intersect_range>
5642 restricts the input function to those shared domain elements
5643 that map to the specified range.
5647 #include <isl/set.h>
5648 __isl_give isl_set *isl_basic_set_union(
5649 __isl_take isl_basic_set *bset1,
5650 __isl_take isl_basic_set *bset2);
5651 __isl_give isl_set *isl_set_union(
5652 __isl_take isl_set *set1,
5653 __isl_take isl_set *set2);
5655 #include <isl/map.h>
5656 __isl_give isl_map *isl_basic_map_union(
5657 __isl_take isl_basic_map *bmap1,
5658 __isl_take isl_basic_map *bmap2);
5659 __isl_give isl_map *isl_map_union(
5660 __isl_take isl_map *map1,
5661 __isl_take isl_map *map2);
5663 #include <isl/union_set.h>
5664 __isl_give isl_union_set *isl_union_set_union(
5665 __isl_take isl_union_set *uset1,
5666 __isl_take isl_union_set *uset2);
5667 __isl_give isl_union_set *isl_union_set_list_union(
5668 __isl_take isl_union_set_list *list);
5670 #include <isl/union_map.h>
5671 __isl_give isl_union_map *isl_union_map_union(
5672 __isl_take isl_union_map *umap1,
5673 __isl_take isl_union_map *umap2);
5675 =item * Set difference
5677 #include <isl/set.h>
5678 __isl_give isl_set *isl_set_subtract(
5679 __isl_take isl_set *set1,
5680 __isl_take isl_set *set2);
5682 #include <isl/map.h>
5683 __isl_give isl_map *isl_map_subtract(
5684 __isl_take isl_map *map1,
5685 __isl_take isl_map *map2);
5686 __isl_give isl_map *isl_map_subtract_domain(
5687 __isl_take isl_map *map,
5688 __isl_take isl_set *dom);
5689 __isl_give isl_map *isl_map_subtract_range(
5690 __isl_take isl_map *map,
5691 __isl_take isl_set *dom);
5693 #include <isl/union_set.h>
5694 __isl_give isl_union_set *isl_union_set_subtract(
5695 __isl_take isl_union_set *uset1,
5696 __isl_take isl_union_set *uset2);
5698 #include <isl/union_map.h>
5699 __isl_give isl_union_map *isl_union_map_subtract(
5700 __isl_take isl_union_map *umap1,
5701 __isl_take isl_union_map *umap2);
5702 __isl_give isl_union_map *isl_union_map_subtract_domain(
5703 __isl_take isl_union_map *umap,
5704 __isl_take isl_union_set *dom);
5705 __isl_give isl_union_map *isl_union_map_subtract_range(
5706 __isl_take isl_union_map *umap,
5707 __isl_take isl_union_set *dom);
5709 #include <isl/aff.h>
5710 __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5711 __isl_take isl_pw_aff *pa,
5712 __isl_take isl_set *set);
5713 __isl_give isl_pw_multi_aff *
5714 isl_pw_multi_aff_subtract_domain(
5715 __isl_take isl_pw_multi_aff *pma,
5716 __isl_take isl_set *set);
5717 __isl_give isl_union_pw_aff *
5718 isl_union_pw_aff_subtract_domain(
5719 __isl_take isl_union_pw_aff *upa,
5720 __isl_take isl_union_set *uset);
5721 __isl_give isl_union_pw_multi_aff *
5722 isl_union_pw_multi_aff_subtract_domain(
5723 __isl_take isl_union_pw_multi_aff *upma,
5724 __isl_take isl_set *set);
5726 #include <isl/polynomial.h>
5727 __isl_give isl_pw_qpolynomial *
5728 isl_pw_qpolynomial_subtract_domain(
5729 __isl_take isl_pw_qpolynomial *pwpq,
5730 __isl_take isl_set *set);
5731 __isl_give isl_pw_qpolynomial_fold *
5732 isl_pw_qpolynomial_fold_subtract_domain(
5733 __isl_take isl_pw_qpolynomial_fold *pwf,
5734 __isl_take isl_set *set);
5735 __isl_give isl_union_pw_qpolynomial *
5736 isl_union_pw_qpolynomial_subtract_domain(
5737 __isl_take isl_union_pw_qpolynomial *upwpq,
5738 __isl_take isl_union_set *uset);
5739 __isl_give isl_union_pw_qpolynomial_fold *
5740 isl_union_pw_qpolynomial_fold_subtract_domain(
5741 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5742 __isl_take isl_union_set *uset);
5746 #include <isl/space.h>
5747 __isl_give isl_space *isl_space_join(
5748 __isl_take isl_space *left,
5749 __isl_take isl_space *right);
5751 #include <isl/map.h>
5752 __isl_give isl_basic_set *isl_basic_set_apply(
5753 __isl_take isl_basic_set *bset,
5754 __isl_take isl_basic_map *bmap);
5755 __isl_give isl_set *isl_set_apply(
5756 __isl_take isl_set *set,
5757 __isl_take isl_map *map);
5758 __isl_give isl_union_set *isl_union_set_apply(
5759 __isl_take isl_union_set *uset,
5760 __isl_take isl_union_map *umap);
5761 __isl_give isl_basic_map *isl_basic_map_apply_domain(
5762 __isl_take isl_basic_map *bmap1,
5763 __isl_take isl_basic_map *bmap2);
5764 __isl_give isl_basic_map *isl_basic_map_apply_range(
5765 __isl_take isl_basic_map *bmap1,
5766 __isl_take isl_basic_map *bmap2);
5767 __isl_give isl_map *isl_map_apply_domain(
5768 __isl_take isl_map *map1,
5769 __isl_take isl_map *map2);
5770 __isl_give isl_map *isl_map_apply_range(
5771 __isl_take isl_map *map1,
5772 __isl_take isl_map *map2);
5774 #include <isl/union_map.h>
5775 __isl_give isl_union_map *isl_union_map_apply_domain(
5776 __isl_take isl_union_map *umap1,
5777 __isl_take isl_union_map *umap2);
5778 __isl_give isl_union_map *isl_union_map_apply_range(
5779 __isl_take isl_union_map *umap1,
5780 __isl_take isl_union_map *umap2);
5782 #include <isl/aff.h>
5783 __isl_give isl_union_pw_aff *
5784 isl_multi_union_pw_aff_apply_aff(
5785 __isl_take isl_multi_union_pw_aff *mupa,
5786 __isl_take isl_aff *aff);
5787 __isl_give isl_union_pw_aff *
5788 isl_multi_union_pw_aff_apply_pw_aff(
5789 __isl_take isl_multi_union_pw_aff *mupa,
5790 __isl_take isl_pw_aff *pa);
5791 __isl_give isl_multi_union_pw_aff *
5792 isl_multi_union_pw_aff_apply_multi_aff(
5793 __isl_take isl_multi_union_pw_aff *mupa,
5794 __isl_take isl_multi_aff *ma);
5795 __isl_give isl_multi_union_pw_aff *
5796 isl_multi_union_pw_aff_apply_pw_multi_aff(
5797 __isl_take isl_multi_union_pw_aff *mupa,
5798 __isl_take isl_pw_multi_aff *pma);
5800 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
5801 over the shared domain of the elements of the input. The dimension is
5802 required to be greater than zero.
5803 The C<isl_multi_union_pw_aff> argument of
5804 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
5805 but only if the range of the C<isl_multi_aff> argument
5806 is also zero-dimensional.
5807 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
5809 #include <isl/polynomial.h>
5810 __isl_give isl_pw_qpolynomial_fold *
5811 isl_set_apply_pw_qpolynomial_fold(
5812 __isl_take isl_set *set,
5813 __isl_take isl_pw_qpolynomial_fold *pwf,
5815 __isl_give isl_pw_qpolynomial_fold *
5816 isl_map_apply_pw_qpolynomial_fold(
5817 __isl_take isl_map *map,
5818 __isl_take isl_pw_qpolynomial_fold *pwf,
5820 __isl_give isl_union_pw_qpolynomial_fold *
5821 isl_union_set_apply_union_pw_qpolynomial_fold(
5822 __isl_take isl_union_set *uset,
5823 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5825 __isl_give isl_union_pw_qpolynomial_fold *
5826 isl_union_map_apply_union_pw_qpolynomial_fold(
5827 __isl_take isl_union_map *umap,
5828 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5831 The functions taking a map
5832 compose the given map with the given piecewise quasipolynomial reduction.
5833 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5834 over all elements in the intersection of the range of the map
5835 and the domain of the piecewise quasipolynomial reduction
5836 as a function of an element in the domain of the map.
5837 The functions taking a set compute a bound over all elements in the
5838 intersection of the set and the domain of the
5839 piecewise quasipolynomial reduction.
5843 #include <isl/set.h>
5844 __isl_give isl_basic_set *
5845 isl_basic_set_preimage_multi_aff(
5846 __isl_take isl_basic_set *bset,
5847 __isl_take isl_multi_aff *ma);
5848 __isl_give isl_set *isl_set_preimage_multi_aff(
5849 __isl_take isl_set *set,
5850 __isl_take isl_multi_aff *ma);
5851 __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5852 __isl_take isl_set *set,
5853 __isl_take isl_pw_multi_aff *pma);
5854 __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5855 __isl_take isl_set *set,
5856 __isl_take isl_multi_pw_aff *mpa);
5858 #include <isl/union_set.h>
5859 __isl_give isl_union_set *
5860 isl_union_set_preimage_multi_aff(
5861 __isl_take isl_union_set *uset,
5862 __isl_take isl_multi_aff *ma);
5863 __isl_give isl_union_set *
5864 isl_union_set_preimage_pw_multi_aff(
5865 __isl_take isl_union_set *uset,
5866 __isl_take isl_pw_multi_aff *pma);
5867 __isl_give isl_union_set *
5868 isl_union_set_preimage_union_pw_multi_aff(
5869 __isl_take isl_union_set *uset,
5870 __isl_take isl_union_pw_multi_aff *upma);
5872 #include <isl/map.h>
5873 __isl_give isl_basic_map *
5874 isl_basic_map_preimage_domain_multi_aff(
5875 __isl_take isl_basic_map *bmap,
5876 __isl_take isl_multi_aff *ma);
5877 __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5878 __isl_take isl_map *map,
5879 __isl_take isl_multi_aff *ma);
5880 __isl_give isl_map *isl_map_preimage_range_multi_aff(
5881 __isl_take isl_map *map,
5882 __isl_take isl_multi_aff *ma);
5883 __isl_give isl_map *
5884 isl_map_preimage_domain_pw_multi_aff(
5885 __isl_take isl_map *map,
5886 __isl_take isl_pw_multi_aff *pma);
5887 __isl_give isl_map *
5888 isl_map_preimage_range_pw_multi_aff(
5889 __isl_take isl_map *map,
5890 __isl_take isl_pw_multi_aff *pma);
5891 __isl_give isl_map *
5892 isl_map_preimage_domain_multi_pw_aff(
5893 __isl_take isl_map *map,
5894 __isl_take isl_multi_pw_aff *mpa);
5895 __isl_give isl_basic_map *
5896 isl_basic_map_preimage_range_multi_aff(
5897 __isl_take isl_basic_map *bmap,
5898 __isl_take isl_multi_aff *ma);
5900 #include <isl/union_map.h>
5901 __isl_give isl_union_map *
5902 isl_union_map_preimage_domain_multi_aff(
5903 __isl_take isl_union_map *umap,
5904 __isl_take isl_multi_aff *ma);
5905 __isl_give isl_union_map *
5906 isl_union_map_preimage_range_multi_aff(
5907 __isl_take isl_union_map *umap,
5908 __isl_take isl_multi_aff *ma);
5909 __isl_give isl_union_map *
5910 isl_union_map_preimage_domain_pw_multi_aff(
5911 __isl_take isl_union_map *umap,
5912 __isl_take isl_pw_multi_aff *pma);
5913 __isl_give isl_union_map *
5914 isl_union_map_preimage_range_pw_multi_aff(
5915 __isl_take isl_union_map *umap,
5916 __isl_take isl_pw_multi_aff *pma);
5917 __isl_give isl_union_map *
5918 isl_union_map_preimage_domain_union_pw_multi_aff(
5919 __isl_take isl_union_map *umap,
5920 __isl_take isl_union_pw_multi_aff *upma);
5921 __isl_give isl_union_map *
5922 isl_union_map_preimage_range_union_pw_multi_aff(
5923 __isl_take isl_union_map *umap,
5924 __isl_take isl_union_pw_multi_aff *upma);
5926 These functions compute the preimage of the given set or map domain/range under
5927 the given function. In other words, the expression is plugged
5928 into the set description or into the domain/range of the map.
5932 #include <isl/aff.h>
5933 __isl_give isl_aff *isl_aff_pullback_aff(
5934 __isl_take isl_aff *aff1,
5935 __isl_take isl_aff *aff2);
5936 __isl_give isl_aff *isl_aff_pullback_multi_aff(
5937 __isl_take isl_aff *aff,
5938 __isl_take isl_multi_aff *ma);
5939 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5940 __isl_take isl_pw_aff *pa,
5941 __isl_take isl_multi_aff *ma);
5942 __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5943 __isl_take isl_pw_aff *pa,
5944 __isl_take isl_pw_multi_aff *pma);
5945 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5946 __isl_take isl_pw_aff *pa,
5947 __isl_take isl_multi_pw_aff *mpa);
5948 __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5949 __isl_take isl_multi_aff *ma1,
5950 __isl_take isl_multi_aff *ma2);
5951 __isl_give isl_pw_multi_aff *
5952 isl_pw_multi_aff_pullback_multi_aff(
5953 __isl_take isl_pw_multi_aff *pma,
5954 __isl_take isl_multi_aff *ma);
5955 __isl_give isl_multi_pw_aff *
5956 isl_multi_pw_aff_pullback_multi_aff(
5957 __isl_take isl_multi_pw_aff *mpa,
5958 __isl_take isl_multi_aff *ma);
5959 __isl_give isl_pw_multi_aff *
5960 isl_pw_multi_aff_pullback_pw_multi_aff(
5961 __isl_take isl_pw_multi_aff *pma1,
5962 __isl_take isl_pw_multi_aff *pma2);
5963 __isl_give isl_multi_pw_aff *
5964 isl_multi_pw_aff_pullback_pw_multi_aff(
5965 __isl_take isl_multi_pw_aff *mpa,
5966 __isl_take isl_pw_multi_aff *pma);
5967 __isl_give isl_multi_pw_aff *
5968 isl_multi_pw_aff_pullback_multi_pw_aff(
5969 __isl_take isl_multi_pw_aff *mpa1,
5970 __isl_take isl_multi_pw_aff *mpa2);
5971 __isl_give isl_union_pw_aff *
5972 isl_union_pw_aff_pullback_union_pw_multi_aff(
5973 __isl_take isl_union_pw_aff *upa,
5974 __isl_take isl_union_pw_multi_aff *upma);
5975 __isl_give isl_union_pw_multi_aff *
5976 isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
5977 __isl_take isl_union_pw_multi_aff *upma1,
5978 __isl_take isl_union_pw_multi_aff *upma2);
5979 __isl_give isl_multi_union_pw_aff *
5980 isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
5981 __isl_take isl_multi_union_pw_aff *mupa,
5982 __isl_take isl_union_pw_multi_aff *upma);
5984 These functions precompose the first expression by the second function.
5985 In other words, the second function is plugged
5986 into the first expression.
5990 #include <isl/aff.h>
5991 __isl_give isl_basic_set *isl_aff_le_basic_set(
5992 __isl_take isl_aff *aff1,
5993 __isl_take isl_aff *aff2);
5994 __isl_give isl_basic_set *isl_aff_ge_basic_set(
5995 __isl_take isl_aff *aff1,
5996 __isl_take isl_aff *aff2);
5997 __isl_give isl_set *isl_pw_aff_eq_set(
5998 __isl_take isl_pw_aff *pwaff1,
5999 __isl_take isl_pw_aff *pwaff2);
6000 __isl_give isl_set *isl_pw_aff_ne_set(
6001 __isl_take isl_pw_aff *pwaff1,
6002 __isl_take isl_pw_aff *pwaff2);
6003 __isl_give isl_set *isl_pw_aff_le_set(
6004 __isl_take isl_pw_aff *pwaff1,
6005 __isl_take isl_pw_aff *pwaff2);
6006 __isl_give isl_set *isl_pw_aff_lt_set(
6007 __isl_take isl_pw_aff *pwaff1,
6008 __isl_take isl_pw_aff *pwaff2);
6009 __isl_give isl_set *isl_pw_aff_ge_set(
6010 __isl_take isl_pw_aff *pwaff1,
6011 __isl_take isl_pw_aff *pwaff2);
6012 __isl_give isl_set *isl_pw_aff_gt_set(
6013 __isl_take isl_pw_aff *pwaff1,
6014 __isl_take isl_pw_aff *pwaff2);
6016 __isl_give isl_set *isl_multi_aff_lex_le_set(
6017 __isl_take isl_multi_aff *ma1,
6018 __isl_take isl_multi_aff *ma2);
6019 __isl_give isl_set *isl_multi_aff_lex_ge_set(
6020 __isl_take isl_multi_aff *ma1,
6021 __isl_take isl_multi_aff *ma2);
6023 __isl_give isl_set *isl_pw_aff_list_eq_set(
6024 __isl_take isl_pw_aff_list *list1,
6025 __isl_take isl_pw_aff_list *list2);
6026 __isl_give isl_set *isl_pw_aff_list_ne_set(
6027 __isl_take isl_pw_aff_list *list1,
6028 __isl_take isl_pw_aff_list *list2);
6029 __isl_give isl_set *isl_pw_aff_list_le_set(
6030 __isl_take isl_pw_aff_list *list1,
6031 __isl_take isl_pw_aff_list *list2);
6032 __isl_give isl_set *isl_pw_aff_list_lt_set(
6033 __isl_take isl_pw_aff_list *list1,
6034 __isl_take isl_pw_aff_list *list2);
6035 __isl_give isl_set *isl_pw_aff_list_ge_set(
6036 __isl_take isl_pw_aff_list *list1,
6037 __isl_take isl_pw_aff_list *list2);
6038 __isl_give isl_set *isl_pw_aff_list_gt_set(
6039 __isl_take isl_pw_aff_list *list1,
6040 __isl_take isl_pw_aff_list *list2);
6042 The function C<isl_aff_ge_basic_set> returns a basic set
6043 containing those elements in the shared space
6044 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
6045 The function C<isl_pw_aff_ge_set> returns a set
6046 containing those elements in the shared domain
6047 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
6048 greater than or equal to C<pwaff2>.
6049 The function C<isl_multi_aff_lex_le_set> returns a set
6050 containing those elements in the shared domain space
6051 where C<ma1> is lexicographically smaller than or
6053 The functions operating on C<isl_pw_aff_list> apply the corresponding
6054 C<isl_pw_aff> function to each pair of elements in the two lists.
6056 #include <isl/aff.h>
6057 __isl_give isl_map *isl_pw_aff_eq_map(
6058 __isl_take isl_pw_aff *pa1,
6059 __isl_take isl_pw_aff *pa2);
6060 __isl_give isl_map *isl_pw_aff_lt_map(
6061 __isl_take isl_pw_aff *pa1,
6062 __isl_take isl_pw_aff *pa2);
6063 __isl_give isl_map *isl_pw_aff_gt_map(
6064 __isl_take isl_pw_aff *pa1,
6065 __isl_take isl_pw_aff *pa2);
6067 __isl_give isl_map *isl_multi_pw_aff_eq_map(
6068 __isl_take isl_multi_pw_aff *mpa1,
6069 __isl_take isl_multi_pw_aff *mpa2);
6070 __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
6071 __isl_take isl_multi_pw_aff *mpa1,
6072 __isl_take isl_multi_pw_aff *mpa2);
6073 __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
6074 __isl_take isl_multi_pw_aff *mpa1,
6075 __isl_take isl_multi_pw_aff *mpa2);
6077 These functions return a map between domain elements of the arguments
6078 where the function values satisfy the given relation.
6080 #include <isl/union_map.h>
6081 __isl_give isl_union_map *
6082 isl_union_map_eq_at_multi_union_pw_aff(
6083 __isl_take isl_union_map *umap,
6084 __isl_take isl_multi_union_pw_aff *mupa);
6085 __isl_give isl_union_map *
6086 isl_union_map_lex_lt_at_multi_union_pw_aff(
6087 __isl_take isl_union_map *umap,
6088 __isl_take isl_multi_union_pw_aff *mupa);
6089 __isl_give isl_union_map *
6090 isl_union_map_lex_gt_at_multi_union_pw_aff(
6091 __isl_take isl_union_map *umap,
6092 __isl_take isl_multi_union_pw_aff *mupa);
6094 These functions select the subset of elements in the union map
6095 that have an equal or lexicographically smaller function value.
6097 =item * Cartesian Product
6099 #include <isl/space.h>
6100 __isl_give isl_space *isl_space_product(
6101 __isl_take isl_space *space1,
6102 __isl_take isl_space *space2);
6103 __isl_give isl_space *isl_space_domain_product(
6104 __isl_take isl_space *space1,
6105 __isl_take isl_space *space2);
6106 __isl_give isl_space *isl_space_range_product(
6107 __isl_take isl_space *space1,
6108 __isl_take isl_space *space2);
6111 C<isl_space_product>, C<isl_space_domain_product>
6112 and C<isl_space_range_product> take pairs or relation spaces and
6113 produce a single relations space, where either the domain, the range
6114 or both domain and range are wrapped spaces of relations between
6115 the domains and/or ranges of the input spaces.
6116 If the product is only constructed over the domain or the range
6117 then the ranges or the domains of the inputs should be the same.
6118 The function C<isl_space_product> also accepts a pair of set spaces,
6119 in which case it returns a wrapped space of a relation between the
6122 #include <isl/set.h>
6123 __isl_give isl_set *isl_set_product(
6124 __isl_take isl_set *set1,
6125 __isl_take isl_set *set2);
6127 #include <isl/map.h>
6128 __isl_give isl_basic_map *isl_basic_map_domain_product(
6129 __isl_take isl_basic_map *bmap1,
6130 __isl_take isl_basic_map *bmap2);
6131 __isl_give isl_basic_map *isl_basic_map_range_product(
6132 __isl_take isl_basic_map *bmap1,
6133 __isl_take isl_basic_map *bmap2);
6134 __isl_give isl_basic_map *isl_basic_map_product(
6135 __isl_take isl_basic_map *bmap1,
6136 __isl_take isl_basic_map *bmap2);
6137 __isl_give isl_map *isl_map_domain_product(
6138 __isl_take isl_map *map1,
6139 __isl_take isl_map *map2);
6140 __isl_give isl_map *isl_map_range_product(
6141 __isl_take isl_map *map1,
6142 __isl_take isl_map *map2);
6143 __isl_give isl_map *isl_map_product(
6144 __isl_take isl_map *map1,
6145 __isl_take isl_map *map2);
6147 #include <isl/union_set.h>
6148 __isl_give isl_union_set *isl_union_set_product(
6149 __isl_take isl_union_set *uset1,
6150 __isl_take isl_union_set *uset2);
6152 #include <isl/union_map.h>
6153 __isl_give isl_union_map *isl_union_map_domain_product(
6154 __isl_take isl_union_map *umap1,
6155 __isl_take isl_union_map *umap2);
6156 __isl_give isl_union_map *isl_union_map_range_product(
6157 __isl_take isl_union_map *umap1,
6158 __isl_take isl_union_map *umap2);
6159 __isl_give isl_union_map *isl_union_map_product(
6160 __isl_take isl_union_map *umap1,
6161 __isl_take isl_union_map *umap2);
6163 #include <isl/val.h>
6164 __isl_give isl_multi_val *isl_multi_val_range_product(
6165 __isl_take isl_multi_val *mv1,
6166 __isl_take isl_multi_val *mv2);
6167 __isl_give isl_multi_val *isl_multi_val_product(
6168 __isl_take isl_multi_val *mv1,
6169 __isl_take isl_multi_val *mv2);
6171 #include <isl/aff.h>
6172 __isl_give isl_multi_aff *isl_multi_aff_range_product(
6173 __isl_take isl_multi_aff *ma1,
6174 __isl_take isl_multi_aff *ma2);
6175 __isl_give isl_multi_aff *isl_multi_aff_product(
6176 __isl_take isl_multi_aff *ma1,
6177 __isl_take isl_multi_aff *ma2);
6178 __isl_give isl_multi_pw_aff *
6179 isl_multi_pw_aff_range_product(
6180 __isl_take isl_multi_pw_aff *mpa1,
6181 __isl_take isl_multi_pw_aff *mpa2);
6182 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6183 __isl_take isl_multi_pw_aff *mpa1,
6184 __isl_take isl_multi_pw_aff *mpa2);
6185 __isl_give isl_pw_multi_aff *
6186 isl_pw_multi_aff_range_product(
6187 __isl_take isl_pw_multi_aff *pma1,
6188 __isl_take isl_pw_multi_aff *pma2);
6189 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6190 __isl_take isl_pw_multi_aff *pma1,
6191 __isl_take isl_pw_multi_aff *pma2);
6192 __isl_give isl_multi_union_pw_aff *
6193 isl_multi_union_pw_aff_range_product(
6194 __isl_take isl_multi_union_pw_aff *mupa1,
6195 __isl_take isl_multi_union_pw_aff *mupa2);
6197 The above functions compute the cross product of the given
6198 sets, relations or functions. The domains and ranges of the results
6199 are wrapped maps between domains and ranges of the inputs.
6200 To obtain a ``flat'' product, use the following functions
6203 #include <isl/set.h>
6204 __isl_give isl_basic_set *isl_basic_set_flat_product(
6205 __isl_take isl_basic_set *bset1,
6206 __isl_take isl_basic_set *bset2);
6207 __isl_give isl_set *isl_set_flat_product(
6208 __isl_take isl_set *set1,
6209 __isl_take isl_set *set2);
6211 #include <isl/map.h>
6212 __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6213 __isl_take isl_basic_map *bmap1,
6214 __isl_take isl_basic_map *bmap2);
6215 __isl_give isl_map *isl_map_flat_domain_product(
6216 __isl_take isl_map *map1,
6217 __isl_take isl_map *map2);
6218 __isl_give isl_map *isl_map_flat_range_product(
6219 __isl_take isl_map *map1,
6220 __isl_take isl_map *map2);
6221 __isl_give isl_basic_map *isl_basic_map_flat_product(
6222 __isl_take isl_basic_map *bmap1,
6223 __isl_take isl_basic_map *bmap2);
6224 __isl_give isl_map *isl_map_flat_product(
6225 __isl_take isl_map *map1,
6226 __isl_take isl_map *map2);
6228 #include <isl/union_map.h>
6229 __isl_give isl_union_map *
6230 isl_union_map_flat_domain_product(
6231 __isl_take isl_union_map *umap1,
6232 __isl_take isl_union_map *umap2);
6233 __isl_give isl_union_map *
6234 isl_union_map_flat_range_product(
6235 __isl_take isl_union_map *umap1,
6236 __isl_take isl_union_map *umap2);
6238 #include <isl/val.h>
6239 __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6240 __isl_take isl_multi_val *mv1,
6241 __isl_take isl_multi_aff *mv2);
6243 #include <isl/aff.h>
6244 __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6245 __isl_take isl_multi_aff *ma1,
6246 __isl_take isl_multi_aff *ma2);
6247 __isl_give isl_pw_multi_aff *
6248 isl_pw_multi_aff_flat_range_product(
6249 __isl_take isl_pw_multi_aff *pma1,
6250 __isl_take isl_pw_multi_aff *pma2);
6251 __isl_give isl_multi_pw_aff *
6252 isl_multi_pw_aff_flat_range_product(
6253 __isl_take isl_multi_pw_aff *mpa1,
6254 __isl_take isl_multi_pw_aff *mpa2);
6255 __isl_give isl_union_pw_multi_aff *
6256 isl_union_pw_multi_aff_flat_range_product(
6257 __isl_take isl_union_pw_multi_aff *upma1,
6258 __isl_take isl_union_pw_multi_aff *upma2);
6259 __isl_give isl_multi_union_pw_aff *
6260 isl_multi_union_pw_aff_flat_range_product(
6261 __isl_take isl_multi_union_pw_aff *mupa1,
6262 __isl_take isl_multi_union_pw_aff *mupa2);
6264 #include <isl/space.h>
6265 __isl_give isl_space *isl_space_factor_domain(
6266 __isl_take isl_space *space);
6267 __isl_give isl_space *isl_space_factor_range(
6268 __isl_take isl_space *space);
6269 __isl_give isl_space *isl_space_domain_factor_domain(
6270 __isl_take isl_space *space);
6271 __isl_give isl_space *isl_space_domain_factor_range(
6272 __isl_take isl_space *space);
6273 __isl_give isl_space *isl_space_range_factor_domain(
6274 __isl_take isl_space *space);
6275 __isl_give isl_space *isl_space_range_factor_range(
6276 __isl_take isl_space *space);
6278 The functions C<isl_space_range_factor_domain> and
6279 C<isl_space_range_factor_range> extract the two arguments from
6280 the result of a call to C<isl_space_range_product>.
6282 The arguments of a call to a product can be extracted
6283 from the result using the following functions.
6285 #include <isl/map.h>
6286 __isl_give isl_map *isl_map_factor_domain(
6287 __isl_take isl_map *map);
6288 __isl_give isl_map *isl_map_factor_range(
6289 __isl_take isl_map *map);
6290 __isl_give isl_map *isl_map_domain_factor_domain(
6291 __isl_take isl_map *map);
6292 __isl_give isl_map *isl_map_domain_factor_range(
6293 __isl_take isl_map *map);
6294 __isl_give isl_map *isl_map_range_factor_domain(
6295 __isl_take isl_map *map);
6296 __isl_give isl_map *isl_map_range_factor_range(
6297 __isl_take isl_map *map);
6299 #include <isl/union_map.h>
6300 __isl_give isl_union_map *isl_union_map_factor_domain(
6301 __isl_take isl_union_map *umap);
6302 __isl_give isl_union_map *isl_union_map_factor_range(
6303 __isl_take isl_union_map *umap);
6304 __isl_give isl_union_map *
6305 isl_union_map_domain_factor_domain(
6306 __isl_take isl_union_map *umap);
6307 __isl_give isl_union_map *
6308 isl_union_map_domain_factor_range(
6309 __isl_take isl_union_map *umap);
6310 __isl_give isl_union_map *
6311 isl_union_map_range_factor_range(
6312 __isl_take isl_union_map *umap);
6314 #include <isl/val.h>
6315 __isl_give isl_multi_val *isl_multi_val_factor_range(
6316 __isl_take isl_multi_val *mv);
6317 __isl_give isl_multi_val *
6318 isl_multi_val_range_factor_domain(
6319 __isl_take isl_multi_val *mv);
6320 __isl_give isl_multi_val *
6321 isl_multi_val_range_factor_range(
6322 __isl_take isl_multi_val *mv);
6324 #include <isl/aff.h>
6325 __isl_give isl_multi_aff *isl_multi_aff_factor_range(
6326 __isl_take isl_multi_aff *ma);
6327 __isl_give isl_multi_aff *
6328 isl_multi_aff_range_factor_domain(
6329 __isl_take isl_multi_aff *ma);
6330 __isl_give isl_multi_aff *
6331 isl_multi_aff_range_factor_range(
6332 __isl_take isl_multi_aff *ma);
6333 __isl_give isl_multi_pw_aff *
6334 isl_multi_pw_aff_factor_range(
6335 __isl_take isl_multi_pw_aff *mpa);
6336 __isl_give isl_multi_pw_aff *
6337 isl_multi_pw_aff_range_factor_domain(
6338 __isl_take isl_multi_pw_aff *mpa);
6339 __isl_give isl_multi_pw_aff *
6340 isl_multi_pw_aff_range_factor_range(
6341 __isl_take isl_multi_pw_aff *mpa);
6342 __isl_give isl_multi_union_pw_aff *
6343 isl_multi_union_pw_aff_factor_range(
6344 __isl_take isl_multi_union_pw_aff *mupa);
6345 __isl_give isl_multi_union_pw_aff *
6346 isl_multi_union_pw_aff_range_factor_domain(
6347 __isl_take isl_multi_union_pw_aff *mupa);
6348 __isl_give isl_multi_union_pw_aff *
6349 isl_multi_union_pw_aff_range_factor_range(
6350 __isl_take isl_multi_union_pw_aff *mupa);
6352 The splice functions are a generalization of the flat product functions,
6353 where the second argument may be inserted at any position inside
6354 the first argument rather than being placed at the end.
6355 The functions C<isl_multi_val_factor_range>,
6356 C<isl_multi_aff_factor_range>,
6357 C<isl_multi_pw_aff_factor_range> and
6358 C<isl_multi_union_pw_aff_factor_range>
6359 take functions that live in a set space.
6361 #include <isl/val.h>
6362 __isl_give isl_multi_val *isl_multi_val_range_splice(
6363 __isl_take isl_multi_val *mv1, unsigned pos,
6364 __isl_take isl_multi_val *mv2);
6366 #include <isl/aff.h>
6367 __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6368 __isl_take isl_multi_aff *ma1, unsigned pos,
6369 __isl_take isl_multi_aff *ma2);
6370 __isl_give isl_multi_aff *isl_multi_aff_splice(
6371 __isl_take isl_multi_aff *ma1,
6372 unsigned in_pos, unsigned out_pos,
6373 __isl_take isl_multi_aff *ma2);
6374 __isl_give isl_multi_pw_aff *
6375 isl_multi_pw_aff_range_splice(
6376 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6377 __isl_take isl_multi_pw_aff *mpa2);
6378 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6379 __isl_take isl_multi_pw_aff *mpa1,
6380 unsigned in_pos, unsigned out_pos,
6381 __isl_take isl_multi_pw_aff *mpa2);
6382 __isl_give isl_multi_union_pw_aff *
6383 isl_multi_union_pw_aff_range_splice(
6384 __isl_take isl_multi_union_pw_aff *mupa1,
6386 __isl_take isl_multi_union_pw_aff *mupa2);
6388 =item * Simplification
6390 When applied to a set or relation,
6391 the gist operation returns a set or relation that has the
6392 same intersection with the context as the input set or relation.
6393 Any implicit equality in the intersection is made explicit in the result,
6394 while all inequalities that are redundant with respect to the intersection
6396 In case of union sets and relations, the gist operation is performed
6399 When applied to a function,
6400 the gist operation applies the set gist operation to each of
6401 the cells in the domain of the input piecewise expression.
6402 The context is also exploited
6403 to simplify the expression associated to each cell.
6405 #include <isl/set.h>
6406 __isl_give isl_basic_set *isl_basic_set_gist(
6407 __isl_take isl_basic_set *bset,
6408 __isl_take isl_basic_set *context);
6409 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6410 __isl_take isl_set *context);
6411 __isl_give isl_set *isl_set_gist_params(
6412 __isl_take isl_set *set,
6413 __isl_take isl_set *context);
6415 #include <isl/map.h>
6416 __isl_give isl_basic_map *isl_basic_map_gist(
6417 __isl_take isl_basic_map *bmap,
6418 __isl_take isl_basic_map *context);
6419 __isl_give isl_basic_map *isl_basic_map_gist_domain(
6420 __isl_take isl_basic_map *bmap,
6421 __isl_take isl_basic_set *context);
6422 __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6423 __isl_take isl_map *context);
6424 __isl_give isl_map *isl_map_gist_params(
6425 __isl_take isl_map *map,
6426 __isl_take isl_set *context);
6427 __isl_give isl_map *isl_map_gist_domain(
6428 __isl_take isl_map *map,
6429 __isl_take isl_set *context);
6430 __isl_give isl_map *isl_map_gist_range(
6431 __isl_take isl_map *map,
6432 __isl_take isl_set *context);
6434 #include <isl/union_set.h>
6435 __isl_give isl_union_set *isl_union_set_gist(
6436 __isl_take isl_union_set *uset,
6437 __isl_take isl_union_set *context);
6438 __isl_give isl_union_set *isl_union_set_gist_params(
6439 __isl_take isl_union_set *uset,
6440 __isl_take isl_set *set);
6442 #include <isl/union_map.h>
6443 __isl_give isl_union_map *isl_union_map_gist(
6444 __isl_take isl_union_map *umap,
6445 __isl_take isl_union_map *context);
6446 __isl_give isl_union_map *isl_union_map_gist_params(
6447 __isl_take isl_union_map *umap,
6448 __isl_take isl_set *set);
6449 __isl_give isl_union_map *isl_union_map_gist_domain(
6450 __isl_take isl_union_map *umap,
6451 __isl_take isl_union_set *uset);
6452 __isl_give isl_union_map *isl_union_map_gist_range(
6453 __isl_take isl_union_map *umap,
6454 __isl_take isl_union_set *uset);
6456 #include <isl/aff.h>
6457 __isl_give isl_aff *isl_aff_gist_params(
6458 __isl_take isl_aff *aff,
6459 __isl_take isl_set *context);
6460 __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6461 __isl_take isl_set *context);
6462 __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6463 __isl_take isl_multi_aff *maff,
6464 __isl_take isl_set *context);
6465 __isl_give isl_multi_aff *isl_multi_aff_gist(
6466 __isl_take isl_multi_aff *maff,
6467 __isl_take isl_set *context);
6468 __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6469 __isl_take isl_pw_aff *pwaff,
6470 __isl_take isl_set *context);
6471 __isl_give isl_pw_aff *isl_pw_aff_gist(
6472 __isl_take isl_pw_aff *pwaff,
6473 __isl_take isl_set *context);
6474 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6475 __isl_take isl_pw_multi_aff *pma,
6476 __isl_take isl_set *set);
6477 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6478 __isl_take isl_pw_multi_aff *pma,
6479 __isl_take isl_set *set);
6480 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6481 __isl_take isl_multi_pw_aff *mpa,
6482 __isl_take isl_set *set);
6483 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6484 __isl_take isl_multi_pw_aff *mpa,
6485 __isl_take isl_set *set);
6486 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6487 __isl_take isl_union_pw_aff *upa,
6488 __isl_take isl_union_set *context);
6489 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6490 __isl_take isl_union_pw_aff *upa,
6491 __isl_take isl_set *context);
6492 __isl_give isl_union_pw_multi_aff *
6493 isl_union_pw_multi_aff_gist_params(
6494 __isl_take isl_union_pw_multi_aff *upma,
6495 __isl_take isl_set *context);
6496 __isl_give isl_union_pw_multi_aff *
6497 isl_union_pw_multi_aff_gist(
6498 __isl_take isl_union_pw_multi_aff *upma,
6499 __isl_take isl_union_set *context);
6500 __isl_give isl_multi_union_pw_aff *
6501 isl_multi_union_pw_aff_gist_params(
6502 __isl_take isl_multi_union_pw_aff *aff,
6503 __isl_take isl_set *context);
6504 __isl_give isl_multi_union_pw_aff *
6505 isl_multi_union_pw_aff_gist(
6506 __isl_take isl_multi_union_pw_aff *aff,
6507 __isl_take isl_union_set *context);
6509 #include <isl/polynomial.h>
6510 __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6511 __isl_take isl_qpolynomial *qp,
6512 __isl_take isl_set *context);
6513 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6514 __isl_take isl_qpolynomial *qp,
6515 __isl_take isl_set *context);
6516 __isl_give isl_qpolynomial_fold *
6517 isl_qpolynomial_fold_gist_params(
6518 __isl_take isl_qpolynomial_fold *fold,
6519 __isl_take isl_set *context);
6520 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6521 __isl_take isl_qpolynomial_fold *fold,
6522 __isl_take isl_set *context);
6523 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6524 __isl_take isl_pw_qpolynomial *pwqp,
6525 __isl_take isl_set *context);
6526 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6527 __isl_take isl_pw_qpolynomial *pwqp,
6528 __isl_take isl_set *context);
6529 __isl_give isl_pw_qpolynomial_fold *
6530 isl_pw_qpolynomial_fold_gist(
6531 __isl_take isl_pw_qpolynomial_fold *pwf,
6532 __isl_take isl_set *context);
6533 __isl_give isl_pw_qpolynomial_fold *
6534 isl_pw_qpolynomial_fold_gist_params(
6535 __isl_take isl_pw_qpolynomial_fold *pwf,
6536 __isl_take isl_set *context);
6537 __isl_give isl_union_pw_qpolynomial *
6538 isl_union_pw_qpolynomial_gist_params(
6539 __isl_take isl_union_pw_qpolynomial *upwqp,
6540 __isl_take isl_set *context);
6541 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6542 __isl_take isl_union_pw_qpolynomial *upwqp,
6543 __isl_take isl_union_set *context);
6544 __isl_give isl_union_pw_qpolynomial_fold *
6545 isl_union_pw_qpolynomial_fold_gist(
6546 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6547 __isl_take isl_union_set *context);
6548 __isl_give isl_union_pw_qpolynomial_fold *
6549 isl_union_pw_qpolynomial_fold_gist_params(
6550 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6551 __isl_take isl_set *context);
6553 =item * Binary Arithmethic Operations
6555 #include <isl/val.h>
6556 __isl_give isl_multi_val *isl_multi_val_add(
6557 __isl_take isl_multi_val *mv1,
6558 __isl_take isl_multi_val *mv2);
6559 __isl_give isl_multi_val *isl_multi_val_sub(
6560 __isl_take isl_multi_val *mv1,
6561 __isl_take isl_multi_val *mv2);
6563 #include <isl/aff.h>
6564 __isl_give isl_aff *isl_aff_add(
6565 __isl_take isl_aff *aff1,
6566 __isl_take isl_aff *aff2);
6567 __isl_give isl_multi_aff *isl_multi_aff_add(
6568 __isl_take isl_multi_aff *maff1,
6569 __isl_take isl_multi_aff *maff2);
6570 __isl_give isl_pw_aff *isl_pw_aff_add(
6571 __isl_take isl_pw_aff *pwaff1,
6572 __isl_take isl_pw_aff *pwaff2);
6573 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
6574 __isl_take isl_multi_pw_aff *mpa1,
6575 __isl_take isl_multi_pw_aff *mpa2);
6576 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6577 __isl_take isl_pw_multi_aff *pma1,
6578 __isl_take isl_pw_multi_aff *pma2);
6579 __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6580 __isl_take isl_union_pw_aff *upa1,
6581 __isl_take isl_union_pw_aff *upa2);
6582 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6583 __isl_take isl_union_pw_multi_aff *upma1,
6584 __isl_take isl_union_pw_multi_aff *upma2);
6585 __isl_give isl_multi_union_pw_aff *
6586 isl_multi_union_pw_aff_add(
6587 __isl_take isl_multi_union_pw_aff *mupa1,
6588 __isl_take isl_multi_union_pw_aff *mupa2);
6589 __isl_give isl_pw_aff *isl_pw_aff_min(
6590 __isl_take isl_pw_aff *pwaff1,
6591 __isl_take isl_pw_aff *pwaff2);
6592 __isl_give isl_pw_aff *isl_pw_aff_max(
6593 __isl_take isl_pw_aff *pwaff1,
6594 __isl_take isl_pw_aff *pwaff2);
6595 __isl_give isl_aff *isl_aff_sub(
6596 __isl_take isl_aff *aff1,
6597 __isl_take isl_aff *aff2);
6598 __isl_give isl_multi_aff *isl_multi_aff_sub(
6599 __isl_take isl_multi_aff *ma1,
6600 __isl_take isl_multi_aff *ma2);
6601 __isl_give isl_pw_aff *isl_pw_aff_sub(
6602 __isl_take isl_pw_aff *pwaff1,
6603 __isl_take isl_pw_aff *pwaff2);
6604 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6605 __isl_take isl_multi_pw_aff *mpa1,
6606 __isl_take isl_multi_pw_aff *mpa2);
6607 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6608 __isl_take isl_pw_multi_aff *pma1,
6609 __isl_take isl_pw_multi_aff *pma2);
6610 __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6611 __isl_take isl_union_pw_aff *upa1,
6612 __isl_take isl_union_pw_aff *upa2);
6613 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6614 __isl_take isl_union_pw_multi_aff *upma1,
6615 __isl_take isl_union_pw_multi_aff *upma2);
6616 __isl_give isl_multi_union_pw_aff *
6617 isl_multi_union_pw_aff_sub(
6618 __isl_take isl_multi_union_pw_aff *mupa1,
6619 __isl_take isl_multi_union_pw_aff *mupa2);
6621 C<isl_aff_sub> subtracts the second argument from the first.
6623 #include <isl/polynomial.h>
6624 __isl_give isl_qpolynomial *isl_qpolynomial_add(
6625 __isl_take isl_qpolynomial *qp1,
6626 __isl_take isl_qpolynomial *qp2);
6627 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6628 __isl_take isl_pw_qpolynomial *pwqp1,
6629 __isl_take isl_pw_qpolynomial *pwqp2);
6630 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6631 __isl_take isl_pw_qpolynomial *pwqp1,
6632 __isl_take isl_pw_qpolynomial *pwqp2);
6633 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6634 __isl_take isl_pw_qpolynomial_fold *pwf1,
6635 __isl_take isl_pw_qpolynomial_fold *pwf2);
6636 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6637 __isl_take isl_union_pw_qpolynomial *upwqp1,
6638 __isl_take isl_union_pw_qpolynomial *upwqp2);
6639 __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6640 __isl_take isl_qpolynomial *qp1,
6641 __isl_take isl_qpolynomial *qp2);
6642 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6643 __isl_take isl_pw_qpolynomial *pwqp1,
6644 __isl_take isl_pw_qpolynomial *pwqp2);
6645 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6646 __isl_take isl_union_pw_qpolynomial *upwqp1,
6647 __isl_take isl_union_pw_qpolynomial *upwqp2);
6648 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6649 __isl_take isl_pw_qpolynomial_fold *pwf1,
6650 __isl_take isl_pw_qpolynomial_fold *pwf2);
6651 __isl_give isl_union_pw_qpolynomial_fold *
6652 isl_union_pw_qpolynomial_fold_fold(
6653 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6654 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6656 #include <isl/aff.h>
6657 __isl_give isl_pw_aff *isl_pw_aff_union_add(
6658 __isl_take isl_pw_aff *pwaff1,
6659 __isl_take isl_pw_aff *pwaff2);
6660 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6661 __isl_take isl_pw_multi_aff *pma1,
6662 __isl_take isl_pw_multi_aff *pma2);
6663 __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6664 __isl_take isl_union_pw_aff *upa1,
6665 __isl_take isl_union_pw_aff *upa2);
6666 __isl_give isl_union_pw_multi_aff *
6667 isl_union_pw_multi_aff_union_add(
6668 __isl_take isl_union_pw_multi_aff *upma1,
6669 __isl_take isl_union_pw_multi_aff *upma2);
6670 __isl_give isl_multi_union_pw_aff *
6671 isl_multi_union_pw_aff_union_add(
6672 __isl_take isl_multi_union_pw_aff *mupa1,
6673 __isl_take isl_multi_union_pw_aff *mupa2);
6674 __isl_give isl_pw_aff *isl_pw_aff_union_min(
6675 __isl_take isl_pw_aff *pwaff1,
6676 __isl_take isl_pw_aff *pwaff2);
6677 __isl_give isl_pw_aff *isl_pw_aff_union_max(
6678 __isl_take isl_pw_aff *pwaff1,
6679 __isl_take isl_pw_aff *pwaff2);
6681 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6682 expression with a domain that is the union of those of C<pwaff1> and
6683 C<pwaff2> and such that on each cell, the quasi-affine expression is
6684 the maximum of those of C<pwaff1> and C<pwaff2>. If only one of
6685 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6686 associated expression is the defined one.
6687 This in contrast to the C<isl_pw_aff_max> function, which is
6688 only defined on the shared definition domain of the arguments.
6690 #include <isl/val.h>
6691 __isl_give isl_multi_val *isl_multi_val_add_val(
6692 __isl_take isl_multi_val *mv,
6693 __isl_take isl_val *v);
6694 __isl_give isl_multi_val *isl_multi_val_mod_val(
6695 __isl_take isl_multi_val *mv,
6696 __isl_take isl_val *v);
6697 __isl_give isl_multi_val *isl_multi_val_scale_val(
6698 __isl_take isl_multi_val *mv,
6699 __isl_take isl_val *v);
6700 __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6701 __isl_take isl_multi_val *mv,
6702 __isl_take isl_val *v);
6704 #include <isl/aff.h>
6705 __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6706 __isl_take isl_val *mod);
6707 __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6708 __isl_take isl_pw_aff *pa,
6709 __isl_take isl_val *mod);
6710 __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6711 __isl_take isl_union_pw_aff *upa,
6712 __isl_take isl_val *f);
6713 __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6714 __isl_take isl_val *v);
6715 __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6716 __isl_take isl_multi_aff *ma,
6717 __isl_take isl_val *v);
6718 __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6719 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6720 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6721 __isl_take isl_multi_pw_aff *mpa,
6722 __isl_take isl_val *v);
6723 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6724 __isl_take isl_pw_multi_aff *pma,
6725 __isl_take isl_val *v);
6726 __isl_give isl_union_pw_multi_aff *
6727 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6728 __isl_take isl_union_pw_aff *upa,
6729 __isl_take isl_val *f);
6730 isl_union_pw_multi_aff_scale_val(
6731 __isl_take isl_union_pw_multi_aff *upma,
6732 __isl_take isl_val *val);
6733 __isl_give isl_multi_union_pw_aff *
6734 isl_multi_union_pw_aff_scale_val(
6735 __isl_take isl_multi_union_pw_aff *mupa,
6736 __isl_take isl_val *v);
6737 __isl_give isl_aff *isl_aff_scale_down_ui(
6738 __isl_take isl_aff *aff, unsigned f);
6739 __isl_give isl_aff *isl_aff_scale_down_val(
6740 __isl_take isl_aff *aff, __isl_take isl_val *v);
6741 __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6742 __isl_take isl_multi_aff *ma,
6743 __isl_take isl_val *v);
6744 __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6745 __isl_take isl_pw_aff *pa,
6746 __isl_take isl_val *f);
6747 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6748 __isl_take isl_multi_pw_aff *mpa,
6749 __isl_take isl_val *v);
6750 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6751 __isl_take isl_pw_multi_aff *pma,
6752 __isl_take isl_val *v);
6753 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6754 __isl_take isl_union_pw_aff *upa,
6755 __isl_take isl_val *v);
6756 __isl_give isl_union_pw_multi_aff *
6757 isl_union_pw_multi_aff_scale_down_val(
6758 __isl_take isl_union_pw_multi_aff *upma,
6759 __isl_take isl_val *val);
6760 __isl_give isl_multi_union_pw_aff *
6761 isl_multi_union_pw_aff_scale_down_val(
6762 __isl_take isl_multi_union_pw_aff *mupa,
6763 __isl_take isl_val *v);
6765 #include <isl/polynomial.h>
6766 __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6767 __isl_take isl_qpolynomial *qp,
6768 __isl_take isl_val *v);
6769 __isl_give isl_qpolynomial_fold *
6770 isl_qpolynomial_fold_scale_val(
6771 __isl_take isl_qpolynomial_fold *fold,
6772 __isl_take isl_val *v);
6773 __isl_give isl_pw_qpolynomial *
6774 isl_pw_qpolynomial_scale_val(
6775 __isl_take isl_pw_qpolynomial *pwqp,
6776 __isl_take isl_val *v);
6777 __isl_give isl_pw_qpolynomial_fold *
6778 isl_pw_qpolynomial_fold_scale_val(
6779 __isl_take isl_pw_qpolynomial_fold *pwf,
6780 __isl_take isl_val *v);
6781 __isl_give isl_union_pw_qpolynomial *
6782 isl_union_pw_qpolynomial_scale_val(
6783 __isl_take isl_union_pw_qpolynomial *upwqp,
6784 __isl_take isl_val *v);
6785 __isl_give isl_union_pw_qpolynomial_fold *
6786 isl_union_pw_qpolynomial_fold_scale_val(
6787 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6788 __isl_take isl_val *v);
6789 __isl_give isl_qpolynomial *
6790 isl_qpolynomial_scale_down_val(
6791 __isl_take isl_qpolynomial *qp,
6792 __isl_take isl_val *v);
6793 __isl_give isl_qpolynomial_fold *
6794 isl_qpolynomial_fold_scale_down_val(
6795 __isl_take isl_qpolynomial_fold *fold,
6796 __isl_take isl_val *v);
6797 __isl_give isl_pw_qpolynomial *
6798 isl_pw_qpolynomial_scale_down_val(
6799 __isl_take isl_pw_qpolynomial *pwqp,
6800 __isl_take isl_val *v);
6801 __isl_give isl_pw_qpolynomial_fold *
6802 isl_pw_qpolynomial_fold_scale_down_val(
6803 __isl_take isl_pw_qpolynomial_fold *pwf,
6804 __isl_take isl_val *v);
6805 __isl_give isl_union_pw_qpolynomial *
6806 isl_union_pw_qpolynomial_scale_down_val(
6807 __isl_take isl_union_pw_qpolynomial *upwqp,
6808 __isl_take isl_val *v);
6809 __isl_give isl_union_pw_qpolynomial_fold *
6810 isl_union_pw_qpolynomial_fold_scale_down_val(
6811 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6812 __isl_take isl_val *v);
6814 #include <isl/val.h>
6815 __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6816 __isl_take isl_multi_val *mv1,
6817 __isl_take isl_multi_val *mv2);
6818 __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6819 __isl_take isl_multi_val *mv1,
6820 __isl_take isl_multi_val *mv2);
6821 __isl_give isl_multi_val *
6822 isl_multi_val_scale_down_multi_val(
6823 __isl_take isl_multi_val *mv1,
6824 __isl_take isl_multi_val *mv2);
6826 #include <isl/aff.h>
6827 __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6828 __isl_take isl_multi_aff *ma,
6829 __isl_take isl_multi_val *mv);
6830 __isl_give isl_multi_union_pw_aff *
6831 isl_multi_union_pw_aff_mod_multi_val(
6832 __isl_take isl_multi_union_pw_aff *upma,
6833 __isl_take isl_multi_val *mv);
6834 __isl_give isl_multi_pw_aff *
6835 isl_multi_pw_aff_mod_multi_val(
6836 __isl_take isl_multi_pw_aff *mpa,
6837 __isl_take isl_multi_val *mv);
6838 __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6839 __isl_take isl_multi_aff *ma,
6840 __isl_take isl_multi_val *mv);
6841 __isl_give isl_pw_multi_aff *
6842 isl_pw_multi_aff_scale_multi_val(
6843 __isl_take isl_pw_multi_aff *pma,
6844 __isl_take isl_multi_val *mv);
6845 __isl_give isl_multi_pw_aff *
6846 isl_multi_pw_aff_scale_multi_val(
6847 __isl_take isl_multi_pw_aff *mpa,
6848 __isl_take isl_multi_val *mv);
6849 __isl_give isl_multi_union_pw_aff *
6850 isl_multi_union_pw_aff_scale_multi_val(
6851 __isl_take isl_multi_union_pw_aff *mupa,
6852 __isl_take isl_multi_val *mv);
6853 __isl_give isl_union_pw_multi_aff *
6854 isl_union_pw_multi_aff_scale_multi_val(
6855 __isl_take isl_union_pw_multi_aff *upma,
6856 __isl_take isl_multi_val *mv);
6857 __isl_give isl_multi_aff *
6858 isl_multi_aff_scale_down_multi_val(
6859 __isl_take isl_multi_aff *ma,
6860 __isl_take isl_multi_val *mv);
6861 __isl_give isl_multi_pw_aff *
6862 isl_multi_pw_aff_scale_down_multi_val(
6863 __isl_take isl_multi_pw_aff *mpa,
6864 __isl_take isl_multi_val *mv);
6865 __isl_give isl_multi_union_pw_aff *
6866 isl_multi_union_pw_aff_scale_down_multi_val(
6867 __isl_take isl_multi_union_pw_aff *mupa,
6868 __isl_take isl_multi_val *mv);
6870 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6871 by the corresponding elements of C<mv>.
6873 #include <isl/aff.h>
6874 __isl_give isl_aff *isl_aff_mul(
6875 __isl_take isl_aff *aff1,
6876 __isl_take isl_aff *aff2);
6877 __isl_give isl_aff *isl_aff_div(
6878 __isl_take isl_aff *aff1,
6879 __isl_take isl_aff *aff2);
6880 __isl_give isl_pw_aff *isl_pw_aff_mul(
6881 __isl_take isl_pw_aff *pwaff1,
6882 __isl_take isl_pw_aff *pwaff2);
6883 __isl_give isl_pw_aff *isl_pw_aff_div(
6884 __isl_take isl_pw_aff *pa1,
6885 __isl_take isl_pw_aff *pa2);
6886 __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6887 __isl_take isl_pw_aff *pa1,
6888 __isl_take isl_pw_aff *pa2);
6889 __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6890 __isl_take isl_pw_aff *pa1,
6891 __isl_take isl_pw_aff *pa2);
6893 When multiplying two affine expressions, at least one of the two needs
6894 to be a constant. Similarly, when dividing an affine expression by another,
6895 the second expression needs to be a constant.
6896 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6897 rounding towards zero. C<isl_pw_aff_tdiv_r> computes the corresponding
6900 #include <isl/polynomial.h>
6901 __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6902 __isl_take isl_qpolynomial *qp1,
6903 __isl_take isl_qpolynomial *qp2);
6904 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6905 __isl_take isl_pw_qpolynomial *pwqp1,
6906 __isl_take isl_pw_qpolynomial *pwqp2);
6907 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6908 __isl_take isl_union_pw_qpolynomial *upwqp1,
6909 __isl_take isl_union_pw_qpolynomial *upwqp2);
6913 =head3 Lexicographic Optimization
6915 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6916 the following functions
6917 compute a set that contains the lexicographic minimum or maximum
6918 of the elements in C<set> (or C<bset>) for those values of the parameters
6919 that satisfy C<dom>.
6920 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6921 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6923 In other words, the union of the parameter values
6924 for which the result is non-empty and of C<*empty>
6927 #include <isl/set.h>
6928 __isl_give isl_set *isl_basic_set_partial_lexmin(
6929 __isl_take isl_basic_set *bset,
6930 __isl_take isl_basic_set *dom,
6931 __isl_give isl_set **empty);
6932 __isl_give isl_set *isl_basic_set_partial_lexmax(
6933 __isl_take isl_basic_set *bset,
6934 __isl_take isl_basic_set *dom,
6935 __isl_give isl_set **empty);
6936 __isl_give isl_set *isl_set_partial_lexmin(
6937 __isl_take isl_set *set, __isl_take isl_set *dom,
6938 __isl_give isl_set **empty);
6939 __isl_give isl_set *isl_set_partial_lexmax(
6940 __isl_take isl_set *set, __isl_take isl_set *dom,
6941 __isl_give isl_set **empty);
6943 Given a (basic) set C<set> (or C<bset>), the following functions simply
6944 return a set containing the lexicographic minimum or maximum
6945 of the elements in C<set> (or C<bset>).
6946 In case of union sets, the optimum is computed per space.
6948 #include <isl/set.h>
6949 __isl_give isl_set *isl_basic_set_lexmin(
6950 __isl_take isl_basic_set *bset);
6951 __isl_give isl_set *isl_basic_set_lexmax(
6952 __isl_take isl_basic_set *bset);
6953 __isl_give isl_set *isl_set_lexmin(
6954 __isl_take isl_set *set);
6955 __isl_give isl_set *isl_set_lexmax(
6956 __isl_take isl_set *set);
6957 __isl_give isl_union_set *isl_union_set_lexmin(
6958 __isl_take isl_union_set *uset);
6959 __isl_give isl_union_set *isl_union_set_lexmax(
6960 __isl_take isl_union_set *uset);
6962 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6963 the following functions
6964 compute a relation that maps each element of C<dom>
6965 to the single lexicographic minimum or maximum
6966 of the elements that are associated to that same
6967 element in C<map> (or C<bmap>).
6968 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6969 that contains the elements in C<dom> that do not map
6970 to any elements in C<map> (or C<bmap>).
6971 In other words, the union of the domain of the result and of C<*empty>
6974 #include <isl/map.h>
6975 __isl_give isl_map *isl_basic_map_partial_lexmax(
6976 __isl_take isl_basic_map *bmap,
6977 __isl_take isl_basic_set *dom,
6978 __isl_give isl_set **empty);
6979 __isl_give isl_map *isl_basic_map_partial_lexmin(
6980 __isl_take isl_basic_map *bmap,
6981 __isl_take isl_basic_set *dom,
6982 __isl_give isl_set **empty);
6983 __isl_give isl_map *isl_map_partial_lexmax(
6984 __isl_take isl_map *map, __isl_take isl_set *dom,
6985 __isl_give isl_set **empty);
6986 __isl_give isl_map *isl_map_partial_lexmin(
6987 __isl_take isl_map *map, __isl_take isl_set *dom,
6988 __isl_give isl_set **empty);
6990 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6991 return a map mapping each element in the domain of
6992 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6993 of all elements associated to that element.
6994 In case of union relations, the optimum is computed per space.
6996 #include <isl/map.h>
6997 __isl_give isl_map *isl_basic_map_lexmin(
6998 __isl_take isl_basic_map *bmap);
6999 __isl_give isl_map *isl_basic_map_lexmax(
7000 __isl_take isl_basic_map *bmap);
7001 __isl_give isl_map *isl_map_lexmin(
7002 __isl_take isl_map *map);
7003 __isl_give isl_map *isl_map_lexmax(
7004 __isl_take isl_map *map);
7005 __isl_give isl_union_map *isl_union_map_lexmin(
7006 __isl_take isl_union_map *umap);
7007 __isl_give isl_union_map *isl_union_map_lexmax(
7008 __isl_take isl_union_map *umap);
7010 The following functions return their result in the form of
7011 a piecewise multi-affine expression,
7012 but are otherwise equivalent to the corresponding functions
7013 returning a basic set or relation.
7015 #include <isl/set.h>
7016 __isl_give isl_pw_multi_aff *
7017 isl_basic_set_partial_lexmin_pw_multi_aff(
7018 __isl_take isl_basic_set *bset,
7019 __isl_take isl_basic_set *dom,
7020 __isl_give isl_set **empty);
7021 __isl_give isl_pw_multi_aff *
7022 isl_basic_set_partial_lexmax_pw_multi_aff(
7023 __isl_take isl_basic_set *bset,
7024 __isl_take isl_basic_set *dom,
7025 __isl_give isl_set **empty);
7026 __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
7027 __isl_take isl_set *set);
7028 __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
7029 __isl_take isl_set *set);
7031 #include <isl/map.h>
7032 __isl_give isl_pw_multi_aff *
7033 isl_basic_map_lexmin_pw_multi_aff(
7034 __isl_take isl_basic_map *bmap);
7035 __isl_give isl_pw_multi_aff *
7036 isl_basic_map_partial_lexmin_pw_multi_aff(
7037 __isl_take isl_basic_map *bmap,
7038 __isl_take isl_basic_set *dom,
7039 __isl_give isl_set **empty);
7040 __isl_give isl_pw_multi_aff *
7041 isl_basic_map_partial_lexmax_pw_multi_aff(
7042 __isl_take isl_basic_map *bmap,
7043 __isl_take isl_basic_set *dom,
7044 __isl_give isl_set **empty);
7045 __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
7046 __isl_take isl_map *map);
7047 __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
7048 __isl_take isl_map *map);
7050 The following functions return the lexicographic minimum or maximum
7051 on the shared domain of the inputs and the single defined function
7052 on those parts of the domain where only a single function is defined.
7054 #include <isl/aff.h>
7055 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
7056 __isl_take isl_pw_multi_aff *pma1,
7057 __isl_take isl_pw_multi_aff *pma2);
7058 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
7059 __isl_take isl_pw_multi_aff *pma1,
7060 __isl_take isl_pw_multi_aff *pma2);
7062 =head2 Ternary Operations
7064 #include <isl/aff.h>
7065 __isl_give isl_pw_aff *isl_pw_aff_cond(
7066 __isl_take isl_pw_aff *cond,
7067 __isl_take isl_pw_aff *pwaff_true,
7068 __isl_take isl_pw_aff *pwaff_false);
7070 The function C<isl_pw_aff_cond> performs a conditional operator
7071 and returns an expression that is equal to C<pwaff_true>
7072 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
7073 where C<cond> is zero.
7077 Lists are defined over several element types, including
7078 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
7079 C<isl_union_pw_multi_aff>, C<isl_constraint>,
7080 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
7081 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
7082 Here we take lists of C<isl_set>s as an example.
7083 Lists can be created, copied, modified and freed using the following functions.
7085 #include <isl/set.h>
7086 __isl_give isl_set_list *isl_set_list_from_set(
7087 __isl_take isl_set *el);
7088 __isl_give isl_set_list *isl_set_list_alloc(
7089 isl_ctx *ctx, int n);
7090 __isl_give isl_set_list *isl_set_list_copy(
7091 __isl_keep isl_set_list *list);
7092 __isl_give isl_set_list *isl_set_list_insert(
7093 __isl_take isl_set_list *list, unsigned pos,
7094 __isl_take isl_set *el);
7095 __isl_give isl_set_list *isl_set_list_add(
7096 __isl_take isl_set_list *list,
7097 __isl_take isl_set *el);
7098 __isl_give isl_set_list *isl_set_list_drop(
7099 __isl_take isl_set_list *list,
7100 unsigned first, unsigned n);
7101 __isl_give isl_set_list *isl_set_list_set_set(
7102 __isl_take isl_set_list *list, int index,
7103 __isl_take isl_set *set);
7104 __isl_give isl_set_list *isl_set_list_concat(
7105 __isl_take isl_set_list *list1,
7106 __isl_take isl_set_list *list2);
7107 __isl_give isl_set_list *isl_set_list_sort(
7108 __isl_take isl_set_list *list,
7109 int (*cmp)(__isl_keep isl_set *a,
7110 __isl_keep isl_set *b, void *user),
7112 __isl_null isl_set_list *isl_set_list_free(
7113 __isl_take isl_set_list *list);
7115 C<isl_set_list_alloc> creates an empty list with an initial capacity
7116 for C<n> elements. C<isl_set_list_insert> and C<isl_set_list_add>
7117 add elements to a list, increasing its capacity as needed.
7118 C<isl_set_list_from_set> creates a list with a single element.
7120 Lists can be inspected using the following functions.
7122 #include <isl/set.h>
7123 int isl_set_list_n_set(__isl_keep isl_set_list *list);
7124 __isl_give isl_set *isl_set_list_get_set(
7125 __isl_keep isl_set_list *list, int index);
7126 isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
7127 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7129 isl_stat isl_set_list_foreach_scc(
7130 __isl_keep isl_set_list *list,
7131 isl_bool (*follows)(__isl_keep isl_set *a,
7132 __isl_keep isl_set *b, void *user),
7134 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7137 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
7138 strongly connected components of the graph with as vertices the elements
7139 of C<list> and a directed edge from vertex C<b> to vertex C<a>
7140 iff C<follows(a, b)> returns C<1>. The callbacks C<follows> and C<fn>
7141 should return C<-1> on error.
7143 Lists can be printed using
7145 #include <isl/set.h>
7146 __isl_give isl_printer *isl_printer_print_set_list(
7147 __isl_take isl_printer *p,
7148 __isl_keep isl_set_list *list);
7150 =head2 Associative arrays
7152 Associative arrays map isl objects of a specific type to isl objects
7153 of some (other) specific type. They are defined for several pairs
7154 of types, including (C<isl_map>, C<isl_basic_set>),
7155 (C<isl_id>, C<isl_ast_expr>) and.
7156 (C<isl_id>, C<isl_pw_aff>).
7157 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7160 Associative arrays can be created, copied and freed using
7161 the following functions.
7163 #include <isl/id_to_ast_expr.h>
7164 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7165 isl_ctx *ctx, int min_size);
7166 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7167 __isl_keep isl_id_to_ast_expr *id2expr);
7168 __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7169 __isl_take isl_id_to_ast_expr *id2expr);
7171 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7172 to specify the expected size of the associative array.
7173 The associative array will be grown automatically as needed.
7175 Associative arrays can be inspected using the following functions.
7177 #include <isl/id_to_ast_expr.h>
7178 isl_bool isl_id_to_ast_expr_has(
7179 __isl_keep isl_id_to_ast_expr *id2expr,
7180 __isl_keep isl_id *key);
7181 __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7182 __isl_keep isl_id_to_ast_expr *id2expr,
7183 __isl_take isl_id *key);
7184 isl_stat isl_id_to_ast_expr_foreach(
7185 __isl_keep isl_id_to_ast_expr *id2expr,
7186 isl_stat (*fn)(__isl_take isl_id *key,
7187 __isl_take isl_ast_expr *val, void *user),
7190 They can be modified using the following function.
7192 #include <isl/id_to_ast_expr.h>
7193 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7194 __isl_take isl_id_to_ast_expr *id2expr,
7195 __isl_take isl_id *key,
7196 __isl_take isl_ast_expr *val);
7197 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7198 __isl_take isl_id_to_ast_expr *id2expr,
7199 __isl_take isl_id *key);
7201 Associative arrays can be printed using the following function.
7203 #include <isl/id_to_ast_expr.h>
7204 __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7205 __isl_take isl_printer *p,
7206 __isl_keep isl_id_to_ast_expr *id2expr);
7210 Vectors can be created, copied and freed using the following functions.
7212 #include <isl/vec.h>
7213 __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7215 __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7216 __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7218 Note that the elements of a newly created vector may have arbitrary values.
7219 The elements can be changed and inspected using the following functions.
7221 int isl_vec_size(__isl_keep isl_vec *vec);
7222 __isl_give isl_val *isl_vec_get_element_val(
7223 __isl_keep isl_vec *vec, int pos);
7224 __isl_give isl_vec *isl_vec_set_element_si(
7225 __isl_take isl_vec *vec, int pos, int v);
7226 __isl_give isl_vec *isl_vec_set_element_val(
7227 __isl_take isl_vec *vec, int pos,
7228 __isl_take isl_val *v);
7229 __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7231 __isl_give isl_vec *isl_vec_set_val(
7232 __isl_take isl_vec *vec, __isl_take isl_val *v);
7233 int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7234 __isl_keep isl_vec *vec2, int pos);
7236 C<isl_vec_get_element> will return a negative value if anything went wrong.
7237 In that case, the value of C<*v> is undefined.
7239 The following function can be used to concatenate two vectors.
7241 __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7242 __isl_take isl_vec *vec2);
7246 Matrices can be created, copied and freed using the following functions.
7248 #include <isl/mat.h>
7249 __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7250 unsigned n_row, unsigned n_col);
7251 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7252 __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7254 Note that the elements of a newly created matrix may have arbitrary values.
7255 The elements can be changed and inspected using the following functions.
7257 int isl_mat_rows(__isl_keep isl_mat *mat);
7258 int isl_mat_cols(__isl_keep isl_mat *mat);
7259 __isl_give isl_val *isl_mat_get_element_val(
7260 __isl_keep isl_mat *mat, int row, int col);
7261 __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7262 int row, int col, int v);
7263 __isl_give isl_mat *isl_mat_set_element_val(
7264 __isl_take isl_mat *mat, int row, int col,
7265 __isl_take isl_val *v);
7267 C<isl_mat_get_element> will return a negative value if anything went wrong.
7268 In that case, the value of C<*v> is undefined.
7270 The following function can be used to compute the (right) inverse
7271 of a matrix, i.e., a matrix such that the product of the original
7272 and the inverse (in that order) is a multiple of the identity matrix.
7273 The input matrix is assumed to be of full row-rank.
7275 __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7277 The following function can be used to compute the (right) kernel
7278 (or null space) of a matrix, i.e., a matrix such that the product of
7279 the original and the kernel (in that order) is the zero matrix.
7281 __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7283 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7285 The following functions determine
7286 an upper or lower bound on a quasipolynomial over its domain.
7288 __isl_give isl_pw_qpolynomial_fold *
7289 isl_pw_qpolynomial_bound(
7290 __isl_take isl_pw_qpolynomial *pwqp,
7291 enum isl_fold type, int *tight);
7293 __isl_give isl_union_pw_qpolynomial_fold *
7294 isl_union_pw_qpolynomial_bound(
7295 __isl_take isl_union_pw_qpolynomial *upwqp,
7296 enum isl_fold type, int *tight);
7298 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7299 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7300 is the returned bound is known be tight, i.e., for each value
7301 of the parameters there is at least
7302 one element in the domain that reaches the bound.
7303 If the domain of C<pwqp> is not wrapping, then the bound is computed
7304 over all elements in that domain and the result has a purely parametric
7305 domain. If the domain of C<pwqp> is wrapping, then the bound is
7306 computed over the range of the wrapped relation. The domain of the
7307 wrapped relation becomes the domain of the result.
7309 =head2 Parametric Vertex Enumeration
7311 The parametric vertex enumeration described in this section
7312 is mainly intended to be used internally and by the C<barvinok>
7315 #include <isl/vertices.h>
7316 __isl_give isl_vertices *isl_basic_set_compute_vertices(
7317 __isl_keep isl_basic_set *bset);
7319 The function C<isl_basic_set_compute_vertices> performs the
7320 actual computation of the parametric vertices and the chamber
7321 decomposition and store the result in an C<isl_vertices> object.
7322 This information can be queried by either iterating over all
7323 the vertices or iterating over all the chambers or cells
7324 and then iterating over all vertices that are active on the chamber.
7326 isl_stat isl_vertices_foreach_vertex(
7327 __isl_keep isl_vertices *vertices,
7328 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7329 void *user), void *user);
7331 isl_stat isl_vertices_foreach_cell(
7332 __isl_keep isl_vertices *vertices,
7333 isl_stat (*fn)(__isl_take isl_cell *cell,
7334 void *user), void *user);
7335 isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7336 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7337 void *user), void *user);
7339 Other operations that can be performed on an C<isl_vertices> object are
7342 int isl_vertices_get_n_vertices(
7343 __isl_keep isl_vertices *vertices);
7344 void isl_vertices_free(__isl_take isl_vertices *vertices);
7346 Vertices can be inspected and destroyed using the following functions.
7348 int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7349 __isl_give isl_basic_set *isl_vertex_get_domain(
7350 __isl_keep isl_vertex *vertex);
7351 __isl_give isl_multi_aff *isl_vertex_get_expr(
7352 __isl_keep isl_vertex *vertex);
7353 void isl_vertex_free(__isl_take isl_vertex *vertex);
7355 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7356 describing the vertex in terms of the parameters,
7357 while C<isl_vertex_get_domain> returns the activity domain
7360 Chambers can be inspected and destroyed using the following functions.
7362 __isl_give isl_basic_set *isl_cell_get_domain(
7363 __isl_keep isl_cell *cell);
7364 void isl_cell_free(__isl_take isl_cell *cell);
7366 =head1 Polyhedral Compilation Library
7368 This section collects functionality in C<isl> that has been specifically
7369 designed for use during polyhedral compilation.
7371 =head2 Schedule Trees
7373 A schedule tree is a structured representation of a schedule,
7374 assigning a relative order to a set of domain elements.
7375 The relative order expressed by the schedule tree is
7376 defined recursively. In particular, the order between
7377 two domain elements is determined by the node that is closest
7378 to the root that refers to both elements and that orders them apart.
7379 Each node in the tree is of one of several types.
7380 The root node is always of type C<isl_schedule_node_domain>
7381 (or C<isl_schedule_node_extension>)
7382 and it describes the (extra) domain elements to which the schedule applies.
7383 The other types of nodes are as follows.
7387 =item C<isl_schedule_node_band>
7389 A band of schedule dimensions. Each schedule dimension is represented
7390 by a union piecewise quasi-affine expression. If this expression
7391 assigns a different value to two domain elements, while all previous
7392 schedule dimensions in the same band assign them the same value,
7393 then the two domain elements are ordered according to these two
7396 =item C<isl_schedule_node_expansion>
7398 An expansion node maps each of the domain elements that reach the node
7399 to one or more domain elements. The image of this mapping forms
7400 the set of domain elements that reach the child of the expansion node.
7401 The function that maps each of the expanded domain elements
7402 to the original domain element from which it was expanded
7403 is called the contraction.
7405 =item C<isl_schedule_node_filter>
7407 A filter node does not impose any ordering, but rather intersects
7408 the set of domain elements that the current subtree refers to
7409 with a given union set. The subtree of the filter node only
7410 refers to domain elements in the intersection.
7411 A filter node is typically only used a child of a sequence or
7414 =item C<isl_schedule_node_leaf>
7416 A leaf of the schedule tree. Leaf nodes do not impose any ordering.
7418 =item C<isl_schedule_node_mark>
7420 A mark node can be used to attach any kind of information to a subtree
7421 of the schedule tree.
7423 =item C<isl_schedule_node_sequence>
7425 A sequence node has one or more children, each of which is a filter node.
7426 The filters on these filter nodes form a partition of
7427 the domain elements that the current subtree refers to.
7428 If two domain elements appear in distinct filters then the sequence
7429 node orders them according to the child positions of the corresponding
7432 =item C<isl_schedule_node_set>
7434 A set node is similar to a sequence node, except that
7435 it expresses that domain elements appearing in distinct filters
7436 may have any order. The order of the children of a set node
7437 is therefore also immaterial.
7441 The following node types are only supported by the AST generator.
7445 =item C<isl_schedule_node_context>
7447 The context describes constraints on the parameters and
7448 the schedule dimensions of outer
7449 bands that the AST generator may assume to hold. It is also the only
7450 kind of node that may introduce additional parameters.
7451 The space of the context is that of the flat product of the outer
7452 band nodes. In particular, if there are no outer band nodes, then
7453 this space is the unnamed zero-dimensional space.
7454 Since a context node references the outer band nodes, any tree
7455 containing a context node is considered to be anchored.
7457 =item C<isl_schedule_node_extension>
7459 An extension node instructs the AST generator to add additional
7460 domain elements that need to be scheduled.
7461 The additional domain elements are described by the range of
7462 the extension map in terms of the outer schedule dimensions,
7463 i.e., the flat product of the outer band nodes.
7464 Note that domain elements are added whenever the AST generator
7465 reaches the extension node, meaning that there are still some
7466 active domain elements for which an AST needs to be generated.
7467 The conditions under which some domain elements are still active
7468 may however not be completely described by the outer AST nodes
7469 generated at that point.
7471 An extension node may also appear as the root of a schedule tree,
7472 when it is intended to be inserted into another tree
7473 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
7474 In this case, the domain of the extension node should
7475 correspond to the flat product of the outer band nodes
7476 in this other schedule tree at the point where the extension tree
7479 =item C<isl_schedule_node_guard>
7481 The guard describes constraints on the parameters and
7482 the schedule dimensions of outer
7483 bands that need to be enforced by the outer nodes
7484 in the generated AST.
7485 The space of the guard is that of the flat product of the outer
7486 band nodes. In particular, if there are no outer band nodes, then
7487 this space is the unnamed zero-dimensional space.
7488 Since a guard node references the outer band nodes, any tree
7489 containing a guard node is considered to be anchored.
7493 Except for the C<isl_schedule_node_context> nodes,
7494 none of the nodes may introduce any parameters that were not
7495 already present in the root domain node.
7497 A schedule tree is encapsulated in an C<isl_schedule> object.
7498 The simplest such objects, those with a tree consisting of single domain node,
7499 can be created using the following functions with either an empty
7500 domain or a given domain.
7502 #include <isl/schedule.h>
7503 __isl_give isl_schedule *isl_schedule_empty(
7504 __isl_take isl_space *space);
7505 __isl_give isl_schedule *isl_schedule_from_domain(
7506 __isl_take isl_union_set *domain);
7508 The function C<isl_schedule_constraints_compute_schedule> described
7509 in L</"Scheduling"> can also be used to construct schedules.
7511 C<isl_schedule> objects may be copied and freed using the following functions.
7513 #include <isl/schedule.h>
7514 __isl_give isl_schedule *isl_schedule_copy(
7515 __isl_keep isl_schedule *sched);
7516 __isl_null isl_schedule *isl_schedule_free(
7517 __isl_take isl_schedule *sched);
7519 The following functions checks whether two C<isl_schedule> objects
7520 are obviously the same.
7522 #include <isl/schedule.h>
7523 isl_bool isl_schedule_plain_is_equal(
7524 __isl_keep isl_schedule *schedule1,
7525 __isl_keep isl_schedule *schedule2);
7527 The domain of the schedule, i.e., the domain described by the root node,
7528 can be obtained using the following function.
7530 #include <isl/schedule.h>
7531 __isl_give isl_union_set *isl_schedule_get_domain(
7532 __isl_keep isl_schedule *schedule);
7534 An extra top-level band node (right underneath the domain node) can
7535 be introduced into the schedule using the following function.
7536 The schedule tree is assumed not to have any anchored nodes.
7538 #include <isl/schedule.h>
7539 __isl_give isl_schedule *
7540 isl_schedule_insert_partial_schedule(
7541 __isl_take isl_schedule *schedule,
7542 __isl_take isl_multi_union_pw_aff *partial);
7544 A top-level context node (right underneath the domain node) can
7545 be introduced into the schedule using the following function.
7547 #include <isl/schedule.h>
7548 __isl_give isl_schedule *isl_schedule_insert_context(
7549 __isl_take isl_schedule *schedule,
7550 __isl_take isl_set *context)
7552 A top-level guard node (right underneath the domain node) can
7553 be introduced into the schedule using the following function.
7555 #include <isl/schedule.h>
7556 __isl_give isl_schedule *isl_schedule_insert_guard(
7557 __isl_take isl_schedule *schedule,
7558 __isl_take isl_set *guard)
7560 A schedule that combines two schedules either in the given
7561 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
7562 or an C<isl_schedule_node_set> node,
7563 can be created using the following functions.
7565 #include <isl/schedule.h>
7566 __isl_give isl_schedule *isl_schedule_sequence(
7567 __isl_take isl_schedule *schedule1,
7568 __isl_take isl_schedule *schedule2);
7569 __isl_give isl_schedule *isl_schedule_set(
7570 __isl_take isl_schedule *schedule1,
7571 __isl_take isl_schedule *schedule2);
7573 The domains of the two input schedules need to be disjoint.
7575 The following function can be used to restrict the domain
7576 of a schedule with a domain node as root to be a subset of the given union set.
7577 This operation may remove nodes in the tree that have become
7580 #include <isl/schedule.h>
7581 __isl_give isl_schedule *isl_schedule_intersect_domain(
7582 __isl_take isl_schedule *schedule,
7583 __isl_take isl_union_set *domain);
7585 The following function can be used to simplify the domain
7586 of a schedule with a domain node as root with respect to the given
7589 #include <isl/schedule.h>
7590 __isl_give isl_schedule *isl_schedule_gist_domain_params(
7591 __isl_take isl_schedule *schedule,
7592 __isl_take isl_set *context);
7594 The following function resets the user pointers on all parameter
7595 and tuple identifiers referenced by the nodes of the given schedule.
7597 #include <isl/schedule.h>
7598 __isl_give isl_schedule *isl_schedule_reset_user(
7599 __isl_take isl_schedule *schedule);
7601 The following function aligns the parameters of all nodes
7602 in the given schedule to the given space.
7604 #include <isl/schedule.h>
7605 __isl_give isl_schedule *isl_schedule_align_params(
7606 __isl_take isl_schedule *schedule,
7607 __isl_take isl_space *space);
7609 The following function allows the user to plug in a given function
7610 in the iteration domains. The input schedule is not allowed to contain
7611 any expansion nodes.
7613 #include <isl/schedule.h>
7614 __isl_give isl_schedule *
7615 isl_schedule_pullback_union_pw_multi_aff(
7616 __isl_take isl_schedule *schedule,
7617 __isl_take isl_union_pw_multi_aff *upma);
7619 An C<isl_union_map> representation of the schedule can be obtained
7620 from an C<isl_schedule> using the following function.
7622 #include <isl/schedule.h>
7623 __isl_give isl_union_map *isl_schedule_get_map(
7624 __isl_keep isl_schedule *sched);
7626 The resulting relation encodes the same relative ordering as
7627 the schedule by mapping the domain elements to a common schedule space.
7628 If the schedule_separate_components option is set, then the order
7629 of the children of a set node is explicitly encoded in the result.
7630 If the tree contains any expansion nodes, then the relation
7631 is formulated in terms of the expanded domain elements.
7633 Schedules can be read from input using the following functions.
7635 #include <isl/schedule.h>
7636 __isl_give isl_schedule *isl_schedule_read_from_file(
7637 isl_ctx *ctx, FILE *input);
7638 __isl_give isl_schedule *isl_schedule_read_from_str(
7639 isl_ctx *ctx, const char *str);
7641 A representation of the schedule can be printed using
7643 #include <isl/schedule.h>
7644 __isl_give isl_printer *isl_printer_print_schedule(
7645 __isl_take isl_printer *p,
7646 __isl_keep isl_schedule *schedule);
7648 The schedule tree can be traversed through the use of
7649 C<isl_schedule_node> objects that point to a particular
7650 position in the schedule tree. Whenever a C<isl_schedule_node>
7651 is use to modify a node in the schedule tree, the original schedule
7652 tree is left untouched and the modifications are performed to a copy
7653 of the tree. The returned C<isl_schedule_node> then points to
7654 this modified copy of the tree.
7656 The root of the schedule tree can be obtained using the following function.
7658 #include <isl/schedule.h>
7659 __isl_give isl_schedule_node *isl_schedule_get_root(
7660 __isl_keep isl_schedule *schedule);
7662 A pointer to a newly created schedule tree with a single domain
7663 node can be created using the following functions.
7665 #include <isl/schedule_node.h>
7666 __isl_give isl_schedule_node *
7667 isl_schedule_node_from_domain(
7668 __isl_take isl_union_set *domain);
7669 __isl_give isl_schedule_node *
7670 isl_schedule_node_from_extension(
7671 __isl_take isl_union_map *extension);
7673 C<isl_schedule_node_from_extension> creates a tree with an extension
7676 Schedule nodes can be copied and freed using the following functions.
7678 #include <isl/schedule_node.h>
7679 __isl_give isl_schedule_node *isl_schedule_node_copy(
7680 __isl_keep isl_schedule_node *node);
7681 __isl_null isl_schedule_node *isl_schedule_node_free(
7682 __isl_take isl_schedule_node *node);
7684 The following functions can be used to check if two schedule
7685 nodes point to the same position in the same schedule.
7687 #include <isl/schedule_node.h>
7688 isl_bool isl_schedule_node_is_equal(
7689 __isl_keep isl_schedule_node *node1,
7690 __isl_keep isl_schedule_node *node2);
7692 The following properties can be obtained from a schedule node.
7694 #include <isl/schedule_node.h>
7695 enum isl_schedule_node_type isl_schedule_node_get_type(
7696 __isl_keep isl_schedule_node *node);
7697 enum isl_schedule_node_type
7698 isl_schedule_node_get_parent_type(
7699 __isl_keep isl_schedule_node *node);
7700 __isl_give isl_schedule *isl_schedule_node_get_schedule(
7701 __isl_keep isl_schedule_node *node);
7703 The function C<isl_schedule_node_get_type> returns the type of
7704 the node, while C<isl_schedule_node_get_parent_type> returns
7705 type of the parent of the node, which is required to exist.
7706 The function C<isl_schedule_node_get_schedule> returns a copy
7707 to the schedule to which the node belongs.
7709 The following functions can be used to move the schedule node
7710 to a different position in the tree or to check if such a position
7713 #include <isl/schedule_node.h>
7714 isl_bool isl_schedule_node_has_parent(
7715 __isl_keep isl_schedule_node *node);
7716 __isl_give isl_schedule_node *isl_schedule_node_parent(
7717 __isl_take isl_schedule_node *node);
7718 __isl_give isl_schedule_node *isl_schedule_node_root(
7719 __isl_take isl_schedule_node *node);
7720 __isl_give isl_schedule_node *isl_schedule_node_ancestor(
7721 __isl_take isl_schedule_node *node,
7723 int isl_schedule_node_n_children(
7724 __isl_keep isl_schedule_node *node);
7725 __isl_give isl_schedule_node *isl_schedule_node_child(
7726 __isl_take isl_schedule_node *node, int pos);
7727 isl_bool isl_schedule_node_has_children(
7728 __isl_keep isl_schedule_node *node);
7729 __isl_give isl_schedule_node *isl_schedule_node_first_child(
7730 __isl_take isl_schedule_node *node);
7731 isl_bool isl_schedule_node_has_previous_sibling(
7732 __isl_keep isl_schedule_node *node);
7733 __isl_give isl_schedule_node *
7734 isl_schedule_node_previous_sibling(
7735 __isl_take isl_schedule_node *node);
7736 isl_bool isl_schedule_node_has_next_sibling(
7737 __isl_keep isl_schedule_node *node);
7738 __isl_give isl_schedule_node *
7739 isl_schedule_node_next_sibling(
7740 __isl_take isl_schedule_node *node);
7742 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
7743 is the node itself, the ancestor of generation 1 is its parent and so on.
7745 It is also possible to query the number of ancestors of a node,
7746 the position of the current node
7747 within the children of its parent, the position of the subtree
7748 containing a node within the children of an ancestor
7749 or to obtain a copy of a given
7750 child without destroying the current node.
7751 Given two nodes that point to the same schedule, their closest
7752 shared ancestor can be obtained using
7753 C<isl_schedule_node_get_shared_ancestor>.
7755 #include <isl/schedule_node.h>
7756 int isl_schedule_node_get_tree_depth(
7757 __isl_keep isl_schedule_node *node);
7758 int isl_schedule_node_get_child_position(
7759 __isl_keep isl_schedule_node *node);
7760 int isl_schedule_node_get_ancestor_child_position(
7761 __isl_keep isl_schedule_node *node,
7762 __isl_keep isl_schedule_node *ancestor);
7763 __isl_give isl_schedule_node *isl_schedule_node_get_child(
7764 __isl_keep isl_schedule_node *node, int pos);
7765 __isl_give isl_schedule_node *
7766 isl_schedule_node_get_shared_ancestor(
7767 __isl_keep isl_schedule_node *node1,
7768 __isl_keep isl_schedule_node *node2);
7770 All nodes in a schedule tree or
7771 all descendants of a specific node (including the node) can be visited
7772 in depth-first pre-order using the following functions.
7774 #include <isl/schedule.h>
7775 isl_stat isl_schedule_foreach_schedule_node_top_down(
7776 __isl_keep isl_schedule *sched,
7777 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
7778 void *user), void *user);
7780 #include <isl/schedule_node.h>
7781 isl_stat isl_schedule_node_foreach_descendant_top_down(
7782 __isl_keep isl_schedule_node *node,
7783 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
7784 void *user), void *user);
7786 The callback function is slightly different from the usual
7787 callbacks in that it not only indicates success (non-negative result)
7788 or failure (negative result), but also indicates whether the children
7789 of the given node should be visited. In particular, if the callback
7790 returns a positive value, then the children are visited, but if
7791 the callback returns zero, then the children are not visited.
7793 The ancestors of a node in a schedule tree can be visited from
7794 the root down to and including the parent of the node using
7795 the following function.
7797 #include <isl/schedule_node.h>
7798 isl_stat isl_schedule_node_foreach_ancestor_top_down(
7799 __isl_keep isl_schedule_node *node,
7800 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
7801 void *user), void *user);
7803 The following functions allows for a depth-first post-order
7804 traversal of the nodes in a schedule tree or
7805 of the descendants of a specific node (including the node
7806 itself), where the user callback is allowed to modify the
7809 #include <isl/schedule.h>
7810 __isl_give isl_schedule *
7811 isl_schedule_map_schedule_node_bottom_up(
7812 __isl_take isl_schedule *schedule,
7813 __isl_give isl_schedule_node *(*fn)(
7814 __isl_take isl_schedule_node *node,
7815 void *user), void *user);
7817 #include <isl/schedule_node.h>
7818 __isl_give isl_schedule_node *
7819 isl_schedule_node_map_descendant_bottom_up(
7820 __isl_take isl_schedule_node *node,
7821 __isl_give isl_schedule_node *(*fn)(
7822 __isl_take isl_schedule_node *node,
7823 void *user), void *user);
7825 The traversal continues from the node returned by the callback function.
7826 It is the responsibility of the user to ensure that this does not
7827 lead to an infinite loop. It is safest to always return a pointer
7828 to the same position (same ancestors and child positions) as the input node.
7830 The following function removes a node (along with its descendants)
7831 from a schedule tree and returns a pointer to the leaf at the
7832 same position in the updated tree.
7833 It is not allowed to remove the root of a schedule tree or
7834 a child of a set or sequence node.
7836 #include <isl/schedule_node.h>
7837 __isl_give isl_schedule_node *isl_schedule_node_cut(
7838 __isl_take isl_schedule_node *node);
7840 The following function removes a single node
7841 from a schedule tree and returns a pointer to the child
7842 of the node, now located at the position of the original node
7843 or to a leaf node at that position if there was no child.
7844 It is not allowed to remove the root of a schedule tree,
7845 a set or sequence node, a child of a set or sequence node or
7846 a band node with an anchored subtree.
7848 #include <isl/schedule_node.h>
7849 __isl_give isl_schedule_node *isl_schedule_node_delete(
7850 __isl_take isl_schedule_node *node);
7852 Most nodes in a schedule tree only contain local information.
7853 In some cases, however, a node may also refer to outer band nodes.
7854 This means that the position of the node within the tree should
7855 not be changed, or at least that no changes are performed to the
7856 outer band nodes. The following function can be used to test
7857 whether the subtree rooted at a given node contains any such nodes.
7859 #include <isl/schedule_node.h>
7860 isl_bool isl_schedule_node_is_subtree_anchored(
7861 __isl_keep isl_schedule_node *node);
7863 The following function resets the user pointers on all parameter
7864 and tuple identifiers referenced by the given schedule node.
7866 #include <isl/schedule_node.h>
7867 __isl_give isl_schedule_node *isl_schedule_node_reset_user(
7868 __isl_take isl_schedule_node *node);
7870 The following function aligns the parameters of the given schedule
7871 node to the given space.
7873 #include <isl/schedule_node.h>
7874 __isl_give isl_schedule_node *
7875 isl_schedule_node_align_params(
7876 __isl_take isl_schedule_node *node,
7877 __isl_take isl_space *space);
7879 Several node types have their own functions for querying
7880 (and in some cases setting) some node type specific properties.
7882 #include <isl/schedule_node.h>
7883 __isl_give isl_space *isl_schedule_node_band_get_space(
7884 __isl_keep isl_schedule_node *node);
7885 __isl_give isl_multi_union_pw_aff *
7886 isl_schedule_node_band_get_partial_schedule(
7887 __isl_keep isl_schedule_node *node);
7888 __isl_give isl_union_map *
7889 isl_schedule_node_band_get_partial_schedule_union_map(
7890 __isl_keep isl_schedule_node *node);
7891 unsigned isl_schedule_node_band_n_member(
7892 __isl_keep isl_schedule_node *node);
7893 isl_bool isl_schedule_node_band_member_get_coincident(
7894 __isl_keep isl_schedule_node *node, int pos);
7895 __isl_give isl_schedule_node *
7896 isl_schedule_node_band_member_set_coincident(
7897 __isl_take isl_schedule_node *node, int pos,
7899 isl_bool isl_schedule_node_band_get_permutable(
7900 __isl_keep isl_schedule_node *node);
7901 __isl_give isl_schedule_node *
7902 isl_schedule_node_band_set_permutable(
7903 __isl_take isl_schedule_node *node, int permutable);
7904 enum isl_ast_loop_type
7905 isl_schedule_node_band_member_get_ast_loop_type(
7906 __isl_keep isl_schedule_node *node, int pos);
7907 __isl_give isl_schedule_node *
7908 isl_schedule_node_band_member_set_ast_loop_type(
7909 __isl_take isl_schedule_node *node, int pos,
7910 enum isl_ast_loop_type type);
7911 __isl_give isl_union_set *
7912 enum isl_ast_loop_type
7913 isl_schedule_node_band_member_get_isolate_ast_loop_type(
7914 __isl_keep isl_schedule_node *node, int pos);
7915 __isl_give isl_schedule_node *
7916 isl_schedule_node_band_member_set_isolate_ast_loop_type(
7917 __isl_take isl_schedule_node *node, int pos,
7918 enum isl_ast_loop_type type);
7919 isl_schedule_node_band_get_ast_build_options(
7920 __isl_keep isl_schedule_node *node);
7921 __isl_give isl_schedule_node *
7922 isl_schedule_node_band_set_ast_build_options(
7923 __isl_take isl_schedule_node *node,
7924 __isl_take isl_union_set *options);
7926 The function C<isl_schedule_node_band_get_space> returns the space
7927 of the partial schedule of the band.
7928 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
7929 returns a representation of the partial schedule of the band node
7930 in the form of an C<isl_union_map>.
7931 The coincident and permutable properties are set by
7932 C<isl_schedule_constraints_compute_schedule> on the schedule tree
7934 A scheduling dimension is considered to be ``coincident''
7935 if it satisfies the coincidence constraints within its band.
7936 That is, if the dependence distances of the coincidence
7937 constraints are all zero in that direction (for fixed
7938 iterations of outer bands).
7939 A band is marked permutable if it was produced using the Pluto-like scheduler.
7940 Note that the scheduler may have to resort to a Feautrier style scheduling
7941 step even if the default scheduler is used.
7942 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
7943 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
7944 For the meaning of these loop AST generation types and the difference
7945 between the regular loop AST generation type and the isolate
7946 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
7947 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
7948 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
7949 may return C<isl_ast_loop_error> if an error occurs.
7950 The AST build options govern how an AST is generated for
7951 the individual schedule dimensions during AST generation.
7952 See L</"AST Generation Options (Schedule Tree)">.
7954 #include <isl/schedule_node.h>
7955 __isl_give isl_set *
7956 isl_schedule_node_context_get_context(
7957 __isl_keep isl_schedule_node *node);
7959 #include <isl/schedule_node.h>
7960 __isl_give isl_union_set *
7961 isl_schedule_node_domain_get_domain(
7962 __isl_keep isl_schedule_node *node);
7964 #include <isl/schedule_node.h>
7965 __isl_give isl_union_map *
7966 isl_schedule_node_expansion_get_expansion(
7967 __isl_keep isl_schedule_node *node);
7968 __isl_give isl_union_pw_multi_aff *
7969 isl_schedule_node_expansion_get_contraction(
7970 __isl_keep isl_schedule_node *node);
7972 #include <isl/schedule_node.h>
7973 __isl_give isl_union_map *
7974 isl_schedule_node_extension_get_extension(
7975 __isl_keep isl_schedule_node *node);
7977 #include <isl/schedule_node.h>
7978 __isl_give isl_union_set *
7979 isl_schedule_node_filter_get_filter(
7980 __isl_keep isl_schedule_node *node);
7982 #include <isl/schedule_node.h>
7983 __isl_give isl_set *isl_schedule_node_guard_get_guard(
7984 __isl_keep isl_schedule_node *node);
7986 #include <isl/schedule_node.h>
7987 __isl_give isl_id *isl_schedule_node_mark_get_id(
7988 __isl_keep isl_schedule_node *node);
7990 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
7991 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
7992 partial schedules related to the node.
7994 #include <isl/schedule_node.h>
7995 __isl_give isl_multi_union_pw_aff *
7996 isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
7997 __isl_keep isl_schedule_node *node);
7998 __isl_give isl_union_pw_multi_aff *
7999 isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
8000 __isl_keep isl_schedule_node *node);
8001 __isl_give isl_union_map *
8002 isl_schedule_node_get_prefix_schedule_union_map(
8003 __isl_keep isl_schedule_node *node);
8004 __isl_give isl_union_map *
8005 isl_schedule_node_get_prefix_schedule_relation(
8006 __isl_keep isl_schedule_node *node);
8007 __isl_give isl_union_map *
8008 isl_schedule_node_get_subtree_schedule_union_map(
8009 __isl_keep isl_schedule_node *node);
8011 In particular, the functions
8012 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
8013 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
8014 and C<isl_schedule_node_get_prefix_schedule_union_map>
8015 return a relative ordering on the domain elements that reach the given
8016 node determined by its ancestors.
8017 The function C<isl_schedule_node_get_prefix_schedule_relation>
8018 additionally includes the domain constraints in the result.
8019 The function C<isl_schedule_node_get_subtree_schedule_union_map>
8020 returns a representation of the partial schedule defined by the
8021 subtree rooted at the given node.
8022 If the tree contains any expansion nodes, then the subtree schedule
8023 is formulated in terms of the expanded domain elements.
8024 The tree passed to functions returning a prefix schedule
8025 may only contain extension nodes if these would not affect
8026 the result of these functions. That is, if one of the ancestors
8027 is an extension node, then all of the domain elements that were
8028 added by the extension node need to have been filtered out
8029 by filter nodes between the extension node and the input node.
8030 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
8031 may not contain in extension nodes in the selected subtree.
8033 The expansion/contraction defined by an entire subtree, combining
8034 the expansions/contractions
8035 on the expansion nodes in the subtree, can be obtained using
8036 the following functions.
8038 #include <isl/schedule_node.h>
8039 __isl_give isl_union_map *
8040 isl_schedule_node_get_subtree_expansion(
8041 __isl_keep isl_schedule_node *node);
8042 __isl_give isl_union_pw_multi_aff *
8043 isl_schedule_node_get_subtree_contraction(
8044 __isl_keep isl_schedule_node *node);
8046 The total number of outer band members of given node, i.e.,
8047 the shared output dimension of the maps in the result
8048 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
8049 using the following function.
8051 #include <isl/schedule_node.h>
8052 int isl_schedule_node_get_schedule_depth(
8053 __isl_keep isl_schedule_node *node);
8055 The following functions return the elements that reach the given node
8056 or the union of universes in the spaces that contain these elements.
8058 #include <isl/schedule_node.h>
8059 __isl_give isl_union_set *
8060 isl_schedule_node_get_domain(
8061 __isl_keep isl_schedule_node *node);
8062 __isl_give isl_union_set *
8063 isl_schedule_node_get_universe_domain(
8064 __isl_keep isl_schedule_node *node);
8066 The input tree of C<isl_schedule_node_get_domain>
8067 may only contain extension nodes if these would not affect
8068 the result of this function. That is, if one of the ancestors
8069 is an extension node, then all of the domain elements that were
8070 added by the extension node need to have been filtered out
8071 by filter nodes between the extension node and the input node.
8073 The following functions can be used to introduce additional nodes
8074 in the schedule tree. The new node is introduced at the point
8075 in the tree where the C<isl_schedule_node> points to and
8076 the results points to the new node.
8078 #include <isl/schedule_node.h>
8079 __isl_give isl_schedule_node *
8080 isl_schedule_node_insert_partial_schedule(
8081 __isl_take isl_schedule_node *node,
8082 __isl_take isl_multi_union_pw_aff *schedule);
8084 This function inserts a new band node with (the greatest integer
8085 part of) the given partial schedule.
8086 The subtree rooted at the given node is assumed not to have
8089 #include <isl/schedule_node.h>
8090 __isl_give isl_schedule_node *
8091 isl_schedule_node_insert_context(
8092 __isl_take isl_schedule_node *node,
8093 __isl_take isl_set *context);
8095 This function inserts a new context node with the given context constraints.
8097 #include <isl/schedule_node.h>
8098 __isl_give isl_schedule_node *
8099 isl_schedule_node_insert_filter(
8100 __isl_take isl_schedule_node *node,
8101 __isl_take isl_union_set *filter);
8103 This function inserts a new filter node with the given filter.
8104 If the original node already pointed to a filter node, then the
8105 two filter nodes are merged into one.
8107 #include <isl/schedule_node.h>
8108 __isl_give isl_schedule_node *
8109 isl_schedule_node_insert_guard(
8110 __isl_take isl_schedule_node *node,
8111 __isl_take isl_set *guard);
8113 This function inserts a new guard node with the given guard constraints.
8115 #include <isl/schedule_node.h>
8116 __isl_give isl_schedule_node *
8117 isl_schedule_node_insert_mark(
8118 __isl_take isl_schedule_node *node,
8119 __isl_take isl_id *mark);
8121 This function inserts a new mark node with the give mark identifier.
8123 #include <isl/schedule_node.h>
8124 __isl_give isl_schedule_node *
8125 isl_schedule_node_insert_sequence(
8126 __isl_take isl_schedule_node *node,
8127 __isl_take isl_union_set_list *filters);
8128 __isl_give isl_schedule_node *
8129 isl_schedule_node_insert_set(
8130 __isl_take isl_schedule_node *node,
8131 __isl_take isl_union_set_list *filters);
8133 These functions insert a new sequence or set node with the given
8134 filters as children.
8136 #include <isl/schedule_node.h>
8137 __isl_give isl_schedule_node *isl_schedule_node_group(
8138 __isl_take isl_schedule_node *node,
8139 __isl_take isl_id *group_id);
8141 This function introduces an expansion node in between the current
8142 node and its parent that expands instances of a space with tuple
8143 identifier C<group_id> to the original domain elements that reach
8144 the node. The group instances are identified by the prefix schedule
8145 of those domain elements. The ancestors of the node are adjusted
8146 to refer to the group instances instead of the original domain
8147 elements. The return value points to the same node in the updated
8148 schedule tree as the input node, i.e., to the child of the newly
8149 introduced expansion node. Grouping instances of different statements
8150 ensures that they will be treated as a single statement by the
8151 AST generator up to the point of the expansion node.
8153 The partial schedule of a band node can be scaled (down) or reduced using
8154 the following functions.
8156 #include <isl/schedule_node.h>
8157 __isl_give isl_schedule_node *
8158 isl_schedule_node_band_scale(
8159 __isl_take isl_schedule_node *node,
8160 __isl_take isl_multi_val *mv);
8161 __isl_give isl_schedule_node *
8162 isl_schedule_node_band_scale_down(
8163 __isl_take isl_schedule_node *node,
8164 __isl_take isl_multi_val *mv);
8165 __isl_give isl_schedule_node *
8166 isl_schedule_node_band_mod(
8167 __isl_take isl_schedule_node *node,
8168 __isl_take isl_multi_val *mv);
8170 The spaces of the two arguments need to match.
8171 After scaling, the partial schedule is replaced by its greatest
8172 integer part to ensure that the schedule remains integral.
8174 The partial schedule of a band node can be shifted by an
8175 C<isl_multi_union_pw_aff> with a domain that is a superset
8176 of the domain of the partial schedule using
8177 the following function.
8179 #include <isl/schedule_node.h>
8180 __isl_give isl_schedule_node *
8181 isl_schedule_node_band_shift(
8182 __isl_take isl_schedule_node *node,
8183 __isl_take isl_multi_union_pw_aff *shift);
8185 A band node can be tiled using the following function.
8187 #include <isl/schedule_node.h>
8188 __isl_give isl_schedule_node *isl_schedule_node_band_tile(
8189 __isl_take isl_schedule_node *node,
8190 __isl_take isl_multi_val *sizes);
8192 isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8194 int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8195 isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8197 int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8199 The C<isl_schedule_node_band_tile> function tiles
8200 the band using the given tile sizes inside its schedule.
8201 A new child band node is created to represent the point loops and it is
8202 inserted between the modified band and its children.
8203 The subtree rooted at the given node is assumed not to have
8205 The C<tile_scale_tile_loops> option specifies whether the tile
8206 loops iterators should be scaled by the tile sizes.
8207 If the C<tile_shift_point_loops> option is set, then the point loops
8208 are shifted to start at zero.
8210 A band node can be split into two nested band nodes
8211 using the following function.
8213 #include <isl/schedule_node.h>
8214 __isl_give isl_schedule_node *isl_schedule_node_band_split(
8215 __isl_take isl_schedule_node *node, int pos);
8217 The resulting outer band node contains the first C<pos> dimensions of
8218 the schedule of C<node> while the inner band contains the remaining dimensions.
8219 The schedules of the two band nodes live in anonymous spaces.
8221 A band node can be moved down to the leaves of the subtree rooted
8222 at the band node using the following function.
8224 #include <isl/schedule_node.h>
8225 __isl_give isl_schedule_node *isl_schedule_node_band_sink(
8226 __isl_take isl_schedule_node *node);
8228 The subtree rooted at the given node is assumed not to have
8230 The result points to the node in the resulting tree that is in the same
8231 position as the node pointed to by C<node> in the original tree.
8233 #include <isl/schedule_node.h>
8234 __isl_give isl_schedule_node *
8235 isl_schedule_node_order_after(
8236 __isl_take isl_schedule_node *node,
8237 __isl_take isl_union_set *filter);
8239 This function splits the domain elements that reach C<node>
8240 into those that satisfy C<filter> and those that do not and
8241 arranges for the elements that do satisfy the filter to be
8242 executed after those that do not. The order is imposed by
8243 a sequence node, possibly reusing the grandparent of C<node>
8244 on two copies of the subtree attached to the original C<node>.
8245 Both copies are simplified with respect to their filter.
8247 Return a pointer to the copy of the subtree that does not
8248 satisfy C<filter>. If there is no such copy (because all
8249 reaching domain elements satisfy the filter), then return
8250 the original pointer.
8252 #include <isl/schedule_node.h>
8253 __isl_give isl_schedule_node *
8254 isl_schedule_node_graft_before(
8255 __isl_take isl_schedule_node *node,
8256 __isl_take isl_schedule_node *graft);
8257 __isl_give isl_schedule_node *
8258 isl_schedule_node_graft_after(
8259 __isl_take isl_schedule_node *node,
8260 __isl_take isl_schedule_node *graft);
8262 This function inserts the C<graft> tree into the tree containing C<node>
8263 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
8264 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
8265 The root node of C<graft>
8266 should be an extension node where the domain of the extension
8267 is the flat product of all outer band nodes of C<node>.
8268 The root node may also be a domain node.
8269 The elements of the domain or the range of the extension may not
8270 intersect with the domain elements that reach "node".
8271 The schedule tree of C<graft> may not be anchored.
8273 The schedule tree of C<node> is modified to include an extension node
8274 corresponding to the root node of C<graft> as a child of the original
8275 parent of C<node>. The original node that C<node> points to and the
8276 child of the root node of C<graft> are attached to this extension node
8277 through a sequence, with appropriate filters and with the child
8278 of C<graft> appearing before or after the original C<node>.
8280 If C<node> already appears inside a sequence that is the child of
8281 an extension node and if the spaces of the new domain elements
8282 do not overlap with those of the original domain elements,
8283 then that extension node is extended with the new extension
8284 rather than introducing a new segment of extension and sequence nodes.
8286 Return a pointer to the same node in the modified tree that
8287 C<node> pointed to in the original tree.
8289 A representation of the schedule node can be printed using
8291 #include <isl/schedule_node.h>
8292 __isl_give isl_printer *isl_printer_print_schedule_node(
8293 __isl_take isl_printer *p,
8294 __isl_keep isl_schedule_node *node);
8296 =head2 Dependence Analysis
8298 C<isl> contains specialized functionality for performing
8299 array dataflow analysis. That is, given a I<sink> access relation
8300 and a collection of possible I<source> access relations,
8301 C<isl> can compute relations that describe
8302 for each iteration of the sink access, which iteration
8303 of which of the source access relations was the last
8304 to access the same data element before the given iteration
8306 The resulting dependence relations map source iterations
8307 to the corresponding sink iterations.
8308 To compute standard flow dependences, the sink should be
8309 a read, while the sources should be writes.
8310 If any of the source accesses are marked as being I<may>
8311 accesses, then there will be a dependence from the last
8312 I<must> access B<and> from any I<may> access that follows
8313 this last I<must> access.
8314 In particular, if I<all> sources are I<may> accesses,
8315 then memory based dependence analysis is performed.
8316 If, on the other hand, all sources are I<must> accesses,
8317 then value based dependence analysis is performed.
8319 =head3 High-level Interface
8321 A high-level interface to dependence analysis is provided
8322 by the following function.
8324 #include <isl/flow.h>
8325 __isl_give isl_union_flow *
8326 isl_union_access_info_compute_flow(
8327 __isl_take isl_union_access_info *access);
8329 The input C<isl_union_access_info> object describes the sink
8330 access relations, the source access relations and a schedule,
8331 while the output C<isl_union_flow> object describes
8332 the resulting dependence relations and the subsets of the
8333 sink relations for which no source was found.
8335 An C<isl_union_access_info> is created, modified, copied and freed using
8336 the following functions.
8338 #include <isl/flow.h>
8339 __isl_give isl_union_access_info *
8340 isl_union_access_info_from_sink(
8341 __isl_take isl_union_map *sink);
8342 __isl_give isl_union_access_info *
8343 isl_union_access_info_set_must_source(
8344 __isl_take isl_union_access_info *access,
8345 __isl_take isl_union_map *must_source);
8346 __isl_give isl_union_access_info *
8347 isl_union_access_info_set_may_source(
8348 __isl_take isl_union_access_info *access,
8349 __isl_take isl_union_map *may_source);
8350 __isl_give isl_union_access_info *
8351 isl_union_access_info_set_schedule(
8352 __isl_take isl_union_access_info *access,
8353 __isl_take isl_schedule *schedule);
8354 __isl_give isl_union_access_info *
8355 isl_union_access_info_set_schedule_map(
8356 __isl_take isl_union_access_info *access,
8357 __isl_take isl_union_map *schedule_map);
8358 __isl_give isl_union_access_info *
8359 isl_union_access_info_copy(
8360 __isl_keep isl_union_access_info *access);
8361 __isl_null isl_union_access_info *
8362 isl_union_access_info_free(
8363 __isl_take isl_union_access_info *access);
8365 The may sources set by C<isl_union_access_info_set_may_source>
8366 do not need to include the must sources set by
8367 C<isl_union_access_info_set_must_source> as a subset.
8368 The user is free not to call one (or both) of these functions,
8369 in which case the corresponding set is kept to its empty default.
8370 Similarly, the default schedule initialized by
8371 C<isl_union_access_info_from_sink> is empty.
8372 The current schedule is determined by the last call to either
8373 C<isl_union_access_info_set_schedule> or
8374 C<isl_union_access_info_set_schedule_map>.
8375 The domain of the schedule corresponds to the domains of
8376 the access relations. In particular, the domains of the access
8377 relations are effectively intersected with the domain of the schedule
8378 and only the resulting accesses are considered by the dependence analysis.
8380 The output of C<isl_union_access_info_compute_flow> can be examined
8381 and freed using the following functions.
8383 #include <isl/flow.h>
8384 __isl_give isl_union_map *isl_union_flow_get_must_dependence(
8385 __isl_keep isl_union_flow *flow);
8386 __isl_give isl_union_map *isl_union_flow_get_may_dependence(
8387 __isl_keep isl_union_flow *flow);
8388 __isl_give isl_union_map *isl_union_flow_get_must_no_source(
8389 __isl_keep isl_union_flow *flow);
8390 __isl_give isl_union_map *isl_union_flow_get_may_no_source(
8391 __isl_keep isl_union_flow *flow);
8392 __isl_null isl_union_flow *isl_union_flow_free(
8393 __isl_take isl_union_flow *flow);
8395 The relation returned by C<isl_union_flow_get_must_dependence>
8396 relates domain elements of must sources to domain elements of the sink.
8397 The relation returned by C<isl_union_flow_get_may_dependence>
8398 relates domain elements of must or may sources to domain elements of the sink
8399 and includes the previous relation as a subset.
8400 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
8401 of the sink relation for which no dependences have been found.
8402 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
8403 of the sink relation for which no definite dependences have been found.
8404 That is, it contains those sink access that do not contribute to any
8405 of the elements in the relation returned
8406 by C<isl_union_flow_get_must_dependence>.
8408 =head3 Low-level Interface
8410 A lower-level interface is provided by the following functions.
8412 #include <isl/flow.h>
8414 typedef int (*isl_access_level_before)(void *first, void *second);
8416 __isl_give isl_access_info *isl_access_info_alloc(
8417 __isl_take isl_map *sink,
8418 void *sink_user, isl_access_level_before fn,
8420 __isl_give isl_access_info *isl_access_info_add_source(
8421 __isl_take isl_access_info *acc,
8422 __isl_take isl_map *source, int must,
8424 __isl_null isl_access_info *isl_access_info_free(
8425 __isl_take isl_access_info *acc);
8427 __isl_give isl_flow *isl_access_info_compute_flow(
8428 __isl_take isl_access_info *acc);
8430 isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
8431 isl_stat (*fn)(__isl_take isl_map *dep, int must,
8432 void *dep_user, void *user),
8434 __isl_give isl_map *isl_flow_get_no_source(
8435 __isl_keep isl_flow *deps, int must);
8436 void isl_flow_free(__isl_take isl_flow *deps);
8438 The function C<isl_access_info_compute_flow> performs the actual
8439 dependence analysis. The other functions are used to construct
8440 the input for this function or to read off the output.
8442 The input is collected in an C<isl_access_info>, which can
8443 be created through a call to C<isl_access_info_alloc>.
8444 The arguments to this functions are the sink access relation
8445 C<sink>, a token C<sink_user> used to identify the sink
8446 access to the user, a callback function for specifying the
8447 relative order of source and sink accesses, and the number
8448 of source access relations that will be added.
8449 The callback function has type C<int (*)(void *first, void *second)>.
8450 The function is called with two user supplied tokens identifying
8451 either a source or the sink and it should return the shared nesting
8452 level and the relative order of the two accesses.
8453 In particular, let I<n> be the number of loops shared by
8454 the two accesses. If C<first> precedes C<second> textually,
8455 then the function should return I<2 * n + 1>; otherwise,
8456 it should return I<2 * n>.
8457 The sources can be added to the C<isl_access_info> by performing
8458 (at most) C<max_source> calls to C<isl_access_info_add_source>.
8459 C<must> indicates whether the source is a I<must> access
8460 or a I<may> access. Note that a multi-valued access relation
8461 should only be marked I<must> if every iteration in the domain
8462 of the relation accesses I<all> elements in its image.
8463 The C<source_user> token is again used to identify
8464 the source access. The range of the source access relation
8465 C<source> should have the same dimension as the range
8466 of the sink access relation.
8467 The C<isl_access_info_free> function should usually not be
8468 called explicitly, because it is called implicitly by
8469 C<isl_access_info_compute_flow>.
8471 The result of the dependence analysis is collected in an
8472 C<isl_flow>. There may be elements of
8473 the sink access for which no preceding source access could be
8474 found or for which all preceding sources are I<may> accesses.
8475 The relations containing these elements can be obtained through
8476 calls to C<isl_flow_get_no_source>, the first with C<must> set
8477 and the second with C<must> unset.
8478 In the case of standard flow dependence analysis,
8479 with the sink a read and the sources I<must> writes,
8480 the first relation corresponds to the reads from uninitialized
8481 array elements and the second relation is empty.
8482 The actual flow dependences can be extracted using
8483 C<isl_flow_foreach>. This function will call the user-specified
8484 callback function C<fn> for each B<non-empty> dependence between
8485 a source and the sink. The callback function is called
8486 with four arguments, the actual flow dependence relation
8487 mapping source iterations to sink iterations, a boolean that
8488 indicates whether it is a I<must> or I<may> dependence, a token
8489 identifying the source and an additional C<void *> with value
8490 equal to the third argument of the C<isl_flow_foreach> call.
8491 A dependence is marked I<must> if it originates from a I<must>
8492 source and if it is not followed by any I<may> sources.
8494 After finishing with an C<isl_flow>, the user should call
8495 C<isl_flow_free> to free all associated memory.
8497 =head3 Interaction with the Low-level Interface
8499 During the dependence analysis, we frequently need to perform
8500 the following operation. Given a relation between sink iterations
8501 and potential source iterations from a particular source domain,
8502 what is the last potential source iteration corresponding to each
8503 sink iteration. It can sometimes be convenient to adjust
8504 the set of potential source iterations before or after each such operation.
8505 The prototypical example is fuzzy array dataflow analysis,
8506 where we need to analyze if, based on data-dependent constraints,
8507 the sink iteration can ever be executed without one or more of
8508 the corresponding potential source iterations being executed.
8509 If so, we can introduce extra parameters and select an unknown
8510 but fixed source iteration from the potential source iterations.
8511 To be able to perform such manipulations, C<isl> provides the following
8514 #include <isl/flow.h>
8516 typedef __isl_give isl_restriction *(*isl_access_restrict)(
8517 __isl_keep isl_map *source_map,
8518 __isl_keep isl_set *sink, void *source_user,
8520 __isl_give isl_access_info *isl_access_info_set_restrict(
8521 __isl_take isl_access_info *acc,
8522 isl_access_restrict fn, void *user);
8524 The function C<isl_access_info_set_restrict> should be called
8525 before calling C<isl_access_info_compute_flow> and registers a callback function
8526 that will be called any time C<isl> is about to compute the last
8527 potential source. The first argument is the (reverse) proto-dependence,
8528 mapping sink iterations to potential source iterations.
8529 The second argument represents the sink iterations for which
8530 we want to compute the last source iteration.
8531 The third argument is the token corresponding to the source
8532 and the final argument is the token passed to C<isl_access_info_set_restrict>.
8533 The callback is expected to return a restriction on either the input or
8534 the output of the operation computing the last potential source.
8535 If the input needs to be restricted then restrictions are needed
8536 for both the source and the sink iterations. The sink iterations
8537 and the potential source iterations will be intersected with these sets.
8538 If the output needs to be restricted then only a restriction on the source
8539 iterations is required.
8540 If any error occurs, the callback should return C<NULL>.
8541 An C<isl_restriction> object can be created, freed and inspected
8542 using the following functions.
8544 #include <isl/flow.h>
8546 __isl_give isl_restriction *isl_restriction_input(
8547 __isl_take isl_set *source_restr,
8548 __isl_take isl_set *sink_restr);
8549 __isl_give isl_restriction *isl_restriction_output(
8550 __isl_take isl_set *source_restr);
8551 __isl_give isl_restriction *isl_restriction_none(
8552 __isl_take isl_map *source_map);
8553 __isl_give isl_restriction *isl_restriction_empty(
8554 __isl_take isl_map *source_map);
8555 __isl_null isl_restriction *isl_restriction_free(
8556 __isl_take isl_restriction *restr);
8558 C<isl_restriction_none> and C<isl_restriction_empty> are special
8559 cases of C<isl_restriction_input>. C<isl_restriction_none>
8560 is essentially equivalent to
8562 isl_restriction_input(isl_set_universe(
8563 isl_space_range(isl_map_get_space(source_map))),
8565 isl_space_domain(isl_map_get_space(source_map))));
8567 whereas C<isl_restriction_empty> is essentially equivalent to
8569 isl_restriction_input(isl_set_empty(
8570 isl_space_range(isl_map_get_space(source_map))),
8572 isl_space_domain(isl_map_get_space(source_map))));
8576 B<The functionality described in this section is fairly new
8577 and may be subject to change.>
8579 #include <isl/schedule.h>
8580 __isl_give isl_schedule *
8581 isl_schedule_constraints_compute_schedule(
8582 __isl_take isl_schedule_constraints *sc);
8584 The function C<isl_schedule_constraints_compute_schedule> can be
8585 used to compute a schedule that satisfies the given schedule constraints.
8586 These schedule constraints include the iteration domain for which
8587 a schedule should be computed and dependences between pairs of
8588 iterations. In particular, these dependences include
8589 I<validity> dependences and I<proximity> dependences.
8590 By default, the algorithm used to construct the schedule is similar
8591 to that of C<Pluto>.
8592 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
8594 The generated schedule respects all validity dependences.
8595 That is, all dependence distances over these dependences in the
8596 scheduled space are lexicographically positive.
8598 The default algorithm tries to ensure that the dependence distances
8599 over coincidence constraints are zero and to minimize the
8600 dependence distances over proximity dependences.
8601 Moreover, it tries to obtain sequences (bands) of schedule dimensions
8602 for groups of domains where the dependence distances over validity
8603 dependences have only non-negative values.
8604 Note that when minimizing the maximal dependence distance
8605 over proximity dependences, a single affine expression in the parameters
8606 is constructed that bounds all dependence distances. If no such expression
8607 exists, then the algorithm will fail and resort to an alternative
8608 scheduling algorithm. In particular, this means that adding proximity
8609 dependences may eliminate valid solutions. A typical example where this
8610 phenomenon may occur is when some subset of the proximity dependences
8611 has no restriction on some parameter, forcing the coefficient of that
8612 parameter to be zero, while some other subset forces the dependence
8613 distance to depend on that parameter, requiring the same coefficient
8615 When using Feautrier's algorithm, the coincidence and proximity constraints
8616 are only taken into account during the extension to a
8617 full-dimensional schedule.
8619 An C<isl_schedule_constraints> object can be constructed
8620 and manipulated using the following functions.
8622 #include <isl/schedule.h>
8623 __isl_give isl_schedule_constraints *
8624 isl_schedule_constraints_copy(
8625 __isl_keep isl_schedule_constraints *sc);
8626 __isl_give isl_schedule_constraints *
8627 isl_schedule_constraints_on_domain(
8628 __isl_take isl_union_set *domain);
8629 __isl_give isl_schedule_constraints *
8630 isl_schedule_constraints_set_context(
8631 __isl_take isl_schedule_constraints *sc,
8632 __isl_take isl_set *context);
8633 __isl_give isl_schedule_constraints *
8634 isl_schedule_constraints_set_validity(
8635 __isl_take isl_schedule_constraints *sc,
8636 __isl_take isl_union_map *validity);
8637 __isl_give isl_schedule_constraints *
8638 isl_schedule_constraints_set_coincidence(
8639 __isl_take isl_schedule_constraints *sc,
8640 __isl_take isl_union_map *coincidence);
8641 __isl_give isl_schedule_constraints *
8642 isl_schedule_constraints_set_proximity(
8643 __isl_take isl_schedule_constraints *sc,
8644 __isl_take isl_union_map *proximity);
8645 __isl_give isl_schedule_constraints *
8646 isl_schedule_constraints_set_conditional_validity(
8647 __isl_take isl_schedule_constraints *sc,
8648 __isl_take isl_union_map *condition,
8649 __isl_take isl_union_map *validity);
8650 __isl_null isl_schedule_constraints *
8651 isl_schedule_constraints_free(
8652 __isl_take isl_schedule_constraints *sc);
8654 The initial C<isl_schedule_constraints> object created by
8655 C<isl_schedule_constraints_on_domain> does not impose any constraints.
8656 That is, it has an empty set of dependences.
8657 The function C<isl_schedule_constraints_set_context> allows the user
8658 to specify additional constraints on the parameters that may
8659 be assumed to hold during the construction of the schedule.
8660 The function C<isl_schedule_constraints_set_validity> replaces the
8661 validity dependences, mapping domain elements I<i> to domain
8662 elements that should be scheduled after I<i>.
8663 The function C<isl_schedule_constraints_set_coincidence> replaces the
8664 coincidence dependences, mapping domain elements I<i> to domain
8665 elements that should be scheduled together with I<I>, if possible.
8666 The function C<isl_schedule_constraints_set_proximity> replaces the
8667 proximity dependences, mapping domain elements I<i> to domain
8668 elements that should be scheduled either before I<I>
8669 or as early as possible after I<i>.
8671 The function C<isl_schedule_constraints_set_conditional_validity>
8672 replaces the conditional validity constraints.
8673 A conditional validity constraint is only imposed when any of the corresponding
8674 conditions is satisfied, i.e., when any of them is non-zero.
8675 That is, the scheduler ensures that within each band if the dependence
8676 distances over the condition constraints are not all zero
8677 then all corresponding conditional validity constraints are respected.
8678 A conditional validity constraint corresponds to a condition
8679 if the two are adjacent, i.e., if the domain of one relation intersect
8680 the range of the other relation.
8681 The typical use case of conditional validity constraints is
8682 to allow order constraints between live ranges to be violated
8683 as long as the live ranges themselves are local to the band.
8684 To allow more fine-grained control over which conditions correspond
8685 to which conditional validity constraints, the domains and ranges
8686 of these relations may include I<tags>. That is, the domains and
8687 ranges of those relation may themselves be wrapped relations
8688 where the iteration domain appears in the domain of those wrapped relations
8689 and the range of the wrapped relations can be arbitrarily chosen
8690 by the user. Conditions and conditional validity constraints are only
8691 considered adjacent to each other if the entire wrapped relation matches.
8692 In particular, a relation with a tag will never be considered adjacent
8693 to a relation without a tag.
8695 An C<isl_schedule_constraints> object can be inspected
8696 using the following functions.
8698 #include <isl/schedule.h>
8699 __isl_give isl_union_map *
8700 isl_schedule_constraints_get_validity(
8701 __isl_keep isl_schedule_constraints *sc);
8702 __isl_give isl_union_map *
8703 isl_schedule_constraints_get_coincidence(
8704 __isl_keep isl_schedule_constraints *sc);
8705 __isl_give isl_union_map *
8706 isl_schedule_constraints_get_conditional_validity(
8707 __isl_keep isl_schedule_constraints *sc);
8708 __isl_give isl_union_map *
8709 isl_schedule_constraints_get_conditional_validity_condition(
8710 __isl_keep isl_schedule_constraints *sc);
8712 The following function computes a schedule directly from
8713 an iteration domain and validity and proximity dependences
8714 and is implemented in terms of the functions described above.
8715 The use of C<isl_union_set_compute_schedule> is discouraged.
8717 #include <isl/schedule.h>
8718 __isl_give isl_schedule *isl_union_set_compute_schedule(
8719 __isl_take isl_union_set *domain,
8720 __isl_take isl_union_map *validity,
8721 __isl_take isl_union_map *proximity);
8723 The generated schedule represents a schedule tree.
8724 For more information on schedule trees, see
8725 L</"Schedule Trees">.
8729 #include <isl/schedule.h>
8730 isl_stat isl_options_set_schedule_max_coefficient(
8731 isl_ctx *ctx, int val);
8732 int isl_options_get_schedule_max_coefficient(
8734 isl_stat isl_options_set_schedule_max_constant_term(
8735 isl_ctx *ctx, int val);
8736 int isl_options_get_schedule_max_constant_term(
8738 isl_stat isl_options_set_schedule_serialize_sccs(
8739 isl_ctx *ctx, int val);
8740 int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
8741 isl_stat isl_options_set_schedule_maximize_band_depth(
8742 isl_ctx *ctx, int val);
8743 int isl_options_get_schedule_maximize_band_depth(
8745 isl_stat isl_options_set_schedule_outer_coincidence(
8746 isl_ctx *ctx, int val);
8747 int isl_options_get_schedule_outer_coincidence(
8749 isl_stat isl_options_set_schedule_split_scaled(
8750 isl_ctx *ctx, int val);
8751 int isl_options_get_schedule_split_scaled(
8753 isl_stat isl_options_set_schedule_algorithm(
8754 isl_ctx *ctx, int val);
8755 int isl_options_get_schedule_algorithm(
8757 isl_stat isl_options_set_schedule_separate_components(
8758 isl_ctx *ctx, int val);
8759 int isl_options_get_schedule_separate_components(
8764 =item * schedule_max_coefficient
8766 This option enforces that the coefficients for variable and parameter
8767 dimensions in the calculated schedule are not larger than the specified value.
8768 This option can significantly increase the speed of the scheduling calculation
8769 and may also prevent fusing of unrelated dimensions. A value of -1 means that
8770 this option does not introduce bounds on the variable or parameter
8773 =item * schedule_max_constant_term
8775 This option enforces that the constant coefficients in the calculated schedule
8776 are not larger than the maximal constant term. This option can significantly
8777 increase the speed of the scheduling calculation and may also prevent fusing of
8778 unrelated dimensions. A value of -1 means that this option does not introduce
8779 bounds on the constant coefficients.
8781 =item * schedule_serialize_sccs
8783 If this option is set, then all strongly connected components
8784 in the dependence graph are serialized as soon as they are detected.
8785 This means in particular that instances of statements will only
8786 appear in the same band node if these statements belong
8787 to the same strongly connected component at the point where
8788 the band node is constructed.
8790 =item * schedule_maximize_band_depth
8792 If this option is set, we do not split bands at the point
8793 where we detect splitting is necessary. Instead, we
8794 backtrack and split bands as early as possible. This
8795 reduces the number of splits and maximizes the width of
8796 the bands. Wider bands give more possibilities for tiling.
8797 Note that if the C<schedule_serialize_sccs> options is set,
8798 then bands will be split as early as possible, even if there is no need.
8799 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
8801 =item * schedule_outer_coincidence
8803 If this option is set, then we try to construct schedules
8804 where the outermost scheduling dimension in each band
8805 satisfies the coincidence constraints.
8807 =item * schedule_split_scaled
8809 If this option is set, then we try to construct schedules in which the
8810 constant term is split off from the linear part if the linear parts of
8811 the scheduling rows for all nodes in the graphs have a common non-trivial
8813 The constant term is then placed in a separate band and the linear
8816 =item * schedule_algorithm
8818 Selects the scheduling algorithm to be used.
8819 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
8820 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
8822 =item * schedule_separate_components
8824 If this option is set then the function C<isl_schedule_get_map>
8825 will treat set nodes in the same way as sequence nodes.
8829 =head2 AST Generation
8831 This section describes the C<isl> functionality for generating
8832 ASTs that visit all the elements
8833 in a domain in an order specified by a schedule tree or
8835 In case the schedule given as a C<isl_union_map>, an AST is generated
8836 that visits all the elements in the domain of the C<isl_union_map>
8837 according to the lexicographic order of the corresponding image
8838 element(s). If the range of the C<isl_union_map> consists of
8839 elements in more than one space, then each of these spaces is handled
8840 separately in an arbitrary order.
8841 It should be noted that the schedule tree or the image elements
8842 in a schedule map only specify the I<order>
8843 in which the corresponding domain elements should be visited.
8844 No direct relation between the partial schedule values
8845 or the image elements on the one hand and the loop iterators
8846 in the generated AST on the other hand should be assumed.
8848 Each AST is generated within a build. The initial build
8849 simply specifies the constraints on the parameters (if any)
8850 and can be created, inspected, copied and freed using the following functions.
8852 #include <isl/ast_build.h>
8853 __isl_give isl_ast_build *isl_ast_build_alloc(
8855 __isl_give isl_ast_build *isl_ast_build_from_context(
8856 __isl_take isl_set *set);
8857 __isl_give isl_ast_build *isl_ast_build_copy(
8858 __isl_keep isl_ast_build *build);
8859 __isl_null isl_ast_build *isl_ast_build_free(
8860 __isl_take isl_ast_build *build);
8862 The C<set> argument is usually a parameter set with zero or more parameters.
8863 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
8864 this set is required to be a parameter set.
8865 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
8866 specify any parameter constraints.
8867 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
8868 and L</"Fine-grained Control over AST Generation">.
8869 Finally, the AST itself can be constructed using one of the following
8872 #include <isl/ast_build.h>
8873 __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
8874 __isl_keep isl_ast_build *build,
8875 __isl_take isl_schedule *schedule);
8876 __isl_give isl_ast_node *
8877 isl_ast_build_node_from_schedule_map(
8878 __isl_keep isl_ast_build *build,
8879 __isl_take isl_union_map *schedule);
8881 =head3 Inspecting the AST
8883 The basic properties of an AST node can be obtained as follows.
8885 #include <isl/ast.h>
8886 enum isl_ast_node_type isl_ast_node_get_type(
8887 __isl_keep isl_ast_node *node);
8889 The type of an AST node is one of
8890 C<isl_ast_node_for>,
8892 C<isl_ast_node_block>,
8893 C<isl_ast_node_mark> or
8894 C<isl_ast_node_user>.
8895 An C<isl_ast_node_for> represents a for node.
8896 An C<isl_ast_node_if> represents an if node.
8897 An C<isl_ast_node_block> represents a compound node.
8898 An C<isl_ast_node_mark> introduces a mark in the AST.
8899 An C<isl_ast_node_user> represents an expression statement.
8900 An expression statement typically corresponds to a domain element, i.e.,
8901 one of the elements that is visited by the AST.
8903 Each type of node has its own additional properties.
8905 #include <isl/ast.h>
8906 __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
8907 __isl_keep isl_ast_node *node);
8908 __isl_give isl_ast_expr *isl_ast_node_for_get_init(
8909 __isl_keep isl_ast_node *node);
8910 __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
8911 __isl_keep isl_ast_node *node);
8912 __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
8913 __isl_keep isl_ast_node *node);
8914 __isl_give isl_ast_node *isl_ast_node_for_get_body(
8915 __isl_keep isl_ast_node *node);
8916 isl_bool isl_ast_node_for_is_degenerate(
8917 __isl_keep isl_ast_node *node);
8919 An C<isl_ast_for> is considered degenerate if it is known to execute
8922 #include <isl/ast.h>
8923 __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
8924 __isl_keep isl_ast_node *node);
8925 __isl_give isl_ast_node *isl_ast_node_if_get_then(
8926 __isl_keep isl_ast_node *node);
8927 isl_bool isl_ast_node_if_has_else(
8928 __isl_keep isl_ast_node *node);
8929 __isl_give isl_ast_node *isl_ast_node_if_get_else(
8930 __isl_keep isl_ast_node *node);
8932 __isl_give isl_ast_node_list *
8933 isl_ast_node_block_get_children(
8934 __isl_keep isl_ast_node *node);
8936 __isl_give isl_id *isl_ast_node_mark_get_id(
8937 __isl_keep isl_ast_node *node);
8938 __isl_give isl_ast_node *isl_ast_node_mark_get_node(
8939 __isl_keep isl_ast_node *node);
8941 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
8942 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
8944 #include <isl/ast.h>
8945 __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
8946 __isl_keep isl_ast_node *node);
8948 Each of the returned C<isl_ast_expr>s can in turn be inspected using
8949 the following functions.
8951 #include <isl/ast.h>
8952 enum isl_ast_expr_type isl_ast_expr_get_type(
8953 __isl_keep isl_ast_expr *expr);
8955 The type of an AST expression is one of
8957 C<isl_ast_expr_id> or
8958 C<isl_ast_expr_int>.
8959 An C<isl_ast_expr_op> represents the result of an operation.
8960 An C<isl_ast_expr_id> represents an identifier.
8961 An C<isl_ast_expr_int> represents an integer value.
8963 Each type of expression has its own additional properties.
8965 #include <isl/ast.h>
8966 enum isl_ast_op_type isl_ast_expr_get_op_type(
8967 __isl_keep isl_ast_expr *expr);
8968 int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
8969 __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
8970 __isl_keep isl_ast_expr *expr, int pos);
8971 isl_stat isl_ast_node_foreach_ast_op_type(
8972 __isl_keep isl_ast_node *node,
8973 isl_stat (*fn)(enum isl_ast_op_type type,
8974 void *user), void *user);
8976 C<isl_ast_expr_get_op_type> returns the type of the operation
8977 performed. C<isl_ast_expr_get_op_n_arg> returns the number of
8978 arguments. C<isl_ast_expr_get_op_arg> returns the specified
8980 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
8981 C<isl_ast_op_type> that appears in C<node>.
8982 The operation type is one of the following.
8986 =item C<isl_ast_op_and>
8988 Logical I<and> of two arguments.
8989 Both arguments can be evaluated.
8991 =item C<isl_ast_op_and_then>
8993 Logical I<and> of two arguments.
8994 The second argument can only be evaluated if the first evaluates to true.
8996 =item C<isl_ast_op_or>
8998 Logical I<or> of two arguments.
8999 Both arguments can be evaluated.
9001 =item C<isl_ast_op_or_else>
9003 Logical I<or> of two arguments.
9004 The second argument can only be evaluated if the first evaluates to false.
9006 =item C<isl_ast_op_max>
9008 Maximum of two or more arguments.
9010 =item C<isl_ast_op_min>
9012 Minimum of two or more arguments.
9014 =item C<isl_ast_op_minus>
9018 =item C<isl_ast_op_add>
9020 Sum of two arguments.
9022 =item C<isl_ast_op_sub>
9024 Difference of two arguments.
9026 =item C<isl_ast_op_mul>
9028 Product of two arguments.
9030 =item C<isl_ast_op_div>
9032 Exact division. That is, the result is known to be an integer.
9034 =item C<isl_ast_op_fdiv_q>
9036 Result of integer division, rounded towards negative
9039 =item C<isl_ast_op_pdiv_q>
9041 Result of integer division, where dividend is known to be non-negative.
9043 =item C<isl_ast_op_pdiv_r>
9045 Remainder of integer division, where dividend is known to be non-negative.
9047 =item C<isl_ast_op_zdiv_r>
9049 Equal to zero iff the remainder on integer division is zero.
9051 =item C<isl_ast_op_cond>
9053 Conditional operator defined on three arguments.
9054 If the first argument evaluates to true, then the result
9055 is equal to the second argument. Otherwise, the result
9056 is equal to the third argument.
9057 The second and third argument may only be evaluated if
9058 the first argument evaluates to true and false, respectively.
9059 Corresponds to C<a ? b : c> in C.
9061 =item C<isl_ast_op_select>
9063 Conditional operator defined on three arguments.
9064 If the first argument evaluates to true, then the result
9065 is equal to the second argument. Otherwise, the result
9066 is equal to the third argument.
9067 The second and third argument may be evaluated independently
9068 of the value of the first argument.
9069 Corresponds to C<a * b + (1 - a) * c> in C.
9071 =item C<isl_ast_op_eq>
9075 =item C<isl_ast_op_le>
9077 Less than or equal relation.
9079 =item C<isl_ast_op_lt>
9083 =item C<isl_ast_op_ge>
9085 Greater than or equal relation.
9087 =item C<isl_ast_op_gt>
9089 Greater than relation.
9091 =item C<isl_ast_op_call>
9094 The number of arguments of the C<isl_ast_expr> is one more than
9095 the number of arguments in the function call, the first argument
9096 representing the function being called.
9098 =item C<isl_ast_op_access>
9101 The number of arguments of the C<isl_ast_expr> is one more than
9102 the number of index expressions in the array access, the first argument
9103 representing the array being accessed.
9105 =item C<isl_ast_op_member>
9108 This operation has two arguments, a structure and the name of
9109 the member of the structure being accessed.
9113 #include <isl/ast.h>
9114 __isl_give isl_id *isl_ast_expr_get_id(
9115 __isl_keep isl_ast_expr *expr);
9117 Return the identifier represented by the AST expression.
9119 #include <isl/ast.h>
9120 __isl_give isl_val *isl_ast_expr_get_val(
9121 __isl_keep isl_ast_expr *expr);
9123 Return the integer represented by the AST expression.
9125 =head3 Properties of ASTs
9127 #include <isl/ast.h>
9128 isl_bool isl_ast_expr_is_equal(
9129 __isl_keep isl_ast_expr *expr1,
9130 __isl_keep isl_ast_expr *expr2);
9132 Check if two C<isl_ast_expr>s are equal to each other.
9134 =head3 Manipulating and printing the AST
9136 AST nodes can be copied and freed using the following functions.
9138 #include <isl/ast.h>
9139 __isl_give isl_ast_node *isl_ast_node_copy(
9140 __isl_keep isl_ast_node *node);
9141 __isl_null isl_ast_node *isl_ast_node_free(
9142 __isl_take isl_ast_node *node);
9144 AST expressions can be copied and freed using the following functions.
9146 #include <isl/ast.h>
9147 __isl_give isl_ast_expr *isl_ast_expr_copy(
9148 __isl_keep isl_ast_expr *expr);
9149 __isl_null isl_ast_expr *isl_ast_expr_free(
9150 __isl_take isl_ast_expr *expr);
9152 New AST expressions can be created either directly or within
9153 the context of an C<isl_ast_build>.
9155 #include <isl/ast.h>
9156 __isl_give isl_ast_expr *isl_ast_expr_from_val(
9157 __isl_take isl_val *v);
9158 __isl_give isl_ast_expr *isl_ast_expr_from_id(
9159 __isl_take isl_id *id);
9160 __isl_give isl_ast_expr *isl_ast_expr_neg(
9161 __isl_take isl_ast_expr *expr);
9162 __isl_give isl_ast_expr *isl_ast_expr_address_of(
9163 __isl_take isl_ast_expr *expr);
9164 __isl_give isl_ast_expr *isl_ast_expr_add(
9165 __isl_take isl_ast_expr *expr1,
9166 __isl_take isl_ast_expr *expr2);
9167 __isl_give isl_ast_expr *isl_ast_expr_sub(
9168 __isl_take isl_ast_expr *expr1,
9169 __isl_take isl_ast_expr *expr2);
9170 __isl_give isl_ast_expr *isl_ast_expr_mul(
9171 __isl_take isl_ast_expr *expr1,
9172 __isl_take isl_ast_expr *expr2);
9173 __isl_give isl_ast_expr *isl_ast_expr_div(
9174 __isl_take isl_ast_expr *expr1,
9175 __isl_take isl_ast_expr *expr2);
9176 __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
9177 __isl_take isl_ast_expr *expr1,
9178 __isl_take isl_ast_expr *expr2);
9179 __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
9180 __isl_take isl_ast_expr *expr1,
9181 __isl_take isl_ast_expr *expr2);
9182 __isl_give isl_ast_expr *isl_ast_expr_and(
9183 __isl_take isl_ast_expr *expr1,
9184 __isl_take isl_ast_expr *expr2)
9185 __isl_give isl_ast_expr *isl_ast_expr_and_then(
9186 __isl_take isl_ast_expr *expr1,
9187 __isl_take isl_ast_expr *expr2)
9188 __isl_give isl_ast_expr *isl_ast_expr_or(
9189 __isl_take isl_ast_expr *expr1,
9190 __isl_take isl_ast_expr *expr2)
9191 __isl_give isl_ast_expr *isl_ast_expr_or_else(
9192 __isl_take isl_ast_expr *expr1,
9193 __isl_take isl_ast_expr *expr2)
9194 __isl_give isl_ast_expr *isl_ast_expr_eq(
9195 __isl_take isl_ast_expr *expr1,
9196 __isl_take isl_ast_expr *expr2);
9197 __isl_give isl_ast_expr *isl_ast_expr_le(
9198 __isl_take isl_ast_expr *expr1,
9199 __isl_take isl_ast_expr *expr2);
9200 __isl_give isl_ast_expr *isl_ast_expr_lt(
9201 __isl_take isl_ast_expr *expr1,
9202 __isl_take isl_ast_expr *expr2);
9203 __isl_give isl_ast_expr *isl_ast_expr_ge(
9204 __isl_take isl_ast_expr *expr1,
9205 __isl_take isl_ast_expr *expr2);
9206 __isl_give isl_ast_expr *isl_ast_expr_gt(
9207 __isl_take isl_ast_expr *expr1,
9208 __isl_take isl_ast_expr *expr2);
9209 __isl_give isl_ast_expr *isl_ast_expr_access(
9210 __isl_take isl_ast_expr *array,
9211 __isl_take isl_ast_expr_list *indices);
9212 __isl_give isl_ast_expr *isl_ast_expr_call(
9213 __isl_take isl_ast_expr *function,
9214 __isl_take isl_ast_expr_list *arguments);
9216 The function C<isl_ast_expr_address_of> can be applied to an
9217 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
9218 to represent the address of the C<isl_ast_expr_access>. The function
9219 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
9220 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
9222 #include <isl/ast_build.h>
9223 __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
9224 __isl_keep isl_ast_build *build,
9225 __isl_take isl_set *set);
9226 __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
9227 __isl_keep isl_ast_build *build,
9228 __isl_take isl_pw_aff *pa);
9229 __isl_give isl_ast_expr *
9230 isl_ast_build_access_from_pw_multi_aff(
9231 __isl_keep isl_ast_build *build,
9232 __isl_take isl_pw_multi_aff *pma);
9233 __isl_give isl_ast_expr *
9234 isl_ast_build_access_from_multi_pw_aff(
9235 __isl_keep isl_ast_build *build,
9236 __isl_take isl_multi_pw_aff *mpa);
9237 __isl_give isl_ast_expr *
9238 isl_ast_build_call_from_pw_multi_aff(
9239 __isl_keep isl_ast_build *build,
9240 __isl_take isl_pw_multi_aff *pma);
9241 __isl_give isl_ast_expr *
9242 isl_ast_build_call_from_multi_pw_aff(
9243 __isl_keep isl_ast_build *build,
9244 __isl_take isl_multi_pw_aff *mpa);
9247 the domains of C<pa>, C<mpa> and C<pma> should correspond
9248 to the schedule space of C<build>.
9249 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
9250 the function being called.
9251 If the accessed space is a nested relation, then it is taken
9252 to represent an access of the member specified by the range
9253 of this nested relation of the structure specified by the domain
9254 of the nested relation.
9256 The following functions can be used to modify an C<isl_ast_expr>.
9258 #include <isl/ast.h>
9259 __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
9260 __isl_take isl_ast_expr *expr, int pos,
9261 __isl_take isl_ast_expr *arg);
9263 Replace the argument of C<expr> at position C<pos> by C<arg>.
9265 #include <isl/ast.h>
9266 __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
9267 __isl_take isl_ast_expr *expr,
9268 __isl_take isl_id_to_ast_expr *id2expr);
9270 The function C<isl_ast_expr_substitute_ids> replaces the
9271 subexpressions of C<expr> of type C<isl_ast_expr_id>
9272 by the corresponding expression in C<id2expr>, if there is any.
9275 User specified data can be attached to an C<isl_ast_node> and obtained
9276 from the same C<isl_ast_node> using the following functions.
9278 #include <isl/ast.h>
9279 __isl_give isl_ast_node *isl_ast_node_set_annotation(
9280 __isl_take isl_ast_node *node,
9281 __isl_take isl_id *annotation);
9282 __isl_give isl_id *isl_ast_node_get_annotation(
9283 __isl_keep isl_ast_node *node);
9285 Basic printing can be performed using the following functions.
9287 #include <isl/ast.h>
9288 __isl_give isl_printer *isl_printer_print_ast_expr(
9289 __isl_take isl_printer *p,
9290 __isl_keep isl_ast_expr *expr);
9291 __isl_give isl_printer *isl_printer_print_ast_node(
9292 __isl_take isl_printer *p,
9293 __isl_keep isl_ast_node *node);
9294 __isl_give char *isl_ast_expr_to_str(
9295 __isl_keep isl_ast_expr *expr);
9297 More advanced printing can be performed using the following functions.
9299 #include <isl/ast.h>
9300 __isl_give isl_printer *isl_ast_op_type_print_macro(
9301 enum isl_ast_op_type type,
9302 __isl_take isl_printer *p);
9303 __isl_give isl_printer *isl_ast_node_print_macros(
9304 __isl_keep isl_ast_node *node,
9305 __isl_take isl_printer *p);
9306 __isl_give isl_printer *isl_ast_node_print(
9307 __isl_keep isl_ast_node *node,
9308 __isl_take isl_printer *p,
9309 __isl_take isl_ast_print_options *options);
9310 __isl_give isl_printer *isl_ast_node_for_print(
9311 __isl_keep isl_ast_node *node,
9312 __isl_take isl_printer *p,
9313 __isl_take isl_ast_print_options *options);
9314 __isl_give isl_printer *isl_ast_node_if_print(
9315 __isl_keep isl_ast_node *node,
9316 __isl_take isl_printer *p,
9317 __isl_take isl_ast_print_options *options);
9319 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
9320 C<isl> may print out an AST that makes use of macros such
9321 as C<floord>, C<min> and C<max>.
9322 C<isl_ast_op_type_print_macro> prints out the macro
9323 corresponding to a specific C<isl_ast_op_type>.
9324 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
9325 for expressions where these macros would be used and prints
9326 out the required macro definitions.
9327 Essentially, C<isl_ast_node_print_macros> calls
9328 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
9329 as function argument.
9330 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
9331 C<isl_ast_node_if_print> print an C<isl_ast_node>
9332 in C<ISL_FORMAT_C>, but allow for some extra control
9333 through an C<isl_ast_print_options> object.
9334 This object can be created using the following functions.
9336 #include <isl/ast.h>
9337 __isl_give isl_ast_print_options *
9338 isl_ast_print_options_alloc(isl_ctx *ctx);
9339 __isl_give isl_ast_print_options *
9340 isl_ast_print_options_copy(
9341 __isl_keep isl_ast_print_options *options);
9342 __isl_null isl_ast_print_options *
9343 isl_ast_print_options_free(
9344 __isl_take isl_ast_print_options *options);
9346 __isl_give isl_ast_print_options *
9347 isl_ast_print_options_set_print_user(
9348 __isl_take isl_ast_print_options *options,
9349 __isl_give isl_printer *(*print_user)(
9350 __isl_take isl_printer *p,
9351 __isl_take isl_ast_print_options *options,
9352 __isl_keep isl_ast_node *node, void *user),
9354 __isl_give isl_ast_print_options *
9355 isl_ast_print_options_set_print_for(
9356 __isl_take isl_ast_print_options *options,
9357 __isl_give isl_printer *(*print_for)(
9358 __isl_take isl_printer *p,
9359 __isl_take isl_ast_print_options *options,
9360 __isl_keep isl_ast_node *node, void *user),
9363 The callback set by C<isl_ast_print_options_set_print_user>
9364 is called whenever a node of type C<isl_ast_node_user> needs to
9366 The callback set by C<isl_ast_print_options_set_print_for>
9367 is called whenever a node of type C<isl_ast_node_for> needs to
9369 Note that C<isl_ast_node_for_print> will I<not> call the
9370 callback set by C<isl_ast_print_options_set_print_for> on the node
9371 on which C<isl_ast_node_for_print> is called, but only on nested
9372 nodes of type C<isl_ast_node_for>. It is therefore safe to
9373 call C<isl_ast_node_for_print> from within the callback set by
9374 C<isl_ast_print_options_set_print_for>.
9376 The following option determines the type to be used for iterators
9377 while printing the AST.
9379 isl_stat isl_options_set_ast_iterator_type(
9380 isl_ctx *ctx, const char *val);
9381 const char *isl_options_get_ast_iterator_type(
9384 The AST printer only prints body nodes as blocks if these
9385 blocks cannot be safely omitted.
9386 For example, a C<for> node with one body node will not be
9387 surrounded with braces in C<ISL_FORMAT_C>.
9388 A block will always be printed by setting the following option.
9390 isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
9392 int isl_options_get_ast_always_print_block(isl_ctx *ctx);
9396 #include <isl/ast_build.h>
9397 isl_stat isl_options_set_ast_build_atomic_upper_bound(
9398 isl_ctx *ctx, int val);
9399 int isl_options_get_ast_build_atomic_upper_bound(
9401 isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
9403 int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
9404 isl_stat isl_options_set_ast_build_exploit_nested_bounds(
9405 isl_ctx *ctx, int val);
9406 int isl_options_get_ast_build_exploit_nested_bounds(
9408 isl_stat isl_options_set_ast_build_group_coscheduled(
9409 isl_ctx *ctx, int val);
9410 int isl_options_get_ast_build_group_coscheduled(
9412 isl_stat isl_options_set_ast_build_scale_strides(
9413 isl_ctx *ctx, int val);
9414 int isl_options_get_ast_build_scale_strides(
9416 isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
9418 int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
9419 isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
9421 int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
9425 =item * ast_build_atomic_upper_bound
9427 Generate loop upper bounds that consist of the current loop iterator,
9428 an operator and an expression not involving the iterator.
9429 If this option is not set, then the current loop iterator may appear
9430 several times in the upper bound.
9431 For example, when this option is turned off, AST generation
9434 [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
9438 for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
9441 When the option is turned on, the following AST is generated
9443 for (int c0 = 0; c0 <= min(100, n); c0 += 1)
9446 =item * ast_build_prefer_pdiv
9448 If this option is turned off, then the AST generation will
9449 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
9450 operators, but no C<isl_ast_op_pdiv_q> or
9451 C<isl_ast_op_pdiv_r> operators.
9452 If this options is turned on, then C<isl> will try to convert
9453 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
9454 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
9456 =item * ast_build_exploit_nested_bounds
9458 Simplify conditions based on bounds of nested for loops.
9459 In particular, remove conditions that are implied by the fact
9460 that one or more nested loops have at least one iteration,
9461 meaning that the upper bound is at least as large as the lower bound.
9462 For example, when this option is turned off, AST generation
9465 [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
9471 for (int c0 = 0; c0 <= N; c0 += 1)
9472 for (int c1 = 0; c1 <= M; c1 += 1)
9475 When the option is turned on, the following AST is generated
9477 for (int c0 = 0; c0 <= N; c0 += 1)
9478 for (int c1 = 0; c1 <= M; c1 += 1)
9481 =item * ast_build_group_coscheduled
9483 If two domain elements are assigned the same schedule point, then
9484 they may be executed in any order and they may even appear in different
9485 loops. If this options is set, then the AST generator will make
9486 sure that coscheduled domain elements do not appear in separate parts
9487 of the AST. This is useful in case of nested AST generation
9488 if the outer AST generation is given only part of a schedule
9489 and the inner AST generation should handle the domains that are
9490 coscheduled by this initial part of the schedule together.
9491 For example if an AST is generated for a schedule
9493 { A[i] -> [0]; B[i] -> [0] }
9495 then the C<isl_ast_build_set_create_leaf> callback described
9496 below may get called twice, once for each domain.
9497 Setting this option ensures that the callback is only called once
9498 on both domains together.
9500 =item * ast_build_separation_bounds
9502 This option specifies which bounds to use during separation.
9503 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
9504 then all (possibly implicit) bounds on the current dimension will
9505 be used during separation.
9506 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
9507 then only those bounds that are explicitly available will
9508 be used during separation.
9510 =item * ast_build_scale_strides
9512 This option specifies whether the AST generator is allowed
9513 to scale down iterators of strided loops.
9515 =item * ast_build_allow_else
9517 This option specifies whether the AST generator is allowed
9518 to construct if statements with else branches.
9520 =item * ast_build_allow_or
9522 This option specifies whether the AST generator is allowed
9523 to construct if conditions with disjunctions.
9527 =head3 AST Generation Options (Schedule Tree)
9529 In case of AST construction from a schedule tree, the options
9530 that control how an AST is created from the individual schedule
9531 dimensions are stored in the band nodes of the tree
9532 (see L</"Schedule Trees">).
9534 In particular, a schedule dimension can be handled in four
9535 different ways, atomic, separate, unroll or the default.
9536 This loop AST generation type can be set using
9537 C<isl_schedule_node_band_member_set_ast_loop_type>.
9539 the first three can be selected by including a one-dimensional
9540 element with as value the position of the schedule dimension
9541 within the band and as name one of C<atomic>, C<separate>
9542 or C<unroll> in the options
9543 set by C<isl_schedule_node_band_set_ast_build_options>.
9544 Only one of these three may be specified for
9545 any given schedule dimension within a band node.
9546 If none of these is specified, then the default
9547 is used. The meaning of the options is as follows.
9553 When this option is specified, the AST generator will make
9554 sure that a given domains space only appears in a single
9555 loop at the specified level.
9557 For example, for the schedule tree
9559 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
9561 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
9562 options: "{ atomic[x] }"
9564 the following AST will be generated
9566 for (int c0 = 0; c0 <= 10; c0 += 1) {
9573 On the other hand, for the schedule tree
9575 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
9577 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
9578 options: "{ separate[x] }"
9580 the following AST will be generated
9584 for (int c0 = 1; c0 <= 9; c0 += 1) {
9591 If neither C<atomic> nor C<separate> is specified, then the AST generator
9592 may produce either of these two results or some intermediate form.
9596 When this option is specified, the AST generator will
9597 split the domain of the specified schedule dimension
9598 into pieces with a fixed set of statements for which
9599 instances need to be executed by the iterations in
9600 the schedule domain part. This option tends to avoid
9601 the generation of guards inside the corresponding loops.
9602 See also the C<atomic> option.
9606 When this option is specified, the AST generator will
9607 I<completely> unroll the corresponding schedule dimension.
9608 It is the responsibility of the user to ensure that such
9609 unrolling is possible.
9610 To obtain a partial unrolling, the user should apply an additional
9611 strip-mining to the schedule and fully unroll the inner schedule
9616 The C<isolate> option is a bit more involved. It allows the user
9617 to isolate a range of schedule dimension values from smaller and
9618 greater values. Additionally, the user may specify a different
9619 atomic/separate/unroll choice for the isolated part and the remaining
9620 parts. The typical use case of the C<isolate> option is to isolate
9621 full tiles from partial tiles.
9622 The part that needs to be isolated may depend on outer schedule dimensions.
9623 The option therefore needs to be able to reference those outer schedule
9624 dimensions. In particular, the space of the C<isolate> option is that
9625 of a wrapped map with as domain the flat product of all outer band nodes
9626 and as range the space of the current band node.
9627 The atomic/separate/unroll choice for the isolated part is determined
9628 by an option that lives in an unnamed wrapped space with as domain
9629 a zero-dimensional C<isolate> space and as range the regular
9630 C<atomic>, C<separate> or C<unroll> space.
9631 This option may also be set directly using
9632 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
9633 The atomic/separate/unroll choice for the remaining part is determined
9634 by the regular C<atomic>, C<separate> or C<unroll> option.
9635 The use of the C<isolate> option causes any tree containing the node
9636 to be considered anchored.
9638 As an example, consider the isolation of full tiles from partial tiles
9639 in a tiling of a triangular domain. The original schedule is as follows.
9641 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9643 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9644 { A[i,j] -> [floor(j/10)] }, \
9645 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9649 for (int c0 = 0; c0 <= 10; c0 += 1)
9650 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9651 for (int c2 = 10 * c0;
9652 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9653 for (int c3 = 10 * c1;
9654 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9657 Isolating the full tiles, we have the following input
9659 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9661 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9662 { A[i,j] -> [floor(j/10)] }, \
9663 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9664 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
9665 10a+9+10b+9 <= 100 }"
9670 for (int c0 = 0; c0 <= 8; c0 += 1) {
9671 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9672 for (int c2 = 10 * c0;
9673 c2 <= 10 * c0 + 9; c2 += 1)
9674 for (int c3 = 10 * c1;
9675 c3 <= 10 * c1 + 9; c3 += 1)
9677 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9678 for (int c2 = 10 * c0;
9679 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9680 for (int c3 = 10 * c1;
9681 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9684 for (int c0 = 9; c0 <= 10; c0 += 1)
9685 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9686 for (int c2 = 10 * c0;
9687 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9688 for (int c3 = 10 * c1;
9689 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9693 We may then additionally unroll the innermost loop of the isolated part
9695 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9697 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9698 { A[i,j] -> [floor(j/10)] }, \
9699 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9700 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
9701 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
9706 for (int c0 = 0; c0 <= 8; c0 += 1) {
9707 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9708 for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
9720 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9721 for (int c2 = 10 * c0;
9722 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9723 for (int c3 = 10 * c1;
9724 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9727 for (int c0 = 9; c0 <= 10; c0 += 1)
9728 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9729 for (int c2 = 10 * c0;
9730 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9731 for (int c3 = 10 * c1;
9732 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9737 =head3 AST Generation Options (Schedule Map)
9739 In case of AST construction using
9740 C<isl_ast_build_node_from_schedule_map>, the options
9741 that control how an AST is created from the individual schedule
9742 dimensions are stored in the C<isl_ast_build>.
9743 They can be set using the following function.
9745 #include <isl/ast_build.h>
9746 __isl_give isl_ast_build *
9747 isl_ast_build_set_options(
9748 __isl_take isl_ast_build *control,
9749 __isl_take isl_union_map *options);
9751 The options are encoded in an C<isl_union_map>.
9752 The domain of this union relation refers to the schedule domain,
9753 i.e., the range of the schedule passed
9754 to C<isl_ast_build_node_from_schedule_map>.
9755 In the case of nested AST generation (see L</"Nested AST Generation">),
9756 the domain of C<options> should refer to the extra piece of the schedule.
9757 That is, it should be equal to the range of the wrapped relation in the
9758 range of the schedule.
9759 The range of the options can consist of elements in one or more spaces,
9760 the names of which determine the effect of the option.
9761 The values of the range typically also refer to the schedule dimension
9762 to which the option applies. In case of nested AST generation
9763 (see L</"Nested AST Generation">), these values refer to the position
9764 of the schedule dimension within the innermost AST generation.
9765 The constraints on the domain elements of
9766 the option should only refer to this dimension and earlier dimensions.
9767 We consider the following spaces.
9771 =item C<separation_class>
9773 B<This option has been deprecated. Use the isolate option on
9774 schedule trees instead.>
9776 This space is a wrapped relation between two one dimensional spaces.
9777 The input space represents the schedule dimension to which the option
9778 applies and the output space represents the separation class.
9779 While constructing a loop corresponding to the specified schedule
9780 dimension(s), the AST generator will try to generate separate loops
9781 for domain elements that are assigned different classes.
9782 If only some of the elements are assigned a class, then those elements
9783 that are not assigned any class will be treated as belonging to a class
9784 that is separate from the explicitly assigned classes.
9785 The typical use case for this option is to separate full tiles from
9787 The other options, described below, are applied after the separation
9790 As an example, consider the separation into full and partial tiles
9791 of a tiling of a triangular domain.
9792 Take, for example, the domain
9794 { A[i,j] : 0 <= i,j and i + j <= 100 }
9796 and a tiling into tiles of 10 by 10. The input to the AST generator
9797 is then the schedule
9799 { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
9802 Without any options, the following AST is generated
9804 for (int c0 = 0; c0 <= 10; c0 += 1)
9805 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9806 for (int c2 = 10 * c0;
9807 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9809 for (int c3 = 10 * c1;
9810 c3 <= min(10 * c1 + 9, -c2 + 100);
9814 Separation into full and partial tiles can be obtained by assigning
9815 a class, say C<0>, to the full tiles. The full tiles are represented by those
9816 values of the first and second schedule dimensions for which there are
9817 values of the third and fourth dimensions to cover an entire tile.
9818 That is, we need to specify the following option
9820 { [a,b,c,d] -> separation_class[[0]->[0]] :
9821 exists b': 0 <= 10a,10b' and
9822 10a+9+10b'+9 <= 100;
9823 [a,b,c,d] -> separation_class[[1]->[0]] :
9824 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
9828 { [a, b, c, d] -> separation_class[[1] -> [0]] :
9829 a >= 0 and b >= 0 and b <= 8 - a;
9830 [a, b, c, d] -> separation_class[[0] -> [0]] :
9833 With this option, the generated AST is as follows
9836 for (int c0 = 0; c0 <= 8; c0 += 1) {
9837 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9838 for (int c2 = 10 * c0;
9839 c2 <= 10 * c0 + 9; c2 += 1)
9840 for (int c3 = 10 * c1;
9841 c3 <= 10 * c1 + 9; c3 += 1)
9843 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9844 for (int c2 = 10 * c0;
9845 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9847 for (int c3 = 10 * c1;
9848 c3 <= min(-c2 + 100, 10 * c1 + 9);
9852 for (int c0 = 9; c0 <= 10; c0 += 1)
9853 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9854 for (int c2 = 10 * c0;
9855 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9857 for (int c3 = 10 * c1;
9858 c3 <= min(10 * c1 + 9, -c2 + 100);
9865 This is a single-dimensional space representing the schedule dimension(s)
9866 to which ``separation'' should be applied. Separation tries to split
9867 a loop into several pieces if this can avoid the generation of guards
9869 See also the C<atomic> option.
9873 This is a single-dimensional space representing the schedule dimension(s)
9874 for which the domains should be considered ``atomic''. That is, the
9875 AST generator will make sure that any given domain space will only appear
9876 in a single loop at the specified level.
9878 Consider the following schedule
9880 { a[i] -> [i] : 0 <= i < 10;
9881 b[i] -> [i+1] : 0 <= i < 10 }
9883 If the following option is specified
9885 { [i] -> separate[x] }
9887 then the following AST will be generated
9891 for (int c0 = 1; c0 <= 9; c0 += 1) {
9898 If, on the other hand, the following option is specified
9900 { [i] -> atomic[x] }
9902 then the following AST will be generated
9904 for (int c0 = 0; c0 <= 10; c0 += 1) {
9911 If neither C<atomic> nor C<separate> is specified, then the AST generator
9912 may produce either of these two results or some intermediate form.
9916 This is a single-dimensional space representing the schedule dimension(s)
9917 that should be I<completely> unrolled.
9918 To obtain a partial unrolling, the user should apply an additional
9919 strip-mining to the schedule and fully unroll the inner loop.
9923 =head3 Fine-grained Control over AST Generation
9925 Besides specifying the constraints on the parameters,
9926 an C<isl_ast_build> object can be used to control
9927 various aspects of the AST generation process.
9928 In case of AST construction using
9929 C<isl_ast_build_node_from_schedule_map>,
9930 the most prominent way of control is through ``options'',
9933 Additional control is available through the following functions.
9935 #include <isl/ast_build.h>
9936 __isl_give isl_ast_build *
9937 isl_ast_build_set_iterators(
9938 __isl_take isl_ast_build *control,
9939 __isl_take isl_id_list *iterators);
9941 The function C<isl_ast_build_set_iterators> allows the user to
9942 specify a list of iterator C<isl_id>s to be used as iterators.
9943 If the input schedule is injective, then
9944 the number of elements in this list should be as large as the dimension
9945 of the schedule space, but no direct correspondence should be assumed
9946 between dimensions and elements.
9947 If the input schedule is not injective, then an additional number
9948 of C<isl_id>s equal to the largest dimension of the input domains
9950 If the number of provided C<isl_id>s is insufficient, then additional
9951 names are automatically generated.
9953 #include <isl/ast_build.h>
9954 __isl_give isl_ast_build *
9955 isl_ast_build_set_create_leaf(
9956 __isl_take isl_ast_build *control,
9957 __isl_give isl_ast_node *(*fn)(
9958 __isl_take isl_ast_build *build,
9959 void *user), void *user);
9962 C<isl_ast_build_set_create_leaf> function allows for the
9963 specification of a callback that should be called whenever the AST
9964 generator arrives at an element of the schedule domain.
9965 The callback should return an AST node that should be inserted
9966 at the corresponding position of the AST. The default action (when
9967 the callback is not set) is to continue generating parts of the AST to scan
9968 all the domain elements associated to the schedule domain element
9969 and to insert user nodes, ``calling'' the domain element, for each of them.
9970 The C<build> argument contains the current state of the C<isl_ast_build>.
9971 To ease nested AST generation (see L</"Nested AST Generation">),
9972 all control information that is
9973 specific to the current AST generation such as the options and
9974 the callbacks has been removed from this C<isl_ast_build>.
9975 The callback would typically return the result of a nested
9977 user defined node created using the following function.
9979 #include <isl/ast.h>
9980 __isl_give isl_ast_node *isl_ast_node_alloc_user(
9981 __isl_take isl_ast_expr *expr);
9983 #include <isl/ast_build.h>
9984 __isl_give isl_ast_build *
9985 isl_ast_build_set_at_each_domain(
9986 __isl_take isl_ast_build *build,
9987 __isl_give isl_ast_node *(*fn)(
9988 __isl_take isl_ast_node *node,
9989 __isl_keep isl_ast_build *build,
9990 void *user), void *user);
9991 __isl_give isl_ast_build *
9992 isl_ast_build_set_before_each_for(
9993 __isl_take isl_ast_build *build,
9994 __isl_give isl_id *(*fn)(
9995 __isl_keep isl_ast_build *build,
9996 void *user), void *user);
9997 __isl_give isl_ast_build *
9998 isl_ast_build_set_after_each_for(
9999 __isl_take isl_ast_build *build,
10000 __isl_give isl_ast_node *(*fn)(
10001 __isl_take isl_ast_node *node,
10002 __isl_keep isl_ast_build *build,
10003 void *user), void *user);
10004 __isl_give isl_ast_build *
10005 isl_ast_build_set_before_each_mark(
10006 __isl_take isl_ast_build *build,
10007 isl_stat (*fn)(__isl_keep isl_id *mark,
10008 __isl_keep isl_ast_build *build,
10009 void *user), void *user);
10010 __isl_give isl_ast_build *
10011 isl_ast_build_set_after_each_mark(
10012 __isl_take isl_ast_build *build,
10013 __isl_give isl_ast_node *(*fn)(
10014 __isl_take isl_ast_node *node,
10015 __isl_keep isl_ast_build *build,
10016 void *user), void *user);
10018 The callback set by C<isl_ast_build_set_at_each_domain> will
10019 be called for each domain AST node.
10020 The callbacks set by C<isl_ast_build_set_before_each_for>
10021 and C<isl_ast_build_set_after_each_for> will be called
10022 for each for AST node. The first will be called in depth-first
10023 pre-order, while the second will be called in depth-first post-order.
10024 Since C<isl_ast_build_set_before_each_for> is called before the for
10025 node is actually constructed, it is only passed an C<isl_ast_build>.
10026 The returned C<isl_id> will be added as an annotation (using
10027 C<isl_ast_node_set_annotation>) to the constructed for node.
10028 In particular, if the user has also specified an C<after_each_for>
10029 callback, then the annotation can be retrieved from the node passed to
10030 that callback using C<isl_ast_node_get_annotation>.
10031 The callbacks set by C<isl_ast_build_set_before_each_mark>
10032 and C<isl_ast_build_set_after_each_mark> will be called for each
10033 mark AST node that is created, i.e., for each mark schedule node
10034 in the input schedule tree. The first will be called in depth-first
10035 pre-order, while the second will be called in depth-first post-order.
10036 Since the callback set by C<isl_ast_build_set_before_each_mark>
10037 is called before the mark AST node is actually constructed, it is passed
10038 the identifier of the mark node.
10039 All callbacks should C<NULL> (or -1) on failure.
10040 The given C<isl_ast_build> can be used to create new
10041 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
10042 or C<isl_ast_build_call_from_pw_multi_aff>.
10044 =head3 Nested AST Generation
10046 C<isl> allows the user to create an AST within the context
10047 of another AST. These nested ASTs are created using the
10048 same C<isl_ast_build_node_from_schedule_map> function that is used to create
10049 the outer AST. The C<build> argument should be an C<isl_ast_build>
10050 passed to a callback set by
10051 C<isl_ast_build_set_create_leaf>.
10052 The space of the range of the C<schedule> argument should refer
10053 to this build. In particular, the space should be a wrapped
10054 relation and the domain of this wrapped relation should be the
10055 same as that of the range of the schedule returned by
10056 C<isl_ast_build_get_schedule> below.
10057 In practice, the new schedule is typically
10058 created by calling C<isl_union_map_range_product> on the old schedule
10059 and some extra piece of the schedule.
10060 The space of the schedule domain is also available from
10061 the C<isl_ast_build>.
10063 #include <isl/ast_build.h>
10064 __isl_give isl_union_map *isl_ast_build_get_schedule(
10065 __isl_keep isl_ast_build *build);
10066 __isl_give isl_space *isl_ast_build_get_schedule_space(
10067 __isl_keep isl_ast_build *build);
10068 __isl_give isl_ast_build *isl_ast_build_restrict(
10069 __isl_take isl_ast_build *build,
10070 __isl_take isl_set *set);
10072 The C<isl_ast_build_get_schedule> function returns a (partial)
10073 schedule for the domains elements for which part of the AST still needs to
10074 be generated in the current build.
10075 In particular, the domain elements are mapped to those iterations of the loops
10076 enclosing the current point of the AST generation inside which
10077 the domain elements are executed.
10078 No direct correspondence between
10079 the input schedule and this schedule should be assumed.
10080 The space obtained from C<isl_ast_build_get_schedule_space> can be used
10081 to create a set for C<isl_ast_build_restrict> to intersect
10082 with the current build. In particular, the set passed to
10083 C<isl_ast_build_restrict> can have additional parameters.
10084 The ids of the set dimensions in the space returned by
10085 C<isl_ast_build_get_schedule_space> correspond to the
10086 iterators of the already generated loops.
10087 The user should not rely on the ids of the output dimensions
10088 of the relations in the union relation returned by
10089 C<isl_ast_build_get_schedule> having any particular value.
10091 =head1 Applications
10093 Although C<isl> is mainly meant to be used as a library,
10094 it also contains some basic applications that use some
10095 of the functionality of C<isl>.
10096 The input may be specified in either the L<isl format>
10097 or the L<PolyLib format>.
10099 =head2 C<isl_polyhedron_sample>
10101 C<isl_polyhedron_sample> takes a polyhedron as input and prints
10102 an integer element of the polyhedron, if there is any.
10103 The first column in the output is the denominator and is always
10104 equal to 1. If the polyhedron contains no integer points,
10105 then a vector of length zero is printed.
10109 C<isl_pip> takes the same input as the C<example> program
10110 from the C<piplib> distribution, i.e., a set of constraints
10111 on the parameters, a line containing only -1 and finally a set
10112 of constraints on a parametric polyhedron.
10113 The coefficients of the parameters appear in the last columns
10114 (but before the final constant column).
10115 The output is the lexicographic minimum of the parametric polyhedron.
10116 As C<isl> currently does not have its own output format, the output
10117 is just a dump of the internal state.
10119 =head2 C<isl_polyhedron_minimize>
10121 C<isl_polyhedron_minimize> computes the minimum of some linear
10122 or affine objective function over the integer points in a polyhedron.
10123 If an affine objective function
10124 is given, then the constant should appear in the last column.
10126 =head2 C<isl_polytope_scan>
10128 Given a polytope, C<isl_polytope_scan> prints
10129 all integer points in the polytope.
10131 =head2 C<isl_codegen>
10133 Given a schedule, a context set and an options relation,
10134 C<isl_codegen> prints out an AST that scans the domain elements
10135 of the schedule in the order of their image(s) taking into account
10136 the constraints in the context set.