3 C<isl> is a thread-safe C library for manipulating
4 sets and relations of integer points bounded by affine constraints.
5 The descriptions of the sets and relations may involve
6 both parameters and existentially quantified variables.
7 All computations are performed in exact integer arithmetic
8 using C<GMP> or C<imath>.
9 The C<isl> library offers functionality that is similar
10 to that offered by the C<Omega> and C<Omega+> libraries,
11 but the underlying algorithms are in most cases completely different.
13 The library is by no means complete and some fairly basic
14 functionality is still missing.
15 Still, even in its current form, the library has been successfully
16 used as a backend polyhedral library for the polyhedral
17 scanner C<CLooG> and as part of an equivalence checker of
18 static affine programs.
19 For bug reports, feature requests and questions,
20 visit the discussion group at
21 L<http://groups.google.com/group/isl-development>.
23 =head2 Backward Incompatible Changes
25 =head3 Changes since isl-0.02
29 =item * The old printing functions have been deprecated
30 and replaced by C<isl_printer> functions, see L<Input and Output>.
32 =item * Most functions related to dependence analysis have acquired
33 an extra C<must> argument. To obtain the old behavior, this argument
34 should be given the value 1. See L<Dependence Analysis>.
38 =head3 Changes since isl-0.03
42 =item * The function C<isl_pw_qpolynomial_fold_add> has been
43 renamed to C<isl_pw_qpolynomial_fold_fold>.
44 Similarly, C<isl_union_pw_qpolynomial_fold_add> has been
45 renamed to C<isl_union_pw_qpolynomial_fold_fold>.
49 =head3 Changes since isl-0.04
53 =item * All header files have been renamed from C<isl_header.h>
58 =head3 Changes since isl-0.05
62 =item * The functions C<isl_printer_print_basic_set> and
63 C<isl_printer_print_basic_map> no longer print a newline.
65 =item * The functions C<isl_flow_get_no_source>
66 and C<isl_union_map_compute_flow> now return
67 the accesses for which no source could be found instead of
68 the iterations where those accesses occur.
70 =item * The functions C<isl_basic_map_identity> and
71 C<isl_map_identity> now take a B<map> space as input. An old call
72 C<isl_map_identity(space)> can be rewritten to
73 C<isl_map_identity(isl_space_map_from_set(space))>.
75 =item * The function C<isl_map_power> no longer takes
76 a parameter position as input. Instead, the exponent
77 is now expressed as the domain of the resulting relation.
81 =head3 Changes since isl-0.06
85 =item * The format of C<isl_printer_print_qpolynomial>'s
86 C<ISL_FORMAT_ISL> output has changed.
87 Use C<ISL_FORMAT_C> to obtain the old output.
89 =item * The C<*_fast_*> functions have been renamed to C<*_plain_*>.
90 Some of the old names have been kept for backward compatibility,
91 but they will be removed in the future.
95 =head3 Changes since isl-0.07
99 =item * The function C<isl_pw_aff_max> has been renamed to
100 C<isl_pw_aff_union_max>.
101 Similarly, the function C<isl_pw_aff_add> has been renamed to
102 C<isl_pw_aff_union_add>.
104 =item * The C<isl_dim> type has been renamed to C<isl_space>
105 along with the associated functions.
106 Some of the old names have been kept for backward compatibility,
107 but they will be removed in the future.
109 =item * Spaces of maps, sets and parameter domains are now
110 treated differently. The distinction between map spaces and set spaces
111 has always been made on a conceptual level, but proper use of such spaces
112 was never checked. Furthermore, up until isl-0.07 there was no way
113 of explicitly creating a parameter space. These can now be created
114 directly using C<isl_space_params_alloc> or from other spaces using
117 =item * The space in which C<isl_aff>, C<isl_pw_aff>, C<isl_qpolynomial>,
118 C<isl_pw_qpolynomial>, C<isl_qpolynomial_fold> and C<isl_pw_qpolynomial_fold>
119 objects live is now a map space
120 instead of a set space. This means, for example, that the dimensions
121 of the domain of an C<isl_aff> are now considered to be of type
122 C<isl_dim_in> instead of C<isl_dim_set>. Extra functions have been
123 added to obtain the domain space. Some of the constructors still
124 take a domain space and have therefore been renamed.
126 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
127 now take an C<isl_local_space> instead of an C<isl_space>.
128 An C<isl_local_space> can be created from an C<isl_space>
129 using C<isl_local_space_from_space>.
131 =item * The C<isl_div> type has been removed. Functions that used
132 to return an C<isl_div> now return an C<isl_aff>.
133 Note that the space of an C<isl_aff> is that of relation.
134 When replacing a call to C<isl_div_get_coefficient> by a call to
135 C<isl_aff_get_coefficient> any C<isl_dim_set> argument needs
136 to be replaced by C<isl_dim_in>.
137 A call to C<isl_aff_from_div> can be replaced by a call
139 A call to C<isl_qpolynomial_div(div)> call be replaced by
142 isl_qpolynomial_from_aff(isl_aff_floor(div))
144 The function C<isl_constraint_div> has also been renamed
145 to C<isl_constraint_get_div>.
147 =item * The C<nparam> argument has been removed from
148 C<isl_map_read_from_str> and similar functions.
149 When reading input in the original PolyLib format,
150 the result will have no parameters.
151 If parameters are expected, the caller may want to perform
152 dimension manipulation on the result.
156 =head3 Changes since isl-0.09
160 =item * The C<schedule_split_parallel> option has been replaced
161 by the C<schedule_split_scaled> option.
163 =item * The first argument of C<isl_pw_aff_cond> is now
164 an C<isl_pw_aff> instead of an C<isl_set>.
165 A call C<isl_pw_aff_cond(a, b, c)> can be replaced by
167 isl_pw_aff_cond(isl_set_indicator_function(a), b, c)
171 =head3 Changes since isl-0.10
175 =item * The functions C<isl_set_dim_has_lower_bound> and
176 C<isl_set_dim_has_upper_bound> have been renamed to
177 C<isl_set_dim_has_any_lower_bound> and
178 C<isl_set_dim_has_any_upper_bound>.
179 The new C<isl_set_dim_has_lower_bound> and
180 C<isl_set_dim_has_upper_bound> have slightly different meanings.
184 =head3 Changes since isl-0.12
188 =item * C<isl_int> has been replaced by C<isl_val>.
189 Some of the old functions are still available in C<isl/deprecated/*.h>
190 but they will be removed in the future.
192 =item * The functions C<isl_pw_qpolynomial_eval>,
193 C<isl_union_pw_qpolynomial_eval>, C<isl_pw_qpolynomial_fold_eval>
194 and C<isl_union_pw_qpolynomial_fold_eval> have been changed to return
195 an C<isl_val> instead of an C<isl_qpolynomial>.
197 =item * The function C<isl_band_member_is_zero_distance>
198 has been removed. Essentially the same functionality is available
199 through C<isl_band_member_is_coincident>, except that is requires
200 setting up coincidence constraints.
201 The option C<schedule_outer_zero_distance> has accordingly been
202 replaced by the option C<schedule_outer_coincidence>.
204 =item * The function C<isl_vertex_get_expr> has been changed
205 to return an C<isl_multi_aff> instead of a rational C<isl_basic_set>.
206 The function C<isl_vertex_get_domain> has been changed to return
207 a regular basic set, rather than a rational basic set.
211 =head3 Changes since isl-0.14
215 =item * Objects of type C<isl_union_pw_multi_aff> can no longer contain
216 two or more C<isl_pw_multi_aff> objects with the same domain space.
218 =item * The function C<isl_union_pw_multi_aff_add> now consistently
219 computes the sum on the shared definition domain.
220 The function C<isl_union_pw_multi_aff_union_add> has been added
221 to compute the sum on the union of definition domains.
222 The original behavior of C<isl_union_pw_multi_aff_add> was
223 confused and is no longer available.
225 =item * Band forests have been replaced by schedule trees.
227 =item * The function C<isl_union_map_compute_flow> has been
228 replaced by the function C<isl_union_access_info_compute_flow>.
229 Note that the may dependence relation returned by
230 C<isl_union_flow_get_may_dependence> is the union of
231 the two dependence relations returned by
232 C<isl_union_map_compute_flow>. Similarly for the no source relations.
233 The function C<isl_union_map_compute_flow> is still available
234 for backward compatibility, but it will be removed in the future.
236 =item * The function C<isl_basic_set_drop_constraint> has been
239 =item * The function C<isl_ast_build_ast_from_schedule> has been
240 renamed to C<isl_ast_build_node_from_schedule_map>.
241 The original name is still available
242 for backward compatibility, but it will be removed in the future.
244 =item * The C<separation_class> AST generation option has been
247 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
248 have been renamed to C<isl_constraint_alloc_equality> and
249 C<isl_constraint_alloc_inequality>. The original names have been
250 kept for backward compatibility, but they will be removed in the future.
252 =item * The C<schedule_fuse> option has been replaced
253 by the C<schedule_serialize_sccs> option. The effect
254 of setting the C<schedule_fuse> option to C<ISL_SCHEDULE_FUSE_MIN>
255 is now obtained by turning on the C<schedule_serialize_sccs> option.
261 C<isl> is released under the MIT license.
265 Permission is hereby granted, free of charge, to any person obtaining a copy of
266 this software and associated documentation files (the "Software"), to deal in
267 the Software without restriction, including without limitation the rights to
268 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
269 of the Software, and to permit persons to whom the Software is furnished to do
270 so, subject to the following conditions:
272 The above copyright notice and this permission notice shall be included in all
273 copies or substantial portions of the Software.
275 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
276 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
277 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
278 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
279 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
280 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
285 Note that by default C<isl> requires C<GMP>, which is released
286 under the GNU Lesser General Public License (LGPL). This means
287 that code linked against C<isl> is also linked against LGPL code.
289 When configuring with C<--with-int=imath>, C<isl> will link against C<imath>, a
290 library for exact integer arithmetic released under the MIT license.
294 The source of C<isl> can be obtained either as a tarball
295 or from the git repository. Both are available from
296 L<http://freshmeat.net/projects/isl/>.
297 The installation process depends on how you obtained
300 =head2 Installation from the git repository
304 =item 1 Clone or update the repository
306 The first time the source is obtained, you need to clone
309 git clone git://repo.or.cz/isl.git
311 To obtain updates, you need to pull in the latest changes
315 =item 2 Optionally get C<imath> submodule
317 To build C<isl> with C<imath>, you need to obtain the C<imath>
318 submodule by running in the git source tree of C<isl>
323 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
325 =item 2 Generate C<configure>
331 After performing the above steps, continue
332 with the L<Common installation instructions>.
334 =head2 Common installation instructions
338 =item 1 Obtain C<GMP>
340 By default, building C<isl> requires C<GMP>, including its headers files.
341 Your distribution may not provide these header files by default
342 and you may need to install a package called C<gmp-devel> or something
343 similar. Alternatively, C<GMP> can be built from
344 source, available from L<http://gmplib.org/>.
345 C<GMP> is not needed if you build C<isl> with C<imath>.
349 C<isl> uses the standard C<autoconf> C<configure> script.
354 optionally followed by some configure options.
355 A complete list of options can be obtained by running
359 Below we discuss some of the more common options.
365 Installation prefix for C<isl>
367 =item C<--with-int=[gmp|imath]>
369 Select the integer library to be used by C<isl>, the default is C<gmp>.
370 Note that C<isl> may run significantly slower if you use C<imath>.
372 =item C<--with-gmp-prefix>
374 Installation prefix for C<GMP> (architecture-independent files).
376 =item C<--with-gmp-exec-prefix>
378 Installation prefix for C<GMP> (architecture-dependent files).
386 =item 4 Install (optional)
392 =head1 Integer Set Library
394 =head2 Memory Management
396 Since a high-level operation on isl objects usually involves
397 several substeps and since the user is usually not interested in
398 the intermediate results, most functions that return a new object
399 will also release all the objects passed as arguments.
400 If the user still wants to use one or more of these arguments
401 after the function call, she should pass along a copy of the
402 object rather than the object itself.
403 The user is then responsible for making sure that the original
404 object gets used somewhere else or is explicitly freed.
406 The arguments and return values of all documented functions are
407 annotated to make clear which arguments are released and which
408 arguments are preserved. In particular, the following annotations
415 C<__isl_give> means that a new object is returned.
416 The user should make sure that the returned pointer is
417 used exactly once as a value for an C<__isl_take> argument.
418 In between, it can be used as a value for as many
419 C<__isl_keep> arguments as the user likes.
420 There is one exception, and that is the case where the
421 pointer returned is C<NULL>. Is this case, the user
422 is free to use it as an C<__isl_take> argument or not.
423 When applied to a C<char *>, the returned pointer needs to be
428 C<__isl_null> means that a C<NULL> value is returned.
432 C<__isl_take> means that the object the argument points to
433 is taken over by the function and may no longer be used
434 by the user as an argument to any other function.
435 The pointer value must be one returned by a function
436 returning an C<__isl_give> pointer.
437 If the user passes in a C<NULL> value, then this will
438 be treated as an error in the sense that the function will
439 not perform its usual operation. However, it will still
440 make sure that all the other C<__isl_take> arguments
445 C<__isl_keep> means that the function will only use the object
446 temporarily. After the function has finished, the user
447 can still use it as an argument to other functions.
448 A C<NULL> value will be treated in the same way as
449 a C<NULL> value for an C<__isl_take> argument.
450 This annotation may also be used on return values of
451 type C<const char *>, in which case the returned pointer should
452 not be freed by the user and is only valid until the object
453 from which it was derived is updated or freed.
457 =head2 Initialization
459 All manipulations of integer sets and relations occur within
460 the context of an C<isl_ctx>.
461 A given C<isl_ctx> can only be used within a single thread.
462 All arguments of a function are required to have been allocated
463 within the same context.
464 There are currently no functions available for moving an object
465 from one C<isl_ctx> to another C<isl_ctx>. This means that
466 there is currently no way of safely moving an object from one
467 thread to another, unless the whole C<isl_ctx> is moved.
469 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
470 freed using C<isl_ctx_free>.
471 All objects allocated within an C<isl_ctx> should be freed
472 before the C<isl_ctx> itself is freed.
474 isl_ctx *isl_ctx_alloc();
475 void isl_ctx_free(isl_ctx *ctx);
477 The user can impose a bound on the number of low-level I<operations>
478 that can be performed by an C<isl_ctx>. This bound can be set and
479 retrieved using the following functions. A bound of zero means that
480 no bound is imposed. The number of operations performed can be
481 reset using C<isl_ctx_reset_operations>. Note that the number
482 of low-level operations needed to perform a high-level computation
483 may differ significantly across different versions
484 of C<isl>, but it should be the same across different platforms
485 for the same version of C<isl>.
487 Warning: This feature is experimental. C<isl> has good support to abort and
488 bail out during the computation, but this feature may exercise error code paths
489 that are normally not used that much. Consequently, it is not unlikely that
490 hidden bugs will be exposed.
492 void isl_ctx_set_max_operations(isl_ctx *ctx,
493 unsigned long max_operations);
494 unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
495 void isl_ctx_reset_operations(isl_ctx *ctx);
497 In order to be able to create an object in the same context
498 as another object, most object types (described later in
499 this document) provide a function to obtain the context
500 in which the object was created.
503 isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
504 isl_ctx *isl_multi_val_get_ctx(
505 __isl_keep isl_multi_val *mv);
508 isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
510 #include <isl/local_space.h>
511 isl_ctx *isl_local_space_get_ctx(
512 __isl_keep isl_local_space *ls);
515 isl_ctx *isl_set_list_get_ctx(
516 __isl_keep isl_set_list *list);
519 isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
520 isl_ctx *isl_multi_aff_get_ctx(
521 __isl_keep isl_multi_aff *maff);
522 isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
523 isl_ctx *isl_pw_multi_aff_get_ctx(
524 __isl_keep isl_pw_multi_aff *pma);
525 isl_ctx *isl_multi_pw_aff_get_ctx(
526 __isl_keep isl_multi_pw_aff *mpa);
527 isl_ctx *isl_union_pw_aff_get_ctx(
528 __isl_keep isl_union_pw_aff *upa);
529 isl_ctx *isl_union_pw_multi_aff_get_ctx(
530 __isl_keep isl_union_pw_multi_aff *upma);
531 isl_ctx *isl_multi_union_pw_aff_get_ctx(
532 __isl_keep isl_multi_union_pw_aff *mupa);
534 #include <isl/id_to_ast_expr.h>
535 isl_ctx *isl_id_to_ast_expr_get_ctx(
536 __isl_keep isl_id_to_ast_expr *id2expr);
538 #include <isl/point.h>
539 isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
542 isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
545 isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
547 #include <isl/vertices.h>
548 isl_ctx *isl_vertices_get_ctx(
549 __isl_keep isl_vertices *vertices);
550 isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
551 isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
553 #include <isl/flow.h>
554 isl_ctx *isl_restriction_get_ctx(
555 __isl_keep isl_restriction *restr);
556 isl_ctx *isl_union_access_info_get_ctx(
557 __isl_keep isl_union_access_info *access);
558 isl_ctx *isl_union_flow_get_ctx(
559 __isl_keep isl_union_flow *flow);
561 #include <isl/schedule.h>
562 isl_ctx *isl_schedule_get_ctx(
563 __isl_keep isl_schedule *sched);
564 isl_ctx *isl_schedule_constraints_get_ctx(
565 __isl_keep isl_schedule_constraints *sc);
567 #include <isl/schedule_node.h>
568 isl_ctx *isl_schedule_node_get_ctx(
569 __isl_keep isl_schedule_node *node);
571 #include <isl/band.h>
572 isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
574 #include <isl/ast_build.h>
575 isl_ctx *isl_ast_build_get_ctx(
576 __isl_keep isl_ast_build *build);
579 isl_ctx *isl_ast_expr_get_ctx(
580 __isl_keep isl_ast_expr *expr);
581 isl_ctx *isl_ast_node_get_ctx(
582 __isl_keep isl_ast_node *node);
586 C<isl> uses two special return types for functions that either return
587 a boolean or that in principle do not return anything.
588 In particular, the C<isl_bool> type has three possible values:
589 C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
590 C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
591 C<isl_bool_error> (a negative integer value), indicating that something
593 The C<isl_stat> type has two possible values:
594 C<isl_stat_ok> (the integer value zero), indicating a successful
596 C<isl_stat_error> (a negative integer value), indicating that something
598 See L</"Error Handling"> for more information on
599 C<isl_bool_error> and C<isl_stat_error>.
603 An C<isl_val> represents an integer value, a rational value
604 or one of three special values, infinity, negative infinity and NaN.
605 Some predefined values can be created using the following functions.
608 __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
609 __isl_give isl_val *isl_val_one(isl_ctx *ctx);
610 __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
611 __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
612 __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
613 __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
615 Specific integer values can be created using the following functions.
618 __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
620 __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
622 __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
623 size_t n, size_t size, const void *chunks);
625 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
626 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
627 The least significant digit is assumed to be stored first.
629 Value objects can be copied and freed using the following functions.
632 __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
633 __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
635 They can be inspected using the following functions.
638 long isl_val_get_num_si(__isl_keep isl_val *v);
639 long isl_val_get_den_si(__isl_keep isl_val *v);
640 double isl_val_get_d(__isl_keep isl_val *v);
641 size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
643 int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
644 size_t size, void *chunks);
646 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
647 of C<size> bytes needed to store the absolute value of the
649 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
650 which is assumed to have been preallocated by the caller.
651 The least significant digit is stored first.
652 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
653 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
654 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
656 An C<isl_val> can be modified using the following function.
659 __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
662 The following unary properties are defined on C<isl_val>s.
665 int isl_val_sgn(__isl_keep isl_val *v);
666 isl_bool isl_val_is_zero(__isl_keep isl_val *v);
667 isl_bool isl_val_is_one(__isl_keep isl_val *v);
668 isl_bool isl_val_is_negone(__isl_keep isl_val *v);
669 isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
670 isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
671 isl_bool isl_val_is_pos(__isl_keep isl_val *v);
672 isl_bool isl_val_is_neg(__isl_keep isl_val *v);
673 isl_bool isl_val_is_int(__isl_keep isl_val *v);
674 isl_bool isl_val_is_rat(__isl_keep isl_val *v);
675 isl_bool isl_val_is_nan(__isl_keep isl_val *v);
676 isl_bool isl_val_is_infty(__isl_keep isl_val *v);
677 isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
679 Note that the sign of NaN is undefined.
681 The following binary properties are defined on pairs of C<isl_val>s.
684 isl_bool isl_val_lt(__isl_keep isl_val *v1,
685 __isl_keep isl_val *v2);
686 isl_bool isl_val_le(__isl_keep isl_val *v1,
687 __isl_keep isl_val *v2);
688 isl_bool isl_val_gt(__isl_keep isl_val *v1,
689 __isl_keep isl_val *v2);
690 isl_bool isl_val_ge(__isl_keep isl_val *v1,
691 __isl_keep isl_val *v2);
692 isl_bool isl_val_eq(__isl_keep isl_val *v1,
693 __isl_keep isl_val *v2);
694 isl_bool isl_val_ne(__isl_keep isl_val *v1,
695 __isl_keep isl_val *v2);
696 isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
697 __isl_keep isl_val *v2);
699 The function C<isl_val_abs_eq> checks whether its two arguments
700 are equal in absolute value.
702 For integer C<isl_val>s we additionally have the following binary property.
705 isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
706 __isl_keep isl_val *v2);
708 An C<isl_val> can also be compared to an integer using the following
709 function. The result is undefined for NaN.
712 int isl_val_cmp_si(__isl_keep isl_val *v, long i);
714 The following unary operations are available on C<isl_val>s.
717 __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
718 __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
719 __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
720 __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
721 __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
722 __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
723 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
725 The following binary operations are available on C<isl_val>s.
728 __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
729 __isl_take isl_val *v2);
730 __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
731 __isl_take isl_val *v2);
732 __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
733 __isl_take isl_val *v2);
734 __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
736 __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
737 __isl_take isl_val *v2);
738 __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
740 __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
741 __isl_take isl_val *v2);
742 __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
744 __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
745 __isl_take isl_val *v2);
747 On integer values, we additionally have the following operations.
750 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
751 __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
752 __isl_take isl_val *v2);
753 __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
754 __isl_take isl_val *v2);
755 __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
756 __isl_take isl_val *v2, __isl_give isl_val **x,
757 __isl_give isl_val **y);
759 The function C<isl_val_gcdext> returns the greatest common divisor g
760 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
761 that C<*x> * C<v1> + C<*y> * C<v2> = g.
763 =head3 GMP specific functions
765 These functions are only available if C<isl> has been compiled with C<GMP>
768 Specific integer and rational values can be created from C<GMP> values using
769 the following functions.
771 #include <isl/val_gmp.h>
772 __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
774 __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
775 const mpz_t n, const mpz_t d);
777 The numerator and denominator of a rational value can be extracted as
778 C<GMP> values using the following functions.
780 #include <isl/val_gmp.h>
781 int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
782 int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
784 =head2 Sets and Relations
786 C<isl> uses six types of objects for representing sets and relations,
787 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
788 C<isl_union_set> and C<isl_union_map>.
789 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
790 can be described as a conjunction of affine constraints, while
791 C<isl_set> and C<isl_map> represent unions of
792 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
793 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
794 to live in the same space. C<isl_union_set>s and C<isl_union_map>s
795 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
796 where spaces are considered different if they have a different number
797 of dimensions and/or different names (see L<"Spaces">).
798 The difference between sets and relations (maps) is that sets have
799 one set of variables, while relations have two sets of variables,
800 input variables and output variables.
802 =head2 Error Handling
804 C<isl> supports different ways to react in case a runtime error is triggered.
805 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
806 with two maps that have incompatible spaces. There are three possible ways
807 to react on error: to warn, to continue or to abort.
809 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
810 the last error in the corresponding C<isl_ctx> and the function in which the
811 error was triggered returns a value indicating that some error has
812 occurred. In case of functions returning a pointer, this value is
813 C<NULL>. In case of functions returning an C<isl_bool> or an
814 C<isl_stat>, this valus is C<isl_bool_error> or C<isl_stat_error>.
815 An error does not corrupt internal state,
816 such that isl can continue to be used. C<isl> also provides functions to
817 read the last error and to reset the memory that stores the last error. The
818 last error is only stored for information purposes. Its presence does not
819 change the behavior of C<isl>. Hence, resetting an error is not required to
820 continue to use isl, but only to observe new errors.
823 enum isl_error isl_ctx_last_error(isl_ctx *ctx);
824 void isl_ctx_reset_error(isl_ctx *ctx);
826 Another option is to continue on error. This is similar to warn on error mode,
827 except that C<isl> does not print any warning. This allows a program to
828 implement its own error reporting.
830 The last option is to directly abort the execution of the program from within
831 the isl library. This makes it obviously impossible to recover from an error,
832 but it allows to directly spot the error location. By aborting on error,
833 debuggers break at the location the error occurred and can provide a stack
834 trace. Other tools that automatically provide stack traces on abort or that do
835 not want to continue execution after an error was triggered may also prefer to
838 The on error behavior of isl can be specified by calling
839 C<isl_options_set_on_error> or by setting the command line option
840 C<--isl-on-error>. Valid arguments for the function call are
841 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
842 choices for the command line option are C<warn>, C<continue> and C<abort>.
843 It is also possible to query the current error mode.
845 #include <isl/options.h>
846 isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
847 int isl_options_get_on_error(isl_ctx *ctx);
851 Identifiers are used to identify both individual dimensions
852 and tuples of dimensions. They consist of an optional name and an optional
853 user pointer. The name and the user pointer cannot both be C<NULL>, however.
854 Identifiers with the same name but different pointer values
855 are considered to be distinct.
856 Similarly, identifiers with different names but the same pointer value
857 are also considered to be distinct.
858 Equal identifiers are represented using the same object.
859 Pairs of identifiers can therefore be tested for equality using the
861 Identifiers can be constructed, copied, freed, inspected and printed
862 using the following functions.
865 __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
866 __isl_keep const char *name, void *user);
867 __isl_give isl_id *isl_id_set_free_user(
868 __isl_take isl_id *id,
869 __isl_give void (*free_user)(void *user));
870 __isl_give isl_id *isl_id_copy(isl_id *id);
871 __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
873 void *isl_id_get_user(__isl_keep isl_id *id);
874 __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
876 __isl_give isl_printer *isl_printer_print_id(
877 __isl_take isl_printer *p, __isl_keep isl_id *id);
879 The callback set by C<isl_id_set_free_user> is called on the user
880 pointer when the last reference to the C<isl_id> is freed.
881 Note that C<isl_id_get_name> returns a pointer to some internal
882 data structure, so the result can only be used while the
883 corresponding C<isl_id> is alive.
887 Whenever a new set, relation or similar object is created from scratch,
888 the space in which it lives needs to be specified using an C<isl_space>.
889 Each space involves zero or more parameters and zero, one or two
890 tuples of set or input/output dimensions. The parameters and dimensions
891 are identified by an C<isl_dim_type> and a position.
892 The type C<isl_dim_param> refers to parameters,
893 the type C<isl_dim_set> refers to set dimensions (for spaces
894 with a single tuple of dimensions) and the types C<isl_dim_in>
895 and C<isl_dim_out> refer to input and output dimensions
896 (for spaces with two tuples of dimensions).
897 Local spaces (see L</"Local Spaces">) also contain dimensions
898 of type C<isl_dim_div>.
899 Note that parameters are only identified by their position within
900 a given object. Across different objects, parameters are (usually)
901 identified by their names or identifiers. Only unnamed parameters
902 are identified by their positions across objects. The use of unnamed
903 parameters is discouraged.
905 #include <isl/space.h>
906 __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
907 unsigned nparam, unsigned n_in, unsigned n_out);
908 __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
910 __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
911 unsigned nparam, unsigned dim);
912 __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
913 __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
915 The space used for creating a parameter domain
916 needs to be created using C<isl_space_params_alloc>.
917 For other sets, the space
918 needs to be created using C<isl_space_set_alloc>, while
919 for a relation, the space
920 needs to be created using C<isl_space_alloc>.
922 To check whether a given space is that of a set or a map
923 or whether it is a parameter space, use these functions:
925 #include <isl/space.h>
926 isl_bool isl_space_is_params(__isl_keep isl_space *space);
927 isl_bool isl_space_is_set(__isl_keep isl_space *space);
928 isl_bool isl_space_is_map(__isl_keep isl_space *space);
930 Spaces can be compared using the following functions:
932 #include <isl/space.h>
933 isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
934 __isl_keep isl_space *space2);
935 isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
936 __isl_keep isl_space *space2);
937 isl_bool isl_space_is_range(__isl_keep isl_space *space1,
938 __isl_keep isl_space *space2);
939 isl_bool isl_space_tuple_is_equal(
940 __isl_keep isl_space *space1,
941 enum isl_dim_type type1,
942 __isl_keep isl_space *space2,
943 enum isl_dim_type type2);
945 C<isl_space_is_domain> checks whether the first argument is equal
946 to the domain of the second argument. This requires in particular that
947 the first argument is a set space and that the second argument
948 is a map space. C<isl_space_tuple_is_equal> checks whether the given
949 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
950 spaces are the same. That is, it checks if they have the same
951 identifier (if any), the same dimension and the same internal structure
954 It is often useful to create objects that live in the
955 same space as some other object. This can be accomplished
956 by creating the new objects
957 (see L</"Creating New Sets and Relations"> or
958 L</"Functions">) based on the space
959 of the original object.
962 __isl_give isl_space *isl_basic_set_get_space(
963 __isl_keep isl_basic_set *bset);
964 __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
966 #include <isl/union_set.h>
967 __isl_give isl_space *isl_union_set_get_space(
968 __isl_keep isl_union_set *uset);
971 __isl_give isl_space *isl_basic_map_get_space(
972 __isl_keep isl_basic_map *bmap);
973 __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
975 #include <isl/union_map.h>
976 __isl_give isl_space *isl_union_map_get_space(
977 __isl_keep isl_union_map *umap);
979 #include <isl/constraint.h>
980 __isl_give isl_space *isl_constraint_get_space(
981 __isl_keep isl_constraint *constraint);
983 #include <isl/polynomial.h>
984 __isl_give isl_space *isl_qpolynomial_get_domain_space(
985 __isl_keep isl_qpolynomial *qp);
986 __isl_give isl_space *isl_qpolynomial_get_space(
987 __isl_keep isl_qpolynomial *qp);
988 __isl_give isl_space *isl_qpolynomial_fold_get_space(
989 __isl_keep isl_qpolynomial_fold *fold);
990 __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
991 __isl_keep isl_pw_qpolynomial *pwqp);
992 __isl_give isl_space *isl_pw_qpolynomial_get_space(
993 __isl_keep isl_pw_qpolynomial *pwqp);
994 __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
995 __isl_keep isl_pw_qpolynomial_fold *pwf);
996 __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
997 __isl_keep isl_pw_qpolynomial_fold *pwf);
998 __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
999 __isl_keep isl_union_pw_qpolynomial *upwqp);
1000 __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1001 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1003 #include <isl/val.h>
1004 __isl_give isl_space *isl_multi_val_get_space(
1005 __isl_keep isl_multi_val *mv);
1007 #include <isl/aff.h>
1008 __isl_give isl_space *isl_aff_get_domain_space(
1009 __isl_keep isl_aff *aff);
1010 __isl_give isl_space *isl_aff_get_space(
1011 __isl_keep isl_aff *aff);
1012 __isl_give isl_space *isl_pw_aff_get_domain_space(
1013 __isl_keep isl_pw_aff *pwaff);
1014 __isl_give isl_space *isl_pw_aff_get_space(
1015 __isl_keep isl_pw_aff *pwaff);
1016 __isl_give isl_space *isl_multi_aff_get_domain_space(
1017 __isl_keep isl_multi_aff *maff);
1018 __isl_give isl_space *isl_multi_aff_get_space(
1019 __isl_keep isl_multi_aff *maff);
1020 __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1021 __isl_keep isl_pw_multi_aff *pma);
1022 __isl_give isl_space *isl_pw_multi_aff_get_space(
1023 __isl_keep isl_pw_multi_aff *pma);
1024 __isl_give isl_space *isl_union_pw_aff_get_space(
1025 __isl_keep isl_union_pw_aff *upa);
1026 __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1027 __isl_keep isl_union_pw_multi_aff *upma);
1028 __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1029 __isl_keep isl_multi_pw_aff *mpa);
1030 __isl_give isl_space *isl_multi_pw_aff_get_space(
1031 __isl_keep isl_multi_pw_aff *mpa);
1032 __isl_give isl_space *
1033 isl_multi_union_pw_aff_get_domain_space(
1034 __isl_keep isl_multi_union_pw_aff *mupa);
1035 __isl_give isl_space *
1036 isl_multi_union_pw_aff_get_space(
1037 __isl_keep isl_multi_union_pw_aff *mupa);
1039 #include <isl/point.h>
1040 __isl_give isl_space *isl_point_get_space(
1041 __isl_keep isl_point *pnt);
1043 The number of dimensions of a given type of space
1044 may be read off from a space or an object that lives
1045 in a space using the following functions.
1046 In case of C<isl_space_dim>, type may be
1047 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1048 C<isl_dim_out> (only for relations), C<isl_dim_set>
1049 (only for sets) or C<isl_dim_all>.
1051 #include <isl/space.h>
1052 unsigned isl_space_dim(__isl_keep isl_space *space,
1053 enum isl_dim_type type);
1055 #include <isl/local_space.h>
1056 int isl_local_space_dim(__isl_keep isl_local_space *ls,
1057 enum isl_dim_type type);
1059 #include <isl/set.h>
1060 unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1061 enum isl_dim_type type);
1062 unsigned isl_set_dim(__isl_keep isl_set *set,
1063 enum isl_dim_type type);
1065 #include <isl/union_set.h>
1066 unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1067 enum isl_dim_type type);
1069 #include <isl/map.h>
1070 unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1071 enum isl_dim_type type);
1072 unsigned isl_map_dim(__isl_keep isl_map *map,
1073 enum isl_dim_type type);
1075 #include <isl/union_map.h>
1076 unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1077 enum isl_dim_type type);
1079 #include <isl/val.h>
1080 unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1081 enum isl_dim_type type);
1083 #include <isl/aff.h>
1084 int isl_aff_dim(__isl_keep isl_aff *aff,
1085 enum isl_dim_type type);
1086 unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1087 enum isl_dim_type type);
1088 unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1089 enum isl_dim_type type);
1090 unsigned isl_pw_multi_aff_dim(
1091 __isl_keep isl_pw_multi_aff *pma,
1092 enum isl_dim_type type);
1093 unsigned isl_multi_pw_aff_dim(
1094 __isl_keep isl_multi_pw_aff *mpa,
1095 enum isl_dim_type type);
1096 unsigned isl_union_pw_aff_dim(
1097 __isl_keep isl_union_pw_aff *upa,
1098 enum isl_dim_type type);
1099 unsigned isl_union_pw_multi_aff_dim(
1100 __isl_keep isl_union_pw_multi_aff *upma,
1101 enum isl_dim_type type);
1102 unsigned isl_multi_union_pw_aff_dim(
1103 __isl_keep isl_multi_union_pw_aff *mupa,
1104 enum isl_dim_type type);
1106 #include <isl/polynomial.h>
1107 unsigned isl_union_pw_qpolynomial_dim(
1108 __isl_keep isl_union_pw_qpolynomial *upwqp,
1109 enum isl_dim_type type);
1110 unsigned isl_union_pw_qpolynomial_fold_dim(
1111 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1112 enum isl_dim_type type);
1114 Note that an C<isl_union_set>, an C<isl_union_map>,
1115 an C<isl_union_pw_multi_aff>,
1116 an C<isl_union_pw_qpolynomial> and
1117 an C<isl_union_pw_qpolynomial_fold>
1118 only have parameters.
1120 The identifiers or names of the individual dimensions of spaces
1121 may be set or read off using the following functions on spaces
1122 or objects that live in spaces.
1123 These functions are mostly useful to obtain the identifiers, positions
1124 or names of the parameters. Identifiers of individual dimensions are
1125 essentially only useful for printing. They are ignored by all other
1126 operations and may not be preserved across those operations.
1128 #include <isl/space.h>
1129 __isl_give isl_space *isl_space_set_dim_id(
1130 __isl_take isl_space *space,
1131 enum isl_dim_type type, unsigned pos,
1132 __isl_take isl_id *id);
1133 isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1134 enum isl_dim_type type, unsigned pos);
1135 __isl_give isl_id *isl_space_get_dim_id(
1136 __isl_keep isl_space *space,
1137 enum isl_dim_type type, unsigned pos);
1138 __isl_give isl_space *isl_space_set_dim_name(
1139 __isl_take isl_space *space,
1140 enum isl_dim_type type, unsigned pos,
1141 __isl_keep const char *name);
1142 isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1143 enum isl_dim_type type, unsigned pos);
1144 __isl_keep const char *isl_space_get_dim_name(
1145 __isl_keep isl_space *space,
1146 enum isl_dim_type type, unsigned pos);
1148 #include <isl/local_space.h>
1149 __isl_give isl_local_space *isl_local_space_set_dim_id(
1150 __isl_take isl_local_space *ls,
1151 enum isl_dim_type type, unsigned pos,
1152 __isl_take isl_id *id);
1153 isl_bool isl_local_space_has_dim_id(
1154 __isl_keep isl_local_space *ls,
1155 enum isl_dim_type type, unsigned pos);
1156 __isl_give isl_id *isl_local_space_get_dim_id(
1157 __isl_keep isl_local_space *ls,
1158 enum isl_dim_type type, unsigned pos);
1159 __isl_give isl_local_space *isl_local_space_set_dim_name(
1160 __isl_take isl_local_space *ls,
1161 enum isl_dim_type type, unsigned pos, const char *s);
1162 isl_bool isl_local_space_has_dim_name(
1163 __isl_keep isl_local_space *ls,
1164 enum isl_dim_type type, unsigned pos)
1165 const char *isl_local_space_get_dim_name(
1166 __isl_keep isl_local_space *ls,
1167 enum isl_dim_type type, unsigned pos);
1169 #include <isl/constraint.h>
1170 const char *isl_constraint_get_dim_name(
1171 __isl_keep isl_constraint *constraint,
1172 enum isl_dim_type type, unsigned pos);
1174 #include <isl/set.h>
1175 __isl_give isl_id *isl_basic_set_get_dim_id(
1176 __isl_keep isl_basic_set *bset,
1177 enum isl_dim_type type, unsigned pos);
1178 __isl_give isl_set *isl_set_set_dim_id(
1179 __isl_take isl_set *set, enum isl_dim_type type,
1180 unsigned pos, __isl_take isl_id *id);
1181 isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1182 enum isl_dim_type type, unsigned pos);
1183 __isl_give isl_id *isl_set_get_dim_id(
1184 __isl_keep isl_set *set, enum isl_dim_type type,
1186 const char *isl_basic_set_get_dim_name(
1187 __isl_keep isl_basic_set *bset,
1188 enum isl_dim_type type, unsigned pos);
1189 isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1190 enum isl_dim_type type, unsigned pos);
1191 const char *isl_set_get_dim_name(
1192 __isl_keep isl_set *set,
1193 enum isl_dim_type type, unsigned pos);
1195 #include <isl/map.h>
1196 __isl_give isl_map *isl_map_set_dim_id(
1197 __isl_take isl_map *map, enum isl_dim_type type,
1198 unsigned pos, __isl_take isl_id *id);
1199 isl_bool isl_basic_map_has_dim_id(
1200 __isl_keep isl_basic_map *bmap,
1201 enum isl_dim_type type, unsigned pos);
1202 isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1203 enum isl_dim_type type, unsigned pos);
1204 __isl_give isl_id *isl_map_get_dim_id(
1205 __isl_keep isl_map *map, enum isl_dim_type type,
1207 __isl_give isl_id *isl_union_map_get_dim_id(
1208 __isl_keep isl_union_map *umap,
1209 enum isl_dim_type type, unsigned pos);
1210 const char *isl_basic_map_get_dim_name(
1211 __isl_keep isl_basic_map *bmap,
1212 enum isl_dim_type type, unsigned pos);
1213 isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1214 enum isl_dim_type type, unsigned pos);
1215 const char *isl_map_get_dim_name(
1216 __isl_keep isl_map *map,
1217 enum isl_dim_type type, unsigned pos);
1219 #include <isl/val.h>
1220 __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1221 __isl_take isl_multi_val *mv,
1222 enum isl_dim_type type, unsigned pos,
1223 __isl_take isl_id *id);
1224 __isl_give isl_id *isl_multi_val_get_dim_id(
1225 __isl_keep isl_multi_val *mv,
1226 enum isl_dim_type type, unsigned pos);
1227 __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1228 __isl_take isl_multi_val *mv,
1229 enum isl_dim_type type, unsigned pos, const char *s);
1231 #include <isl/aff.h>
1232 __isl_give isl_aff *isl_aff_set_dim_id(
1233 __isl_take isl_aff *aff, enum isl_dim_type type,
1234 unsigned pos, __isl_take isl_id *id);
1235 __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1236 __isl_take isl_multi_aff *maff,
1237 enum isl_dim_type type, unsigned pos,
1238 __isl_take isl_id *id);
1239 __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1240 __isl_take isl_pw_aff *pma,
1241 enum isl_dim_type type, unsigned pos,
1242 __isl_take isl_id *id);
1243 __isl_give isl_multi_pw_aff *
1244 isl_multi_pw_aff_set_dim_id(
1245 __isl_take isl_multi_pw_aff *mpa,
1246 enum isl_dim_type type, unsigned pos,
1247 __isl_take isl_id *id);
1248 __isl_give isl_multi_union_pw_aff *
1249 isl_multi_union_pw_aff_set_dim_id(
1250 __isl_take isl_multi_union_pw_aff *mupa,
1251 enum isl_dim_type type, unsigned pos,
1252 __isl_take isl_id *id);
1253 __isl_give isl_id *isl_multi_aff_get_dim_id(
1254 __isl_keep isl_multi_aff *ma,
1255 enum isl_dim_type type, unsigned pos);
1256 isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1257 enum isl_dim_type type, unsigned pos);
1258 __isl_give isl_id *isl_pw_aff_get_dim_id(
1259 __isl_keep isl_pw_aff *pa,
1260 enum isl_dim_type type, unsigned pos);
1261 __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1262 __isl_keep isl_pw_multi_aff *pma,
1263 enum isl_dim_type type, unsigned pos);
1264 __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1265 __isl_keep isl_multi_pw_aff *mpa,
1266 enum isl_dim_type type, unsigned pos);
1267 __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1268 __isl_keep isl_multi_union_pw_aff *mupa,
1269 enum isl_dim_type type, unsigned pos);
1270 __isl_give isl_aff *isl_aff_set_dim_name(
1271 __isl_take isl_aff *aff, enum isl_dim_type type,
1272 unsigned pos, const char *s);
1273 __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1274 __isl_take isl_multi_aff *maff,
1275 enum isl_dim_type type, unsigned pos, const char *s);
1276 __isl_give isl_multi_pw_aff *
1277 isl_multi_pw_aff_set_dim_name(
1278 __isl_take isl_multi_pw_aff *mpa,
1279 enum isl_dim_type type, unsigned pos, const char *s);
1280 __isl_give isl_union_pw_aff *
1281 isl_union_pw_aff_set_dim_name(
1282 __isl_take isl_union_pw_aff *upa,
1283 enum isl_dim_type type, unsigned pos,
1285 __isl_give isl_union_pw_multi_aff *
1286 isl_union_pw_multi_aff_set_dim_name(
1287 __isl_take isl_union_pw_multi_aff *upma,
1288 enum isl_dim_type type, unsigned pos,
1290 __isl_give isl_multi_union_pw_aff *
1291 isl_multi_union_pw_aff_set_dim_name(
1292 __isl_take isl_multi_union_pw_aff *mupa,
1293 enum isl_dim_type type, unsigned pos,
1294 const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1295 enum isl_dim_type type, unsigned pos);
1296 const char *isl_pw_aff_get_dim_name(
1297 __isl_keep isl_pw_aff *pa,
1298 enum isl_dim_type type, unsigned pos);
1299 const char *isl_pw_multi_aff_get_dim_name(
1300 __isl_keep isl_pw_multi_aff *pma,
1301 enum isl_dim_type type, unsigned pos);
1303 #include <isl/polynomial.h>
1304 __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1305 __isl_take isl_qpolynomial *qp,
1306 enum isl_dim_type type, unsigned pos,
1308 __isl_give isl_pw_qpolynomial *
1309 isl_pw_qpolynomial_set_dim_name(
1310 __isl_take isl_pw_qpolynomial *pwqp,
1311 enum isl_dim_type type, unsigned pos,
1313 __isl_give isl_pw_qpolynomial_fold *
1314 isl_pw_qpolynomial_fold_set_dim_name(
1315 __isl_take isl_pw_qpolynomial_fold *pwf,
1316 enum isl_dim_type type, unsigned pos,
1318 __isl_give isl_union_pw_qpolynomial *
1319 isl_union_pw_qpolynomial_set_dim_name(
1320 __isl_take isl_union_pw_qpolynomial *upwqp,
1321 enum isl_dim_type type, unsigned pos,
1323 __isl_give isl_union_pw_qpolynomial_fold *
1324 isl_union_pw_qpolynomial_fold_set_dim_name(
1325 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1326 enum isl_dim_type type, unsigned pos,
1329 Note that C<isl_space_get_name> returns a pointer to some internal
1330 data structure, so the result can only be used while the
1331 corresponding C<isl_space> is alive.
1332 Also note that every function that operates on two sets or relations
1333 requires that both arguments have the same parameters. This also
1334 means that if one of the arguments has named parameters, then the
1335 other needs to have named parameters too and the names need to match.
1336 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1337 arguments may have different parameters (as long as they are named),
1338 in which case the result will have as parameters the union of the parameters of
1341 Given the identifier or name of a dimension (typically a parameter),
1342 its position can be obtained from the following functions.
1344 #include <isl/space.h>
1345 int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1346 enum isl_dim_type type, __isl_keep isl_id *id);
1347 int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1348 enum isl_dim_type type, const char *name);
1350 #include <isl/local_space.h>
1351 int isl_local_space_find_dim_by_name(
1352 __isl_keep isl_local_space *ls,
1353 enum isl_dim_type type, const char *name);
1355 #include <isl/val.h>
1356 int isl_multi_val_find_dim_by_id(
1357 __isl_keep isl_multi_val *mv,
1358 enum isl_dim_type type, __isl_keep isl_id *id);
1359 int isl_multi_val_find_dim_by_name(
1360 __isl_keep isl_multi_val *mv,
1361 enum isl_dim_type type, const char *name);
1363 #include <isl/set.h>
1364 int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1365 enum isl_dim_type type, __isl_keep isl_id *id);
1366 int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1367 enum isl_dim_type type, const char *name);
1369 #include <isl/map.h>
1370 int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1371 enum isl_dim_type type, __isl_keep isl_id *id);
1372 int isl_basic_map_find_dim_by_name(
1373 __isl_keep isl_basic_map *bmap,
1374 enum isl_dim_type type, const char *name);
1375 int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1376 enum isl_dim_type type, const char *name);
1377 int isl_union_map_find_dim_by_name(
1378 __isl_keep isl_union_map *umap,
1379 enum isl_dim_type type, const char *name);
1381 #include <isl/aff.h>
1382 int isl_multi_aff_find_dim_by_id(
1383 __isl_keep isl_multi_aff *ma,
1384 enum isl_dim_type type, __isl_keep isl_id *id);
1385 int isl_multi_pw_aff_find_dim_by_id(
1386 __isl_keep isl_multi_pw_aff *mpa,
1387 enum isl_dim_type type, __isl_keep isl_id *id);
1388 int isl_multi_union_pw_aff_find_dim_by_id(
1389 __isl_keep isl_union_multi_pw_aff *mupa,
1390 enum isl_dim_type type, __isl_keep isl_id *id);
1391 int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1392 enum isl_dim_type type, const char *name);
1393 int isl_multi_aff_find_dim_by_name(
1394 __isl_keep isl_multi_aff *ma,
1395 enum isl_dim_type type, const char *name);
1396 int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1397 enum isl_dim_type type, const char *name);
1398 int isl_multi_pw_aff_find_dim_by_name(
1399 __isl_keep isl_multi_pw_aff *mpa,
1400 enum isl_dim_type type, const char *name);
1401 int isl_pw_multi_aff_find_dim_by_name(
1402 __isl_keep isl_pw_multi_aff *pma,
1403 enum isl_dim_type type, const char *name);
1404 int isl_union_pw_aff_find_dim_by_name(
1405 __isl_keep isl_union_pw_aff *upa,
1406 enum isl_dim_type type, const char *name);
1407 int isl_union_pw_multi_aff_find_dim_by_name(
1408 __isl_keep isl_union_pw_multi_aff *upma,
1409 enum isl_dim_type type, const char *name);
1410 int isl_multi_union_pw_aff_find_dim_by_name(
1411 __isl_keep isl_multi_union_pw_aff *mupa,
1412 enum isl_dim_type type, const char *name);
1414 #include <isl/polynomial.h>
1415 int isl_pw_qpolynomial_find_dim_by_name(
1416 __isl_keep isl_pw_qpolynomial *pwqp,
1417 enum isl_dim_type type, const char *name);
1418 int isl_pw_qpolynomial_fold_find_dim_by_name(
1419 __isl_keep isl_pw_qpolynomial_fold *pwf,
1420 enum isl_dim_type type, const char *name);
1421 int isl_union_pw_qpolynomial_find_dim_by_name(
1422 __isl_keep isl_union_pw_qpolynomial *upwqp,
1423 enum isl_dim_type type, const char *name);
1424 int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1425 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1426 enum isl_dim_type type, const char *name);
1428 The identifiers or names of entire spaces may be set or read off
1429 using the following functions.
1431 #include <isl/space.h>
1432 __isl_give isl_space *isl_space_set_tuple_id(
1433 __isl_take isl_space *space,
1434 enum isl_dim_type type, __isl_take isl_id *id);
1435 __isl_give isl_space *isl_space_reset_tuple_id(
1436 __isl_take isl_space *space, enum isl_dim_type type);
1437 isl_bool isl_space_has_tuple_id(
1438 __isl_keep isl_space *space,
1439 enum isl_dim_type type);
1440 __isl_give isl_id *isl_space_get_tuple_id(
1441 __isl_keep isl_space *space, enum isl_dim_type type);
1442 __isl_give isl_space *isl_space_set_tuple_name(
1443 __isl_take isl_space *space,
1444 enum isl_dim_type type, const char *s);
1445 isl_bool isl_space_has_tuple_name(
1446 __isl_keep isl_space *space,
1447 enum isl_dim_type type);
1448 const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1449 enum isl_dim_type type);
1451 #include <isl/local_space.h>
1452 __isl_give isl_local_space *isl_local_space_set_tuple_id(
1453 __isl_take isl_local_space *ls,
1454 enum isl_dim_type type, __isl_take isl_id *id);
1456 #include <isl/set.h>
1457 __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1458 __isl_take isl_basic_set *bset,
1459 __isl_take isl_id *id);
1460 __isl_give isl_set *isl_set_set_tuple_id(
1461 __isl_take isl_set *set, __isl_take isl_id *id);
1462 __isl_give isl_set *isl_set_reset_tuple_id(
1463 __isl_take isl_set *set);
1464 isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1465 __isl_give isl_id *isl_set_get_tuple_id(
1466 __isl_keep isl_set *set);
1467 __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1468 __isl_take isl_basic_set *set, const char *s);
1469 __isl_give isl_set *isl_set_set_tuple_name(
1470 __isl_take isl_set *set, const char *s);
1471 const char *isl_basic_set_get_tuple_name(
1472 __isl_keep isl_basic_set *bset);
1473 isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1474 const char *isl_set_get_tuple_name(
1475 __isl_keep isl_set *set);
1477 #include <isl/map.h>
1478 __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1479 __isl_take isl_basic_map *bmap,
1480 enum isl_dim_type type, __isl_take isl_id *id);
1481 __isl_give isl_map *isl_map_set_tuple_id(
1482 __isl_take isl_map *map, enum isl_dim_type type,
1483 __isl_take isl_id *id);
1484 __isl_give isl_map *isl_map_reset_tuple_id(
1485 __isl_take isl_map *map, enum isl_dim_type type);
1486 isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1487 enum isl_dim_type type);
1488 __isl_give isl_id *isl_map_get_tuple_id(
1489 __isl_keep isl_map *map, enum isl_dim_type type);
1490 __isl_give isl_map *isl_map_set_tuple_name(
1491 __isl_take isl_map *map,
1492 enum isl_dim_type type, const char *s);
1493 const char *isl_basic_map_get_tuple_name(
1494 __isl_keep isl_basic_map *bmap,
1495 enum isl_dim_type type);
1496 __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1497 __isl_take isl_basic_map *bmap,
1498 enum isl_dim_type type, const char *s);
1499 isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1500 enum isl_dim_type type);
1501 const char *isl_map_get_tuple_name(
1502 __isl_keep isl_map *map,
1503 enum isl_dim_type type);
1505 #include <isl/val.h>
1506 __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1507 __isl_take isl_multi_val *mv,
1508 enum isl_dim_type type, __isl_take isl_id *id);
1509 __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1510 __isl_take isl_multi_val *mv,
1511 enum isl_dim_type type);
1512 isl_bool isl_multi_val_has_tuple_id(
1513 __isl_keep isl_multi_val *mv,
1514 enum isl_dim_type type);
1515 __isl_give isl_id *isl_multi_val_get_tuple_id(
1516 __isl_keep isl_multi_val *mv,
1517 enum isl_dim_type type);
1518 __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1519 __isl_take isl_multi_val *mv,
1520 enum isl_dim_type type, const char *s);
1521 const char *isl_multi_val_get_tuple_name(
1522 __isl_keep isl_multi_val *mv,
1523 enum isl_dim_type type);
1525 #include <isl/aff.h>
1526 __isl_give isl_aff *isl_aff_set_tuple_id(
1527 __isl_take isl_aff *aff,
1528 enum isl_dim_type type, __isl_take isl_id *id);
1529 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1530 __isl_take isl_multi_aff *maff,
1531 enum isl_dim_type type, __isl_take isl_id *id);
1532 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1533 __isl_take isl_pw_aff *pwaff,
1534 enum isl_dim_type type, __isl_take isl_id *id);
1535 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1536 __isl_take isl_pw_multi_aff *pma,
1537 enum isl_dim_type type, __isl_take isl_id *id);
1538 __isl_give isl_multi_union_pw_aff *
1539 isl_multi_union_pw_aff_set_tuple_id(
1540 __isl_take isl_multi_union_pw_aff *mupa,
1541 enum isl_dim_type type, __isl_take isl_id *id);
1542 __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1543 __isl_take isl_multi_aff *ma,
1544 enum isl_dim_type type);
1545 __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1546 __isl_take isl_pw_aff *pa,
1547 enum isl_dim_type type);
1548 __isl_give isl_multi_pw_aff *
1549 isl_multi_pw_aff_reset_tuple_id(
1550 __isl_take isl_multi_pw_aff *mpa,
1551 enum isl_dim_type type);
1552 __isl_give isl_pw_multi_aff *
1553 isl_pw_multi_aff_reset_tuple_id(
1554 __isl_take isl_pw_multi_aff *pma,
1555 enum isl_dim_type type);
1556 __isl_give isl_multi_union_pw_aff *
1557 isl_multi_union_pw_aff_reset_tuple_id(
1558 __isl_take isl_multi_union_pw_aff *mupa,
1559 enum isl_dim_type type);
1560 isl_bool isl_multi_aff_has_tuple_id(
1561 __isl_keep isl_multi_aff *ma,
1562 enum isl_dim_type type);
1563 __isl_give isl_id *isl_multi_aff_get_tuple_id(
1564 __isl_keep isl_multi_aff *ma,
1565 enum isl_dim_type type);
1566 isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1567 enum isl_dim_type type);
1568 __isl_give isl_id *isl_pw_aff_get_tuple_id(
1569 __isl_keep isl_pw_aff *pa,
1570 enum isl_dim_type type);
1571 isl_bool isl_pw_multi_aff_has_tuple_id(
1572 __isl_keep isl_pw_multi_aff *pma,
1573 enum isl_dim_type type);
1574 __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1575 __isl_keep isl_pw_multi_aff *pma,
1576 enum isl_dim_type type);
1577 isl_bool isl_multi_pw_aff_has_tuple_id(
1578 __isl_keep isl_multi_pw_aff *mpa,
1579 enum isl_dim_type type);
1580 __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1581 __isl_keep isl_multi_pw_aff *mpa,
1582 enum isl_dim_type type);
1583 isl_bool isl_multi_union_pw_aff_has_tuple_id(
1584 __isl_keep isl_multi_union_pw_aff *mupa,
1585 enum isl_dim_type type);
1586 __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1587 __isl_keep isl_multi_union_pw_aff *mupa,
1588 enum isl_dim_type type);
1589 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1590 __isl_take isl_multi_aff *maff,
1591 enum isl_dim_type type, const char *s);
1592 __isl_give isl_multi_pw_aff *
1593 isl_multi_pw_aff_set_tuple_name(
1594 __isl_take isl_multi_pw_aff *mpa,
1595 enum isl_dim_type type, const char *s);
1596 __isl_give isl_multi_union_pw_aff *
1597 isl_multi_union_pw_aff_set_tuple_name(
1598 __isl_take isl_multi_union_pw_aff *mupa,
1599 enum isl_dim_type type, const char *s);
1600 const char *isl_multi_aff_get_tuple_name(
1601 __isl_keep isl_multi_aff *multi,
1602 enum isl_dim_type type);
1603 isl_bool isl_pw_multi_aff_has_tuple_name(
1604 __isl_keep isl_pw_multi_aff *pma,
1605 enum isl_dim_type type);
1606 const char *isl_pw_multi_aff_get_tuple_name(
1607 __isl_keep isl_pw_multi_aff *pma,
1608 enum isl_dim_type type);
1609 const char *isl_multi_union_pw_aff_get_tuple_name(
1610 __isl_keep isl_multi_union_pw_aff *mupa,
1611 enum isl_dim_type type);
1613 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1614 or C<isl_dim_set>. As with C<isl_space_get_name>,
1615 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1617 Binary operations require the corresponding spaces of their arguments
1618 to have the same name.
1620 To keep the names of all parameters and tuples, but reset the user pointers
1621 of all the corresponding identifiers, use the following function.
1623 #include <isl/space.h>
1624 __isl_give isl_space *isl_space_reset_user(
1625 __isl_take isl_space *space);
1627 #include <isl/set.h>
1628 __isl_give isl_set *isl_set_reset_user(
1629 __isl_take isl_set *set);
1631 #include <isl/map.h>
1632 __isl_give isl_map *isl_map_reset_user(
1633 __isl_take isl_map *map);
1635 #include <isl/union_set.h>
1636 __isl_give isl_union_set *isl_union_set_reset_user(
1637 __isl_take isl_union_set *uset);
1639 #include <isl/union_map.h>
1640 __isl_give isl_union_map *isl_union_map_reset_user(
1641 __isl_take isl_union_map *umap);
1643 #include <isl/val.h>
1644 __isl_give isl_multi_val *isl_multi_val_reset_user(
1645 __isl_take isl_multi_val *mv);
1647 #include <isl/aff.h>
1648 __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1649 __isl_take isl_multi_aff *ma);
1650 __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1651 __isl_take isl_pw_aff *pa);
1652 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1653 __isl_take isl_multi_pw_aff *mpa);
1654 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1655 __isl_take isl_pw_multi_aff *pma);
1656 __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1657 __isl_take isl_union_pw_aff *upa);
1658 __isl_give isl_multi_union_pw_aff *
1659 isl_multi_union_pw_aff_reset_user(
1660 __isl_take isl_multi_union_pw_aff *mupa);
1661 __isl_give isl_union_pw_multi_aff *
1662 isl_union_pw_multi_aff_reset_user(
1663 __isl_take isl_union_pw_multi_aff *upma);
1665 #include <isl/polynomial.h>
1666 __isl_give isl_pw_qpolynomial *
1667 isl_pw_qpolynomial_reset_user(
1668 __isl_take isl_pw_qpolynomial *pwqp);
1669 __isl_give isl_union_pw_qpolynomial *
1670 isl_union_pw_qpolynomial_reset_user(
1671 __isl_take isl_union_pw_qpolynomial *upwqp);
1672 __isl_give isl_pw_qpolynomial_fold *
1673 isl_pw_qpolynomial_fold_reset_user(
1674 __isl_take isl_pw_qpolynomial_fold *pwf);
1675 __isl_give isl_union_pw_qpolynomial_fold *
1676 isl_union_pw_qpolynomial_fold_reset_user(
1677 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1679 Spaces can be nested. In particular, the domain of a set or
1680 the domain or range of a relation can be a nested relation.
1681 This process is also called I<wrapping>.
1682 The functions for detecting, constructing and deconstructing
1683 such nested spaces can be found in the wrapping properties
1684 of L</"Unary Properties">, the wrapping operations
1685 of L</"Unary Operations"> and the Cartesian product operations
1686 of L</"Basic Operations">.
1688 Spaces can be created from other spaces
1689 using the functions described in L</"Unary Operations">
1690 and L</"Binary Operations">.
1694 A local space is essentially a space with
1695 zero or more existentially quantified variables.
1696 The local space of various objects can be obtained
1697 using the following functions.
1699 #include <isl/constraint.h>
1700 __isl_give isl_local_space *isl_constraint_get_local_space(
1701 __isl_keep isl_constraint *constraint);
1703 #include <isl/set.h>
1704 __isl_give isl_local_space *isl_basic_set_get_local_space(
1705 __isl_keep isl_basic_set *bset);
1707 #include <isl/map.h>
1708 __isl_give isl_local_space *isl_basic_map_get_local_space(
1709 __isl_keep isl_basic_map *bmap);
1711 #include <isl/aff.h>
1712 __isl_give isl_local_space *isl_aff_get_domain_local_space(
1713 __isl_keep isl_aff *aff);
1714 __isl_give isl_local_space *isl_aff_get_local_space(
1715 __isl_keep isl_aff *aff);
1717 A new local space can be created from a space using
1719 #include <isl/local_space.h>
1720 __isl_give isl_local_space *isl_local_space_from_space(
1721 __isl_take isl_space *space);
1723 They can be inspected, modified, copied and freed using the following functions.
1725 #include <isl/local_space.h>
1726 isl_bool isl_local_space_is_params(
1727 __isl_keep isl_local_space *ls);
1728 isl_bool isl_local_space_is_set(
1729 __isl_keep isl_local_space *ls);
1730 __isl_give isl_space *isl_local_space_get_space(
1731 __isl_keep isl_local_space *ls);
1732 __isl_give isl_aff *isl_local_space_get_div(
1733 __isl_keep isl_local_space *ls, int pos);
1734 __isl_give isl_local_space *isl_local_space_copy(
1735 __isl_keep isl_local_space *ls);
1736 __isl_null isl_local_space *isl_local_space_free(
1737 __isl_take isl_local_space *ls);
1739 Note that C<isl_local_space_get_div> can only be used on local spaces
1742 Two local spaces can be compared using
1744 isl_bool isl_local_space_is_equal(
1745 __isl_keep isl_local_space *ls1,
1746 __isl_keep isl_local_space *ls2);
1748 Local spaces can be created from other local spaces
1749 using the functions described in L</"Unary Operations">
1750 and L</"Binary Operations">.
1752 =head2 Creating New Sets and Relations
1754 C<isl> has functions for creating some standard sets and relations.
1758 =item * Empty sets and relations
1760 __isl_give isl_basic_set *isl_basic_set_empty(
1761 __isl_take isl_space *space);
1762 __isl_give isl_basic_map *isl_basic_map_empty(
1763 __isl_take isl_space *space);
1764 __isl_give isl_set *isl_set_empty(
1765 __isl_take isl_space *space);
1766 __isl_give isl_map *isl_map_empty(
1767 __isl_take isl_space *space);
1768 __isl_give isl_union_set *isl_union_set_empty(
1769 __isl_take isl_space *space);
1770 __isl_give isl_union_map *isl_union_map_empty(
1771 __isl_take isl_space *space);
1773 For C<isl_union_set>s and C<isl_union_map>s, the space
1774 is only used to specify the parameters.
1776 =item * Universe sets and relations
1778 __isl_give isl_basic_set *isl_basic_set_universe(
1779 __isl_take isl_space *space);
1780 __isl_give isl_basic_map *isl_basic_map_universe(
1781 __isl_take isl_space *space);
1782 __isl_give isl_set *isl_set_universe(
1783 __isl_take isl_space *space);
1784 __isl_give isl_map *isl_map_universe(
1785 __isl_take isl_space *space);
1786 __isl_give isl_union_set *isl_union_set_universe(
1787 __isl_take isl_union_set *uset);
1788 __isl_give isl_union_map *isl_union_map_universe(
1789 __isl_take isl_union_map *umap);
1791 The sets and relations constructed by the functions above
1792 contain all integer values, while those constructed by the
1793 functions below only contain non-negative values.
1795 __isl_give isl_basic_set *isl_basic_set_nat_universe(
1796 __isl_take isl_space *space);
1797 __isl_give isl_basic_map *isl_basic_map_nat_universe(
1798 __isl_take isl_space *space);
1799 __isl_give isl_set *isl_set_nat_universe(
1800 __isl_take isl_space *space);
1801 __isl_give isl_map *isl_map_nat_universe(
1802 __isl_take isl_space *space);
1804 =item * Identity relations
1806 __isl_give isl_basic_map *isl_basic_map_identity(
1807 __isl_take isl_space *space);
1808 __isl_give isl_map *isl_map_identity(
1809 __isl_take isl_space *space);
1811 The number of input and output dimensions in C<space> needs
1814 =item * Lexicographic order
1816 __isl_give isl_map *isl_map_lex_lt(
1817 __isl_take isl_space *set_space);
1818 __isl_give isl_map *isl_map_lex_le(
1819 __isl_take isl_space *set_space);
1820 __isl_give isl_map *isl_map_lex_gt(
1821 __isl_take isl_space *set_space);
1822 __isl_give isl_map *isl_map_lex_ge(
1823 __isl_take isl_space *set_space);
1824 __isl_give isl_map *isl_map_lex_lt_first(
1825 __isl_take isl_space *space, unsigned n);
1826 __isl_give isl_map *isl_map_lex_le_first(
1827 __isl_take isl_space *space, unsigned n);
1828 __isl_give isl_map *isl_map_lex_gt_first(
1829 __isl_take isl_space *space, unsigned n);
1830 __isl_give isl_map *isl_map_lex_ge_first(
1831 __isl_take isl_space *space, unsigned n);
1833 The first four functions take a space for a B<set>
1834 and return relations that express that the elements in the domain
1835 are lexicographically less
1836 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1837 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1838 than the elements in the range.
1839 The last four functions take a space for a map
1840 and return relations that express that the first C<n> dimensions
1841 in the domain are lexicographically less
1842 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1843 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1844 than the first C<n> dimensions in the range.
1848 A basic set or relation can be converted to a set or relation
1849 using the following functions.
1851 __isl_give isl_set *isl_set_from_basic_set(
1852 __isl_take isl_basic_set *bset);
1853 __isl_give isl_map *isl_map_from_basic_map(
1854 __isl_take isl_basic_map *bmap);
1856 Sets and relations can be converted to union sets and relations
1857 using the following functions.
1859 __isl_give isl_union_set *isl_union_set_from_basic_set(
1860 __isl_take isl_basic_set *bset);
1861 __isl_give isl_union_map *isl_union_map_from_basic_map(
1862 __isl_take isl_basic_map *bmap);
1863 __isl_give isl_union_set *isl_union_set_from_set(
1864 __isl_take isl_set *set);
1865 __isl_give isl_union_map *isl_union_map_from_map(
1866 __isl_take isl_map *map);
1868 The inverse conversions below can only be used if the input
1869 union set or relation is known to contain elements in exactly one
1872 __isl_give isl_set *isl_set_from_union_set(
1873 __isl_take isl_union_set *uset);
1874 __isl_give isl_map *isl_map_from_union_map(
1875 __isl_take isl_union_map *umap);
1877 Sets and relations can be copied and freed again using the following
1880 __isl_give isl_basic_set *isl_basic_set_copy(
1881 __isl_keep isl_basic_set *bset);
1882 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1883 __isl_give isl_union_set *isl_union_set_copy(
1884 __isl_keep isl_union_set *uset);
1885 __isl_give isl_basic_map *isl_basic_map_copy(
1886 __isl_keep isl_basic_map *bmap);
1887 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1888 __isl_give isl_union_map *isl_union_map_copy(
1889 __isl_keep isl_union_map *umap);
1890 __isl_null isl_basic_set *isl_basic_set_free(
1891 __isl_take isl_basic_set *bset);
1892 __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1893 __isl_null isl_union_set *isl_union_set_free(
1894 __isl_take isl_union_set *uset);
1895 __isl_null isl_basic_map *isl_basic_map_free(
1896 __isl_take isl_basic_map *bmap);
1897 __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1898 __isl_null isl_union_map *isl_union_map_free(
1899 __isl_take isl_union_map *umap);
1901 Other sets and relations can be constructed by starting
1902 from a universe set or relation, adding equality and/or
1903 inequality constraints and then projecting out the
1904 existentially quantified variables, if any.
1905 Constraints can be constructed, manipulated and
1906 added to (or removed from) (basic) sets and relations
1907 using the following functions.
1909 #include <isl/constraint.h>
1910 __isl_give isl_constraint *isl_constraint_alloc_equality(
1911 __isl_take isl_local_space *ls);
1912 __isl_give isl_constraint *isl_constraint_alloc_inequality(
1913 __isl_take isl_local_space *ls);
1914 __isl_give isl_constraint *isl_constraint_set_constant_si(
1915 __isl_take isl_constraint *constraint, int v);
1916 __isl_give isl_constraint *isl_constraint_set_constant_val(
1917 __isl_take isl_constraint *constraint,
1918 __isl_take isl_val *v);
1919 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1920 __isl_take isl_constraint *constraint,
1921 enum isl_dim_type type, int pos, int v);
1922 __isl_give isl_constraint *
1923 isl_constraint_set_coefficient_val(
1924 __isl_take isl_constraint *constraint,
1925 enum isl_dim_type type, int pos,
1926 __isl_take isl_val *v);
1927 __isl_give isl_basic_map *isl_basic_map_add_constraint(
1928 __isl_take isl_basic_map *bmap,
1929 __isl_take isl_constraint *constraint);
1930 __isl_give isl_basic_set *isl_basic_set_add_constraint(
1931 __isl_take isl_basic_set *bset,
1932 __isl_take isl_constraint *constraint);
1933 __isl_give isl_map *isl_map_add_constraint(
1934 __isl_take isl_map *map,
1935 __isl_take isl_constraint *constraint);
1936 __isl_give isl_set *isl_set_add_constraint(
1937 __isl_take isl_set *set,
1938 __isl_take isl_constraint *constraint);
1940 For example, to create a set containing the even integers
1941 between 10 and 42, you would use the following code.
1944 isl_local_space *ls;
1946 isl_basic_set *bset;
1948 space = isl_space_set_alloc(ctx, 0, 2);
1949 bset = isl_basic_set_universe(isl_space_copy(space));
1950 ls = isl_local_space_from_space(space);
1952 c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
1953 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1954 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1955 bset = isl_basic_set_add_constraint(bset, c);
1957 c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
1958 c = isl_constraint_set_constant_si(c, -10);
1959 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1960 bset = isl_basic_set_add_constraint(bset, c);
1962 c = isl_constraint_alloc_inequality(ls);
1963 c = isl_constraint_set_constant_si(c, 42);
1964 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1965 bset = isl_basic_set_add_constraint(bset, c);
1967 bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1971 isl_basic_set *bset;
1972 bset = isl_basic_set_read_from_str(ctx,
1973 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1975 A basic set or relation can also be constructed from two matrices
1976 describing the equalities and the inequalities.
1978 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1979 __isl_take isl_space *space,
1980 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1981 enum isl_dim_type c1,
1982 enum isl_dim_type c2, enum isl_dim_type c3,
1983 enum isl_dim_type c4);
1984 __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1985 __isl_take isl_space *space,
1986 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1987 enum isl_dim_type c1,
1988 enum isl_dim_type c2, enum isl_dim_type c3,
1989 enum isl_dim_type c4, enum isl_dim_type c5);
1991 The C<isl_dim_type> arguments indicate the order in which
1992 different kinds of variables appear in the input matrices
1993 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1994 C<isl_dim_set> and C<isl_dim_div> for sets and
1995 of C<isl_dim_cst>, C<isl_dim_param>,
1996 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1998 A (basic or union) set or relation can also be constructed from a
1999 (union) (piecewise) (multiple) affine expression
2000 or a list of affine expressions
2001 (See L</"Functions">).
2003 __isl_give isl_basic_map *isl_basic_map_from_aff(
2004 __isl_take isl_aff *aff);
2005 __isl_give isl_map *isl_map_from_aff(
2006 __isl_take isl_aff *aff);
2007 __isl_give isl_set *isl_set_from_pw_aff(
2008 __isl_take isl_pw_aff *pwaff);
2009 __isl_give isl_map *isl_map_from_pw_aff(
2010 __isl_take isl_pw_aff *pwaff);
2011 __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2012 __isl_take isl_space *domain_space,
2013 __isl_take isl_aff_list *list);
2014 __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2015 __isl_take isl_multi_aff *maff)
2016 __isl_give isl_map *isl_map_from_multi_aff(
2017 __isl_take isl_multi_aff *maff)
2018 __isl_give isl_set *isl_set_from_pw_multi_aff(
2019 __isl_take isl_pw_multi_aff *pma);
2020 __isl_give isl_map *isl_map_from_pw_multi_aff(
2021 __isl_take isl_pw_multi_aff *pma);
2022 __isl_give isl_set *isl_set_from_multi_pw_aff(
2023 __isl_take isl_multi_pw_aff *mpa);
2024 __isl_give isl_map *isl_map_from_multi_pw_aff(
2025 __isl_take isl_multi_pw_aff *mpa);
2026 __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2027 __isl_take isl_union_pw_aff *upa);
2028 __isl_give isl_union_map *
2029 isl_union_map_from_union_pw_multi_aff(
2030 __isl_take isl_union_pw_multi_aff *upma);
2031 __isl_give isl_union_map *
2032 isl_union_map_from_multi_union_pw_aff(
2033 __isl_take isl_multi_union_pw_aff *mupa);
2035 The C<domain_space> argument describes the domain of the resulting
2036 basic relation. It is required because the C<list> may consist
2037 of zero affine expressions.
2038 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2039 is not allowed to be zero-dimensional. The domain of the result
2040 is the shared domain of the union piecewise affine elements.
2042 =head2 Inspecting Sets and Relations
2044 Usually, the user should not have to care about the actual constraints
2045 of the sets and maps, but should instead apply the abstract operations
2046 explained in the following sections.
2047 Occasionally, however, it may be required to inspect the individual
2048 coefficients of the constraints. This section explains how to do so.
2049 In these cases, it may also be useful to have C<isl> compute
2050 an explicit representation of the existentially quantified variables.
2052 __isl_give isl_set *isl_set_compute_divs(
2053 __isl_take isl_set *set);
2054 __isl_give isl_map *isl_map_compute_divs(
2055 __isl_take isl_map *map);
2056 __isl_give isl_union_set *isl_union_set_compute_divs(
2057 __isl_take isl_union_set *uset);
2058 __isl_give isl_union_map *isl_union_map_compute_divs(
2059 __isl_take isl_union_map *umap);
2061 This explicit representation defines the existentially quantified
2062 variables as integer divisions of the other variables, possibly
2063 including earlier existentially quantified variables.
2064 An explicitly represented existentially quantified variable therefore
2065 has a unique value when the values of the other variables are known.
2066 If, furthermore, the same existentials, i.e., existentials
2067 with the same explicit representations, should appear in the
2068 same order in each of the disjuncts of a set or map, then the user should call
2069 either of the following functions.
2071 __isl_give isl_set *isl_set_align_divs(
2072 __isl_take isl_set *set);
2073 __isl_give isl_map *isl_map_align_divs(
2074 __isl_take isl_map *map);
2076 Alternatively, the existentially quantified variables can be removed
2077 using the following functions, which compute an overapproximation.
2079 __isl_give isl_basic_set *isl_basic_set_remove_divs(
2080 __isl_take isl_basic_set *bset);
2081 __isl_give isl_basic_map *isl_basic_map_remove_divs(
2082 __isl_take isl_basic_map *bmap);
2083 __isl_give isl_set *isl_set_remove_divs(
2084 __isl_take isl_set *set);
2085 __isl_give isl_map *isl_map_remove_divs(
2086 __isl_take isl_map *map);
2088 It is also possible to only remove those divs that are defined
2089 in terms of a given range of dimensions or only those for which
2090 no explicit representation is known.
2092 __isl_give isl_basic_set *
2093 isl_basic_set_remove_divs_involving_dims(
2094 __isl_take isl_basic_set *bset,
2095 enum isl_dim_type type,
2096 unsigned first, unsigned n);
2097 __isl_give isl_basic_map *
2098 isl_basic_map_remove_divs_involving_dims(
2099 __isl_take isl_basic_map *bmap,
2100 enum isl_dim_type type,
2101 unsigned first, unsigned n);
2102 __isl_give isl_set *isl_set_remove_divs_involving_dims(
2103 __isl_take isl_set *set, enum isl_dim_type type,
2104 unsigned first, unsigned n);
2105 __isl_give isl_map *isl_map_remove_divs_involving_dims(
2106 __isl_take isl_map *map, enum isl_dim_type type,
2107 unsigned first, unsigned n);
2109 __isl_give isl_basic_set *
2110 isl_basic_set_remove_unknown_divs(
2111 __isl_take isl_basic_set *bset);
2112 __isl_give isl_set *isl_set_remove_unknown_divs(
2113 __isl_take isl_set *set);
2114 __isl_give isl_map *isl_map_remove_unknown_divs(
2115 __isl_take isl_map *map);
2117 To iterate over all the sets or maps in a union set or map, use
2119 isl_stat isl_union_set_foreach_set(
2120 __isl_keep isl_union_set *uset,
2121 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2123 isl_stat isl_union_map_foreach_map(
2124 __isl_keep isl_union_map *umap,
2125 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2128 The number of sets or maps in a union set or map can be obtained
2131 int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2132 int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2134 To extract the set or map in a given space from a union, use
2136 __isl_give isl_set *isl_union_set_extract_set(
2137 __isl_keep isl_union_set *uset,
2138 __isl_take isl_space *space);
2139 __isl_give isl_map *isl_union_map_extract_map(
2140 __isl_keep isl_union_map *umap,
2141 __isl_take isl_space *space);
2143 To iterate over all the basic sets or maps in a set or map, use
2145 isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2146 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2149 isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2150 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2154 The callback function C<fn> should return 0 if successful and
2155 -1 if an error occurs. In the latter case, or if any other error
2156 occurs, the above functions will return -1.
2158 It should be noted that C<isl> does not guarantee that
2159 the basic sets or maps passed to C<fn> are disjoint.
2160 If this is required, then the user should call one of
2161 the following functions first.
2163 __isl_give isl_set *isl_set_make_disjoint(
2164 __isl_take isl_set *set);
2165 __isl_give isl_map *isl_map_make_disjoint(
2166 __isl_take isl_map *map);
2168 The number of basic sets in a set can be obtained
2169 or the number of basic maps in a map can be obtained
2172 #include <isl/set.h>
2173 int isl_set_n_basic_set(__isl_keep isl_set *set);
2175 #include <isl/map.h>
2176 int isl_map_n_basic_map(__isl_keep isl_map *map);
2178 To iterate over the constraints of a basic set or map, use
2180 #include <isl/constraint.h>
2182 int isl_basic_set_n_constraint(
2183 __isl_keep isl_basic_set *bset);
2184 isl_stat isl_basic_set_foreach_constraint(
2185 __isl_keep isl_basic_set *bset,
2186 isl_stat (*fn)(__isl_take isl_constraint *c,
2189 int isl_basic_map_n_constraint(
2190 __isl_keep isl_basic_map *bmap);
2191 isl_stat isl_basic_map_foreach_constraint(
2192 __isl_keep isl_basic_map *bmap,
2193 isl_stat (*fn)(__isl_take isl_constraint *c,
2196 __isl_null isl_constraint *isl_constraint_free(
2197 __isl_take isl_constraint *c);
2199 Again, the callback function C<fn> should return 0 if successful and
2200 -1 if an error occurs. In the latter case, or if any other error
2201 occurs, the above functions will return -1.
2202 The constraint C<c> represents either an equality or an inequality.
2203 Use the following function to find out whether a constraint
2204 represents an equality. If not, it represents an inequality.
2206 isl_bool isl_constraint_is_equality(
2207 __isl_keep isl_constraint *constraint);
2209 It is also possible to obtain a list of constraints from a basic
2212 #include <isl/constraint.h>
2213 __isl_give isl_constraint_list *
2214 isl_basic_map_get_constraint_list(
2215 __isl_keep isl_basic_map *bmap);
2216 __isl_give isl_constraint_list *
2217 isl_basic_set_get_constraint_list(
2218 __isl_keep isl_basic_set *bset);
2220 These functions require that all existentially quantified variables
2221 have an explicit representation.
2222 The returned list can be manipulated using the functions in L<"Lists">.
2224 The coefficients of the constraints can be inspected using
2225 the following functions.
2227 isl_bool isl_constraint_is_lower_bound(
2228 __isl_keep isl_constraint *constraint,
2229 enum isl_dim_type type, unsigned pos);
2230 isl_bool isl_constraint_is_upper_bound(
2231 __isl_keep isl_constraint *constraint,
2232 enum isl_dim_type type, unsigned pos);
2233 __isl_give isl_val *isl_constraint_get_constant_val(
2234 __isl_keep isl_constraint *constraint);
2235 __isl_give isl_val *isl_constraint_get_coefficient_val(
2236 __isl_keep isl_constraint *constraint,
2237 enum isl_dim_type type, int pos);
2239 The explicit representations of the existentially quantified
2240 variables can be inspected using the following function.
2241 Note that the user is only allowed to use this function
2242 if the inspected set or map is the result of a call
2243 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2244 The existentially quantified variable is equal to the floor
2245 of the returned affine expression. The affine expression
2246 itself can be inspected using the functions in
2249 __isl_give isl_aff *isl_constraint_get_div(
2250 __isl_keep isl_constraint *constraint, int pos);
2252 To obtain the constraints of a basic set or map in matrix
2253 form, use the following functions.
2255 __isl_give isl_mat *isl_basic_set_equalities_matrix(
2256 __isl_keep isl_basic_set *bset,
2257 enum isl_dim_type c1, enum isl_dim_type c2,
2258 enum isl_dim_type c3, enum isl_dim_type c4);
2259 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2260 __isl_keep isl_basic_set *bset,
2261 enum isl_dim_type c1, enum isl_dim_type c2,
2262 enum isl_dim_type c3, enum isl_dim_type c4);
2263 __isl_give isl_mat *isl_basic_map_equalities_matrix(
2264 __isl_keep isl_basic_map *bmap,
2265 enum isl_dim_type c1,
2266 enum isl_dim_type c2, enum isl_dim_type c3,
2267 enum isl_dim_type c4, enum isl_dim_type c5);
2268 __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2269 __isl_keep isl_basic_map *bmap,
2270 enum isl_dim_type c1,
2271 enum isl_dim_type c2, enum isl_dim_type c3,
2272 enum isl_dim_type c4, enum isl_dim_type c5);
2274 The C<isl_dim_type> arguments dictate the order in which
2275 different kinds of variables appear in the resulting matrix.
2276 For set inputs, they should be a permutation of
2277 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2278 For map inputs, they should be a permutation of
2279 C<isl_dim_cst>, C<isl_dim_param>,
2280 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2284 Points are elements of a set. They can be used to construct
2285 simple sets (boxes) or they can be used to represent the
2286 individual elements of a set.
2287 The zero point (the origin) can be created using
2289 __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2291 The coordinates of a point can be inspected, set and changed
2294 __isl_give isl_val *isl_point_get_coordinate_val(
2295 __isl_keep isl_point *pnt,
2296 enum isl_dim_type type, int pos);
2297 __isl_give isl_point *isl_point_set_coordinate_val(
2298 __isl_take isl_point *pnt,
2299 enum isl_dim_type type, int pos,
2300 __isl_take isl_val *v);
2302 __isl_give isl_point *isl_point_add_ui(
2303 __isl_take isl_point *pnt,
2304 enum isl_dim_type type, int pos, unsigned val);
2305 __isl_give isl_point *isl_point_sub_ui(
2306 __isl_take isl_point *pnt,
2307 enum isl_dim_type type, int pos, unsigned val);
2309 Points can be copied or freed using
2311 __isl_give isl_point *isl_point_copy(
2312 __isl_keep isl_point *pnt);
2313 void isl_point_free(__isl_take isl_point *pnt);
2315 A singleton set can be created from a point using
2317 __isl_give isl_basic_set *isl_basic_set_from_point(
2318 __isl_take isl_point *pnt);
2319 __isl_give isl_set *isl_set_from_point(
2320 __isl_take isl_point *pnt);
2322 and a box can be created from two opposite extremal points using
2324 __isl_give isl_basic_set *isl_basic_set_box_from_points(
2325 __isl_take isl_point *pnt1,
2326 __isl_take isl_point *pnt2);
2327 __isl_give isl_set *isl_set_box_from_points(
2328 __isl_take isl_point *pnt1,
2329 __isl_take isl_point *pnt2);
2331 All elements of a B<bounded> (union) set can be enumerated using
2332 the following functions.
2334 isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2335 isl_stat (*fn)(__isl_take isl_point *pnt,
2338 isl_stat isl_union_set_foreach_point(
2339 __isl_keep isl_union_set *uset,
2340 isl_stat (*fn)(__isl_take isl_point *pnt,
2344 The function C<fn> is called for each integer point in
2345 C<set> with as second argument the last argument of
2346 the C<isl_set_foreach_point> call. The function C<fn>
2347 should return C<0> on success and C<-1> on failure.
2348 In the latter case, C<isl_set_foreach_point> will stop
2349 enumerating and return C<-1> as well.
2350 If the enumeration is performed successfully and to completion,
2351 then C<isl_set_foreach_point> returns C<0>.
2353 To obtain a single point of a (basic) set, use
2355 __isl_give isl_point *isl_basic_set_sample_point(
2356 __isl_take isl_basic_set *bset);
2357 __isl_give isl_point *isl_set_sample_point(
2358 __isl_take isl_set *set);
2360 If C<set> does not contain any (integer) points, then the
2361 resulting point will be ``void'', a property that can be
2364 isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2368 Besides sets and relation, C<isl> also supports various types of functions.
2369 Each of these types is derived from the value type (see L</"Values">)
2370 or from one of two primitive function types
2371 through the application of zero or more type constructors.
2372 We first describe the primitive type and then we describe
2373 the types derived from these primitive types.
2375 =head3 Primitive Functions
2377 C<isl> support two primitive function types, quasi-affine
2378 expressions and quasipolynomials.
2379 A quasi-affine expression is defined either over a parameter
2380 space or over a set and is composed of integer constants,
2381 parameters and set variables, addition, subtraction and
2382 integer division by an integer constant.
2383 For example, the quasi-affine expression
2385 [n] -> { [x] -> [2*floor((4 n + x)/9] }
2387 maps C<x> to C<2*floor((4 n + x)/9>.
2388 A quasipolynomial is a polynomial expression in quasi-affine
2389 expression. That is, it additionally allows for multiplication.
2390 Note, though, that it is not allowed to construct an integer
2391 division of an expression involving multiplications.
2392 Here is an example of a quasipolynomial that is not
2393 quasi-affine expression
2395 [n] -> { [x] -> (n*floor((4 n + x)/9) }
2397 Note that the external representations of quasi-affine expressions
2398 and quasipolynomials are different. Quasi-affine expressions
2399 use a notation with square brackets just like binary relations,
2400 while quasipolynomials do not. This might change at some point.
2402 If a primitive function is defined over a parameter space,
2403 then the space of the function itself is that of a set.
2404 If it is defined over a set, then the space of the function
2405 is that of a relation. In both cases, the set space (or
2406 the output space) is single-dimensional, anonymous and unstructured.
2407 To create functions with multiple dimensions or with other kinds
2408 of set or output spaces, use multiple expressions
2409 (see L</"Multiple Expressions">).
2413 =item * Quasi-affine Expressions
2415 Besides the expressions described above, a quasi-affine
2416 expression can also be set to NaN. Such expressions
2417 typically represent a failure to represent a result
2418 as a quasi-affine expression.
2420 The zero quasi affine expression or the quasi affine expression
2421 that is equal to a given value or
2422 a specified dimension on a given domain can be created using
2424 #include <isl/aff.h>
2425 __isl_give isl_aff *isl_aff_zero_on_domain(
2426 __isl_take isl_local_space *ls);
2427 __isl_give isl_aff *isl_aff_val_on_domain(
2428 __isl_take isl_local_space *ls,
2429 __isl_take isl_val *val);
2430 __isl_give isl_aff *isl_aff_var_on_domain(
2431 __isl_take isl_local_space *ls,
2432 enum isl_dim_type type, unsigned pos);
2433 __isl_give isl_aff *isl_aff_nan_on_domain(
2434 __isl_take isl_local_space *ls);
2436 Quasi affine expressions can be copied and freed using
2438 #include <isl/aff.h>
2439 __isl_give isl_aff *isl_aff_copy(
2440 __isl_keep isl_aff *aff);
2441 __isl_null isl_aff *isl_aff_free(
2442 __isl_take isl_aff *aff);
2444 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2445 using the following function. The constraint is required to have
2446 a non-zero coefficient for the specified dimension.
2448 #include <isl/constraint.h>
2449 __isl_give isl_aff *isl_constraint_get_bound(
2450 __isl_keep isl_constraint *constraint,
2451 enum isl_dim_type type, int pos);
2453 The entire affine expression of the constraint can also be extracted
2454 using the following function.
2456 #include <isl/constraint.h>
2457 __isl_give isl_aff *isl_constraint_get_aff(
2458 __isl_keep isl_constraint *constraint);
2460 Conversely, an equality constraint equating
2461 the affine expression to zero or an inequality constraint enforcing
2462 the affine expression to be non-negative, can be constructed using
2464 __isl_give isl_constraint *isl_equality_from_aff(
2465 __isl_take isl_aff *aff);
2466 __isl_give isl_constraint *isl_inequality_from_aff(
2467 __isl_take isl_aff *aff);
2469 The coefficients and the integer divisions of an affine expression
2470 can be inspected using the following functions.
2472 #include <isl/aff.h>
2473 __isl_give isl_val *isl_aff_get_constant_val(
2474 __isl_keep isl_aff *aff);
2475 __isl_give isl_val *isl_aff_get_coefficient_val(
2476 __isl_keep isl_aff *aff,
2477 enum isl_dim_type type, int pos);
2478 int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2479 enum isl_dim_type type, int pos);
2480 __isl_give isl_val *isl_aff_get_denominator_val(
2481 __isl_keep isl_aff *aff);
2482 __isl_give isl_aff *isl_aff_get_div(
2483 __isl_keep isl_aff *aff, int pos);
2485 They can be modified using the following functions.
2487 #include <isl/aff.h>
2488 __isl_give isl_aff *isl_aff_set_constant_si(
2489 __isl_take isl_aff *aff, int v);
2490 __isl_give isl_aff *isl_aff_set_constant_val(
2491 __isl_take isl_aff *aff, __isl_take isl_val *v);
2492 __isl_give isl_aff *isl_aff_set_coefficient_si(
2493 __isl_take isl_aff *aff,
2494 enum isl_dim_type type, int pos, int v);
2495 __isl_give isl_aff *isl_aff_set_coefficient_val(
2496 __isl_take isl_aff *aff,
2497 enum isl_dim_type type, int pos,
2498 __isl_take isl_val *v);
2500 __isl_give isl_aff *isl_aff_add_constant_si(
2501 __isl_take isl_aff *aff, int v);
2502 __isl_give isl_aff *isl_aff_add_constant_val(
2503 __isl_take isl_aff *aff, __isl_take isl_val *v);
2504 __isl_give isl_aff *isl_aff_add_constant_num_si(
2505 __isl_take isl_aff *aff, int v);
2506 __isl_give isl_aff *isl_aff_add_coefficient_si(
2507 __isl_take isl_aff *aff,
2508 enum isl_dim_type type, int pos, int v);
2509 __isl_give isl_aff *isl_aff_add_coefficient_val(
2510 __isl_take isl_aff *aff,
2511 enum isl_dim_type type, int pos,
2512 __isl_take isl_val *v);
2514 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2515 set the I<numerator> of the constant or coefficient, while
2516 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2517 the constant or coefficient as a whole.
2518 The C<add_constant> and C<add_coefficient> functions add an integer
2519 or rational value to
2520 the possibly rational constant or coefficient.
2521 The C<add_constant_num> functions add an integer value to
2524 =item * Quasipolynomials
2526 Some simple quasipolynomials can be created using the following functions.
2528 #include <isl/polynomial.h>
2529 __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2530 __isl_take isl_space *domain);
2531 __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2532 __isl_take isl_space *domain);
2533 __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2534 __isl_take isl_space *domain);
2535 __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2536 __isl_take isl_space *domain);
2537 __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2538 __isl_take isl_space *domain);
2539 __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2540 __isl_take isl_space *domain,
2541 __isl_take isl_val *val);
2542 __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2543 __isl_take isl_space *domain,
2544 enum isl_dim_type type, unsigned pos);
2545 __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2546 __isl_take isl_aff *aff);
2548 Recall that the space in which a quasipolynomial lives is a map space
2549 with a one-dimensional range. The C<domain> argument in some of
2550 the functions above corresponds to the domain of this map space.
2552 Quasipolynomials can be copied and freed again using the following
2555 #include <isl/polynomial.h>
2556 __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2557 __isl_keep isl_qpolynomial *qp);
2558 __isl_null isl_qpolynomial *isl_qpolynomial_free(
2559 __isl_take isl_qpolynomial *qp);
2561 The constant term of a quasipolynomial can be extracted using
2563 __isl_give isl_val *isl_qpolynomial_get_constant_val(
2564 __isl_keep isl_qpolynomial *qp);
2566 To iterate over all terms in a quasipolynomial,
2569 isl_stat isl_qpolynomial_foreach_term(
2570 __isl_keep isl_qpolynomial *qp,
2571 isl_stat (*fn)(__isl_take isl_term *term,
2572 void *user), void *user);
2574 The terms themselves can be inspected and freed using
2577 unsigned isl_term_dim(__isl_keep isl_term *term,
2578 enum isl_dim_type type);
2579 __isl_give isl_val *isl_term_get_coefficient_val(
2580 __isl_keep isl_term *term);
2581 int isl_term_get_exp(__isl_keep isl_term *term,
2582 enum isl_dim_type type, unsigned pos);
2583 __isl_give isl_aff *isl_term_get_div(
2584 __isl_keep isl_term *term, unsigned pos);
2585 void isl_term_free(__isl_take isl_term *term);
2587 Each term is a product of parameters, set variables and
2588 integer divisions. The function C<isl_term_get_exp>
2589 returns the exponent of a given dimensions in the given term.
2595 A reduction represents a maximum or a minimum of its
2597 The only reduction type defined by C<isl> is
2598 C<isl_qpolynomial_fold>.
2600 There are currently no functions to directly create such
2601 objects, but they do appear in the piecewise quasipolynomial
2602 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2604 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2606 Reductions can be copied and freed using
2607 the following functions.
2609 #include <isl/polynomial.h>
2610 __isl_give isl_qpolynomial_fold *
2611 isl_qpolynomial_fold_copy(
2612 __isl_keep isl_qpolynomial_fold *fold);
2613 void isl_qpolynomial_fold_free(
2614 __isl_take isl_qpolynomial_fold *fold);
2616 To iterate over all quasipolynomials in a reduction, use
2618 isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2619 __isl_keep isl_qpolynomial_fold *fold,
2620 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2621 void *user), void *user);
2623 =head3 Multiple Expressions
2625 A multiple expression represents a sequence of zero or
2626 more base expressions, all defined on the same domain space.
2627 The domain space of the multiple expression is the same
2628 as that of the base expressions, but the range space
2629 can be any space. In case the base expressions have
2630 a set space, the corresponding multiple expression
2631 also has a set space.
2632 Objects of the value type do not have an associated space.
2633 The space of a multiple value is therefore always a set space.
2634 Similarly, the space of a multiple union piecewise
2635 affine expression is always a set space.
2637 The multiple expression types defined by C<isl>
2638 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2639 C<isl_multi_union_pw_aff>.
2641 A multiple expression with the value zero for
2642 each output (or set) dimension can be created
2643 using the following functions.
2645 #include <isl/val.h>
2646 __isl_give isl_multi_val *isl_multi_val_zero(
2647 __isl_take isl_space *space);
2649 #include <isl/aff.h>
2650 __isl_give isl_multi_aff *isl_multi_aff_zero(
2651 __isl_take isl_space *space);
2652 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2653 __isl_take isl_space *space);
2654 __isl_give isl_multi_union_pw_aff *
2655 isl_multi_union_pw_aff_zero(
2656 __isl_take isl_space *space);
2658 Since there is no canonical way of representing a zero
2659 value of type C<isl_union_pw_aff>, the space passed
2660 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2662 An identity function can be created using the following
2663 functions. The space needs to be that of a relation
2664 with the same number of input and output dimensions.
2666 #include <isl/aff.h>
2667 __isl_give isl_multi_aff *isl_multi_aff_identity(
2668 __isl_take isl_space *space);
2669 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2670 __isl_take isl_space *space);
2672 A function that performs a projection on a universe
2673 relation or set can be created using the following functions.
2674 See also the corresponding
2675 projection operations in L</"Unary Operations">.
2677 #include <isl/aff.h>
2678 __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2679 __isl_take isl_space *space);
2680 __isl_give isl_multi_aff *isl_multi_aff_range_map(
2681 __isl_take isl_space *space);
2682 __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2683 __isl_take isl_space *space,
2684 enum isl_dim_type type,
2685 unsigned first, unsigned n);
2687 A multiple expression can be created from a single
2688 base expression using the following functions.
2689 The space of the created multiple expression is the same
2690 as that of the base expression, except for
2691 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2692 lives in a parameter space and the output lives
2693 in a single-dimensional set space.
2695 #include <isl/aff.h>
2696 __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2697 __isl_take isl_aff *aff);
2698 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2699 __isl_take isl_pw_aff *pa);
2700 __isl_give isl_multi_union_pw_aff *
2701 isl_multi_union_pw_aff_from_union_pw_aff(
2702 __isl_take isl_union_pw_aff *upa);
2704 A multiple expression can be created from a list
2705 of base expression in a specified space.
2706 The domain of this space needs to be the same
2707 as the domains of the base expressions in the list.
2708 If the base expressions have a set space (or no associated space),
2709 then this space also needs to be a set space.
2711 #include <isl/val.h>
2712 __isl_give isl_multi_val *isl_multi_val_from_val_list(
2713 __isl_take isl_space *space,
2714 __isl_take isl_val_list *list);
2716 #include <isl/aff.h>
2717 __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2718 __isl_take isl_space *space,
2719 __isl_take isl_aff_list *list);
2720 __isl_give isl_multi_union_pw_aff *
2721 isl_multi_union_pw_aff_from_union_pw_aff_list(
2722 __isl_take isl_space *space,
2723 __isl_take isl_union_pw_aff_list *list);
2725 As a convenience, a multiple piecewise expression can
2726 also be created from a multiple expression.
2727 Each piecewise expression in the result has a single
2730 #include <isl/aff.h>
2731 __isl_give isl_multi_pw_aff *
2732 isl_multi_pw_aff_from_multi_aff(
2733 __isl_take isl_multi_aff *ma);
2735 Similarly, a multiple union expression can be
2736 created from a multiple expression.
2738 #include <isl/aff.h>
2739 __isl_give isl_multi_union_pw_aff *
2740 isl_multi_union_pw_aff_from_multi_aff(
2741 __isl_take isl_multi_aff *ma);
2742 __isl_give isl_multi_union_pw_aff *
2743 isl_multi_union_pw_aff_from_multi_pw_aff(
2744 __isl_take isl_multi_pw_aff *mpa);
2746 A multiple quasi-affine expression can be created from
2747 a multiple value with a given domain space using the following
2750 #include <isl/aff.h>
2751 __isl_give isl_multi_aff *
2752 isl_multi_aff_multi_val_on_space(
2753 __isl_take isl_space *space,
2754 __isl_take isl_multi_val *mv);
2757 a multiple union piecewise affine expression can be created from
2758 a multiple value with a given domain or
2759 a multiple affine expression with a given domain
2760 using the following functions.
2762 #include <isl/aff.h>
2763 __isl_give isl_multi_union_pw_aff *
2764 isl_multi_union_pw_aff_multi_val_on_domain(
2765 __isl_take isl_union_set *domain,
2766 __isl_take isl_multi_val *mv);
2767 __isl_give isl_multi_union_pw_aff *
2768 isl_multi_union_pw_aff_multi_aff_on_domain(
2769 __isl_take isl_union_set *domain,
2770 __isl_take isl_multi_aff *ma);
2772 Multiple expressions can be copied and freed using
2773 the following functions.
2775 #include <isl/val.h>
2776 __isl_give isl_multi_val *isl_multi_val_copy(
2777 __isl_keep isl_multi_val *mv);
2778 __isl_null isl_multi_val *isl_multi_val_free(
2779 __isl_take isl_multi_val *mv);
2781 #include <isl/aff.h>
2782 __isl_give isl_multi_aff *isl_multi_aff_copy(
2783 __isl_keep isl_multi_aff *maff);
2784 __isl_null isl_multi_aff *isl_multi_aff_free(
2785 __isl_take isl_multi_aff *maff);
2786 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2787 __isl_keep isl_multi_pw_aff *mpa);
2788 __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2789 __isl_take isl_multi_pw_aff *mpa);
2790 __isl_give isl_multi_union_pw_aff *
2791 isl_multi_union_pw_aff_copy(
2792 __isl_keep isl_multi_union_pw_aff *mupa);
2793 __isl_null isl_multi_union_pw_aff *
2794 isl_multi_union_pw_aff_free(
2795 __isl_take isl_multi_union_pw_aff *mupa);
2797 The base expression at a given position of a multiple
2798 expression can be extracted using the following functions.
2800 #include <isl/val.h>
2801 __isl_give isl_val *isl_multi_val_get_val(
2802 __isl_keep isl_multi_val *mv, int pos);
2804 #include <isl/aff.h>
2805 __isl_give isl_aff *isl_multi_aff_get_aff(
2806 __isl_keep isl_multi_aff *multi, int pos);
2807 __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2808 __isl_keep isl_multi_pw_aff *mpa, int pos);
2809 __isl_give isl_union_pw_aff *
2810 isl_multi_union_pw_aff_get_union_pw_aff(
2811 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2813 It can be replaced using the following functions.
2815 #include <isl/val.h>
2816 __isl_give isl_multi_val *isl_multi_val_set_val(
2817 __isl_take isl_multi_val *mv, int pos,
2818 __isl_take isl_val *val);
2820 #include <isl/aff.h>
2821 __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2822 __isl_take isl_multi_aff *multi, int pos,
2823 __isl_take isl_aff *aff);
2824 __isl_give isl_multi_union_pw_aff *
2825 isl_multi_union_pw_aff_set_union_pw_aff(
2826 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2827 __isl_take isl_union_pw_aff *upa);
2829 As a convenience, a sequence of base expressions that have
2830 their domains in a given space can be extracted from a sequence
2831 of union expressions using the following function.
2833 #include <isl/aff.h>
2834 __isl_give isl_multi_pw_aff *
2835 isl_multi_union_pw_aff_extract_multi_pw_aff(
2836 __isl_keep isl_multi_union_pw_aff *mupa,
2837 __isl_take isl_space *space);
2839 Note that there is a difference between C<isl_multi_union_pw_aff>
2840 and C<isl_union_pw_multi_aff> objects. The first is a sequence
2841 of unions of piecewise expressions, while the second is a union
2842 of piecewise sequences. In particular, multiple affine expressions
2843 in an C<isl_union_pw_multi_aff> may live in different spaces,
2844 while there is only a single multiple expression in
2845 an C<isl_multi_union_pw_aff>, which can therefore only live
2846 in a single space. This means that not every
2847 C<isl_union_pw_multi_aff> can be converted to
2848 an C<isl_multi_union_pw_aff>. Conversely, a zero-dimensional
2849 C<isl_multi_union_pw_aff> carries no information
2850 about any possible domain and therefore cannot be converted
2851 to an C<isl_union_pw_multi_aff>. Moreover, the elements
2852 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2853 while each multiple expression inside an C<isl_union_pw_multi_aff>
2854 has a single domain. The conversion of an C<isl_union_pw_multi_aff>
2855 of dimension greater than one may therefore not be exact.
2856 The following functions can
2857 be used to perform these conversions when they are possible.
2859 #include <isl/aff.h>
2860 __isl_give isl_multi_union_pw_aff *
2861 isl_multi_union_pw_aff_from_union_pw_multi_aff(
2862 __isl_take isl_union_pw_multi_aff *upma);
2863 __isl_give isl_union_pw_multi_aff *
2864 isl_union_pw_multi_aff_from_multi_union_pw_aff(
2865 __isl_take isl_multi_union_pw_aff *mupa);
2867 =head3 Piecewise Expressions
2869 A piecewise expression is an expression that is described
2870 using zero or more base expression defined over the same
2871 number of cells in the domain space of the base expressions.
2872 All base expressions are defined over the same
2873 domain space and the cells are disjoint.
2874 The space of a piecewise expression is the same as
2875 that of the base expressions.
2876 If the union of the cells is a strict subset of the domain
2877 space, then the value of the piecewise expression outside
2878 this union is different for types derived from quasi-affine
2879 expressions and those derived from quasipolynomials.
2880 Piecewise expressions derived from quasi-affine expressions
2881 are considered to be undefined outside the union of their cells.
2882 Piecewise expressions derived from quasipolynomials
2883 are considered to be zero outside the union of their cells.
2885 Piecewise quasipolynomials are mainly used by the C<barvinok>
2886 library for representing the number of elements in a parametric set or map.
2887 For example, the piecewise quasipolynomial
2889 [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2891 represents the number of points in the map
2893 [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2895 The piecewise expression types defined by C<isl>
2896 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2897 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2899 A piecewise expression with no cells can be created using
2900 the following functions.
2902 #include <isl/aff.h>
2903 __isl_give isl_pw_aff *isl_pw_aff_empty(
2904 __isl_take isl_space *space);
2905 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2906 __isl_take isl_space *space);
2908 A piecewise expression with a single universe cell can be
2909 created using the following functions.
2911 #include <isl/aff.h>
2912 __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2913 __isl_take isl_aff *aff);
2914 __isl_give isl_pw_multi_aff *
2915 isl_pw_multi_aff_from_multi_aff(
2916 __isl_take isl_multi_aff *ma);
2918 #include <isl/polynomial.h>
2919 __isl_give isl_pw_qpolynomial *
2920 isl_pw_qpolynomial_from_qpolynomial(
2921 __isl_take isl_qpolynomial *qp);
2923 A piecewise expression with a single specified cell can be
2924 created using the following functions.
2926 #include <isl/aff.h>
2927 __isl_give isl_pw_aff *isl_pw_aff_alloc(
2928 __isl_take isl_set *set, __isl_take isl_aff *aff);
2929 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2930 __isl_take isl_set *set,
2931 __isl_take isl_multi_aff *maff);
2933 #include <isl/polynomial.h>
2934 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2935 __isl_take isl_set *set,
2936 __isl_take isl_qpolynomial *qp);
2938 The following convenience functions first create a base expression and
2939 then create a piecewise expression over a universe domain.
2941 #include <isl/aff.h>
2942 __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2943 __isl_take isl_local_space *ls);
2944 __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2945 __isl_take isl_local_space *ls,
2946 enum isl_dim_type type, unsigned pos);
2947 __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2948 __isl_take isl_local_space *ls);
2949 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2950 __isl_take isl_space *space);
2951 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2952 __isl_take isl_space *space);
2953 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2954 __isl_take isl_space *space);
2955 __isl_give isl_pw_multi_aff *
2956 isl_pw_multi_aff_project_out_map(
2957 __isl_take isl_space *space,
2958 enum isl_dim_type type,
2959 unsigned first, unsigned n);
2961 #include <isl/polynomial.h>
2962 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2963 __isl_take isl_space *space);
2965 The following convenience functions first create a base expression and
2966 then create a piecewise expression over a given domain.
2968 #include <isl/aff.h>
2969 __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2970 __isl_take isl_set *domain,
2971 __isl_take isl_val *v);
2972 __isl_give isl_pw_multi_aff *
2973 isl_pw_multi_aff_multi_val_on_domain(
2974 __isl_take isl_set *domain,
2975 __isl_take isl_multi_val *mv);
2977 As a convenience, a piecewise multiple expression can
2978 also be created from a piecewise expression.
2979 Each multiple expression in the result is derived
2980 from the corresponding base expression.
2982 #include <isl/aff.h>
2983 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2984 __isl_take isl_pw_aff *pa);
2986 Similarly, a piecewise quasipolynomial can be
2987 created from a piecewise quasi-affine expression using
2988 the following function.
2990 #include <isl/polynomial.h>
2991 __isl_give isl_pw_qpolynomial *
2992 isl_pw_qpolynomial_from_pw_aff(
2993 __isl_take isl_pw_aff *pwaff);
2995 Piecewise expressions can be copied and freed using the following functions.
2997 #include <isl/aff.h>
2998 __isl_give isl_pw_aff *isl_pw_aff_copy(
2999 __isl_keep isl_pw_aff *pwaff);
3000 __isl_null isl_pw_aff *isl_pw_aff_free(
3001 __isl_take isl_pw_aff *pwaff);
3002 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3003 __isl_keep isl_pw_multi_aff *pma);
3004 __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3005 __isl_take isl_pw_multi_aff *pma);
3007 #include <isl/polynomial.h>
3008 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3009 __isl_keep isl_pw_qpolynomial *pwqp);
3010 __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3011 __isl_take isl_pw_qpolynomial *pwqp);
3012 __isl_give isl_pw_qpolynomial_fold *
3013 isl_pw_qpolynomial_fold_copy(
3014 __isl_keep isl_pw_qpolynomial_fold *pwf);
3015 __isl_null isl_pw_qpolynomial_fold *
3016 isl_pw_qpolynomial_fold_free(
3017 __isl_take isl_pw_qpolynomial_fold *pwf);
3019 To iterate over the different cells of a piecewise expression,
3020 use the following functions.
3022 #include <isl/aff.h>
3023 isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3024 int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3025 isl_stat isl_pw_aff_foreach_piece(
3026 __isl_keep isl_pw_aff *pwaff,
3027 isl_stat (*fn)(__isl_take isl_set *set,
3028 __isl_take isl_aff *aff,
3029 void *user), void *user);
3030 isl_stat isl_pw_multi_aff_foreach_piece(
3031 __isl_keep isl_pw_multi_aff *pma,
3032 isl_stat (*fn)(__isl_take isl_set *set,
3033 __isl_take isl_multi_aff *maff,
3034 void *user), void *user);
3036 #include <isl/polynomial.h>
3037 isl_stat isl_pw_qpolynomial_foreach_piece(
3038 __isl_keep isl_pw_qpolynomial *pwqp,
3039 isl_stat (*fn)(__isl_take isl_set *set,
3040 __isl_take isl_qpolynomial *qp,
3041 void *user), void *user);
3042 isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3043 __isl_keep isl_pw_qpolynomial *pwqp,
3044 isl_stat (*fn)(__isl_take isl_set *set,
3045 __isl_take isl_qpolynomial *qp,
3046 void *user), void *user);
3047 isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3048 __isl_keep isl_pw_qpolynomial_fold *pwf,
3049 isl_stat (*fn)(__isl_take isl_set *set,
3050 __isl_take isl_qpolynomial_fold *fold,
3051 void *user), void *user);
3052 isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3053 __isl_keep isl_pw_qpolynomial_fold *pwf,
3054 isl_stat (*fn)(__isl_take isl_set *set,
3055 __isl_take isl_qpolynomial_fold *fold,
3056 void *user), void *user);
3058 As usual, the function C<fn> should return C<0> on success
3059 and C<-1> on failure. The difference between
3060 C<isl_pw_qpolynomial_foreach_piece> and
3061 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3062 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3063 compute unique representations for all existentially quantified
3064 variables and then turn these existentially quantified variables
3065 into extra set variables, adapting the associated quasipolynomial
3066 accordingly. This means that the C<set> passed to C<fn>
3067 will not have any existentially quantified variables, but that
3068 the dimensions of the sets may be different for different
3069 invocations of C<fn>.
3070 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3071 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3073 A piecewise expression consisting of the expressions at a given
3074 position of a piecewise multiple expression can be extracted
3075 using the following function.
3077 #include <isl/aff.h>
3078 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3079 __isl_keep isl_pw_multi_aff *pma, int pos);
3081 These expressions can be replaced using the following function.
3083 #include <isl/aff.h>
3084 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3085 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3086 __isl_take isl_pw_aff *pa);
3088 Note that there is a difference between C<isl_multi_pw_aff> and
3089 C<isl_pw_multi_aff> objects. The first is a sequence of piecewise
3090 affine expressions, while the second is a piecewise sequence
3091 of affine expressions. In particular, each of the piecewise
3092 affine expressions in an C<isl_multi_pw_aff> may have a different
3093 domain, while all multiple expressions associated to a cell
3094 in an C<isl_pw_multi_aff> have the same domain.
3095 It is possible to convert between the two, but when converting
3096 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3097 of the result is the intersection of the domains of the input.
3098 The reverse conversion is exact.
3100 #include <isl/aff.h>
3101 __isl_give isl_pw_multi_aff *
3102 isl_pw_multi_aff_from_multi_pw_aff(
3103 __isl_take isl_multi_pw_aff *mpa);
3104 __isl_give isl_multi_pw_aff *
3105 isl_multi_pw_aff_from_pw_multi_aff(
3106 __isl_take isl_pw_multi_aff *pma);
3108 =head3 Union Expressions
3110 A union expression collects base expressions defined
3111 over different domains. The space of a union expression
3112 is that of the shared parameter space.
3114 The union expression types defined by C<isl>
3115 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3116 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3118 An empty union expression can be created using the following functions.
3120 #include <isl/aff.h>
3121 __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3122 __isl_take isl_space *space);
3123 __isl_give isl_union_pw_multi_aff *
3124 isl_union_pw_multi_aff_empty(
3125 __isl_take isl_space *space);
3127 #include <isl/polynomial.h>
3128 __isl_give isl_union_pw_qpolynomial *
3129 isl_union_pw_qpolynomial_zero(
3130 __isl_take isl_space *space);
3132 A union expression containing a single base expression
3133 can be created using the following functions.
3135 #include <isl/aff.h>
3136 __isl_give isl_union_pw_aff *
3137 isl_union_pw_aff_from_pw_aff(
3138 __isl_take isl_pw_aff *pa);
3139 __isl_give isl_union_pw_multi_aff *
3140 isl_union_pw_multi_aff_from_aff(
3141 __isl_take isl_aff *aff);
3142 __isl_give isl_union_pw_multi_aff *
3143 isl_union_pw_multi_aff_from_pw_multi_aff(
3144 __isl_take isl_pw_multi_aff *pma);
3146 #include <isl/polynomial.h>
3147 __isl_give isl_union_pw_qpolynomial *
3148 isl_union_pw_qpolynomial_from_pw_qpolynomial(
3149 __isl_take isl_pw_qpolynomial *pwqp);
3151 The following functions create a base expression on each
3152 of the sets in the union set and collect the results.
3154 #include <isl/aff.h>
3155 __isl_give isl_union_pw_multi_aff *
3156 isl_union_pw_multi_aff_from_union_pw_aff(
3157 __isl_take isl_union_pw_aff *upa);
3158 __isl_give isl_union_pw_aff *
3159 isl_union_pw_multi_aff_get_union_pw_aff(
3160 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3161 __isl_give isl_union_pw_aff *
3162 isl_union_pw_aff_val_on_domain(
3163 __isl_take isl_union_set *domain,
3164 __isl_take isl_val *v);
3165 __isl_give isl_union_pw_multi_aff *
3166 isl_union_pw_multi_aff_multi_val_on_domain(
3167 __isl_take isl_union_set *domain,
3168 __isl_take isl_multi_val *mv);
3170 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3171 expression on a given domain can be created using the following
3174 #include <isl/aff.h>
3175 __isl_give isl_union_pw_aff *
3176 isl_union_pw_aff_aff_on_domain(
3177 __isl_take isl_union_set *domain,
3178 __isl_take isl_aff *aff);
3180 A base expression can be added to a union expression using
3181 the following functions.
3183 #include <isl/aff.h>
3184 __isl_give isl_union_pw_aff *
3185 isl_union_pw_aff_add_pw_aff(
3186 __isl_take isl_union_pw_aff *upa,
3187 __isl_take isl_pw_aff *pa);
3188 __isl_give isl_union_pw_multi_aff *
3189 isl_union_pw_multi_aff_add_pw_multi_aff(
3190 __isl_take isl_union_pw_multi_aff *upma,
3191 __isl_take isl_pw_multi_aff *pma);
3193 #include <isl/polynomial.h>
3194 __isl_give isl_union_pw_qpolynomial *
3195 isl_union_pw_qpolynomial_add_pw_qpolynomial(
3196 __isl_take isl_union_pw_qpolynomial *upwqp,
3197 __isl_take isl_pw_qpolynomial *pwqp);
3199 Union expressions can be copied and freed using
3200 the following functions.
3202 #include <isl/aff.h>
3203 __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3204 __isl_keep isl_union_pw_aff *upa);
3205 __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3206 __isl_take isl_union_pw_aff *upa);
3207 __isl_give isl_union_pw_multi_aff *
3208 isl_union_pw_multi_aff_copy(
3209 __isl_keep isl_union_pw_multi_aff *upma);
3210 __isl_null isl_union_pw_multi_aff *
3211 isl_union_pw_multi_aff_free(
3212 __isl_take isl_union_pw_multi_aff *upma);
3214 #include <isl/polynomial.h>
3215 __isl_give isl_union_pw_qpolynomial *
3216 isl_union_pw_qpolynomial_copy(
3217 __isl_keep isl_union_pw_qpolynomial *upwqp);
3218 __isl_null isl_union_pw_qpolynomial *
3219 isl_union_pw_qpolynomial_free(
3220 __isl_take isl_union_pw_qpolynomial *upwqp);
3221 __isl_give isl_union_pw_qpolynomial_fold *
3222 isl_union_pw_qpolynomial_fold_copy(
3223 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3224 __isl_null isl_union_pw_qpolynomial_fold *
3225 isl_union_pw_qpolynomial_fold_free(
3226 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3228 To iterate over the base expressions in a union expression,
3229 use the following functions.
3231 #include <isl/aff.h>
3232 int isl_union_pw_aff_n_pw_aff(
3233 __isl_keep isl_union_pw_aff *upa);
3234 isl_stat isl_union_pw_aff_foreach_pw_aff(
3235 __isl_keep isl_union_pw_aff *upa,
3236 isl_stat (*fn)(__isl_take isl_pw_aff *ma,
3237 void *user), void *user);
3238 int isl_union_pw_multi_aff_n_pw_multi_aff(
3239 __isl_keep isl_union_pw_multi_aff *upma);
3240 isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3241 __isl_keep isl_union_pw_multi_aff *upma,
3242 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3243 void *user), void *user);
3245 #include <isl/polynomial.h>
3246 int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3247 __isl_keep isl_union_pw_qpolynomial *upwqp);
3248 isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3249 __isl_keep isl_union_pw_qpolynomial *upwqp,
3250 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3251 void *user), void *user);
3252 int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3253 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3254 isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3255 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3256 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3257 void *user), void *user);
3259 To extract the base expression in a given space from a union, use
3260 the following functions.
3262 #include <isl/aff.h>
3263 __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3264 __isl_keep isl_union_pw_aff *upa,
3265 __isl_take isl_space *space);
3266 __isl_give isl_pw_multi_aff *
3267 isl_union_pw_multi_aff_extract_pw_multi_aff(
3268 __isl_keep isl_union_pw_multi_aff *upma,
3269 __isl_take isl_space *space);
3271 #include <isl/polynomial.h>
3272 __isl_give isl_pw_qpolynomial *
3273 isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3274 __isl_keep isl_union_pw_qpolynomial *upwqp,
3275 __isl_take isl_space *space);
3277 =head2 Input and Output
3279 For set and relation,
3280 C<isl> supports its own input/output format, which is similar
3281 to the C<Omega> format, but also supports the C<PolyLib> format
3283 For other object types, typically only an C<isl> format is supported.
3285 =head3 C<isl> format
3287 The C<isl> format is similar to that of C<Omega>, but has a different
3288 syntax for describing the parameters and allows for the definition
3289 of an existentially quantified variable as the integer division
3290 of an affine expression.
3291 For example, the set of integers C<i> between C<0> and C<n>
3292 such that C<i % 10 <= 6> can be described as
3294 [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3297 A set or relation can have several disjuncts, separated
3298 by the keyword C<or>. Each disjunct is either a conjunction
3299 of constraints or a projection (C<exists>) of a conjunction
3300 of constraints. The constraints are separated by the keyword
3303 =head3 C<PolyLib> format
3305 If the represented set is a union, then the first line
3306 contains a single number representing the number of disjuncts.
3307 Otherwise, a line containing the number C<1> is optional.
3309 Each disjunct is represented by a matrix of constraints.
3310 The first line contains two numbers representing
3311 the number of rows and columns,
3312 where the number of rows is equal to the number of constraints
3313 and the number of columns is equal to two plus the number of variables.
3314 The following lines contain the actual rows of the constraint matrix.
3315 In each row, the first column indicates whether the constraint
3316 is an equality (C<0>) or inequality (C<1>). The final column
3317 corresponds to the constant term.
3319 If the set is parametric, then the coefficients of the parameters
3320 appear in the last columns before the constant column.
3321 The coefficients of any existentially quantified variables appear
3322 between those of the set variables and those of the parameters.
3324 =head3 Extended C<PolyLib> format
3326 The extended C<PolyLib> format is nearly identical to the
3327 C<PolyLib> format. The only difference is that the line
3328 containing the number of rows and columns of a constraint matrix
3329 also contains four additional numbers:
3330 the number of output dimensions, the number of input dimensions,
3331 the number of local dimensions (i.e., the number of existentially
3332 quantified variables) and the number of parameters.
3333 For sets, the number of ``output'' dimensions is equal
3334 to the number of set dimensions, while the number of ``input''
3339 Objects can be read from input using the following functions.
3341 #include <isl/val.h>
3342 __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3344 __isl_give isl_multi_val *isl_multi_val_read_from_str(
3345 isl_ctx *ctx, const char *str);
3347 #include <isl/set.h>
3348 __isl_give isl_basic_set *isl_basic_set_read_from_file(
3349 isl_ctx *ctx, FILE *input);
3350 __isl_give isl_basic_set *isl_basic_set_read_from_str(
3351 isl_ctx *ctx, const char *str);
3352 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3354 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3357 #include <isl/map.h>
3358 __isl_give isl_basic_map *isl_basic_map_read_from_file(
3359 isl_ctx *ctx, FILE *input);
3360 __isl_give isl_basic_map *isl_basic_map_read_from_str(
3361 isl_ctx *ctx, const char *str);
3362 __isl_give isl_map *isl_map_read_from_file(
3363 isl_ctx *ctx, FILE *input);
3364 __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3367 #include <isl/union_set.h>
3368 __isl_give isl_union_set *isl_union_set_read_from_file(
3369 isl_ctx *ctx, FILE *input);
3370 __isl_give isl_union_set *isl_union_set_read_from_str(
3371 isl_ctx *ctx, const char *str);
3373 #include <isl/union_map.h>
3374 __isl_give isl_union_map *isl_union_map_read_from_file(
3375 isl_ctx *ctx, FILE *input);
3376 __isl_give isl_union_map *isl_union_map_read_from_str(
3377 isl_ctx *ctx, const char *str);
3379 #include <isl/aff.h>
3380 __isl_give isl_aff *isl_aff_read_from_str(
3381 isl_ctx *ctx, const char *str);
3382 __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3383 isl_ctx *ctx, const char *str);
3384 __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3385 isl_ctx *ctx, const char *str);
3386 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3387 isl_ctx *ctx, const char *str);
3388 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3389 isl_ctx *ctx, const char *str);
3390 __isl_give isl_union_pw_multi_aff *
3391 isl_union_pw_multi_aff_read_from_str(
3392 isl_ctx *ctx, const char *str);
3393 __isl_give isl_multi_union_pw_aff *
3394 isl_multi_union_pw_aff_read_from_str(
3395 isl_ctx *ctx, const char *str);
3397 #include <isl/polynomial.h>
3398 __isl_give isl_union_pw_qpolynomial *
3399 isl_union_pw_qpolynomial_read_from_str(
3400 isl_ctx *ctx, const char *str);
3402 For sets and relations,
3403 the input format is autodetected and may be either the C<PolyLib> format
3404 or the C<isl> format.
3408 Before anything can be printed, an C<isl_printer> needs to
3411 __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3413 __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3414 __isl_null isl_printer *isl_printer_free(
3415 __isl_take isl_printer *printer);
3416 __isl_give char *isl_printer_get_str(
3417 __isl_keep isl_printer *printer);
3419 The printer can be inspected using the following functions.
3421 FILE *isl_printer_get_file(
3422 __isl_keep isl_printer *printer);
3423 int isl_printer_get_output_format(
3424 __isl_keep isl_printer *p);
3425 int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3427 The behavior of the printer can be modified in various ways
3429 __isl_give isl_printer *isl_printer_set_output_format(
3430 __isl_take isl_printer *p, int output_format);
3431 __isl_give isl_printer *isl_printer_set_indent(
3432 __isl_take isl_printer *p, int indent);
3433 __isl_give isl_printer *isl_printer_set_indent_prefix(
3434 __isl_take isl_printer *p, const char *prefix);
3435 __isl_give isl_printer *isl_printer_indent(
3436 __isl_take isl_printer *p, int indent);
3437 __isl_give isl_printer *isl_printer_set_prefix(
3438 __isl_take isl_printer *p, const char *prefix);
3439 __isl_give isl_printer *isl_printer_set_suffix(
3440 __isl_take isl_printer *p, const char *suffix);
3441 __isl_give isl_printer *isl_printer_set_yaml_style(
3442 __isl_take isl_printer *p, int yaml_style);
3444 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3445 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3446 and defaults to C<ISL_FORMAT_ISL>.
3447 Each line in the output is prefixed by C<indent_prefix>,
3448 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3449 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3450 In the C<PolyLib> format output,
3451 the coefficients of the existentially quantified variables
3452 appear between those of the set variables and those
3454 The function C<isl_printer_indent> increases the indentation
3455 by the specified amount (which may be negative).
3456 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3457 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3460 To actually print something, use
3462 #include <isl/printer.h>
3463 __isl_give isl_printer *isl_printer_print_double(
3464 __isl_take isl_printer *p, double d);
3466 #include <isl/val.h>
3467 __isl_give isl_printer *isl_printer_print_val(
3468 __isl_take isl_printer *p, __isl_keep isl_val *v);
3470 #include <isl/set.h>
3471 __isl_give isl_printer *isl_printer_print_basic_set(
3472 __isl_take isl_printer *printer,
3473 __isl_keep isl_basic_set *bset);
3474 __isl_give isl_printer *isl_printer_print_set(
3475 __isl_take isl_printer *printer,
3476 __isl_keep isl_set *set);
3478 #include <isl/map.h>
3479 __isl_give isl_printer *isl_printer_print_basic_map(
3480 __isl_take isl_printer *printer,
3481 __isl_keep isl_basic_map *bmap);
3482 __isl_give isl_printer *isl_printer_print_map(
3483 __isl_take isl_printer *printer,
3484 __isl_keep isl_map *map);
3486 #include <isl/union_set.h>
3487 __isl_give isl_printer *isl_printer_print_union_set(
3488 __isl_take isl_printer *p,
3489 __isl_keep isl_union_set *uset);
3491 #include <isl/union_map.h>
3492 __isl_give isl_printer *isl_printer_print_union_map(
3493 __isl_take isl_printer *p,
3494 __isl_keep isl_union_map *umap);
3496 #include <isl/val.h>
3497 __isl_give isl_printer *isl_printer_print_multi_val(
3498 __isl_take isl_printer *p,
3499 __isl_keep isl_multi_val *mv);
3501 #include <isl/aff.h>
3502 __isl_give isl_printer *isl_printer_print_aff(
3503 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3504 __isl_give isl_printer *isl_printer_print_multi_aff(
3505 __isl_take isl_printer *p,
3506 __isl_keep isl_multi_aff *maff);
3507 __isl_give isl_printer *isl_printer_print_pw_aff(
3508 __isl_take isl_printer *p,
3509 __isl_keep isl_pw_aff *pwaff);
3510 __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3511 __isl_take isl_printer *p,
3512 __isl_keep isl_pw_multi_aff *pma);
3513 __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3514 __isl_take isl_printer *p,
3515 __isl_keep isl_multi_pw_aff *mpa);
3516 __isl_give isl_printer *isl_printer_print_union_pw_aff(
3517 __isl_take isl_printer *p,
3518 __isl_keep isl_union_pw_aff *upa);
3519 __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3520 __isl_take isl_printer *p,
3521 __isl_keep isl_union_pw_multi_aff *upma);
3522 __isl_give isl_printer *
3523 isl_printer_print_multi_union_pw_aff(
3524 __isl_take isl_printer *p,
3525 __isl_keep isl_multi_union_pw_aff *mupa);
3527 #include <isl/polynomial.h>
3528 __isl_give isl_printer *isl_printer_print_qpolynomial(
3529 __isl_take isl_printer *p,
3530 __isl_keep isl_qpolynomial *qp);
3531 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3532 __isl_take isl_printer *p,
3533 __isl_keep isl_pw_qpolynomial *pwqp);
3534 __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3535 __isl_take isl_printer *p,
3536 __isl_keep isl_union_pw_qpolynomial *upwqp);
3538 __isl_give isl_printer *
3539 isl_printer_print_pw_qpolynomial_fold(
3540 __isl_take isl_printer *p,
3541 __isl_keep isl_pw_qpolynomial_fold *pwf);
3542 __isl_give isl_printer *
3543 isl_printer_print_union_pw_qpolynomial_fold(
3544 __isl_take isl_printer *p,
3545 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3547 For C<isl_printer_print_qpolynomial>,
3548 C<isl_printer_print_pw_qpolynomial> and
3549 C<isl_printer_print_pw_qpolynomial_fold>,
3550 the output format of the printer
3551 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3552 For C<isl_printer_print_union_pw_qpolynomial> and
3553 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3555 In case of printing in C<ISL_FORMAT_C>, the user may want
3556 to set the names of all dimensions first.
3558 C<isl> also provides limited support for printing YAML documents,
3559 just enough for the internal use for printing such documents.
3561 #include <isl/printer.h>
3562 __isl_give isl_printer *isl_printer_yaml_start_mapping(
3563 __isl_take isl_printer *p);
3564 __isl_give isl_printer *isl_printer_yaml_end_mapping(
3565 __isl_take isl_printer *p);
3566 __isl_give isl_printer *isl_printer_yaml_start_sequence(
3567 __isl_take isl_printer *p);
3568 __isl_give isl_printer *isl_printer_yaml_end_sequence(
3569 __isl_take isl_printer *p);
3570 __isl_give isl_printer *isl_printer_yaml_next(
3571 __isl_take isl_printer *p);
3573 A document is started by a call to either
3574 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3575 Anything printed to the printer after such a call belong to the
3576 first key of the mapping or the first element in the sequence.
3577 The function C<isl_printer_yaml_next> moves to the value if
3578 we are currently printing a mapping key, the next key if we
3579 are printing a value or the next element if we are printing
3580 an element in a sequence.
3581 Nested mappings and sequences are initiated by the same
3582 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3583 Each call to these functions needs to have a corresponding call to
3584 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3586 When called on a file printer, the following function flushes
3587 the file. When called on a string printer, the buffer is cleared.
3589 __isl_give isl_printer *isl_printer_flush(
3590 __isl_take isl_printer *p);
3592 Alternatively, a string representation can be obtained
3593 directly using the following functions, which always print
3596 #include <isl/space.h>
3597 __isl_give char *isl_space_to_str(
3598 __isl_keep isl_space *space);
3600 #include <isl/val.h>
3601 __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3602 __isl_give char *isl_multi_val_to_str(
3603 __isl_keep isl_multi_val *mv);
3605 #include <isl/set.h>
3606 __isl_give char *isl_set_to_str(
3607 __isl_keep isl_set *set);
3609 #include <isl/union_set.h>
3610 __isl_give char *isl_union_set_to_str(
3611 __isl_keep isl_union_set *uset);
3613 #include <isl/map.h>
3614 __isl_give char *isl_map_to_str(
3615 __isl_keep isl_map *map);
3617 #include <isl/union_map.h>
3618 __isl_give char *isl_union_map_to_str(
3619 __isl_keep isl_union_map *umap);
3621 #include <isl/aff.h>
3622 __isl_give char *isl_multi_aff_to_str(
3623 __isl_keep isl_multi_aff *aff);
3624 __isl_give char *isl_union_pw_aff_to_str(
3625 __isl_keep isl_union_pw_aff *upa);
3626 __isl_give char *isl_union_pw_multi_aff_to_str(
3627 __isl_keep isl_union_pw_multi_aff *upma);
3628 __isl_give char *isl_multi_union_pw_aff_to_str(
3629 __isl_keep isl_multi_union_pw_aff *mupa);
3633 =head3 Unary Properties
3639 The following functions test whether the given set or relation
3640 contains any integer points. The ``plain'' variants do not perform
3641 any computations, but simply check if the given set or relation
3642 is already known to be empty.
3644 isl_bool isl_basic_set_plain_is_empty(
3645 __isl_keep isl_basic_set *bset);
3646 isl_bool isl_basic_set_is_empty(
3647 __isl_keep isl_basic_set *bset);
3648 isl_bool isl_set_plain_is_empty(
3649 __isl_keep isl_set *set);
3650 isl_bool isl_set_is_empty(__isl_keep isl_set *set);
3651 isl_bool isl_union_set_is_empty(
3652 __isl_keep isl_union_set *uset);
3653 isl_bool isl_basic_map_plain_is_empty(
3654 __isl_keep isl_basic_map *bmap);
3655 isl_bool isl_basic_map_is_empty(
3656 __isl_keep isl_basic_map *bmap);
3657 isl_bool isl_map_plain_is_empty(
3658 __isl_keep isl_map *map);
3659 isl_bool isl_map_is_empty(__isl_keep isl_map *map);
3660 isl_bool isl_union_map_is_empty(
3661 __isl_keep isl_union_map *umap);
3663 =item * Universality
3665 isl_bool isl_basic_set_is_universe(
3666 __isl_keep isl_basic_set *bset);
3667 isl_bool isl_basic_map_is_universe(
3668 __isl_keep isl_basic_map *bmap);
3669 isl_bool isl_set_plain_is_universe(
3670 __isl_keep isl_set *set);
3671 isl_bool isl_map_plain_is_universe(
3672 __isl_keep isl_map *map);
3674 =item * Single-valuedness
3676 #include <isl/set.h>
3677 isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
3679 #include <isl/map.h>
3680 isl_bool isl_basic_map_is_single_valued(
3681 __isl_keep isl_basic_map *bmap);
3682 isl_bool isl_map_plain_is_single_valued(
3683 __isl_keep isl_map *map);
3684 isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
3686 #include <isl/union_map.h>
3687 isl_bool isl_union_map_is_single_valued(
3688 __isl_keep isl_union_map *umap);
3692 isl_bool isl_map_plain_is_injective(
3693 __isl_keep isl_map *map);
3694 isl_bool isl_map_is_injective(
3695 __isl_keep isl_map *map);
3696 isl_bool isl_union_map_plain_is_injective(
3697 __isl_keep isl_union_map *umap);
3698 isl_bool isl_union_map_is_injective(
3699 __isl_keep isl_union_map *umap);
3703 isl_bool isl_map_is_bijective(
3704 __isl_keep isl_map *map);
3705 isl_bool isl_union_map_is_bijective(
3706 __isl_keep isl_union_map *umap);
3710 __isl_give isl_val *
3711 isl_basic_map_plain_get_val_if_fixed(
3712 __isl_keep isl_basic_map *bmap,
3713 enum isl_dim_type type, unsigned pos);
3714 __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3715 __isl_keep isl_set *set,
3716 enum isl_dim_type type, unsigned pos);
3717 __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3718 __isl_keep isl_map *map,
3719 enum isl_dim_type type, unsigned pos);
3721 If the set or relation obviously lies on a hyperplane where the given dimension
3722 has a fixed value, then return that value.
3723 Otherwise return NaN.
3727 isl_stat isl_set_dim_residue_class_val(
3728 __isl_keep isl_set *set,
3729 int pos, __isl_give isl_val **modulo,
3730 __isl_give isl_val **residue);
3732 Check if the values of the given set dimension are equal to a fixed
3733 value modulo some integer value. If so, assign the modulo to C<*modulo>
3734 and the fixed value to C<*residue>. If the given dimension attains only
3735 a single value, then assign C<0> to C<*modulo> and the fixed value to
3737 If the dimension does not attain only a single value and if no modulo
3738 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3742 To check whether the description of a set, relation or function depends
3743 on one or more given dimensions,
3744 the following functions can be used.
3746 #include <isl/constraint.h>
3747 isl_bool isl_constraint_involves_dims(
3748 __isl_keep isl_constraint *constraint,
3749 enum isl_dim_type type, unsigned first, unsigned n);
3751 #include <isl/set.h>
3752 isl_bool isl_basic_set_involves_dims(
3753 __isl_keep isl_basic_set *bset,
3754 enum isl_dim_type type, unsigned first, unsigned n);
3755 isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
3756 enum isl_dim_type type, unsigned first, unsigned n);
3758 #include <isl/map.h>
3759 isl_bool isl_basic_map_involves_dims(
3760 __isl_keep isl_basic_map *bmap,
3761 enum isl_dim_type type, unsigned first, unsigned n);
3762 isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
3763 enum isl_dim_type type, unsigned first, unsigned n);
3765 #include <isl/union_map.h>
3766 isl_bool isl_union_map_involves_dims(
3767 __isl_keep isl_union_map *umap,
3768 enum isl_dim_type type, unsigned first, unsigned n);
3770 #include <isl/aff.h>
3771 isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
3772 enum isl_dim_type type, unsigned first, unsigned n);
3773 isl_bool isl_pw_aff_involves_dims(
3774 __isl_keep isl_pw_aff *pwaff,
3775 enum isl_dim_type type, unsigned first, unsigned n);
3776 isl_bool isl_multi_aff_involves_dims(
3777 __isl_keep isl_multi_aff *ma,
3778 enum isl_dim_type type, unsigned first, unsigned n);
3779 isl_bool isl_multi_pw_aff_involves_dims(
3780 __isl_keep isl_multi_pw_aff *mpa,
3781 enum isl_dim_type type, unsigned first, unsigned n);
3783 #include <isl/polynomial.h>
3784 isl_bool isl_qpolynomial_involves_dims(
3785 __isl_keep isl_qpolynomial *qp,
3786 enum isl_dim_type type, unsigned first, unsigned n);
3788 Similarly, the following functions can be used to check whether
3789 a given dimension is involved in any lower or upper bound.
3791 #include <isl/set.h>
3792 isl_bool isl_set_dim_has_any_lower_bound(
3793 __isl_keep isl_set *set,
3794 enum isl_dim_type type, unsigned pos);
3795 isl_bool isl_set_dim_has_any_upper_bound(
3796 __isl_keep isl_set *set,
3797 enum isl_dim_type type, unsigned pos);
3799 Note that these functions return true even if there is a bound on
3800 the dimension on only some of the basic sets of C<set>.
3801 To check if they have a bound for all of the basic sets in C<set>,
3802 use the following functions instead.
3804 #include <isl/set.h>
3805 isl_bool isl_set_dim_has_lower_bound(
3806 __isl_keep isl_set *set,
3807 enum isl_dim_type type, unsigned pos);
3808 isl_bool isl_set_dim_has_upper_bound(
3809 __isl_keep isl_set *set,
3810 enum isl_dim_type type, unsigned pos);
3814 To check whether a set is a parameter domain, use this function:
3816 isl_bool isl_set_is_params(__isl_keep isl_set *set);
3817 isl_bool isl_union_set_is_params(
3818 __isl_keep isl_union_set *uset);
3822 The following functions check whether the space of the given
3823 (basic) set or relation range is a wrapped relation.
3825 #include <isl/space.h>
3826 isl_bool isl_space_is_wrapping(
3827 __isl_keep isl_space *space);
3828 isl_bool isl_space_domain_is_wrapping(
3829 __isl_keep isl_space *space);
3830 isl_bool isl_space_range_is_wrapping(
3831 __isl_keep isl_space *space);
3833 #include <isl/set.h>
3834 isl_bool isl_basic_set_is_wrapping(
3835 __isl_keep isl_basic_set *bset);
3836 isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
3838 #include <isl/map.h>
3839 isl_bool isl_map_domain_is_wrapping(
3840 __isl_keep isl_map *map);
3841 isl_bool isl_map_range_is_wrapping(
3842 __isl_keep isl_map *map);
3844 #include <isl/val.h>
3845 isl_bool isl_multi_val_range_is_wrapping(
3846 __isl_keep isl_multi_val *mv);
3848 #include <isl/aff.h>
3849 isl_bool isl_multi_aff_range_is_wrapping(
3850 __isl_keep isl_multi_aff *ma);
3851 isl_bool isl_multi_pw_aff_range_is_wrapping(
3852 __isl_keep isl_multi_pw_aff *mpa);
3853 isl_bool isl_multi_union_pw_aff_range_is_wrapping(
3854 __isl_keep isl_multi_union_pw_aff *mupa);
3856 The input to C<isl_space_is_wrapping> should
3857 be the space of a set, while that of
3858 C<isl_space_domain_is_wrapping> and
3859 C<isl_space_range_is_wrapping> should be the space of a relation.
3861 =item * Internal Product
3863 isl_bool isl_basic_map_can_zip(
3864 __isl_keep isl_basic_map *bmap);
3865 isl_bool isl_map_can_zip(__isl_keep isl_map *map);
3867 Check whether the product of domain and range of the given relation
3869 i.e., whether both domain and range are nested relations.
3873 isl_bool isl_basic_map_can_curry(
3874 __isl_keep isl_basic_map *bmap);
3875 isl_bool isl_map_can_curry(__isl_keep isl_map *map);
3877 Check whether the domain of the (basic) relation is a wrapped relation.
3879 isl_bool isl_basic_map_can_uncurry(
3880 __isl_keep isl_basic_map *bmap);
3881 isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
3883 Check whether the range of the (basic) relation is a wrapped relation.
3885 =item * Special Values
3887 #include <isl/aff.h>
3888 isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
3889 isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3891 Check whether the given expression is a constant.
3893 #include <isl/aff.h>
3894 isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
3895 isl_bool isl_pw_aff_involves_nan(
3896 __isl_keep isl_pw_aff *pa);
3898 #include <isl/polynomial.h>
3899 isl_bool isl_qpolynomial_fold_is_nan(
3900 __isl_keep isl_qpolynomial_fold *fold);
3902 Check whether the given expression is equal to or involves NaN.
3904 #include <isl/aff.h>
3905 isl_bool isl_aff_plain_is_zero(
3906 __isl_keep isl_aff *aff);
3908 Check whether the affine expression is obviously zero.
3912 =head3 Binary Properties
3918 The following functions check whether two objects
3919 represent the same set, relation or function.
3920 The C<plain> variants only return true if the objects
3921 are obviously the same. That is, they may return false
3922 even if the objects are the same, but they will never
3923 return true if the objects are not the same.
3925 #include <isl/set.h>
3926 isl_bool isl_basic_set_plain_is_equal(
3927 __isl_keep isl_basic_set *bset1,
3928 __isl_keep isl_basic_set *bset2);
3929 isl_bool isl_basic_set_is_equal(
3930 __isl_keep isl_basic_set *bset1,
3931 __isl_keep isl_basic_set *bset2);
3932 isl_bool isl_set_plain_is_equal(
3933 __isl_keep isl_set *set1,
3934 __isl_keep isl_set *set2);
3935 isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
3936 __isl_keep isl_set *set2);
3938 #include <isl/map.h>
3939 isl_bool isl_basic_map_is_equal(
3940 __isl_keep isl_basic_map *bmap1,
3941 __isl_keep isl_basic_map *bmap2);
3942 isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
3943 __isl_keep isl_map *map2);
3944 isl_bool isl_map_plain_is_equal(
3945 __isl_keep isl_map *map1,
3946 __isl_keep isl_map *map2);
3948 #include <isl/union_set.h>
3949 isl_bool isl_union_set_is_equal(
3950 __isl_keep isl_union_set *uset1,
3951 __isl_keep isl_union_set *uset2);
3953 #include <isl/union_map.h>
3954 isl_bool isl_union_map_is_equal(
3955 __isl_keep isl_union_map *umap1,
3956 __isl_keep isl_union_map *umap2);
3958 #include <isl/aff.h>
3959 isl_bool isl_aff_plain_is_equal(
3960 __isl_keep isl_aff *aff1,
3961 __isl_keep isl_aff *aff2);
3962 isl_bool isl_multi_aff_plain_is_equal(
3963 __isl_keep isl_multi_aff *maff1,
3964 __isl_keep isl_multi_aff *maff2);
3965 isl_bool isl_pw_aff_plain_is_equal(
3966 __isl_keep isl_pw_aff *pwaff1,
3967 __isl_keep isl_pw_aff *pwaff2);
3968 isl_bool isl_pw_multi_aff_plain_is_equal(
3969 __isl_keep isl_pw_multi_aff *pma1,
3970 __isl_keep isl_pw_multi_aff *pma2);
3971 isl_bool isl_multi_pw_aff_plain_is_equal(
3972 __isl_keep isl_multi_pw_aff *mpa1,
3973 __isl_keep isl_multi_pw_aff *mpa2);
3974 isl_bool isl_multi_pw_aff_is_equal(
3975 __isl_keep isl_multi_pw_aff *mpa1,
3976 __isl_keep isl_multi_pw_aff *mpa2);
3977 isl_bool isl_union_pw_aff_plain_is_equal(
3978 __isl_keep isl_union_pw_aff *upa1,
3979 __isl_keep isl_union_pw_aff *upa2);
3980 isl_bool isl_union_pw_multi_aff_plain_is_equal(
3981 __isl_keep isl_union_pw_multi_aff *upma1,
3982 __isl_keep isl_union_pw_multi_aff *upma2);
3983 isl_bool isl_multi_union_pw_aff_plain_is_equal(
3984 __isl_keep isl_multi_union_pw_aff *mupa1,
3985 __isl_keep isl_multi_union_pw_aff *mupa2);
3987 #include <isl/polynomial.h>
3988 isl_bool isl_union_pw_qpolynomial_plain_is_equal(
3989 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3990 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3991 isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
3992 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3993 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3995 =item * Disjointness
3997 #include <isl/set.h>
3998 isl_bool isl_basic_set_is_disjoint(
3999 __isl_keep isl_basic_set *bset1,
4000 __isl_keep isl_basic_set *bset2);
4001 isl_bool isl_set_plain_is_disjoint(
4002 __isl_keep isl_set *set1,
4003 __isl_keep isl_set *set2);
4004 isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
4005 __isl_keep isl_set *set2);
4007 #include <isl/map.h>
4008 isl_bool isl_basic_map_is_disjoint(
4009 __isl_keep isl_basic_map *bmap1,
4010 __isl_keep isl_basic_map *bmap2);
4011 isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
4012 __isl_keep isl_map *map2);
4014 #include <isl/union_set.h>
4015 isl_bool isl_union_set_is_disjoint(
4016 __isl_keep isl_union_set *uset1,
4017 __isl_keep isl_union_set *uset2);
4019 #include <isl/union_map.h>
4020 isl_bool isl_union_map_is_disjoint(
4021 __isl_keep isl_union_map *umap1,
4022 __isl_keep isl_union_map *umap2);
4026 isl_bool isl_basic_set_is_subset(
4027 __isl_keep isl_basic_set *bset1,
4028 __isl_keep isl_basic_set *bset2);
4029 isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4030 __isl_keep isl_set *set2);
4031 isl_bool isl_set_is_strict_subset(
4032 __isl_keep isl_set *set1,
4033 __isl_keep isl_set *set2);
4034 isl_bool isl_union_set_is_subset(
4035 __isl_keep isl_union_set *uset1,
4036 __isl_keep isl_union_set *uset2);
4037 isl_bool isl_union_set_is_strict_subset(
4038 __isl_keep isl_union_set *uset1,
4039 __isl_keep isl_union_set *uset2);
4040 isl_bool isl_basic_map_is_subset(
4041 __isl_keep isl_basic_map *bmap1,
4042 __isl_keep isl_basic_map *bmap2);
4043 isl_bool isl_basic_map_is_strict_subset(
4044 __isl_keep isl_basic_map *bmap1,
4045 __isl_keep isl_basic_map *bmap2);
4046 isl_bool isl_map_is_subset(
4047 __isl_keep isl_map *map1,
4048 __isl_keep isl_map *map2);
4049 isl_bool isl_map_is_strict_subset(
4050 __isl_keep isl_map *map1,
4051 __isl_keep isl_map *map2);
4052 isl_bool isl_union_map_is_subset(
4053 __isl_keep isl_union_map *umap1,
4054 __isl_keep isl_union_map *umap2);
4055 isl_bool isl_union_map_is_strict_subset(
4056 __isl_keep isl_union_map *umap1,
4057 __isl_keep isl_union_map *umap2);
4059 Check whether the first argument is a (strict) subset of the
4064 Every comparison function returns a negative value if the first
4065 argument is considered smaller than the second, a positive value
4066 if the first argument is considered greater and zero if the two
4067 constraints are considered the same by the comparison criterion.
4069 #include <isl/constraint.h>
4070 int isl_constraint_plain_cmp(
4071 __isl_keep isl_constraint *c1,
4072 __isl_keep isl_constraint *c2);
4074 This function is useful for sorting C<isl_constraint>s.
4075 The order depends on the internal representation of the inputs.
4076 The order is fixed over different calls to the function (assuming
4077 the internal representation of the inputs has not changed), but may
4078 change over different versions of C<isl>.
4080 #include <isl/constraint.h>
4081 int isl_constraint_cmp_last_non_zero(
4082 __isl_keep isl_constraint *c1,
4083 __isl_keep isl_constraint *c2);
4085 This function can be used to sort constraints that live in the same
4086 local space. Constraints that involve ``earlier'' dimensions or
4087 that have a smaller coefficient for the shared latest dimension
4088 are considered smaller than other constraints.
4089 This function only defines a B<partial> order.
4091 #include <isl/set.h>
4092 int isl_set_plain_cmp(__isl_keep isl_set *set1,
4093 __isl_keep isl_set *set2);
4095 This function is useful for sorting C<isl_set>s.
4096 The order depends on the internal representation of the inputs.
4097 The order is fixed over different calls to the function (assuming
4098 the internal representation of the inputs has not changed), but may
4099 change over different versions of C<isl>.
4101 #include <isl/aff.h>
4102 int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4103 __isl_keep isl_pw_aff *pa2);
4105 The function C<isl_pw_aff_plain_cmp> can be used to sort
4106 C<isl_pw_aff>s. The order is not strictly defined.
4107 The current order sorts expressions that only involve
4108 earlier dimensions before those that involve later dimensions.
4112 =head2 Unary Operations
4118 __isl_give isl_set *isl_set_complement(
4119 __isl_take isl_set *set);
4120 __isl_give isl_map *isl_map_complement(
4121 __isl_take isl_map *map);
4125 #include <isl/space.h>
4126 __isl_give isl_space *isl_space_reverse(
4127 __isl_take isl_space *space);
4129 #include <isl/map.h>
4130 __isl_give isl_basic_map *isl_basic_map_reverse(
4131 __isl_take isl_basic_map *bmap);
4132 __isl_give isl_map *isl_map_reverse(
4133 __isl_take isl_map *map);
4135 #include <isl/union_map.h>
4136 __isl_give isl_union_map *isl_union_map_reverse(
4137 __isl_take isl_union_map *umap);
4141 #include <isl/space.h>
4142 __isl_give isl_space *isl_space_domain(
4143 __isl_take isl_space *space);
4144 __isl_give isl_space *isl_space_range(
4145 __isl_take isl_space *space);
4146 __isl_give isl_space *isl_space_params(
4147 __isl_take isl_space *space);
4149 #include <isl/local_space.h>
4150 __isl_give isl_local_space *isl_local_space_domain(
4151 __isl_take isl_local_space *ls);
4152 __isl_give isl_local_space *isl_local_space_range(
4153 __isl_take isl_local_space *ls);
4155 #include <isl/set.h>
4156 __isl_give isl_basic_set *isl_basic_set_project_out(
4157 __isl_take isl_basic_set *bset,
4158 enum isl_dim_type type, unsigned first, unsigned n);
4159 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4160 enum isl_dim_type type, unsigned first, unsigned n);
4161 __isl_give isl_basic_set *isl_basic_set_params(
4162 __isl_take isl_basic_set *bset);
4163 __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4165 #include <isl/map.h>
4166 __isl_give isl_basic_map *isl_basic_map_project_out(
4167 __isl_take isl_basic_map *bmap,
4168 enum isl_dim_type type, unsigned first, unsigned n);
4169 __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4170 enum isl_dim_type type, unsigned first, unsigned n);
4171 __isl_give isl_basic_set *isl_basic_map_domain(
4172 __isl_take isl_basic_map *bmap);
4173 __isl_give isl_basic_set *isl_basic_map_range(
4174 __isl_take isl_basic_map *bmap);
4175 __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4176 __isl_give isl_set *isl_map_domain(
4177 __isl_take isl_map *bmap);
4178 __isl_give isl_set *isl_map_range(
4179 __isl_take isl_map *map);
4181 #include <isl/union_set.h>
4182 __isl_give isl_union_set *isl_union_set_project_out(
4183 __isl_take isl_union_set *uset,
4184 enum isl_dim_type type,
4185 unsigned first, unsigned n);
4186 __isl_give isl_set *isl_union_set_params(
4187 __isl_take isl_union_set *uset);
4189 The function C<isl_union_set_project_out> can only project out
4192 #include <isl/union_map.h>
4193 __isl_give isl_union_map *isl_union_map_project_out(
4194 __isl_take isl_union_map *umap,
4195 enum isl_dim_type type, unsigned first, unsigned n);
4196 __isl_give isl_set *isl_union_map_params(
4197 __isl_take isl_union_map *umap);
4198 __isl_give isl_union_set *isl_union_map_domain(
4199 __isl_take isl_union_map *umap);
4200 __isl_give isl_union_set *isl_union_map_range(
4201 __isl_take isl_union_map *umap);
4203 The function C<isl_union_map_project_out> can only project out
4206 #include <isl/aff.h>
4207 __isl_give isl_aff *isl_aff_project_domain_on_params(
4208 __isl_take isl_aff *aff);
4209 __isl_give isl_pw_multi_aff *
4210 isl_pw_multi_aff_project_domain_on_params(
4211 __isl_take isl_pw_multi_aff *pma);
4212 __isl_give isl_set *isl_pw_aff_domain(
4213 __isl_take isl_pw_aff *pwaff);
4214 __isl_give isl_set *isl_pw_multi_aff_domain(
4215 __isl_take isl_pw_multi_aff *pma);
4216 __isl_give isl_set *isl_multi_pw_aff_domain(
4217 __isl_take isl_multi_pw_aff *mpa);
4218 __isl_give isl_union_set *isl_union_pw_aff_domain(
4219 __isl_take isl_union_pw_aff *upa);
4220 __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4221 __isl_take isl_union_pw_multi_aff *upma);
4222 __isl_give isl_union_set *
4223 isl_multi_union_pw_aff_domain(
4224 __isl_take isl_multi_union_pw_aff *mupa);
4225 __isl_give isl_set *isl_pw_aff_params(
4226 __isl_take isl_pw_aff *pwa);
4228 The function C<isl_multi_union_pw_aff_domain> requires its
4229 input to have at least one set dimension.
4231 #include <isl/polynomial.h>
4232 __isl_give isl_qpolynomial *
4233 isl_qpolynomial_project_domain_on_params(
4234 __isl_take isl_qpolynomial *qp);
4235 __isl_give isl_pw_qpolynomial *
4236 isl_pw_qpolynomial_project_domain_on_params(
4237 __isl_take isl_pw_qpolynomial *pwqp);
4238 __isl_give isl_pw_qpolynomial_fold *
4239 isl_pw_qpolynomial_fold_project_domain_on_params(
4240 __isl_take isl_pw_qpolynomial_fold *pwf);
4241 __isl_give isl_set *isl_pw_qpolynomial_domain(
4242 __isl_take isl_pw_qpolynomial *pwqp);
4243 __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4244 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4245 __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4246 __isl_take isl_union_pw_qpolynomial *upwqp);
4248 #include <isl/space.h>
4249 __isl_give isl_space *isl_space_domain_map(
4250 __isl_take isl_space *space);
4251 __isl_give isl_space *isl_space_range_map(
4252 __isl_take isl_space *space);
4254 #include <isl/map.h>
4255 __isl_give isl_map *isl_set_wrapped_domain_map(
4256 __isl_take isl_set *set);
4257 __isl_give isl_basic_map *isl_basic_map_domain_map(
4258 __isl_take isl_basic_map *bmap);
4259 __isl_give isl_basic_map *isl_basic_map_range_map(
4260 __isl_take isl_basic_map *bmap);
4261 __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4262 __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4264 #include <isl/union_map.h>
4265 __isl_give isl_union_map *isl_union_map_domain_map(
4266 __isl_take isl_union_map *umap);
4267 __isl_give isl_union_pw_multi_aff *
4268 isl_union_map_domain_map_union_pw_multi_aff(
4269 __isl_take isl_union_map *umap);
4270 __isl_give isl_union_map *isl_union_map_range_map(
4271 __isl_take isl_union_map *umap);
4272 __isl_give isl_union_map *
4273 isl_union_set_wrapped_domain_map(
4274 __isl_take isl_union_set *uset);
4276 The functions above construct a (basic, regular or union) relation
4277 that maps (a wrapped version of) the input relation to its domain or range.
4278 C<isl_set_wrapped_domain_map> maps the input set to the domain
4279 of its wrapped relation.
4283 __isl_give isl_basic_set *isl_basic_set_eliminate(
4284 __isl_take isl_basic_set *bset,
4285 enum isl_dim_type type,
4286 unsigned first, unsigned n);
4287 __isl_give isl_set *isl_set_eliminate(
4288 __isl_take isl_set *set, enum isl_dim_type type,
4289 unsigned first, unsigned n);
4290 __isl_give isl_basic_map *isl_basic_map_eliminate(
4291 __isl_take isl_basic_map *bmap,
4292 enum isl_dim_type type,
4293 unsigned first, unsigned n);
4294 __isl_give isl_map *isl_map_eliminate(
4295 __isl_take isl_map *map, enum isl_dim_type type,
4296 unsigned first, unsigned n);
4298 Eliminate the coefficients for the given dimensions from the constraints,
4299 without removing the dimensions.
4301 =item * Constructing a set from a parameter domain
4303 A zero-dimensional space or (basic) set can be constructed
4304 on a given parameter domain using the following functions.
4306 #include <isl/space.h>
4307 __isl_give isl_space *isl_space_set_from_params(
4308 __isl_take isl_space *space);
4310 #include <isl/set.h>
4311 __isl_give isl_basic_set *isl_basic_set_from_params(
4312 __isl_take isl_basic_set *bset);
4313 __isl_give isl_set *isl_set_from_params(
4314 __isl_take isl_set *set);
4316 =item * Constructing a relation from a set
4318 Create a relation with the given set as domain or range.
4319 The range or domain of the created relation is a zero-dimensional
4320 flat anonymous space.
4322 #include <isl/space.h>
4323 __isl_give isl_space *isl_space_from_domain(
4324 __isl_take isl_space *space);
4325 __isl_give isl_space *isl_space_from_range(
4326 __isl_take isl_space *space);
4327 __isl_give isl_space *isl_space_map_from_set(
4328 __isl_take isl_space *space);
4329 __isl_give isl_space *isl_space_map_from_domain_and_range(
4330 __isl_take isl_space *domain,
4331 __isl_take isl_space *range);
4333 #include <isl/local_space.h>
4334 __isl_give isl_local_space *isl_local_space_from_domain(
4335 __isl_take isl_local_space *ls);
4337 #include <isl/map.h>
4338 __isl_give isl_map *isl_map_from_domain(
4339 __isl_take isl_set *set);
4340 __isl_give isl_map *isl_map_from_range(
4341 __isl_take isl_set *set);
4343 #include <isl/val.h>
4344 __isl_give isl_multi_val *isl_multi_val_from_range(
4345 __isl_take isl_multi_val *mv);
4347 #include <isl/aff.h>
4348 __isl_give isl_multi_aff *isl_multi_aff_from_range(
4349 __isl_take isl_multi_aff *ma);
4350 __isl_give isl_pw_aff *isl_pw_aff_from_range(
4351 __isl_take isl_pw_aff *pwa);
4352 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4353 __isl_take isl_multi_pw_aff *mpa);
4354 __isl_give isl_multi_union_pw_aff *
4355 isl_multi_union_pw_aff_from_range(
4356 __isl_take isl_multi_union_pw_aff *mupa);
4357 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4358 __isl_take isl_set *set);
4359 __isl_give isl_union_pw_multi_aff *
4360 isl_union_pw_multi_aff_from_domain(
4361 __isl_take isl_union_set *uset);
4365 #include <isl/set.h>
4366 __isl_give isl_basic_set *isl_basic_set_fix_si(
4367 __isl_take isl_basic_set *bset,
4368 enum isl_dim_type type, unsigned pos, int value);
4369 __isl_give isl_basic_set *isl_basic_set_fix_val(
4370 __isl_take isl_basic_set *bset,
4371 enum isl_dim_type type, unsigned pos,
4372 __isl_take isl_val *v);
4373 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4374 enum isl_dim_type type, unsigned pos, int value);
4375 __isl_give isl_set *isl_set_fix_val(
4376 __isl_take isl_set *set,
4377 enum isl_dim_type type, unsigned pos,
4378 __isl_take isl_val *v);
4380 #include <isl/map.h>
4381 __isl_give isl_basic_map *isl_basic_map_fix_si(
4382 __isl_take isl_basic_map *bmap,
4383 enum isl_dim_type type, unsigned pos, int value);
4384 __isl_give isl_basic_map *isl_basic_map_fix_val(
4385 __isl_take isl_basic_map *bmap,
4386 enum isl_dim_type type, unsigned pos,
4387 __isl_take isl_val *v);
4388 __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4389 enum isl_dim_type type, unsigned pos, int value);
4390 __isl_give isl_map *isl_map_fix_val(
4391 __isl_take isl_map *map,
4392 enum isl_dim_type type, unsigned pos,
4393 __isl_take isl_val *v);
4395 #include <isl/aff.h>
4396 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4397 __isl_take isl_pw_multi_aff *pma,
4398 enum isl_dim_type type, unsigned pos, int value);
4400 #include <isl/polynomial.h>
4401 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4402 __isl_take isl_pw_qpolynomial *pwqp,
4403 enum isl_dim_type type, unsigned n,
4404 __isl_take isl_val *v);
4406 Intersect the set, relation or function domain
4407 with the hyperplane where the given
4408 dimension has the fixed given value.
4410 __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4411 __isl_take isl_basic_map *bmap,
4412 enum isl_dim_type type, unsigned pos, int value);
4413 __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4414 __isl_take isl_basic_map *bmap,
4415 enum isl_dim_type type, unsigned pos, int value);
4416 __isl_give isl_set *isl_set_lower_bound_si(
4417 __isl_take isl_set *set,
4418 enum isl_dim_type type, unsigned pos, int value);
4419 __isl_give isl_set *isl_set_lower_bound_val(
4420 __isl_take isl_set *set,
4421 enum isl_dim_type type, unsigned pos,
4422 __isl_take isl_val *value);
4423 __isl_give isl_map *isl_map_lower_bound_si(
4424 __isl_take isl_map *map,
4425 enum isl_dim_type type, unsigned pos, int value);
4426 __isl_give isl_set *isl_set_upper_bound_si(
4427 __isl_take isl_set *set,
4428 enum isl_dim_type type, unsigned pos, int value);
4429 __isl_give isl_set *isl_set_upper_bound_val(
4430 __isl_take isl_set *set,
4431 enum isl_dim_type type, unsigned pos,
4432 __isl_take isl_val *value);
4433 __isl_give isl_map *isl_map_upper_bound_si(
4434 __isl_take isl_map *map,
4435 enum isl_dim_type type, unsigned pos, int value);
4437 Intersect the set or relation with the half-space where the given
4438 dimension has a value bounded by the fixed given integer value.
4440 __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4441 enum isl_dim_type type1, int pos1,
4442 enum isl_dim_type type2, int pos2);
4443 __isl_give isl_basic_map *isl_basic_map_equate(
4444 __isl_take isl_basic_map *bmap,
4445 enum isl_dim_type type1, int pos1,
4446 enum isl_dim_type type2, int pos2);
4447 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4448 enum isl_dim_type type1, int pos1,
4449 enum isl_dim_type type2, int pos2);
4451 Intersect the set or relation with the hyperplane where the given
4452 dimensions are equal to each other.
4454 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4455 enum isl_dim_type type1, int pos1,
4456 enum isl_dim_type type2, int pos2);
4458 Intersect the relation with the hyperplane where the given
4459 dimensions have opposite values.
4461 __isl_give isl_map *isl_map_order_le(
4462 __isl_take isl_map *map,
4463 enum isl_dim_type type1, int pos1,
4464 enum isl_dim_type type2, int pos2);
4465 __isl_give isl_basic_map *isl_basic_map_order_ge(
4466 __isl_take isl_basic_map *bmap,
4467 enum isl_dim_type type1, int pos1,
4468 enum isl_dim_type type2, int pos2);
4469 __isl_give isl_map *isl_map_order_ge(
4470 __isl_take isl_map *map,
4471 enum isl_dim_type type1, int pos1,
4472 enum isl_dim_type type2, int pos2);
4473 __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4474 enum isl_dim_type type1, int pos1,
4475 enum isl_dim_type type2, int pos2);
4476 __isl_give isl_basic_map *isl_basic_map_order_gt(
4477 __isl_take isl_basic_map *bmap,
4478 enum isl_dim_type type1, int pos1,
4479 enum isl_dim_type type2, int pos2);
4480 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4481 enum isl_dim_type type1, int pos1,
4482 enum isl_dim_type type2, int pos2);
4484 Intersect the relation with the half-space where the given
4485 dimensions satisfy the given ordering.
4489 #include <isl/aff.h>
4490 __isl_give isl_basic_set *isl_aff_zero_basic_set(
4491 __isl_take isl_aff *aff);
4492 __isl_give isl_basic_set *isl_aff_neg_basic_set(
4493 __isl_take isl_aff *aff);
4494 __isl_give isl_set *isl_pw_aff_pos_set(
4495 __isl_take isl_pw_aff *pa);
4496 __isl_give isl_set *isl_pw_aff_nonneg_set(
4497 __isl_take isl_pw_aff *pwaff);
4498 __isl_give isl_set *isl_pw_aff_zero_set(
4499 __isl_take isl_pw_aff *pwaff);
4500 __isl_give isl_set *isl_pw_aff_non_zero_set(
4501 __isl_take isl_pw_aff *pwaff);
4502 __isl_give isl_union_set *
4503 isl_union_pw_aff_zero_union_set(
4504 __isl_take isl_union_pw_aff *upa);
4505 __isl_give isl_union_set *
4506 isl_multi_union_pw_aff_zero_union_set(
4507 __isl_take isl_multi_union_pw_aff *mupa);
4509 The function C<isl_aff_neg_basic_set> returns a basic set
4510 containing those elements in the domain space
4511 of C<aff> where C<aff> is negative.
4512 The function C<isl_pw_aff_nonneg_set> returns a set
4513 containing those elements in the domain
4514 of C<pwaff> where C<pwaff> is non-negative.
4515 The function C<isl_multi_union_pw_aff_zero_union_set>
4516 returns a union set containing those elements
4517 in the domains of its elements where they are all zero.
4521 __isl_give isl_map *isl_set_identity(
4522 __isl_take isl_set *set);
4523 __isl_give isl_union_map *isl_union_set_identity(
4524 __isl_take isl_union_set *uset);
4525 __isl_give isl_union_pw_multi_aff *
4526 isl_union_set_identity_union_pw_multi_aff(
4527 __isl_take isl_union_set *uset);
4529 Construct an identity relation on the given (union) set.
4531 =item * Function Extraction
4533 A piecewise quasi affine expression that is equal to 1 on a set
4534 and 0 outside the set can be created using the following function.
4536 #include <isl/aff.h>
4537 __isl_give isl_pw_aff *isl_set_indicator_function(
4538 __isl_take isl_set *set);
4540 A piecewise multiple quasi affine expression can be extracted
4541 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4542 and the C<isl_map> is single-valued.
4543 In case of a conversion from an C<isl_union_map>
4544 to an C<isl_union_pw_multi_aff>, these properties need to hold
4545 in each domain space.
4546 A conversion to a C<isl_multi_union_pw_aff> additionally
4547 requires that the input is non-empty and involves only a single
4550 #include <isl/aff.h>
4551 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4552 __isl_take isl_set *set);
4553 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4554 __isl_take isl_map *map);
4556 __isl_give isl_union_pw_multi_aff *
4557 isl_union_pw_multi_aff_from_union_set(
4558 __isl_take isl_union_set *uset);
4559 __isl_give isl_union_pw_multi_aff *
4560 isl_union_pw_multi_aff_from_union_map(
4561 __isl_take isl_union_map *umap);
4563 __isl_give isl_multi_union_pw_aff *
4564 isl_multi_union_pw_aff_from_union_map(
4565 __isl_take isl_union_map *umap);
4569 __isl_give isl_basic_set *isl_basic_map_deltas(
4570 __isl_take isl_basic_map *bmap);
4571 __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4572 __isl_give isl_union_set *isl_union_map_deltas(
4573 __isl_take isl_union_map *umap);
4575 These functions return a (basic) set containing the differences
4576 between image elements and corresponding domain elements in the input.
4578 __isl_give isl_basic_map *isl_basic_map_deltas_map(
4579 __isl_take isl_basic_map *bmap);
4580 __isl_give isl_map *isl_map_deltas_map(
4581 __isl_take isl_map *map);
4582 __isl_give isl_union_map *isl_union_map_deltas_map(
4583 __isl_take isl_union_map *umap);
4585 The functions above construct a (basic, regular or union) relation
4586 that maps (a wrapped version of) the input relation to its delta set.
4590 Simplify the representation of a set, relation or functions by trying
4591 to combine pairs of basic sets or relations into a single
4592 basic set or relation.
4594 #include <isl/set.h>
4595 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4597 #include <isl/map.h>
4598 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4600 #include <isl/union_set.h>
4601 __isl_give isl_union_set *isl_union_set_coalesce(
4602 __isl_take isl_union_set *uset);
4604 #include <isl/union_map.h>
4605 __isl_give isl_union_map *isl_union_map_coalesce(
4606 __isl_take isl_union_map *umap);
4608 #include <isl/aff.h>
4609 __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4610 __isl_take isl_pw_aff *pwqp);
4611 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4612 __isl_take isl_pw_multi_aff *pma);
4613 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4614 __isl_take isl_multi_pw_aff *mpa);
4615 __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4616 __isl_take isl_union_pw_aff *upa);
4617 __isl_give isl_union_pw_multi_aff *
4618 isl_union_pw_multi_aff_coalesce(
4619 __isl_take isl_union_pw_multi_aff *upma);
4621 #include <isl/polynomial.h>
4622 __isl_give isl_pw_qpolynomial_fold *
4623 isl_pw_qpolynomial_fold_coalesce(
4624 __isl_take isl_pw_qpolynomial_fold *pwf);
4625 __isl_give isl_union_pw_qpolynomial *
4626 isl_union_pw_qpolynomial_coalesce(
4627 __isl_take isl_union_pw_qpolynomial *upwqp);
4628 __isl_give isl_union_pw_qpolynomial_fold *
4629 isl_union_pw_qpolynomial_fold_coalesce(
4630 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4632 One of the methods for combining pairs of basic sets or relations
4633 can result in coefficients that are much larger than those that appear
4634 in the constraints of the input. By default, the coefficients are
4635 not allowed to grow larger, but this can be changed by unsetting
4636 the following option.
4638 isl_stat isl_options_set_coalesce_bounded_wrapping(
4639 isl_ctx *ctx, int val);
4640 int isl_options_get_coalesce_bounded_wrapping(
4643 =item * Detecting equalities
4645 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4646 __isl_take isl_basic_set *bset);
4647 __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4648 __isl_take isl_basic_map *bmap);
4649 __isl_give isl_set *isl_set_detect_equalities(
4650 __isl_take isl_set *set);
4651 __isl_give isl_map *isl_map_detect_equalities(
4652 __isl_take isl_map *map);
4653 __isl_give isl_union_set *isl_union_set_detect_equalities(
4654 __isl_take isl_union_set *uset);
4655 __isl_give isl_union_map *isl_union_map_detect_equalities(
4656 __isl_take isl_union_map *umap);
4658 Simplify the representation of a set or relation by detecting implicit
4661 =item * Removing redundant constraints
4663 #include <isl/set.h>
4664 __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4665 __isl_take isl_basic_set *bset);
4666 __isl_give isl_set *isl_set_remove_redundancies(
4667 __isl_take isl_set *set);
4669 #include <isl/union_set.h>
4670 __isl_give isl_union_set *
4671 isl_union_set_remove_redundancies(
4672 __isl_take isl_union_set *uset);
4674 #include <isl/map.h>
4675 __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4676 __isl_take isl_basic_map *bmap);
4677 __isl_give isl_map *isl_map_remove_redundancies(
4678 __isl_take isl_map *map);
4680 #include <isl/union_map.h>
4681 __isl_give isl_union_map *
4682 isl_union_map_remove_redundancies(
4683 __isl_take isl_union_map *umap);
4687 __isl_give isl_basic_set *isl_set_convex_hull(
4688 __isl_take isl_set *set);
4689 __isl_give isl_basic_map *isl_map_convex_hull(
4690 __isl_take isl_map *map);
4692 If the input set or relation has any existentially quantified
4693 variables, then the result of these operations is currently undefined.
4697 #include <isl/set.h>
4698 __isl_give isl_basic_set *
4699 isl_set_unshifted_simple_hull(
4700 __isl_take isl_set *set);
4701 __isl_give isl_basic_set *isl_set_simple_hull(
4702 __isl_take isl_set *set);
4703 __isl_give isl_basic_set *
4704 isl_set_unshifted_simple_hull_from_set_list(
4705 __isl_take isl_set *set,
4706 __isl_take isl_set_list *list);
4708 #include <isl/map.h>
4709 __isl_give isl_basic_map *
4710 isl_map_unshifted_simple_hull(
4711 __isl_take isl_map *map);
4712 __isl_give isl_basic_map *isl_map_simple_hull(
4713 __isl_take isl_map *map);
4714 __isl_give isl_basic_map *
4715 isl_map_unshifted_simple_hull_from_map_list(
4716 __isl_take isl_map *map,
4717 __isl_take isl_map_list *list);
4719 #include <isl/union_map.h>
4720 __isl_give isl_union_map *isl_union_map_simple_hull(
4721 __isl_take isl_union_map *umap);
4723 These functions compute a single basic set or relation
4724 that contains the whole input set or relation.
4725 In particular, the output is described by translates
4726 of the constraints describing the basic sets or relations in the input.
4727 In case of C<isl_set_unshifted_simple_hull>, only the original
4728 constraints are used, without any translation.
4729 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4730 C<isl_map_unshifted_simple_hull_from_map_list>, the
4731 constraints are taken from the elements of the second argument.
4735 (See \autoref{s:simple hull}.)
4741 __isl_give isl_basic_set *isl_basic_set_affine_hull(
4742 __isl_take isl_basic_set *bset);
4743 __isl_give isl_basic_set *isl_set_affine_hull(
4744 __isl_take isl_set *set);
4745 __isl_give isl_union_set *isl_union_set_affine_hull(
4746 __isl_take isl_union_set *uset);
4747 __isl_give isl_basic_map *isl_basic_map_affine_hull(
4748 __isl_take isl_basic_map *bmap);
4749 __isl_give isl_basic_map *isl_map_affine_hull(
4750 __isl_take isl_map *map);
4751 __isl_give isl_union_map *isl_union_map_affine_hull(
4752 __isl_take isl_union_map *umap);
4754 In case of union sets and relations, the affine hull is computed
4757 =item * Polyhedral hull
4759 __isl_give isl_basic_set *isl_set_polyhedral_hull(
4760 __isl_take isl_set *set);
4761 __isl_give isl_basic_map *isl_map_polyhedral_hull(
4762 __isl_take isl_map *map);
4763 __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4764 __isl_take isl_union_set *uset);
4765 __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4766 __isl_take isl_union_map *umap);
4768 These functions compute a single basic set or relation
4769 not involving any existentially quantified variables
4770 that contains the whole input set or relation.
4771 In case of union sets and relations, the polyhedral hull is computed
4774 =item * Other approximations
4776 #include <isl/set.h>
4777 __isl_give isl_basic_set *
4778 isl_basic_set_drop_constraints_involving_dims(
4779 __isl_take isl_basic_set *bset,
4780 enum isl_dim_type type,
4781 unsigned first, unsigned n);
4782 __isl_give isl_basic_set *
4783 isl_basic_set_drop_constraints_not_involving_dims(
4784 __isl_take isl_basic_set *bset,
4785 enum isl_dim_type type,
4786 unsigned first, unsigned n);
4787 __isl_give isl_set *
4788 isl_set_drop_constraints_involving_dims(
4789 __isl_take isl_set *set,
4790 enum isl_dim_type type,
4791 unsigned first, unsigned n);
4793 #include <isl/map.h>
4794 __isl_give isl_basic_map *
4795 isl_basic_map_drop_constraints_involving_dims(
4796 __isl_take isl_basic_map *bmap,
4797 enum isl_dim_type type,
4798 unsigned first, unsigned n);
4799 __isl_give isl_map *
4800 isl_map_drop_constraints_involving_dims(
4801 __isl_take isl_map *map,
4802 enum isl_dim_type type,
4803 unsigned first, unsigned n);
4805 These functions drop any constraints (not) involving the specified dimensions.
4806 Note that the result depends on the representation of the input.
4808 #include <isl/polynomial.h>
4809 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4810 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4811 __isl_give isl_union_pw_qpolynomial *
4812 isl_union_pw_qpolynomial_to_polynomial(
4813 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4815 Approximate each quasipolynomial by a polynomial. If C<sign> is positive,
4816 the polynomial will be an overapproximation. If C<sign> is negative,
4817 it will be an underapproximation. If C<sign> is zero, the approximation
4818 will lie somewhere in between.
4822 __isl_give isl_basic_set *isl_basic_set_sample(
4823 __isl_take isl_basic_set *bset);
4824 __isl_give isl_basic_set *isl_set_sample(
4825 __isl_take isl_set *set);
4826 __isl_give isl_basic_map *isl_basic_map_sample(
4827 __isl_take isl_basic_map *bmap);
4828 __isl_give isl_basic_map *isl_map_sample(
4829 __isl_take isl_map *map);
4831 If the input (basic) set or relation is non-empty, then return
4832 a singleton subset of the input. Otherwise, return an empty set.
4834 =item * Optimization
4836 #include <isl/ilp.h>
4837 __isl_give isl_val *isl_basic_set_max_val(
4838 __isl_keep isl_basic_set *bset,
4839 __isl_keep isl_aff *obj);
4840 __isl_give isl_val *isl_set_min_val(
4841 __isl_keep isl_set *set,
4842 __isl_keep isl_aff *obj);
4843 __isl_give isl_val *isl_set_max_val(
4844 __isl_keep isl_set *set,
4845 __isl_keep isl_aff *obj);
4847 Compute the minimum or maximum of the integer affine expression C<obj>
4848 over the points in C<set>, returning the result in C<opt>.
4849 The result is C<NULL> in case of an error, the optimal value in case
4850 there is one, negative infinity or infinity if the problem is unbounded and
4851 NaN if the problem is empty.
4853 =item * Parametric optimization
4855 __isl_give isl_pw_aff *isl_set_dim_min(
4856 __isl_take isl_set *set, int pos);
4857 __isl_give isl_pw_aff *isl_set_dim_max(
4858 __isl_take isl_set *set, int pos);
4859 __isl_give isl_pw_aff *isl_map_dim_max(
4860 __isl_take isl_map *map, int pos);
4862 Compute the minimum or maximum of the given set or output dimension
4863 as a function of the parameters (and input dimensions), but independently
4864 of the other set or output dimensions.
4865 For lexicographic optimization, see L<"Lexicographic Optimization">.
4869 The following functions compute either the set of (rational) coefficient
4870 values of valid constraints for the given set or the set of (rational)
4871 values satisfying the constraints with coefficients from the given set.
4872 Internally, these two sets of functions perform essentially the
4873 same operations, except that the set of coefficients is assumed to
4874 be a cone, while the set of values may be any polyhedron.
4875 The current implementation is based on the Farkas lemma and
4876 Fourier-Motzkin elimination, but this may change or be made optional
4877 in future. In particular, future implementations may use different
4878 dualization algorithms or skip the elimination step.
4880 __isl_give isl_basic_set *isl_basic_set_coefficients(
4881 __isl_take isl_basic_set *bset);
4882 __isl_give isl_basic_set *isl_set_coefficients(
4883 __isl_take isl_set *set);
4884 __isl_give isl_union_set *isl_union_set_coefficients(
4885 __isl_take isl_union_set *bset);
4886 __isl_give isl_basic_set *isl_basic_set_solutions(
4887 __isl_take isl_basic_set *bset);
4888 __isl_give isl_basic_set *isl_set_solutions(
4889 __isl_take isl_set *set);
4890 __isl_give isl_union_set *isl_union_set_solutions(
4891 __isl_take isl_union_set *bset);
4895 __isl_give isl_map *isl_map_fixed_power_val(
4896 __isl_take isl_map *map,
4897 __isl_take isl_val *exp);
4898 __isl_give isl_union_map *
4899 isl_union_map_fixed_power_val(
4900 __isl_take isl_union_map *umap,
4901 __isl_take isl_val *exp);
4903 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4904 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4905 of C<map> is computed.
4907 __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4909 __isl_give isl_union_map *isl_union_map_power(
4910 __isl_take isl_union_map *umap, int *exact);
4912 Compute a parametric representation for all positive powers I<k> of C<map>.
4913 The result maps I<k> to a nested relation corresponding to the
4914 I<k>th power of C<map>.
4915 The result may be an overapproximation. If the result is known to be exact,
4916 then C<*exact> is set to C<1>.
4918 =item * Transitive closure
4920 __isl_give isl_map *isl_map_transitive_closure(
4921 __isl_take isl_map *map, int *exact);
4922 __isl_give isl_union_map *isl_union_map_transitive_closure(
4923 __isl_take isl_union_map *umap, int *exact);
4925 Compute the transitive closure of C<map>.
4926 The result may be an overapproximation. If the result is known to be exact,
4927 then C<*exact> is set to C<1>.
4929 =item * Reaching path lengths
4931 __isl_give isl_map *isl_map_reaching_path_lengths(
4932 __isl_take isl_map *map, int *exact);
4934 Compute a relation that maps each element in the range of C<map>
4935 to the lengths of all paths composed of edges in C<map> that
4936 end up in the given element.
4937 The result may be an overapproximation. If the result is known to be exact,
4938 then C<*exact> is set to C<1>.
4939 To compute the I<maximal> path length, the resulting relation
4940 should be postprocessed by C<isl_map_lexmax>.
4941 In particular, if the input relation is a dependence relation
4942 (mapping sources to sinks), then the maximal path length corresponds
4943 to the free schedule.
4944 Note, however, that C<isl_map_lexmax> expects the maximum to be
4945 finite, so if the path lengths are unbounded (possibly due to
4946 the overapproximation), then you will get an error message.
4950 #include <isl/space.h>
4951 __isl_give isl_space *isl_space_wrap(
4952 __isl_take isl_space *space);
4953 __isl_give isl_space *isl_space_unwrap(
4954 __isl_take isl_space *space);
4956 #include <isl/local_space.h>
4957 __isl_give isl_local_space *isl_local_space_wrap(
4958 __isl_take isl_local_space *ls);
4960 #include <isl/set.h>
4961 __isl_give isl_basic_map *isl_basic_set_unwrap(
4962 __isl_take isl_basic_set *bset);
4963 __isl_give isl_map *isl_set_unwrap(
4964 __isl_take isl_set *set);
4966 #include <isl/map.h>
4967 __isl_give isl_basic_set *isl_basic_map_wrap(
4968 __isl_take isl_basic_map *bmap);
4969 __isl_give isl_set *isl_map_wrap(
4970 __isl_take isl_map *map);
4972 #include <isl/union_set.h>
4973 __isl_give isl_union_map *isl_union_set_unwrap(
4974 __isl_take isl_union_set *uset);
4976 #include <isl/union_map.h>
4977 __isl_give isl_union_set *isl_union_map_wrap(
4978 __isl_take isl_union_map *umap);
4980 The input to C<isl_space_unwrap> should
4981 be the space of a set, while that of
4982 C<isl_space_wrap> should be the space of a relation.
4983 Conversely, the output of C<isl_space_unwrap> is the space
4984 of a relation, while that of C<isl_space_wrap> is the space of a set.
4988 Remove any internal structure of domain (and range) of the given
4989 set or relation. If there is any such internal structure in the input,
4990 then the name of the space is also removed.
4992 #include <isl/local_space.h>
4993 __isl_give isl_local_space *
4994 isl_local_space_flatten_domain(
4995 __isl_take isl_local_space *ls);
4996 __isl_give isl_local_space *
4997 isl_local_space_flatten_range(
4998 __isl_take isl_local_space *ls);
5000 #include <isl/set.h>
5001 __isl_give isl_basic_set *isl_basic_set_flatten(
5002 __isl_take isl_basic_set *bset);
5003 __isl_give isl_set *isl_set_flatten(
5004 __isl_take isl_set *set);
5006 #include <isl/map.h>
5007 __isl_give isl_basic_map *isl_basic_map_flatten_domain(
5008 __isl_take isl_basic_map *bmap);
5009 __isl_give isl_basic_map *isl_basic_map_flatten_range(
5010 __isl_take isl_basic_map *bmap);
5011 __isl_give isl_map *isl_map_flatten_range(
5012 __isl_take isl_map *map);
5013 __isl_give isl_map *isl_map_flatten_domain(
5014 __isl_take isl_map *map);
5015 __isl_give isl_basic_map *isl_basic_map_flatten(
5016 __isl_take isl_basic_map *bmap);
5017 __isl_give isl_map *isl_map_flatten(
5018 __isl_take isl_map *map);
5020 #include <isl/val.h>
5021 __isl_give isl_multi_val *isl_multi_val_flatten_range(
5022 __isl_take isl_multi_val *mv);
5024 #include <isl/aff.h>
5025 __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5026 __isl_take isl_multi_aff *ma);
5027 __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5028 __isl_take isl_multi_aff *ma);
5029 __isl_give isl_multi_pw_aff *
5030 isl_multi_pw_aff_flatten_range(
5031 __isl_take isl_multi_pw_aff *mpa);
5032 __isl_give isl_multi_union_pw_aff *
5033 isl_multi_union_pw_aff_flatten_range(
5034 __isl_take isl_multi_union_pw_aff *mupa);
5036 #include <isl/map.h>
5037 __isl_give isl_map *isl_set_flatten_map(
5038 __isl_take isl_set *set);
5040 The function above constructs a relation
5041 that maps the input set to a flattened version of the set.
5045 Lift the input set to a space with extra dimensions corresponding
5046 to the existentially quantified variables in the input.
5047 In particular, the result lives in a wrapped map where the domain
5048 is the original space and the range corresponds to the original
5049 existentially quantified variables.
5051 #include <isl/set.h>
5052 __isl_give isl_basic_set *isl_basic_set_lift(
5053 __isl_take isl_basic_set *bset);
5054 __isl_give isl_set *isl_set_lift(
5055 __isl_take isl_set *set);
5056 __isl_give isl_union_set *isl_union_set_lift(
5057 __isl_take isl_union_set *uset);
5059 Given a local space that contains the existentially quantified
5060 variables of a set, a basic relation that, when applied to
5061 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
5062 can be constructed using the following function.
5064 #include <isl/local_space.h>
5065 __isl_give isl_basic_map *isl_local_space_lifting(
5066 __isl_take isl_local_space *ls);
5068 #include <isl/aff.h>
5069 __isl_give isl_multi_aff *isl_multi_aff_lift(
5070 __isl_take isl_multi_aff *maff,
5071 __isl_give isl_local_space **ls);
5073 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
5074 then it is assigned the local space that lies at the basis of
5075 the lifting applied.
5077 =item * Internal Product
5079 #include <isl/space.h>
5080 __isl_give isl_space *isl_space_zip(
5081 __isl_take isl_space *space);
5083 #include <isl/map.h>
5084 __isl_give isl_basic_map *isl_basic_map_zip(
5085 __isl_take isl_basic_map *bmap);
5086 __isl_give isl_map *isl_map_zip(
5087 __isl_take isl_map *map);
5089 #include <isl/union_map.h>
5090 __isl_give isl_union_map *isl_union_map_zip(
5091 __isl_take isl_union_map *umap);
5093 Given a relation with nested relations for domain and range,
5094 interchange the range of the domain with the domain of the range.
5098 #include <isl/space.h>
5099 __isl_give isl_space *isl_space_curry(
5100 __isl_take isl_space *space);
5101 __isl_give isl_space *isl_space_uncurry(
5102 __isl_take isl_space *space);
5104 #include <isl/map.h>
5105 __isl_give isl_basic_map *isl_basic_map_curry(
5106 __isl_take isl_basic_map *bmap);
5107 __isl_give isl_basic_map *isl_basic_map_uncurry(
5108 __isl_take isl_basic_map *bmap);
5109 __isl_give isl_map *isl_map_curry(
5110 __isl_take isl_map *map);
5111 __isl_give isl_map *isl_map_uncurry(
5112 __isl_take isl_map *map);
5114 #include <isl/union_map.h>
5115 __isl_give isl_union_map *isl_union_map_curry(
5116 __isl_take isl_union_map *umap);
5117 __isl_give isl_union_map *isl_union_map_uncurry(
5118 __isl_take isl_union_map *umap);
5120 Given a relation with a nested relation for domain,
5121 the C<curry> functions
5122 move the range of the nested relation out of the domain
5123 and use it as the domain of a nested relation in the range,
5124 with the original range as range of this nested relation.
5125 The C<uncurry> functions perform the inverse operation.
5127 =item * Aligning parameters
5129 Change the order of the parameters of the given set, relation
5131 such that the first parameters match those of C<model>.
5132 This may involve the introduction of extra parameters.
5133 All parameters need to be named.
5135 #include <isl/space.h>
5136 __isl_give isl_space *isl_space_align_params(
5137 __isl_take isl_space *space1,
5138 __isl_take isl_space *space2)
5140 #include <isl/set.h>
5141 __isl_give isl_basic_set *isl_basic_set_align_params(
5142 __isl_take isl_basic_set *bset,
5143 __isl_take isl_space *model);
5144 __isl_give isl_set *isl_set_align_params(
5145 __isl_take isl_set *set,
5146 __isl_take isl_space *model);
5148 #include <isl/map.h>
5149 __isl_give isl_basic_map *isl_basic_map_align_params(
5150 __isl_take isl_basic_map *bmap,
5151 __isl_take isl_space *model);
5152 __isl_give isl_map *isl_map_align_params(
5153 __isl_take isl_map *map,
5154 __isl_take isl_space *model);
5156 #include <isl/val.h>
5157 __isl_give isl_multi_val *isl_multi_val_align_params(
5158 __isl_take isl_multi_val *mv,
5159 __isl_take isl_space *model);
5161 #include <isl/aff.h>
5162 __isl_give isl_aff *isl_aff_align_params(
5163 __isl_take isl_aff *aff,
5164 __isl_take isl_space *model);
5165 __isl_give isl_multi_aff *isl_multi_aff_align_params(
5166 __isl_take isl_multi_aff *multi,
5167 __isl_take isl_space *model);
5168 __isl_give isl_pw_aff *isl_pw_aff_align_params(
5169 __isl_take isl_pw_aff *pwaff,
5170 __isl_take isl_space *model);
5171 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5172 __isl_take isl_pw_multi_aff *pma,
5173 __isl_take isl_space *model);
5174 __isl_give isl_union_pw_aff *
5175 isl_union_pw_aff_align_params(
5176 __isl_take isl_union_pw_aff *upa,
5177 __isl_take isl_space *model);
5178 __isl_give isl_union_pw_multi_aff *
5179 isl_union_pw_multi_aff_align_params(
5180 __isl_take isl_union_pw_multi_aff *upma,
5181 __isl_take isl_space *model);
5182 __isl_give isl_multi_union_pw_aff *
5183 isl_multi_union_pw_aff_align_params(
5184 __isl_take isl_multi_union_pw_aff *mupa,
5185 __isl_take isl_space *model);
5187 #include <isl/polynomial.h>
5188 __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5189 __isl_take isl_qpolynomial *qp,
5190 __isl_take isl_space *model);
5192 =item * Unary Arithmethic Operations
5194 #include <isl/val.h>
5195 __isl_give isl_multi_val *isl_multi_val_neg(
5196 __isl_take isl_multi_val *mv);
5198 #include <isl/aff.h>
5199 __isl_give isl_aff *isl_aff_neg(
5200 __isl_take isl_aff *aff);
5201 __isl_give isl_multi_aff *isl_multi_aff_neg(
5202 __isl_take isl_multi_aff *ma);
5203 __isl_give isl_pw_aff *isl_pw_aff_neg(
5204 __isl_take isl_pw_aff *pwaff);
5205 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5206 __isl_take isl_pw_multi_aff *pma);
5207 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5208 __isl_take isl_multi_pw_aff *mpa);
5209 __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5210 __isl_take isl_union_pw_aff *upa);
5211 __isl_give isl_union_pw_multi_aff *
5212 isl_union_pw_multi_aff_neg(
5213 __isl_take isl_union_pw_multi_aff *upma);
5214 __isl_give isl_multi_union_pw_aff *
5215 isl_multi_union_pw_aff_neg(
5216 __isl_take isl_multi_union_pw_aff *mupa);
5217 __isl_give isl_aff *isl_aff_ceil(
5218 __isl_take isl_aff *aff);
5219 __isl_give isl_pw_aff *isl_pw_aff_ceil(
5220 __isl_take isl_pw_aff *pwaff);
5221 __isl_give isl_aff *isl_aff_floor(
5222 __isl_take isl_aff *aff);
5223 __isl_give isl_multi_aff *isl_multi_aff_floor(
5224 __isl_take isl_multi_aff *ma);
5225 __isl_give isl_pw_aff *isl_pw_aff_floor(
5226 __isl_take isl_pw_aff *pwaff);
5227 __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5228 __isl_take isl_union_pw_aff *upa);
5229 __isl_give isl_multi_union_pw_aff *
5230 isl_multi_union_pw_aff_floor(
5231 __isl_take isl_multi_union_pw_aff *mupa);
5233 #include <isl/aff.h>
5234 __isl_give isl_pw_aff *isl_pw_aff_list_min(
5235 __isl_take isl_pw_aff_list *list);
5236 __isl_give isl_pw_aff *isl_pw_aff_list_max(
5237 __isl_take isl_pw_aff_list *list);
5239 #include <isl/polynomial.h>
5240 __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5241 __isl_take isl_qpolynomial *qp);
5242 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5243 __isl_take isl_pw_qpolynomial *pwqp);
5244 __isl_give isl_union_pw_qpolynomial *
5245 isl_union_pw_qpolynomial_neg(
5246 __isl_take isl_union_pw_qpolynomial *upwqp);
5247 __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5248 __isl_take isl_qpolynomial *qp,
5250 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5251 __isl_take isl_pw_qpolynomial *pwqp,
5256 The following functions evaluate a function in a point.
5258 #include <isl/polynomial.h>
5259 __isl_give isl_val *isl_pw_qpolynomial_eval(
5260 __isl_take isl_pw_qpolynomial *pwqp,
5261 __isl_take isl_point *pnt);
5262 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5263 __isl_take isl_pw_qpolynomial_fold *pwf,
5264 __isl_take isl_point *pnt);
5265 __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5266 __isl_take isl_union_pw_qpolynomial *upwqp,
5267 __isl_take isl_point *pnt);
5268 __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5269 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5270 __isl_take isl_point *pnt);
5272 =item * Dimension manipulation
5274 It is usually not advisable to directly change the (input or output)
5275 space of a set or a relation as this removes the name and the internal
5276 structure of the space. However, the functions below can be useful
5277 to add new parameters, assuming
5278 C<isl_set_align_params> and C<isl_map_align_params>
5281 #include <isl/space.h>
5282 __isl_give isl_space *isl_space_add_dims(
5283 __isl_take isl_space *space,
5284 enum isl_dim_type type, unsigned n);
5285 __isl_give isl_space *isl_space_insert_dims(
5286 __isl_take isl_space *space,
5287 enum isl_dim_type type, unsigned pos, unsigned n);
5288 __isl_give isl_space *isl_space_drop_dims(
5289 __isl_take isl_space *space,
5290 enum isl_dim_type type, unsigned first, unsigned n);
5291 __isl_give isl_space *isl_space_move_dims(
5292 __isl_take isl_space *space,
5293 enum isl_dim_type dst_type, unsigned dst_pos,
5294 enum isl_dim_type src_type, unsigned src_pos,
5297 #include <isl/local_space.h>
5298 __isl_give isl_local_space *isl_local_space_add_dims(
5299 __isl_take isl_local_space *ls,
5300 enum isl_dim_type type, unsigned n);
5301 __isl_give isl_local_space *isl_local_space_insert_dims(
5302 __isl_take isl_local_space *ls,
5303 enum isl_dim_type type, unsigned first, unsigned n);
5304 __isl_give isl_local_space *isl_local_space_drop_dims(
5305 __isl_take isl_local_space *ls,
5306 enum isl_dim_type type, unsigned first, unsigned n);
5308 #include <isl/set.h>
5309 __isl_give isl_basic_set *isl_basic_set_add_dims(
5310 __isl_take isl_basic_set *bset,
5311 enum isl_dim_type type, unsigned n);
5312 __isl_give isl_set *isl_set_add_dims(
5313 __isl_take isl_set *set,
5314 enum isl_dim_type type, unsigned n);
5315 __isl_give isl_basic_set *isl_basic_set_insert_dims(
5316 __isl_take isl_basic_set *bset,
5317 enum isl_dim_type type, unsigned pos,
5319 __isl_give isl_set *isl_set_insert_dims(
5320 __isl_take isl_set *set,
5321 enum isl_dim_type type, unsigned pos, unsigned n);
5322 __isl_give isl_basic_set *isl_basic_set_move_dims(
5323 __isl_take isl_basic_set *bset,
5324 enum isl_dim_type dst_type, unsigned dst_pos,
5325 enum isl_dim_type src_type, unsigned src_pos,
5327 __isl_give isl_set *isl_set_move_dims(
5328 __isl_take isl_set *set,
5329 enum isl_dim_type dst_type, unsigned dst_pos,
5330 enum isl_dim_type src_type, unsigned src_pos,
5333 #include <isl/map.h>
5334 __isl_give isl_basic_map *isl_basic_map_add_dims(
5335 __isl_take isl_basic_map *bmap,
5336 enum isl_dim_type type, unsigned n);
5337 __isl_give isl_map *isl_map_add_dims(
5338 __isl_take isl_map *map,
5339 enum isl_dim_type type, unsigned n);
5340 __isl_give isl_basic_map *isl_basic_map_insert_dims(
5341 __isl_take isl_basic_map *bmap,
5342 enum isl_dim_type type, unsigned pos,
5344 __isl_give isl_map *isl_map_insert_dims(
5345 __isl_take isl_map *map,
5346 enum isl_dim_type type, unsigned pos, unsigned n);
5347 __isl_give isl_basic_map *isl_basic_map_move_dims(
5348 __isl_take isl_basic_map *bmap,
5349 enum isl_dim_type dst_type, unsigned dst_pos,
5350 enum isl_dim_type src_type, unsigned src_pos,
5352 __isl_give isl_map *isl_map_move_dims(
5353 __isl_take isl_map *map,
5354 enum isl_dim_type dst_type, unsigned dst_pos,
5355 enum isl_dim_type src_type, unsigned src_pos,
5358 #include <isl/val.h>
5359 __isl_give isl_multi_val *isl_multi_val_insert_dims(
5360 __isl_take isl_multi_val *mv,
5361 enum isl_dim_type type, unsigned first, unsigned n);
5362 __isl_give isl_multi_val *isl_multi_val_add_dims(
5363 __isl_take isl_multi_val *mv,
5364 enum isl_dim_type type, unsigned n);
5365 __isl_give isl_multi_val *isl_multi_val_drop_dims(
5366 __isl_take isl_multi_val *mv,
5367 enum isl_dim_type type, unsigned first, unsigned n);
5369 #include <isl/aff.h>
5370 __isl_give isl_aff *isl_aff_insert_dims(
5371 __isl_take isl_aff *aff,
5372 enum isl_dim_type type, unsigned first, unsigned n);
5373 __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5374 __isl_take isl_multi_aff *ma,
5375 enum isl_dim_type type, unsigned first, unsigned n);
5376 __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5377 __isl_take isl_pw_aff *pwaff,
5378 enum isl_dim_type type, unsigned first, unsigned n);
5379 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5380 __isl_take isl_multi_pw_aff *mpa,
5381 enum isl_dim_type type, unsigned first, unsigned n);
5382 __isl_give isl_aff *isl_aff_add_dims(
5383 __isl_take isl_aff *aff,
5384 enum isl_dim_type type, unsigned n);
5385 __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5386 __isl_take isl_multi_aff *ma,
5387 enum isl_dim_type type, unsigned n);
5388 __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5389 __isl_take isl_pw_aff *pwaff,
5390 enum isl_dim_type type, unsigned n);
5391 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5392 __isl_take isl_multi_pw_aff *mpa,
5393 enum isl_dim_type type, unsigned n);
5394 __isl_give isl_aff *isl_aff_drop_dims(
5395 __isl_take isl_aff *aff,
5396 enum isl_dim_type type, unsigned first, unsigned n);
5397 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5398 __isl_take isl_multi_aff *maff,
5399 enum isl_dim_type type, unsigned first, unsigned n);
5400 __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5401 __isl_take isl_pw_aff *pwaff,
5402 enum isl_dim_type type, unsigned first, unsigned n);
5403 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5404 __isl_take isl_pw_multi_aff *pma,
5405 enum isl_dim_type type, unsigned first, unsigned n);
5406 __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5407 __isl_take isl_union_pw_aff *upa,
5408 enum isl_dim_type type, unsigned first, unsigned n);
5409 __isl_give isl_union_pw_multi_aff *
5410 isl_union_pw_multi_aff_drop_dims(
5411 __isl_take isl_union_pw_multi_aff *upma,
5412 enum isl_dim_type type,
5413 unsigned first, unsigned n);
5414 __isl_give isl_multi_union_pw_aff *
5415 isl_multi_union_pw_aff_drop_dims(
5416 __isl_take isl_multi_union_pw_aff *mupa,
5417 enum isl_dim_type type, unsigned first,
5419 __isl_give isl_aff *isl_aff_move_dims(
5420 __isl_take isl_aff *aff,
5421 enum isl_dim_type dst_type, unsigned dst_pos,
5422 enum isl_dim_type src_type, unsigned src_pos,
5424 __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5425 __isl_take isl_multi_aff *ma,
5426 enum isl_dim_type dst_type, unsigned dst_pos,
5427 enum isl_dim_type src_type, unsigned src_pos,
5429 __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5430 __isl_take isl_pw_aff *pa,
5431 enum isl_dim_type dst_type, unsigned dst_pos,
5432 enum isl_dim_type src_type, unsigned src_pos,
5434 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5435 __isl_take isl_multi_pw_aff *pma,
5436 enum isl_dim_type dst_type, unsigned dst_pos,
5437 enum isl_dim_type src_type, unsigned src_pos,
5440 #include <isl/polynomial.h>
5441 __isl_give isl_union_pw_qpolynomial *
5442 isl_union_pw_qpolynomial_drop_dims(
5443 __isl_take isl_union_pw_qpolynomial *upwqp,
5444 enum isl_dim_type type,
5445 unsigned first, unsigned n);
5446 __isl_give isl_union_pw_qpolynomial_fold *
5447 isl_union_pw_qpolynomial_fold_drop_dims(
5448 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5449 enum isl_dim_type type,
5450 unsigned first, unsigned n);
5452 The operations on union expressions can only manipulate parameters.
5456 =head2 Binary Operations
5458 The two arguments of a binary operation not only need to live
5459 in the same C<isl_ctx>, they currently also need to have
5460 the same (number of) parameters.
5462 =head3 Basic Operations
5466 =item * Intersection
5468 #include <isl/local_space.h>
5469 __isl_give isl_local_space *isl_local_space_intersect(
5470 __isl_take isl_local_space *ls1,
5471 __isl_take isl_local_space *ls2);
5473 #include <isl/set.h>
5474 __isl_give isl_basic_set *isl_basic_set_intersect_params(
5475 __isl_take isl_basic_set *bset1,
5476 __isl_take isl_basic_set *bset2);
5477 __isl_give isl_basic_set *isl_basic_set_intersect(
5478 __isl_take isl_basic_set *bset1,
5479 __isl_take isl_basic_set *bset2);
5480 __isl_give isl_basic_set *isl_basic_set_list_intersect(
5481 __isl_take struct isl_basic_set_list *list);
5482 __isl_give isl_set *isl_set_intersect_params(
5483 __isl_take isl_set *set,
5484 __isl_take isl_set *params);
5485 __isl_give isl_set *isl_set_intersect(
5486 __isl_take isl_set *set1,
5487 __isl_take isl_set *set2);
5489 #include <isl/map.h>
5490 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5491 __isl_take isl_basic_map *bmap,
5492 __isl_take isl_basic_set *bset);
5493 __isl_give isl_basic_map *isl_basic_map_intersect_range(
5494 __isl_take isl_basic_map *bmap,
5495 __isl_take isl_basic_set *bset);
5496 __isl_give isl_basic_map *isl_basic_map_intersect(
5497 __isl_take isl_basic_map *bmap1,
5498 __isl_take isl_basic_map *bmap2);
5499 __isl_give isl_basic_map *isl_basic_map_list_intersect(
5500 __isl_take isl_basic_map_list *list);
5501 __isl_give isl_map *isl_map_intersect_params(
5502 __isl_take isl_map *map,
5503 __isl_take isl_set *params);
5504 __isl_give isl_map *isl_map_intersect_domain(
5505 __isl_take isl_map *map,
5506 __isl_take isl_set *set);
5507 __isl_give isl_map *isl_map_intersect_range(
5508 __isl_take isl_map *map,
5509 __isl_take isl_set *set);
5510 __isl_give isl_map *isl_map_intersect(
5511 __isl_take isl_map *map1,
5512 __isl_take isl_map *map2);
5514 #include <isl/union_set.h>
5515 __isl_give isl_union_set *isl_union_set_intersect_params(
5516 __isl_take isl_union_set *uset,
5517 __isl_take isl_set *set);
5518 __isl_give isl_union_set *isl_union_set_intersect(
5519 __isl_take isl_union_set *uset1,
5520 __isl_take isl_union_set *uset2);
5522 #include <isl/union_map.h>
5523 __isl_give isl_union_map *isl_union_map_intersect_params(
5524 __isl_take isl_union_map *umap,
5525 __isl_take isl_set *set);
5526 __isl_give isl_union_map *isl_union_map_intersect_domain(
5527 __isl_take isl_union_map *umap,
5528 __isl_take isl_union_set *uset);
5529 __isl_give isl_union_map *isl_union_map_intersect_range(
5530 __isl_take isl_union_map *umap,
5531 __isl_take isl_union_set *uset);
5532 __isl_give isl_union_map *isl_union_map_intersect(
5533 __isl_take isl_union_map *umap1,
5534 __isl_take isl_union_map *umap2);
5536 #include <isl/aff.h>
5537 __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5538 __isl_take isl_pw_aff *pa,
5539 __isl_take isl_set *set);
5540 __isl_give isl_multi_pw_aff *
5541 isl_multi_pw_aff_intersect_domain(
5542 __isl_take isl_multi_pw_aff *mpa,
5543 __isl_take isl_set *domain);
5544 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5545 __isl_take isl_pw_multi_aff *pma,
5546 __isl_take isl_set *set);
5547 __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5548 __isl_take isl_union_pw_aff *upa,
5549 __isl_take isl_union_set *uset);
5550 __isl_give isl_union_pw_multi_aff *
5551 isl_union_pw_multi_aff_intersect_domain(
5552 __isl_take isl_union_pw_multi_aff *upma,
5553 __isl_take isl_union_set *uset);
5554 __isl_give isl_multi_union_pw_aff *
5555 isl_multi_union_pw_aff_intersect_domain(
5556 __isl_take isl_multi_union_pw_aff *mupa,
5557 __isl_take isl_union_set *uset);
5558 __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5559 __isl_take isl_pw_aff *pa,
5560 __isl_take isl_set *set);
5561 __isl_give isl_multi_pw_aff *
5562 isl_multi_pw_aff_intersect_params(
5563 __isl_take isl_multi_pw_aff *mpa,
5564 __isl_take isl_set *set);
5565 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5566 __isl_take isl_pw_multi_aff *pma,
5567 __isl_take isl_set *set);
5568 __isl_give isl_union_pw_aff *
5569 isl_union_pw_aff_intersect_params(
5570 __isl_take isl_union_pw_aff *upa,
5571 __isl_give isl_union_pw_multi_aff *
5572 isl_union_pw_multi_aff_intersect_params(
5573 __isl_take isl_union_pw_multi_aff *upma,
5574 __isl_take isl_set *set);
5575 __isl_give isl_multi_union_pw_aff *
5576 isl_multi_union_pw_aff_intersect_params(
5577 __isl_take isl_multi_union_pw_aff *mupa,
5578 __isl_take isl_set *params);
5579 isl_multi_union_pw_aff_intersect_range(
5580 __isl_take isl_multi_union_pw_aff *mupa,
5581 __isl_take isl_set *set);
5583 #include <isl/polynomial.h>
5584 __isl_give isl_pw_qpolynomial *
5585 isl_pw_qpolynomial_intersect_domain(
5586 __isl_take isl_pw_qpolynomial *pwpq,
5587 __isl_take isl_set *set);
5588 __isl_give isl_union_pw_qpolynomial *
5589 isl_union_pw_qpolynomial_intersect_domain(
5590 __isl_take isl_union_pw_qpolynomial *upwpq,
5591 __isl_take isl_union_set *uset);
5592 __isl_give isl_union_pw_qpolynomial_fold *
5593 isl_union_pw_qpolynomial_fold_intersect_domain(
5594 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5595 __isl_take isl_union_set *uset);
5596 __isl_give isl_pw_qpolynomial *
5597 isl_pw_qpolynomial_intersect_params(
5598 __isl_take isl_pw_qpolynomial *pwpq,
5599 __isl_take isl_set *set);
5600 __isl_give isl_pw_qpolynomial_fold *
5601 isl_pw_qpolynomial_fold_intersect_params(
5602 __isl_take isl_pw_qpolynomial_fold *pwf,
5603 __isl_take isl_set *set);
5604 __isl_give isl_union_pw_qpolynomial *
5605 isl_union_pw_qpolynomial_intersect_params(
5606 __isl_take isl_union_pw_qpolynomial *upwpq,
5607 __isl_take isl_set *set);
5608 __isl_give isl_union_pw_qpolynomial_fold *
5609 isl_union_pw_qpolynomial_fold_intersect_params(
5610 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5611 __isl_take isl_set *set);
5613 The second argument to the C<_params> functions needs to be
5614 a parametric (basic) set. For the other functions, a parametric set
5615 for either argument is only allowed if the other argument is
5616 a parametric set as well.
5617 The list passed to C<isl_basic_set_list_intersect> needs to have
5618 at least one element and all elements need to live in the same space.
5619 The function C<isl_multi_union_pw_aff_intersect_range>
5620 restricts the input function to those shared domain elements
5621 that map to the specified range.
5625 #include <isl/set.h>
5626 __isl_give isl_set *isl_basic_set_union(
5627 __isl_take isl_basic_set *bset1,
5628 __isl_take isl_basic_set *bset2);
5629 __isl_give isl_set *isl_set_union(
5630 __isl_take isl_set *set1,
5631 __isl_take isl_set *set2);
5633 #include <isl/map.h>
5634 __isl_give isl_map *isl_basic_map_union(
5635 __isl_take isl_basic_map *bmap1,
5636 __isl_take isl_basic_map *bmap2);
5637 __isl_give isl_map *isl_map_union(
5638 __isl_take isl_map *map1,
5639 __isl_take isl_map *map2);
5641 #include <isl/union_set.h>
5642 __isl_give isl_union_set *isl_union_set_union(
5643 __isl_take isl_union_set *uset1,
5644 __isl_take isl_union_set *uset2);
5645 __isl_give isl_union_set *isl_union_set_list_union(
5646 __isl_take isl_union_set_list *list);
5648 #include <isl/union_map.h>
5649 __isl_give isl_union_map *isl_union_map_union(
5650 __isl_take isl_union_map *umap1,
5651 __isl_take isl_union_map *umap2);
5653 =item * Set difference
5655 #include <isl/set.h>
5656 __isl_give isl_set *isl_set_subtract(
5657 __isl_take isl_set *set1,
5658 __isl_take isl_set *set2);
5660 #include <isl/map.h>
5661 __isl_give isl_map *isl_map_subtract(
5662 __isl_take isl_map *map1,
5663 __isl_take isl_map *map2);
5664 __isl_give isl_map *isl_map_subtract_domain(
5665 __isl_take isl_map *map,
5666 __isl_take isl_set *dom);
5667 __isl_give isl_map *isl_map_subtract_range(
5668 __isl_take isl_map *map,
5669 __isl_take isl_set *dom);
5671 #include <isl/union_set.h>
5672 __isl_give isl_union_set *isl_union_set_subtract(
5673 __isl_take isl_union_set *uset1,
5674 __isl_take isl_union_set *uset2);
5676 #include <isl/union_map.h>
5677 __isl_give isl_union_map *isl_union_map_subtract(
5678 __isl_take isl_union_map *umap1,
5679 __isl_take isl_union_map *umap2);
5680 __isl_give isl_union_map *isl_union_map_subtract_domain(
5681 __isl_take isl_union_map *umap,
5682 __isl_take isl_union_set *dom);
5683 __isl_give isl_union_map *isl_union_map_subtract_range(
5684 __isl_take isl_union_map *umap,
5685 __isl_take isl_union_set *dom);
5687 #include <isl/aff.h>
5688 __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5689 __isl_take isl_pw_aff *pa,
5690 __isl_take isl_set *set);
5691 __isl_give isl_pw_multi_aff *
5692 isl_pw_multi_aff_subtract_domain(
5693 __isl_take isl_pw_multi_aff *pma,
5694 __isl_take isl_set *set);
5695 __isl_give isl_union_pw_aff *
5696 isl_union_pw_aff_subtract_domain(
5697 __isl_take isl_union_pw_aff *upa,
5698 __isl_take isl_union_set *uset);
5699 __isl_give isl_union_pw_multi_aff *
5700 isl_union_pw_multi_aff_subtract_domain(
5701 __isl_take isl_union_pw_multi_aff *upma,
5702 __isl_take isl_set *set);
5704 #include <isl/polynomial.h>
5705 __isl_give isl_pw_qpolynomial *
5706 isl_pw_qpolynomial_subtract_domain(
5707 __isl_take isl_pw_qpolynomial *pwpq,
5708 __isl_take isl_set *set);
5709 __isl_give isl_pw_qpolynomial_fold *
5710 isl_pw_qpolynomial_fold_subtract_domain(
5711 __isl_take isl_pw_qpolynomial_fold *pwf,
5712 __isl_take isl_set *set);
5713 __isl_give isl_union_pw_qpolynomial *
5714 isl_union_pw_qpolynomial_subtract_domain(
5715 __isl_take isl_union_pw_qpolynomial *upwpq,
5716 __isl_take isl_union_set *uset);
5717 __isl_give isl_union_pw_qpolynomial_fold *
5718 isl_union_pw_qpolynomial_fold_subtract_domain(
5719 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5720 __isl_take isl_union_set *uset);
5724 #include <isl/space.h>
5725 __isl_give isl_space *isl_space_join(
5726 __isl_take isl_space *left,
5727 __isl_take isl_space *right);
5729 #include <isl/map.h>
5730 __isl_give isl_basic_set *isl_basic_set_apply(
5731 __isl_take isl_basic_set *bset,
5732 __isl_take isl_basic_map *bmap);
5733 __isl_give isl_set *isl_set_apply(
5734 __isl_take isl_set *set,
5735 __isl_take isl_map *map);
5736 __isl_give isl_union_set *isl_union_set_apply(
5737 __isl_take isl_union_set *uset,
5738 __isl_take isl_union_map *umap);
5739 __isl_give isl_basic_map *isl_basic_map_apply_domain(
5740 __isl_take isl_basic_map *bmap1,
5741 __isl_take isl_basic_map *bmap2);
5742 __isl_give isl_basic_map *isl_basic_map_apply_range(
5743 __isl_take isl_basic_map *bmap1,
5744 __isl_take isl_basic_map *bmap2);
5745 __isl_give isl_map *isl_map_apply_domain(
5746 __isl_take isl_map *map1,
5747 __isl_take isl_map *map2);
5748 __isl_give isl_map *isl_map_apply_range(
5749 __isl_take isl_map *map1,
5750 __isl_take isl_map *map2);
5752 #include <isl/union_map.h>
5753 __isl_give isl_union_map *isl_union_map_apply_domain(
5754 __isl_take isl_union_map *umap1,
5755 __isl_take isl_union_map *umap2);
5756 __isl_give isl_union_map *isl_union_map_apply_range(
5757 __isl_take isl_union_map *umap1,
5758 __isl_take isl_union_map *umap2);
5760 #include <isl/aff.h>
5761 __isl_give isl_union_pw_aff *
5762 isl_multi_union_pw_aff_apply_aff(
5763 __isl_take isl_multi_union_pw_aff *mupa,
5764 __isl_take isl_aff *aff);
5765 __isl_give isl_union_pw_aff *
5766 isl_multi_union_pw_aff_apply_pw_aff(
5767 __isl_take isl_multi_union_pw_aff *mupa,
5768 __isl_take isl_pw_aff *pa);
5769 __isl_give isl_multi_union_pw_aff *
5770 isl_multi_union_pw_aff_apply_multi_aff(
5771 __isl_take isl_multi_union_pw_aff *mupa,
5772 __isl_take isl_multi_aff *ma);
5773 __isl_give isl_multi_union_pw_aff *
5774 isl_multi_union_pw_aff_apply_pw_multi_aff(
5775 __isl_take isl_multi_union_pw_aff *mupa,
5776 __isl_take isl_pw_multi_aff *pma);
5778 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
5779 over the shared domain of the elements of the input. The dimension is
5780 required to be greater than zero.
5781 The C<isl_multi_union_pw_aff> argument of
5782 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
5783 but only if the range of the C<isl_multi_aff> argument
5784 is also zero-dimensional.
5785 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
5787 #include <isl/polynomial.h>
5788 __isl_give isl_pw_qpolynomial_fold *
5789 isl_set_apply_pw_qpolynomial_fold(
5790 __isl_take isl_set *set,
5791 __isl_take isl_pw_qpolynomial_fold *pwf,
5793 __isl_give isl_pw_qpolynomial_fold *
5794 isl_map_apply_pw_qpolynomial_fold(
5795 __isl_take isl_map *map,
5796 __isl_take isl_pw_qpolynomial_fold *pwf,
5798 __isl_give isl_union_pw_qpolynomial_fold *
5799 isl_union_set_apply_union_pw_qpolynomial_fold(
5800 __isl_take isl_union_set *uset,
5801 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5803 __isl_give isl_union_pw_qpolynomial_fold *
5804 isl_union_map_apply_union_pw_qpolynomial_fold(
5805 __isl_take isl_union_map *umap,
5806 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5809 The functions taking a map
5810 compose the given map with the given piecewise quasipolynomial reduction.
5811 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5812 over all elements in the intersection of the range of the map
5813 and the domain of the piecewise quasipolynomial reduction
5814 as a function of an element in the domain of the map.
5815 The functions taking a set compute a bound over all elements in the
5816 intersection of the set and the domain of the
5817 piecewise quasipolynomial reduction.
5821 #include <isl/set.h>
5822 __isl_give isl_basic_set *
5823 isl_basic_set_preimage_multi_aff(
5824 __isl_take isl_basic_set *bset,
5825 __isl_take isl_multi_aff *ma);
5826 __isl_give isl_set *isl_set_preimage_multi_aff(
5827 __isl_take isl_set *set,
5828 __isl_take isl_multi_aff *ma);
5829 __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5830 __isl_take isl_set *set,
5831 __isl_take isl_pw_multi_aff *pma);
5832 __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5833 __isl_take isl_set *set,
5834 __isl_take isl_multi_pw_aff *mpa);
5836 #include <isl/union_set.h>
5837 __isl_give isl_union_set *
5838 isl_union_set_preimage_multi_aff(
5839 __isl_take isl_union_set *uset,
5840 __isl_take isl_multi_aff *ma);
5841 __isl_give isl_union_set *
5842 isl_union_set_preimage_pw_multi_aff(
5843 __isl_take isl_union_set *uset,
5844 __isl_take isl_pw_multi_aff *pma);
5845 __isl_give isl_union_set *
5846 isl_union_set_preimage_union_pw_multi_aff(
5847 __isl_take isl_union_set *uset,
5848 __isl_take isl_union_pw_multi_aff *upma);
5850 #include <isl/map.h>
5851 __isl_give isl_basic_map *
5852 isl_basic_map_preimage_domain_multi_aff(
5853 __isl_take isl_basic_map *bmap,
5854 __isl_take isl_multi_aff *ma);
5855 __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5856 __isl_take isl_map *map,
5857 __isl_take isl_multi_aff *ma);
5858 __isl_give isl_map *isl_map_preimage_range_multi_aff(
5859 __isl_take isl_map *map,
5860 __isl_take isl_multi_aff *ma);
5861 __isl_give isl_map *
5862 isl_map_preimage_domain_pw_multi_aff(
5863 __isl_take isl_map *map,
5864 __isl_take isl_pw_multi_aff *pma);
5865 __isl_give isl_map *
5866 isl_map_preimage_range_pw_multi_aff(
5867 __isl_take isl_map *map,
5868 __isl_take isl_pw_multi_aff *pma);
5869 __isl_give isl_map *
5870 isl_map_preimage_domain_multi_pw_aff(
5871 __isl_take isl_map *map,
5872 __isl_take isl_multi_pw_aff *mpa);
5873 __isl_give isl_basic_map *
5874 isl_basic_map_preimage_range_multi_aff(
5875 __isl_take isl_basic_map *bmap,
5876 __isl_take isl_multi_aff *ma);
5878 #include <isl/union_map.h>
5879 __isl_give isl_union_map *
5880 isl_union_map_preimage_domain_multi_aff(
5881 __isl_take isl_union_map *umap,
5882 __isl_take isl_multi_aff *ma);
5883 __isl_give isl_union_map *
5884 isl_union_map_preimage_range_multi_aff(
5885 __isl_take isl_union_map *umap,
5886 __isl_take isl_multi_aff *ma);
5887 __isl_give isl_union_map *
5888 isl_union_map_preimage_domain_pw_multi_aff(
5889 __isl_take isl_union_map *umap,
5890 __isl_take isl_pw_multi_aff *pma);
5891 __isl_give isl_union_map *
5892 isl_union_map_preimage_range_pw_multi_aff(
5893 __isl_take isl_union_map *umap,
5894 __isl_take isl_pw_multi_aff *pma);
5895 __isl_give isl_union_map *
5896 isl_union_map_preimage_domain_union_pw_multi_aff(
5897 __isl_take isl_union_map *umap,
5898 __isl_take isl_union_pw_multi_aff *upma);
5899 __isl_give isl_union_map *
5900 isl_union_map_preimage_range_union_pw_multi_aff(
5901 __isl_take isl_union_map *umap,
5902 __isl_take isl_union_pw_multi_aff *upma);
5904 These functions compute the preimage of the given set or map domain/range under
5905 the given function. In other words, the expression is plugged
5906 into the set description or into the domain/range of the map.
5910 #include <isl/aff.h>
5911 __isl_give isl_aff *isl_aff_pullback_aff(
5912 __isl_take isl_aff *aff1,
5913 __isl_take isl_aff *aff2);
5914 __isl_give isl_aff *isl_aff_pullback_multi_aff(
5915 __isl_take isl_aff *aff,
5916 __isl_take isl_multi_aff *ma);
5917 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5918 __isl_take isl_pw_aff *pa,
5919 __isl_take isl_multi_aff *ma);
5920 __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5921 __isl_take isl_pw_aff *pa,
5922 __isl_take isl_pw_multi_aff *pma);
5923 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5924 __isl_take isl_pw_aff *pa,
5925 __isl_take isl_multi_pw_aff *mpa);
5926 __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5927 __isl_take isl_multi_aff *ma1,
5928 __isl_take isl_multi_aff *ma2);
5929 __isl_give isl_pw_multi_aff *
5930 isl_pw_multi_aff_pullback_multi_aff(
5931 __isl_take isl_pw_multi_aff *pma,
5932 __isl_take isl_multi_aff *ma);
5933 __isl_give isl_multi_pw_aff *
5934 isl_multi_pw_aff_pullback_multi_aff(
5935 __isl_take isl_multi_pw_aff *mpa,
5936 __isl_take isl_multi_aff *ma);
5937 __isl_give isl_pw_multi_aff *
5938 isl_pw_multi_aff_pullback_pw_multi_aff(
5939 __isl_take isl_pw_multi_aff *pma1,
5940 __isl_take isl_pw_multi_aff *pma2);
5941 __isl_give isl_multi_pw_aff *
5942 isl_multi_pw_aff_pullback_pw_multi_aff(
5943 __isl_take isl_multi_pw_aff *mpa,
5944 __isl_take isl_pw_multi_aff *pma);
5945 __isl_give isl_multi_pw_aff *
5946 isl_multi_pw_aff_pullback_multi_pw_aff(
5947 __isl_take isl_multi_pw_aff *mpa1,
5948 __isl_take isl_multi_pw_aff *mpa2);
5949 __isl_give isl_union_pw_aff *
5950 isl_union_pw_aff_pullback_union_pw_multi_aff(
5951 __isl_take isl_union_pw_aff *upa,
5952 __isl_take isl_union_pw_multi_aff *upma);
5953 __isl_give isl_union_pw_multi_aff *
5954 isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
5955 __isl_take isl_union_pw_multi_aff *upma1,
5956 __isl_take isl_union_pw_multi_aff *upma2);
5957 __isl_give isl_multi_union_pw_aff *
5958 isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
5959 __isl_take isl_multi_union_pw_aff *mupa,
5960 __isl_take isl_union_pw_multi_aff *upma);
5962 These functions precompose the first expression by the second function.
5963 In other words, the second function is plugged
5964 into the first expression.
5968 #include <isl/aff.h>
5969 __isl_give isl_basic_set *isl_aff_le_basic_set(
5970 __isl_take isl_aff *aff1,
5971 __isl_take isl_aff *aff2);
5972 __isl_give isl_basic_set *isl_aff_ge_basic_set(
5973 __isl_take isl_aff *aff1,
5974 __isl_take isl_aff *aff2);
5975 __isl_give isl_set *isl_pw_aff_eq_set(
5976 __isl_take isl_pw_aff *pwaff1,
5977 __isl_take isl_pw_aff *pwaff2);
5978 __isl_give isl_set *isl_pw_aff_ne_set(
5979 __isl_take isl_pw_aff *pwaff1,
5980 __isl_take isl_pw_aff *pwaff2);
5981 __isl_give isl_set *isl_pw_aff_le_set(
5982 __isl_take isl_pw_aff *pwaff1,
5983 __isl_take isl_pw_aff *pwaff2);
5984 __isl_give isl_set *isl_pw_aff_lt_set(
5985 __isl_take isl_pw_aff *pwaff1,
5986 __isl_take isl_pw_aff *pwaff2);
5987 __isl_give isl_set *isl_pw_aff_ge_set(
5988 __isl_take isl_pw_aff *pwaff1,
5989 __isl_take isl_pw_aff *pwaff2);
5990 __isl_give isl_set *isl_pw_aff_gt_set(
5991 __isl_take isl_pw_aff *pwaff1,
5992 __isl_take isl_pw_aff *pwaff2);
5994 __isl_give isl_set *isl_multi_aff_lex_le_set(
5995 __isl_take isl_multi_aff *ma1,
5996 __isl_take isl_multi_aff *ma2);
5997 __isl_give isl_set *isl_multi_aff_lex_ge_set(
5998 __isl_take isl_multi_aff *ma1,
5999 __isl_take isl_multi_aff *ma2);
6001 __isl_give isl_set *isl_pw_aff_list_eq_set(
6002 __isl_take isl_pw_aff_list *list1,
6003 __isl_take isl_pw_aff_list *list2);
6004 __isl_give isl_set *isl_pw_aff_list_ne_set(
6005 __isl_take isl_pw_aff_list *list1,
6006 __isl_take isl_pw_aff_list *list2);
6007 __isl_give isl_set *isl_pw_aff_list_le_set(
6008 __isl_take isl_pw_aff_list *list1,
6009 __isl_take isl_pw_aff_list *list2);
6010 __isl_give isl_set *isl_pw_aff_list_lt_set(
6011 __isl_take isl_pw_aff_list *list1,
6012 __isl_take isl_pw_aff_list *list2);
6013 __isl_give isl_set *isl_pw_aff_list_ge_set(
6014 __isl_take isl_pw_aff_list *list1,
6015 __isl_take isl_pw_aff_list *list2);
6016 __isl_give isl_set *isl_pw_aff_list_gt_set(
6017 __isl_take isl_pw_aff_list *list1,
6018 __isl_take isl_pw_aff_list *list2);
6020 The function C<isl_aff_ge_basic_set> returns a basic set
6021 containing those elements in the shared space
6022 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
6023 The function C<isl_pw_aff_ge_set> returns a set
6024 containing those elements in the shared domain
6025 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
6026 greater than or equal to C<pwaff2>.
6027 The function C<isl_multi_aff_lex_le_set> returns a set
6028 containing those elements in the shared domain space
6029 where C<ma1> is lexicographically smaller than or
6031 The functions operating on C<isl_pw_aff_list> apply the corresponding
6032 C<isl_pw_aff> function to each pair of elements in the two lists.
6034 #include <isl/aff.h>
6035 __isl_give isl_map *isl_pw_aff_eq_map(
6036 __isl_take isl_pw_aff *pa1,
6037 __isl_take isl_pw_aff *pa2);
6038 __isl_give isl_map *isl_pw_aff_lt_map(
6039 __isl_take isl_pw_aff *pa1,
6040 __isl_take isl_pw_aff *pa2);
6041 __isl_give isl_map *isl_pw_aff_gt_map(
6042 __isl_take isl_pw_aff *pa1,
6043 __isl_take isl_pw_aff *pa2);
6045 __isl_give isl_map *isl_multi_pw_aff_eq_map(
6046 __isl_take isl_multi_pw_aff *mpa1,
6047 __isl_take isl_multi_pw_aff *mpa2);
6048 __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
6049 __isl_take isl_multi_pw_aff *mpa1,
6050 __isl_take isl_multi_pw_aff *mpa2);
6051 __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
6052 __isl_take isl_multi_pw_aff *mpa1,
6053 __isl_take isl_multi_pw_aff *mpa2);
6055 These functions return a map between domain elements of the arguments
6056 where the function values satisfy the given relation.
6058 #include <isl/union_map.h>
6059 __isl_give isl_union_map *
6060 isl_union_map_eq_at_multi_union_pw_aff(
6061 __isl_take isl_union_map *umap,
6062 __isl_take isl_multi_union_pw_aff *mupa);
6063 __isl_give isl_union_map *
6064 isl_union_map_lex_lt_at_multi_union_pw_aff(
6065 __isl_take isl_union_map *umap,
6066 __isl_take isl_multi_union_pw_aff *mupa);
6067 __isl_give isl_union_map *
6068 isl_union_map_lex_gt_at_multi_union_pw_aff(
6069 __isl_take isl_union_map *umap,
6070 __isl_take isl_multi_union_pw_aff *mupa);
6072 These functions select the subset of elements in the union map
6073 that have an equal or lexicographically smaller function value.
6075 =item * Cartesian Product
6077 #include <isl/space.h>
6078 __isl_give isl_space *isl_space_product(
6079 __isl_take isl_space *space1,
6080 __isl_take isl_space *space2);
6081 __isl_give isl_space *isl_space_domain_product(
6082 __isl_take isl_space *space1,
6083 __isl_take isl_space *space2);
6084 __isl_give isl_space *isl_space_range_product(
6085 __isl_take isl_space *space1,
6086 __isl_take isl_space *space2);
6089 C<isl_space_product>, C<isl_space_domain_product>
6090 and C<isl_space_range_product> take pairs or relation spaces and
6091 produce a single relations space, where either the domain, the range
6092 or both domain and range are wrapped spaces of relations between
6093 the domains and/or ranges of the input spaces.
6094 If the product is only constructed over the domain or the range
6095 then the ranges or the domains of the inputs should be the same.
6096 The function C<isl_space_product> also accepts a pair of set spaces,
6097 in which case it returns a wrapped space of a relation between the
6100 #include <isl/set.h>
6101 __isl_give isl_set *isl_set_product(
6102 __isl_take isl_set *set1,
6103 __isl_take isl_set *set2);
6105 #include <isl/map.h>
6106 __isl_give isl_basic_map *isl_basic_map_domain_product(
6107 __isl_take isl_basic_map *bmap1,
6108 __isl_take isl_basic_map *bmap2);
6109 __isl_give isl_basic_map *isl_basic_map_range_product(
6110 __isl_take isl_basic_map *bmap1,
6111 __isl_take isl_basic_map *bmap2);
6112 __isl_give isl_basic_map *isl_basic_map_product(
6113 __isl_take isl_basic_map *bmap1,
6114 __isl_take isl_basic_map *bmap2);
6115 __isl_give isl_map *isl_map_domain_product(
6116 __isl_take isl_map *map1,
6117 __isl_take isl_map *map2);
6118 __isl_give isl_map *isl_map_range_product(
6119 __isl_take isl_map *map1,
6120 __isl_take isl_map *map2);
6121 __isl_give isl_map *isl_map_product(
6122 __isl_take isl_map *map1,
6123 __isl_take isl_map *map2);
6125 #include <isl/union_set.h>
6126 __isl_give isl_union_set *isl_union_set_product(
6127 __isl_take isl_union_set *uset1,
6128 __isl_take isl_union_set *uset2);
6130 #include <isl/union_map.h>
6131 __isl_give isl_union_map *isl_union_map_domain_product(
6132 __isl_take isl_union_map *umap1,
6133 __isl_take isl_union_map *umap2);
6134 __isl_give isl_union_map *isl_union_map_range_product(
6135 __isl_take isl_union_map *umap1,
6136 __isl_take isl_union_map *umap2);
6137 __isl_give isl_union_map *isl_union_map_product(
6138 __isl_take isl_union_map *umap1,
6139 __isl_take isl_union_map *umap2);
6141 #include <isl/val.h>
6142 __isl_give isl_multi_val *isl_multi_val_range_product(
6143 __isl_take isl_multi_val *mv1,
6144 __isl_take isl_multi_val *mv2);
6145 __isl_give isl_multi_val *isl_multi_val_product(
6146 __isl_take isl_multi_val *mv1,
6147 __isl_take isl_multi_val *mv2);
6149 #include <isl/aff.h>
6150 __isl_give isl_multi_aff *isl_multi_aff_range_product(
6151 __isl_take isl_multi_aff *ma1,
6152 __isl_take isl_multi_aff *ma2);
6153 __isl_give isl_multi_aff *isl_multi_aff_product(
6154 __isl_take isl_multi_aff *ma1,
6155 __isl_take isl_multi_aff *ma2);
6156 __isl_give isl_multi_pw_aff *
6157 isl_multi_pw_aff_range_product(
6158 __isl_take isl_multi_pw_aff *mpa1,
6159 __isl_take isl_multi_pw_aff *mpa2);
6160 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6161 __isl_take isl_multi_pw_aff *mpa1,
6162 __isl_take isl_multi_pw_aff *mpa2);
6163 __isl_give isl_pw_multi_aff *
6164 isl_pw_multi_aff_range_product(
6165 __isl_take isl_pw_multi_aff *pma1,
6166 __isl_take isl_pw_multi_aff *pma2);
6167 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6168 __isl_take isl_pw_multi_aff *pma1,
6169 __isl_take isl_pw_multi_aff *pma2);
6170 __isl_give isl_multi_union_pw_aff *
6171 isl_multi_union_pw_aff_range_product(
6172 __isl_take isl_multi_union_pw_aff *mupa1,
6173 __isl_take isl_multi_union_pw_aff *mupa2);
6175 The above functions compute the cross product of the given
6176 sets, relations or functions. The domains and ranges of the results
6177 are wrapped maps between domains and ranges of the inputs.
6178 To obtain a ``flat'' product, use the following functions
6181 #include <isl/set.h>
6182 __isl_give isl_basic_set *isl_basic_set_flat_product(
6183 __isl_take isl_basic_set *bset1,
6184 __isl_take isl_basic_set *bset2);
6185 __isl_give isl_set *isl_set_flat_product(
6186 __isl_take isl_set *set1,
6187 __isl_take isl_set *set2);
6189 #include <isl/map.h>
6190 __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6191 __isl_take isl_basic_map *bmap1,
6192 __isl_take isl_basic_map *bmap2);
6193 __isl_give isl_map *isl_map_flat_domain_product(
6194 __isl_take isl_map *map1,
6195 __isl_take isl_map *map2);
6196 __isl_give isl_map *isl_map_flat_range_product(
6197 __isl_take isl_map *map1,
6198 __isl_take isl_map *map2);
6199 __isl_give isl_basic_map *isl_basic_map_flat_product(
6200 __isl_take isl_basic_map *bmap1,
6201 __isl_take isl_basic_map *bmap2);
6202 __isl_give isl_map *isl_map_flat_product(
6203 __isl_take isl_map *map1,
6204 __isl_take isl_map *map2);
6206 #include <isl/union_map.h>
6207 __isl_give isl_union_map *
6208 isl_union_map_flat_domain_product(
6209 __isl_take isl_union_map *umap1,
6210 __isl_take isl_union_map *umap2);
6211 __isl_give isl_union_map *
6212 isl_union_map_flat_range_product(
6213 __isl_take isl_union_map *umap1,
6214 __isl_take isl_union_map *umap2);
6216 #include <isl/val.h>
6217 __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6218 __isl_take isl_multi_val *mv1,
6219 __isl_take isl_multi_aff *mv2);
6221 #include <isl/aff.h>
6222 __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6223 __isl_take isl_multi_aff *ma1,
6224 __isl_take isl_multi_aff *ma2);
6225 __isl_give isl_pw_multi_aff *
6226 isl_pw_multi_aff_flat_range_product(
6227 __isl_take isl_pw_multi_aff *pma1,
6228 __isl_take isl_pw_multi_aff *pma2);
6229 __isl_give isl_multi_pw_aff *
6230 isl_multi_pw_aff_flat_range_product(
6231 __isl_take isl_multi_pw_aff *mpa1,
6232 __isl_take isl_multi_pw_aff *mpa2);
6233 __isl_give isl_union_pw_multi_aff *
6234 isl_union_pw_multi_aff_flat_range_product(
6235 __isl_take isl_union_pw_multi_aff *upma1,
6236 __isl_take isl_union_pw_multi_aff *upma2);
6237 __isl_give isl_multi_union_pw_aff *
6238 isl_multi_union_pw_aff_flat_range_product(
6239 __isl_take isl_multi_union_pw_aff *mupa1,
6240 __isl_take isl_multi_union_pw_aff *mupa2);
6242 #include <isl/space.h>
6243 __isl_give isl_space *isl_space_factor_domain(
6244 __isl_take isl_space *space);
6245 __isl_give isl_space *isl_space_factor_range(
6246 __isl_take isl_space *space);
6247 __isl_give isl_space *isl_space_domain_factor_domain(
6248 __isl_take isl_space *space);
6249 __isl_give isl_space *isl_space_domain_factor_range(
6250 __isl_take isl_space *space);
6251 __isl_give isl_space *isl_space_range_factor_domain(
6252 __isl_take isl_space *space);
6253 __isl_give isl_space *isl_space_range_factor_range(
6254 __isl_take isl_space *space);
6256 The functions C<isl_space_range_factor_domain> and
6257 C<isl_space_range_factor_range> extract the two arguments from
6258 the result of a call to C<isl_space_range_product>.
6260 The arguments of a call to C<isl_map_range_product> can be extracted
6261 from the result using the following functions.
6263 #include <isl/map.h>
6264 __isl_give isl_map *isl_map_factor_domain(
6265 __isl_take isl_map *map);
6266 __isl_give isl_map *isl_map_factor_range(
6267 __isl_take isl_map *map);
6268 __isl_give isl_map *isl_map_domain_factor_domain(
6269 __isl_take isl_map *map);
6270 __isl_give isl_map *isl_map_domain_factor_range(
6271 __isl_take isl_map *map);
6272 __isl_give isl_map *isl_map_range_factor_domain(
6273 __isl_take isl_map *map);
6274 __isl_give isl_map *isl_map_range_factor_range(
6275 __isl_take isl_map *map);
6277 #include <isl/union_map.h>
6278 __isl_give isl_union_map *isl_union_map_factor_domain(
6279 __isl_take isl_union_map *umap);
6280 __isl_give isl_union_map *isl_union_map_factor_range(
6281 __isl_take isl_union_map *umap);
6282 __isl_give isl_union_map *
6283 isl_union_map_domain_factor_domain(
6284 __isl_take isl_union_map *umap);
6285 __isl_give isl_union_map *
6286 isl_union_map_domain_factor_range(
6287 __isl_take isl_union_map *umap);
6288 __isl_give isl_union_map *
6289 isl_union_map_range_factor_range(
6290 __isl_take isl_union_map *umap);
6292 #include <isl/val.h>
6293 __isl_give isl_multi_val *
6294 isl_multi_val_range_factor_domain(
6295 __isl_take isl_multi_val *mv);
6296 __isl_give isl_multi_val *
6297 isl_multi_val_range_factor_range(
6298 __isl_take isl_multi_val *mv);
6300 #include <isl/aff.h>
6301 __isl_give isl_multi_aff *
6302 isl_multi_aff_range_factor_domain(
6303 __isl_take isl_multi_aff *ma);
6304 __isl_give isl_multi_aff *
6305 isl_multi_aff_range_factor_range(
6306 __isl_take isl_multi_aff *ma);
6307 __isl_give isl_multi_pw_aff *
6308 isl_multi_pw_aff_range_factor_domain(
6309 __isl_take isl_multi_pw_aff *mpa);
6310 __isl_give isl_multi_pw_aff *
6311 isl_multi_pw_aff_range_factor_range(
6312 __isl_take isl_multi_pw_aff *mpa);
6313 __isl_give isl_multi_union_pw_aff *
6314 isl_multi_union_pw_aff_range_factor_domain(
6315 __isl_take isl_multi_union_pw_aff *mupa);
6316 __isl_give isl_multi_union_pw_aff *
6317 isl_multi_union_pw_aff_range_factor_range(
6318 __isl_take isl_multi_union_pw_aff *mupa);
6320 The splice functions are a generalization of the flat product functions,
6321 where the second argument may be inserted at any position inside
6322 the first argument rather than being placed at the end.
6324 #include <isl/val.h>
6325 __isl_give isl_multi_val *isl_multi_val_range_splice(
6326 __isl_take isl_multi_val *mv1, unsigned pos,
6327 __isl_take isl_multi_val *mv2);
6329 #include <isl/aff.h>
6330 __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6331 __isl_take isl_multi_aff *ma1, unsigned pos,
6332 __isl_take isl_multi_aff *ma2);
6333 __isl_give isl_multi_aff *isl_multi_aff_splice(
6334 __isl_take isl_multi_aff *ma1,
6335 unsigned in_pos, unsigned out_pos,
6336 __isl_take isl_multi_aff *ma2);
6337 __isl_give isl_multi_pw_aff *
6338 isl_multi_pw_aff_range_splice(
6339 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6340 __isl_take isl_multi_pw_aff *mpa2);
6341 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6342 __isl_take isl_multi_pw_aff *mpa1,
6343 unsigned in_pos, unsigned out_pos,
6344 __isl_take isl_multi_pw_aff *mpa2);
6345 __isl_give isl_multi_union_pw_aff *
6346 isl_multi_union_pw_aff_range_splice(
6347 __isl_take isl_multi_union_pw_aff *mupa1,
6349 __isl_take isl_multi_union_pw_aff *mupa2);
6351 =item * Simplification
6353 When applied to a set or relation,
6354 the gist operation returns a set or relation that has the
6355 same intersection with the context as the input set or relation.
6356 Any implicit equality in the intersection is made explicit in the result,
6357 while all inequalities that are redundant with respect to the intersection
6359 In case of union sets and relations, the gist operation is performed
6362 When applied to a function,
6363 the gist operation applies the set gist operation to each of
6364 the cells in the domain of the input piecewise expression.
6365 The context is also exploited
6366 to simplify the expression associated to each cell.
6368 #include <isl/set.h>
6369 __isl_give isl_basic_set *isl_basic_set_gist(
6370 __isl_take isl_basic_set *bset,
6371 __isl_take isl_basic_set *context);
6372 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6373 __isl_take isl_set *context);
6374 __isl_give isl_set *isl_set_gist_params(
6375 __isl_take isl_set *set,
6376 __isl_take isl_set *context);
6378 #include <isl/map.h>
6379 __isl_give isl_basic_map *isl_basic_map_gist(
6380 __isl_take isl_basic_map *bmap,
6381 __isl_take isl_basic_map *context);
6382 __isl_give isl_basic_map *isl_basic_map_gist_domain(
6383 __isl_take isl_basic_map *bmap,
6384 __isl_take isl_basic_set *context);
6385 __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6386 __isl_take isl_map *context);
6387 __isl_give isl_map *isl_map_gist_params(
6388 __isl_take isl_map *map,
6389 __isl_take isl_set *context);
6390 __isl_give isl_map *isl_map_gist_domain(
6391 __isl_take isl_map *map,
6392 __isl_take isl_set *context);
6393 __isl_give isl_map *isl_map_gist_range(
6394 __isl_take isl_map *map,
6395 __isl_take isl_set *context);
6397 #include <isl/union_set.h>
6398 __isl_give isl_union_set *isl_union_set_gist(
6399 __isl_take isl_union_set *uset,
6400 __isl_take isl_union_set *context);
6401 __isl_give isl_union_set *isl_union_set_gist_params(
6402 __isl_take isl_union_set *uset,
6403 __isl_take isl_set *set);
6405 #include <isl/union_map.h>
6406 __isl_give isl_union_map *isl_union_map_gist(
6407 __isl_take isl_union_map *umap,
6408 __isl_take isl_union_map *context);
6409 __isl_give isl_union_map *isl_union_map_gist_params(
6410 __isl_take isl_union_map *umap,
6411 __isl_take isl_set *set);
6412 __isl_give isl_union_map *isl_union_map_gist_domain(
6413 __isl_take isl_union_map *umap,
6414 __isl_take isl_union_set *uset);
6415 __isl_give isl_union_map *isl_union_map_gist_range(
6416 __isl_take isl_union_map *umap,
6417 __isl_take isl_union_set *uset);
6419 #include <isl/aff.h>
6420 __isl_give isl_aff *isl_aff_gist_params(
6421 __isl_take isl_aff *aff,
6422 __isl_take isl_set *context);
6423 __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6424 __isl_take isl_set *context);
6425 __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6426 __isl_take isl_multi_aff *maff,
6427 __isl_take isl_set *context);
6428 __isl_give isl_multi_aff *isl_multi_aff_gist(
6429 __isl_take isl_multi_aff *maff,
6430 __isl_take isl_set *context);
6431 __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6432 __isl_take isl_pw_aff *pwaff,
6433 __isl_take isl_set *context);
6434 __isl_give isl_pw_aff *isl_pw_aff_gist(
6435 __isl_take isl_pw_aff *pwaff,
6436 __isl_take isl_set *context);
6437 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6438 __isl_take isl_pw_multi_aff *pma,
6439 __isl_take isl_set *set);
6440 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6441 __isl_take isl_pw_multi_aff *pma,
6442 __isl_take isl_set *set);
6443 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6444 __isl_take isl_multi_pw_aff *mpa,
6445 __isl_take isl_set *set);
6446 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6447 __isl_take isl_multi_pw_aff *mpa,
6448 __isl_take isl_set *set);
6449 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6450 __isl_take isl_union_pw_aff *upa,
6451 __isl_take isl_union_set *context);
6452 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6453 __isl_take isl_union_pw_aff *upa,
6454 __isl_take isl_set *context);
6455 __isl_give isl_union_pw_multi_aff *
6456 isl_union_pw_multi_aff_gist_params(
6457 __isl_take isl_union_pw_multi_aff *upma,
6458 __isl_take isl_set *context);
6459 __isl_give isl_union_pw_multi_aff *
6460 isl_union_pw_multi_aff_gist(
6461 __isl_take isl_union_pw_multi_aff *upma,
6462 __isl_take isl_union_set *context);
6463 __isl_give isl_multi_union_pw_aff *
6464 isl_multi_union_pw_aff_gist_params(
6465 __isl_take isl_multi_union_pw_aff *aff,
6466 __isl_take isl_set *context);
6467 __isl_give isl_multi_union_pw_aff *
6468 isl_multi_union_pw_aff_gist(
6469 __isl_take isl_multi_union_pw_aff *aff,
6470 __isl_take isl_union_set *context);
6472 #include <isl/polynomial.h>
6473 __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6474 __isl_take isl_qpolynomial *qp,
6475 __isl_take isl_set *context);
6476 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6477 __isl_take isl_qpolynomial *qp,
6478 __isl_take isl_set *context);
6479 __isl_give isl_qpolynomial_fold *
6480 isl_qpolynomial_fold_gist_params(
6481 __isl_take isl_qpolynomial_fold *fold,
6482 __isl_take isl_set *context);
6483 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6484 __isl_take isl_qpolynomial_fold *fold,
6485 __isl_take isl_set *context);
6486 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6487 __isl_take isl_pw_qpolynomial *pwqp,
6488 __isl_take isl_set *context);
6489 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6490 __isl_take isl_pw_qpolynomial *pwqp,
6491 __isl_take isl_set *context);
6492 __isl_give isl_pw_qpolynomial_fold *
6493 isl_pw_qpolynomial_fold_gist(
6494 __isl_take isl_pw_qpolynomial_fold *pwf,
6495 __isl_take isl_set *context);
6496 __isl_give isl_pw_qpolynomial_fold *
6497 isl_pw_qpolynomial_fold_gist_params(
6498 __isl_take isl_pw_qpolynomial_fold *pwf,
6499 __isl_take isl_set *context);
6500 __isl_give isl_union_pw_qpolynomial *
6501 isl_union_pw_qpolynomial_gist_params(
6502 __isl_take isl_union_pw_qpolynomial *upwqp,
6503 __isl_take isl_set *context);
6504 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6505 __isl_take isl_union_pw_qpolynomial *upwqp,
6506 __isl_take isl_union_set *context);
6507 __isl_give isl_union_pw_qpolynomial_fold *
6508 isl_union_pw_qpolynomial_fold_gist(
6509 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6510 __isl_take isl_union_set *context);
6511 __isl_give isl_union_pw_qpolynomial_fold *
6512 isl_union_pw_qpolynomial_fold_gist_params(
6513 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6514 __isl_take isl_set *context);
6516 =item * Binary Arithmethic Operations
6518 #include <isl/val.h>
6519 __isl_give isl_multi_val *isl_multi_val_sub(
6520 __isl_take isl_multi_val *mv1,
6521 __isl_take isl_multi_val *mv2);
6523 #include <isl/aff.h>
6524 __isl_give isl_aff *isl_aff_add(
6525 __isl_take isl_aff *aff1,
6526 __isl_take isl_aff *aff2);
6527 __isl_give isl_multi_aff *isl_multi_aff_add(
6528 __isl_take isl_multi_aff *maff1,
6529 __isl_take isl_multi_aff *maff2);
6530 __isl_give isl_pw_aff *isl_pw_aff_add(
6531 __isl_take isl_pw_aff *pwaff1,
6532 __isl_take isl_pw_aff *pwaff2);
6533 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6534 __isl_take isl_pw_multi_aff *pma1,
6535 __isl_take isl_pw_multi_aff *pma2);
6536 __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6537 __isl_take isl_union_pw_aff *upa1,
6538 __isl_take isl_union_pw_aff *upa2);
6539 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6540 __isl_take isl_union_pw_multi_aff *upma1,
6541 __isl_take isl_union_pw_multi_aff *upma2);
6542 __isl_give isl_pw_aff *isl_pw_aff_min(
6543 __isl_take isl_pw_aff *pwaff1,
6544 __isl_take isl_pw_aff *pwaff2);
6545 __isl_give isl_pw_aff *isl_pw_aff_max(
6546 __isl_take isl_pw_aff *pwaff1,
6547 __isl_take isl_pw_aff *pwaff2);
6548 __isl_give isl_aff *isl_aff_sub(
6549 __isl_take isl_aff *aff1,
6550 __isl_take isl_aff *aff2);
6551 __isl_give isl_multi_aff *isl_multi_aff_sub(
6552 __isl_take isl_multi_aff *ma1,
6553 __isl_take isl_multi_aff *ma2);
6554 __isl_give isl_pw_aff *isl_pw_aff_sub(
6555 __isl_take isl_pw_aff *pwaff1,
6556 __isl_take isl_pw_aff *pwaff2);
6557 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6558 __isl_take isl_multi_pw_aff *mpa1,
6559 __isl_take isl_multi_pw_aff *mpa2);
6560 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6561 __isl_take isl_pw_multi_aff *pma1,
6562 __isl_take isl_pw_multi_aff *pma2);
6563 __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6564 __isl_take isl_union_pw_aff *upa1,
6565 __isl_take isl_union_pw_aff *upa2);
6566 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6567 __isl_take isl_union_pw_multi_aff *upma1,
6568 __isl_take isl_union_pw_multi_aff *upma2);
6569 __isl_give isl_multi_union_pw_aff *
6570 isl_multi_union_pw_aff_sub(
6571 __isl_take isl_multi_union_pw_aff *mupa1,
6572 __isl_take isl_multi_union_pw_aff *mupa2);
6574 C<isl_aff_sub> subtracts the second argument from the first.
6576 #include <isl/polynomial.h>
6577 __isl_give isl_qpolynomial *isl_qpolynomial_add(
6578 __isl_take isl_qpolynomial *qp1,
6579 __isl_take isl_qpolynomial *qp2);
6580 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6581 __isl_take isl_pw_qpolynomial *pwqp1,
6582 __isl_take isl_pw_qpolynomial *pwqp2);
6583 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6584 __isl_take isl_pw_qpolynomial *pwqp1,
6585 __isl_take isl_pw_qpolynomial *pwqp2);
6586 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6587 __isl_take isl_pw_qpolynomial_fold *pwf1,
6588 __isl_take isl_pw_qpolynomial_fold *pwf2);
6589 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6590 __isl_take isl_union_pw_qpolynomial *upwqp1,
6591 __isl_take isl_union_pw_qpolynomial *upwqp2);
6592 __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6593 __isl_take isl_qpolynomial *qp1,
6594 __isl_take isl_qpolynomial *qp2);
6595 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6596 __isl_take isl_pw_qpolynomial *pwqp1,
6597 __isl_take isl_pw_qpolynomial *pwqp2);
6598 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6599 __isl_take isl_union_pw_qpolynomial *upwqp1,
6600 __isl_take isl_union_pw_qpolynomial *upwqp2);
6601 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6602 __isl_take isl_pw_qpolynomial_fold *pwf1,
6603 __isl_take isl_pw_qpolynomial_fold *pwf2);
6604 __isl_give isl_union_pw_qpolynomial_fold *
6605 isl_union_pw_qpolynomial_fold_fold(
6606 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6607 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6609 #include <isl/aff.h>
6610 __isl_give isl_pw_aff *isl_pw_aff_union_add(
6611 __isl_take isl_pw_aff *pwaff1,
6612 __isl_take isl_pw_aff *pwaff2);
6613 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6614 __isl_take isl_pw_multi_aff *pma1,
6615 __isl_take isl_pw_multi_aff *pma2);
6616 __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6617 __isl_take isl_union_pw_aff *upa1,
6618 __isl_take isl_union_pw_aff *upa2);
6619 __isl_give isl_union_pw_multi_aff *
6620 isl_union_pw_multi_aff_union_add(
6621 __isl_take isl_union_pw_multi_aff *upma1,
6622 __isl_take isl_union_pw_multi_aff *upma2);
6623 __isl_give isl_multi_union_pw_aff *
6624 isl_multi_union_pw_aff_union_add(
6625 __isl_take isl_multi_union_pw_aff *mupa1,
6626 __isl_take isl_multi_union_pw_aff *mupa2);
6627 __isl_give isl_pw_aff *isl_pw_aff_union_min(
6628 __isl_take isl_pw_aff *pwaff1,
6629 __isl_take isl_pw_aff *pwaff2);
6630 __isl_give isl_pw_aff *isl_pw_aff_union_max(
6631 __isl_take isl_pw_aff *pwaff1,
6632 __isl_take isl_pw_aff *pwaff2);
6634 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6635 expression with a domain that is the union of those of C<pwaff1> and
6636 C<pwaff2> and such that on each cell, the quasi-affine expression is
6637 the maximum of those of C<pwaff1> and C<pwaff2>. If only one of
6638 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6639 associated expression is the defined one.
6640 This in contrast to the C<isl_pw_aff_max> function, which is
6641 only defined on the shared definition domain of the arguments.
6643 #include <isl/val.h>
6644 __isl_give isl_multi_val *isl_multi_val_add_val(
6645 __isl_take isl_multi_val *mv,
6646 __isl_take isl_val *v);
6647 __isl_give isl_multi_val *isl_multi_val_mod_val(
6648 __isl_take isl_multi_val *mv,
6649 __isl_take isl_val *v);
6650 __isl_give isl_multi_val *isl_multi_val_scale_val(
6651 __isl_take isl_multi_val *mv,
6652 __isl_take isl_val *v);
6653 __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6654 __isl_take isl_multi_val *mv,
6655 __isl_take isl_val *v);
6657 #include <isl/aff.h>
6658 __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6659 __isl_take isl_val *mod);
6660 __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6661 __isl_take isl_pw_aff *pa,
6662 __isl_take isl_val *mod);
6663 __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6664 __isl_take isl_union_pw_aff *upa,
6665 __isl_take isl_val *f);
6666 __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6667 __isl_take isl_val *v);
6668 __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6669 __isl_take isl_multi_aff *ma,
6670 __isl_take isl_val *v);
6671 __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6672 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6673 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6674 __isl_take isl_multi_pw_aff *mpa,
6675 __isl_take isl_val *v);
6676 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6677 __isl_take isl_pw_multi_aff *pma,
6678 __isl_take isl_val *v);
6679 __isl_give isl_union_pw_multi_aff *
6680 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6681 __isl_take isl_union_pw_aff *upa,
6682 __isl_take isl_val *f);
6683 isl_union_pw_multi_aff_scale_val(
6684 __isl_take isl_union_pw_multi_aff *upma,
6685 __isl_take isl_val *val);
6686 __isl_give isl_multi_union_pw_aff *
6687 isl_multi_union_pw_aff_scale_val(
6688 __isl_take isl_multi_union_pw_aff *mupa,
6689 __isl_take isl_val *v);
6690 __isl_give isl_aff *isl_aff_scale_down_ui(
6691 __isl_take isl_aff *aff, unsigned f);
6692 __isl_give isl_aff *isl_aff_scale_down_val(
6693 __isl_take isl_aff *aff, __isl_take isl_val *v);
6694 __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6695 __isl_take isl_multi_aff *ma,
6696 __isl_take isl_val *v);
6697 __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6698 __isl_take isl_pw_aff *pa,
6699 __isl_take isl_val *f);
6700 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6701 __isl_take isl_multi_pw_aff *mpa,
6702 __isl_take isl_val *v);
6703 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6704 __isl_take isl_pw_multi_aff *pma,
6705 __isl_take isl_val *v);
6706 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6707 __isl_take isl_union_pw_aff *upa,
6708 __isl_take isl_val *v);
6709 __isl_give isl_union_pw_multi_aff *
6710 isl_union_pw_multi_aff_scale_down_val(
6711 __isl_take isl_union_pw_multi_aff *upma,
6712 __isl_take isl_val *val);
6713 __isl_give isl_multi_union_pw_aff *
6714 isl_multi_union_pw_aff_scale_down_val(
6715 __isl_take isl_multi_union_pw_aff *mupa,
6716 __isl_take isl_val *v);
6718 #include <isl/polynomial.h>
6719 __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6720 __isl_take isl_qpolynomial *qp,
6721 __isl_take isl_val *v);
6722 __isl_give isl_qpolynomial_fold *
6723 isl_qpolynomial_fold_scale_val(
6724 __isl_take isl_qpolynomial_fold *fold,
6725 __isl_take isl_val *v);
6726 __isl_give isl_pw_qpolynomial *
6727 isl_pw_qpolynomial_scale_val(
6728 __isl_take isl_pw_qpolynomial *pwqp,
6729 __isl_take isl_val *v);
6730 __isl_give isl_pw_qpolynomial_fold *
6731 isl_pw_qpolynomial_fold_scale_val(
6732 __isl_take isl_pw_qpolynomial_fold *pwf,
6733 __isl_take isl_val *v);
6734 __isl_give isl_union_pw_qpolynomial *
6735 isl_union_pw_qpolynomial_scale_val(
6736 __isl_take isl_union_pw_qpolynomial *upwqp,
6737 __isl_take isl_val *v);
6738 __isl_give isl_union_pw_qpolynomial_fold *
6739 isl_union_pw_qpolynomial_fold_scale_val(
6740 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6741 __isl_take isl_val *v);
6742 __isl_give isl_qpolynomial *
6743 isl_qpolynomial_scale_down_val(
6744 __isl_take isl_qpolynomial *qp,
6745 __isl_take isl_val *v);
6746 __isl_give isl_qpolynomial_fold *
6747 isl_qpolynomial_fold_scale_down_val(
6748 __isl_take isl_qpolynomial_fold *fold,
6749 __isl_take isl_val *v);
6750 __isl_give isl_pw_qpolynomial *
6751 isl_pw_qpolynomial_scale_down_val(
6752 __isl_take isl_pw_qpolynomial *pwqp,
6753 __isl_take isl_val *v);
6754 __isl_give isl_pw_qpolynomial_fold *
6755 isl_pw_qpolynomial_fold_scale_down_val(
6756 __isl_take isl_pw_qpolynomial_fold *pwf,
6757 __isl_take isl_val *v);
6758 __isl_give isl_union_pw_qpolynomial *
6759 isl_union_pw_qpolynomial_scale_down_val(
6760 __isl_take isl_union_pw_qpolynomial *upwqp,
6761 __isl_take isl_val *v);
6762 __isl_give isl_union_pw_qpolynomial_fold *
6763 isl_union_pw_qpolynomial_fold_scale_down_val(
6764 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6765 __isl_take isl_val *v);
6767 #include <isl/val.h>
6768 __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6769 __isl_take isl_multi_val *mv1,
6770 __isl_take isl_multi_val *mv2);
6771 __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6772 __isl_take isl_multi_val *mv1,
6773 __isl_take isl_multi_val *mv2);
6774 __isl_give isl_multi_val *
6775 isl_multi_val_scale_down_multi_val(
6776 __isl_take isl_multi_val *mv1,
6777 __isl_take isl_multi_val *mv2);
6779 #include <isl/aff.h>
6780 __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6781 __isl_take isl_multi_aff *ma,
6782 __isl_take isl_multi_val *mv);
6783 __isl_give isl_multi_union_pw_aff *
6784 isl_multi_union_pw_aff_mod_multi_val(
6785 __isl_take isl_multi_union_pw_aff *upma,
6786 __isl_take isl_multi_val *mv);
6787 __isl_give isl_multi_pw_aff *
6788 isl_multi_pw_aff_mod_multi_val(
6789 __isl_take isl_multi_pw_aff *mpa,
6790 __isl_take isl_multi_val *mv);
6791 __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6792 __isl_take isl_multi_aff *ma,
6793 __isl_take isl_multi_val *mv);
6794 __isl_give isl_pw_multi_aff *
6795 isl_pw_multi_aff_scale_multi_val(
6796 __isl_take isl_pw_multi_aff *pma,
6797 __isl_take isl_multi_val *mv);
6798 __isl_give isl_multi_pw_aff *
6799 isl_multi_pw_aff_scale_multi_val(
6800 __isl_take isl_multi_pw_aff *mpa,
6801 __isl_take isl_multi_val *mv);
6802 __isl_give isl_multi_union_pw_aff *
6803 isl_multi_union_pw_aff_scale_multi_val(
6804 __isl_take isl_multi_union_pw_aff *mupa,
6805 __isl_take isl_multi_val *mv);
6806 __isl_give isl_union_pw_multi_aff *
6807 isl_union_pw_multi_aff_scale_multi_val(
6808 __isl_take isl_union_pw_multi_aff *upma,
6809 __isl_take isl_multi_val *mv);
6810 __isl_give isl_multi_aff *
6811 isl_multi_aff_scale_down_multi_val(
6812 __isl_take isl_multi_aff *ma,
6813 __isl_take isl_multi_val *mv);
6814 __isl_give isl_multi_pw_aff *
6815 isl_multi_pw_aff_scale_down_multi_val(
6816 __isl_take isl_multi_pw_aff *mpa,
6817 __isl_take isl_multi_val *mv);
6818 __isl_give isl_multi_union_pw_aff *
6819 isl_multi_union_pw_aff_scale_down_multi_val(
6820 __isl_take isl_multi_union_pw_aff *mupa,
6821 __isl_take isl_multi_val *mv);
6823 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6824 by the corresponding elements of C<mv>.
6826 #include <isl/aff.h>
6827 __isl_give isl_aff *isl_aff_mul(
6828 __isl_take isl_aff *aff1,
6829 __isl_take isl_aff *aff2);
6830 __isl_give isl_aff *isl_aff_div(
6831 __isl_take isl_aff *aff1,
6832 __isl_take isl_aff *aff2);
6833 __isl_give isl_pw_aff *isl_pw_aff_mul(
6834 __isl_take isl_pw_aff *pwaff1,
6835 __isl_take isl_pw_aff *pwaff2);
6836 __isl_give isl_pw_aff *isl_pw_aff_div(
6837 __isl_take isl_pw_aff *pa1,
6838 __isl_take isl_pw_aff *pa2);
6839 __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6840 __isl_take isl_pw_aff *pa1,
6841 __isl_take isl_pw_aff *pa2);
6842 __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6843 __isl_take isl_pw_aff *pa1,
6844 __isl_take isl_pw_aff *pa2);
6846 When multiplying two affine expressions, at least one of the two needs
6847 to be a constant. Similarly, when dividing an affine expression by another,
6848 the second expression needs to be a constant.
6849 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6850 rounding towards zero. C<isl_pw_aff_tdiv_r> computes the corresponding
6853 #include <isl/polynomial.h>
6854 __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6855 __isl_take isl_qpolynomial *qp1,
6856 __isl_take isl_qpolynomial *qp2);
6857 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6858 __isl_take isl_pw_qpolynomial *pwqp1,
6859 __isl_take isl_pw_qpolynomial *pwqp2);
6860 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6861 __isl_take isl_union_pw_qpolynomial *upwqp1,
6862 __isl_take isl_union_pw_qpolynomial *upwqp2);
6866 =head3 Lexicographic Optimization
6868 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6869 the following functions
6870 compute a set that contains the lexicographic minimum or maximum
6871 of the elements in C<set> (or C<bset>) for those values of the parameters
6872 that satisfy C<dom>.
6873 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6874 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6876 In other words, the union of the parameter values
6877 for which the result is non-empty and of C<*empty>
6880 #include <isl/set.h>
6881 __isl_give isl_set *isl_basic_set_partial_lexmin(
6882 __isl_take isl_basic_set *bset,
6883 __isl_take isl_basic_set *dom,
6884 __isl_give isl_set **empty);
6885 __isl_give isl_set *isl_basic_set_partial_lexmax(
6886 __isl_take isl_basic_set *bset,
6887 __isl_take isl_basic_set *dom,
6888 __isl_give isl_set **empty);
6889 __isl_give isl_set *isl_set_partial_lexmin(
6890 __isl_take isl_set *set, __isl_take isl_set *dom,
6891 __isl_give isl_set **empty);
6892 __isl_give isl_set *isl_set_partial_lexmax(
6893 __isl_take isl_set *set, __isl_take isl_set *dom,
6894 __isl_give isl_set **empty);
6896 Given a (basic) set C<set> (or C<bset>), the following functions simply
6897 return a set containing the lexicographic minimum or maximum
6898 of the elements in C<set> (or C<bset>).
6899 In case of union sets, the optimum is computed per space.
6901 #include <isl/set.h>
6902 __isl_give isl_set *isl_basic_set_lexmin(
6903 __isl_take isl_basic_set *bset);
6904 __isl_give isl_set *isl_basic_set_lexmax(
6905 __isl_take isl_basic_set *bset);
6906 __isl_give isl_set *isl_set_lexmin(
6907 __isl_take isl_set *set);
6908 __isl_give isl_set *isl_set_lexmax(
6909 __isl_take isl_set *set);
6910 __isl_give isl_union_set *isl_union_set_lexmin(
6911 __isl_take isl_union_set *uset);
6912 __isl_give isl_union_set *isl_union_set_lexmax(
6913 __isl_take isl_union_set *uset);
6915 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6916 the following functions
6917 compute a relation that maps each element of C<dom>
6918 to the single lexicographic minimum or maximum
6919 of the elements that are associated to that same
6920 element in C<map> (or C<bmap>).
6921 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6922 that contains the elements in C<dom> that do not map
6923 to any elements in C<map> (or C<bmap>).
6924 In other words, the union of the domain of the result and of C<*empty>
6927 #include <isl/map.h>
6928 __isl_give isl_map *isl_basic_map_partial_lexmax(
6929 __isl_take isl_basic_map *bmap,
6930 __isl_take isl_basic_set *dom,
6931 __isl_give isl_set **empty);
6932 __isl_give isl_map *isl_basic_map_partial_lexmin(
6933 __isl_take isl_basic_map *bmap,
6934 __isl_take isl_basic_set *dom,
6935 __isl_give isl_set **empty);
6936 __isl_give isl_map *isl_map_partial_lexmax(
6937 __isl_take isl_map *map, __isl_take isl_set *dom,
6938 __isl_give isl_set **empty);
6939 __isl_give isl_map *isl_map_partial_lexmin(
6940 __isl_take isl_map *map, __isl_take isl_set *dom,
6941 __isl_give isl_set **empty);
6943 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6944 return a map mapping each element in the domain of
6945 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6946 of all elements associated to that element.
6947 In case of union relations, the optimum is computed per space.
6949 #include <isl/map.h>
6950 __isl_give isl_map *isl_basic_map_lexmin(
6951 __isl_take isl_basic_map *bmap);
6952 __isl_give isl_map *isl_basic_map_lexmax(
6953 __isl_take isl_basic_map *bmap);
6954 __isl_give isl_map *isl_map_lexmin(
6955 __isl_take isl_map *map);
6956 __isl_give isl_map *isl_map_lexmax(
6957 __isl_take isl_map *map);
6958 __isl_give isl_union_map *isl_union_map_lexmin(
6959 __isl_take isl_union_map *umap);
6960 __isl_give isl_union_map *isl_union_map_lexmax(
6961 __isl_take isl_union_map *umap);
6963 The following functions return their result in the form of
6964 a piecewise multi-affine expression,
6965 but are otherwise equivalent to the corresponding functions
6966 returning a basic set or relation.
6968 #include <isl/set.h>
6969 __isl_give isl_pw_multi_aff *
6970 isl_basic_set_partial_lexmin_pw_multi_aff(
6971 __isl_take isl_basic_set *bset,
6972 __isl_take isl_basic_set *dom,
6973 __isl_give isl_set **empty);
6974 __isl_give isl_pw_multi_aff *
6975 isl_basic_set_partial_lexmax_pw_multi_aff(
6976 __isl_take isl_basic_set *bset,
6977 __isl_take isl_basic_set *dom,
6978 __isl_give isl_set **empty);
6979 __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6980 __isl_take isl_set *set);
6981 __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6982 __isl_take isl_set *set);
6984 #include <isl/map.h>
6985 __isl_give isl_pw_multi_aff *
6986 isl_basic_map_lexmin_pw_multi_aff(
6987 __isl_take isl_basic_map *bmap);
6988 __isl_give isl_pw_multi_aff *
6989 isl_basic_map_partial_lexmin_pw_multi_aff(
6990 __isl_take isl_basic_map *bmap,
6991 __isl_take isl_basic_set *dom,
6992 __isl_give isl_set **empty);
6993 __isl_give isl_pw_multi_aff *
6994 isl_basic_map_partial_lexmax_pw_multi_aff(
6995 __isl_take isl_basic_map *bmap,
6996 __isl_take isl_basic_set *dom,
6997 __isl_give isl_set **empty);
6998 __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
6999 __isl_take isl_map *map);
7000 __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
7001 __isl_take isl_map *map);
7003 The following functions return the lexicographic minimum or maximum
7004 on the shared domain of the inputs and the single defined function
7005 on those parts of the domain where only a single function is defined.
7007 #include <isl/aff.h>
7008 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
7009 __isl_take isl_pw_multi_aff *pma1,
7010 __isl_take isl_pw_multi_aff *pma2);
7011 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
7012 __isl_take isl_pw_multi_aff *pma1,
7013 __isl_take isl_pw_multi_aff *pma2);
7015 =head2 Ternary Operations
7017 #include <isl/aff.h>
7018 __isl_give isl_pw_aff *isl_pw_aff_cond(
7019 __isl_take isl_pw_aff *cond,
7020 __isl_take isl_pw_aff *pwaff_true,
7021 __isl_take isl_pw_aff *pwaff_false);
7023 The function C<isl_pw_aff_cond> performs a conditional operator
7024 and returns an expression that is equal to C<pwaff_true>
7025 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
7026 where C<cond> is zero.
7030 Lists are defined over several element types, including
7031 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
7032 C<isl_union_pw_multi_aff>, C<isl_constraint>,
7033 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
7034 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
7035 Here we take lists of C<isl_set>s as an example.
7036 Lists can be created, copied, modified and freed using the following functions.
7038 #include <isl/set.h>
7039 __isl_give isl_set_list *isl_set_list_from_set(
7040 __isl_take isl_set *el);
7041 __isl_give isl_set_list *isl_set_list_alloc(
7042 isl_ctx *ctx, int n);
7043 __isl_give isl_set_list *isl_set_list_copy(
7044 __isl_keep isl_set_list *list);
7045 __isl_give isl_set_list *isl_set_list_insert(
7046 __isl_take isl_set_list *list, unsigned pos,
7047 __isl_take isl_set *el);
7048 __isl_give isl_set_list *isl_set_list_add(
7049 __isl_take isl_set_list *list,
7050 __isl_take isl_set *el);
7051 __isl_give isl_set_list *isl_set_list_drop(
7052 __isl_take isl_set_list *list,
7053 unsigned first, unsigned n);
7054 __isl_give isl_set_list *isl_set_list_set_set(
7055 __isl_take isl_set_list *list, int index,
7056 __isl_take isl_set *set);
7057 __isl_give isl_set_list *isl_set_list_concat(
7058 __isl_take isl_set_list *list1,
7059 __isl_take isl_set_list *list2);
7060 __isl_give isl_set_list *isl_set_list_sort(
7061 __isl_take isl_set_list *list,
7062 int (*cmp)(__isl_keep isl_set *a,
7063 __isl_keep isl_set *b, void *user),
7065 __isl_null isl_set_list *isl_set_list_free(
7066 __isl_take isl_set_list *list);
7068 C<isl_set_list_alloc> creates an empty list with an initial capacity
7069 for C<n> elements. C<isl_set_list_insert> and C<isl_set_list_add>
7070 add elements to a list, increasing its capacity as needed.
7071 C<isl_set_list_from_set> creates a list with a single element.
7073 Lists can be inspected using the following functions.
7075 #include <isl/set.h>
7076 int isl_set_list_n_set(__isl_keep isl_set_list *list);
7077 __isl_give isl_set *isl_set_list_get_set(
7078 __isl_keep isl_set_list *list, int index);
7079 isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
7080 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7082 isl_stat isl_set_list_foreach_scc(
7083 __isl_keep isl_set_list *list,
7084 isl_bool (*follows)(__isl_keep isl_set *a,
7085 __isl_keep isl_set *b, void *user),
7087 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7090 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
7091 strongly connected components of the graph with as vertices the elements
7092 of C<list> and a directed edge from vertex C<b> to vertex C<a>
7093 iff C<follows(a, b)> returns C<1>. The callbacks C<follows> and C<fn>
7094 should return C<-1> on error.
7096 Lists can be printed using
7098 #include <isl/set.h>
7099 __isl_give isl_printer *isl_printer_print_set_list(
7100 __isl_take isl_printer *p,
7101 __isl_keep isl_set_list *list);
7103 =head2 Associative arrays
7105 Associative arrays map isl objects of a specific type to isl objects
7106 of some (other) specific type. They are defined for several pairs
7107 of types, including (C<isl_map>, C<isl_basic_set>),
7108 (C<isl_id>, C<isl_ast_expr>) and.
7109 (C<isl_id>, C<isl_pw_aff>).
7110 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7113 Associative arrays can be created, copied and freed using
7114 the following functions.
7116 #include <isl/id_to_ast_expr.h>
7117 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7118 isl_ctx *ctx, int min_size);
7119 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7120 __isl_keep isl_id_to_ast_expr *id2expr);
7121 __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7122 __isl_take isl_id_to_ast_expr *id2expr);
7124 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7125 to specify the expected size of the associative array.
7126 The associative array will be grown automatically as needed.
7128 Associative arrays can be inspected using the following functions.
7130 #include <isl/id_to_ast_expr.h>
7131 isl_bool isl_id_to_ast_expr_has(
7132 __isl_keep isl_id_to_ast_expr *id2expr,
7133 __isl_keep isl_id *key);
7134 __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7135 __isl_keep isl_id_to_ast_expr *id2expr,
7136 __isl_take isl_id *key);
7137 isl_stat isl_id_to_ast_expr_foreach(
7138 __isl_keep isl_id_to_ast_expr *id2expr,
7139 isl_stat (*fn)(__isl_take isl_id *key,
7140 __isl_take isl_ast_expr *val, void *user),
7143 They can be modified using the following function.
7145 #include <isl/id_to_ast_expr.h>
7146 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7147 __isl_take isl_id_to_ast_expr *id2expr,
7148 __isl_take isl_id *key,
7149 __isl_take isl_ast_expr *val);
7150 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7151 __isl_take isl_id_to_ast_expr *id2expr,
7152 __isl_take isl_id *key);
7154 Associative arrays can be printed using the following function.
7156 #include <isl/id_to_ast_expr.h>
7157 __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7158 __isl_take isl_printer *p,
7159 __isl_keep isl_id_to_ast_expr *id2expr);
7163 Vectors can be created, copied and freed using the following functions.
7165 #include <isl/vec.h>
7166 __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7168 __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7169 __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7171 Note that the elements of a newly created vector may have arbitrary values.
7172 The elements can be changed and inspected using the following functions.
7174 int isl_vec_size(__isl_keep isl_vec *vec);
7175 __isl_give isl_val *isl_vec_get_element_val(
7176 __isl_keep isl_vec *vec, int pos);
7177 __isl_give isl_vec *isl_vec_set_element_si(
7178 __isl_take isl_vec *vec, int pos, int v);
7179 __isl_give isl_vec *isl_vec_set_element_val(
7180 __isl_take isl_vec *vec, int pos,
7181 __isl_take isl_val *v);
7182 __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7184 __isl_give isl_vec *isl_vec_set_val(
7185 __isl_take isl_vec *vec, __isl_take isl_val *v);
7186 int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7187 __isl_keep isl_vec *vec2, int pos);
7189 C<isl_vec_get_element> will return a negative value if anything went wrong.
7190 In that case, the value of C<*v> is undefined.
7192 The following function can be used to concatenate two vectors.
7194 __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7195 __isl_take isl_vec *vec2);
7199 Matrices can be created, copied and freed using the following functions.
7201 #include <isl/mat.h>
7202 __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7203 unsigned n_row, unsigned n_col);
7204 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7205 __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7207 Note that the elements of a newly created matrix may have arbitrary values.
7208 The elements can be changed and inspected using the following functions.
7210 int isl_mat_rows(__isl_keep isl_mat *mat);
7211 int isl_mat_cols(__isl_keep isl_mat *mat);
7212 __isl_give isl_val *isl_mat_get_element_val(
7213 __isl_keep isl_mat *mat, int row, int col);
7214 __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7215 int row, int col, int v);
7216 __isl_give isl_mat *isl_mat_set_element_val(
7217 __isl_take isl_mat *mat, int row, int col,
7218 __isl_take isl_val *v);
7220 C<isl_mat_get_element> will return a negative value if anything went wrong.
7221 In that case, the value of C<*v> is undefined.
7223 The following function can be used to compute the (right) inverse
7224 of a matrix, i.e., a matrix such that the product of the original
7225 and the inverse (in that order) is a multiple of the identity matrix.
7226 The input matrix is assumed to be of full row-rank.
7228 __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7230 The following function can be used to compute the (right) kernel
7231 (or null space) of a matrix, i.e., a matrix such that the product of
7232 the original and the kernel (in that order) is the zero matrix.
7234 __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7236 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7238 The following functions determine
7239 an upper or lower bound on a quasipolynomial over its domain.
7241 __isl_give isl_pw_qpolynomial_fold *
7242 isl_pw_qpolynomial_bound(
7243 __isl_take isl_pw_qpolynomial *pwqp,
7244 enum isl_fold type, int *tight);
7246 __isl_give isl_union_pw_qpolynomial_fold *
7247 isl_union_pw_qpolynomial_bound(
7248 __isl_take isl_union_pw_qpolynomial *upwqp,
7249 enum isl_fold type, int *tight);
7251 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7252 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7253 is the returned bound is known be tight, i.e., for each value
7254 of the parameters there is at least
7255 one element in the domain that reaches the bound.
7256 If the domain of C<pwqp> is not wrapping, then the bound is computed
7257 over all elements in that domain and the result has a purely parametric
7258 domain. If the domain of C<pwqp> is wrapping, then the bound is
7259 computed over the range of the wrapped relation. The domain of the
7260 wrapped relation becomes the domain of the result.
7262 =head2 Parametric Vertex Enumeration
7264 The parametric vertex enumeration described in this section
7265 is mainly intended to be used internally and by the C<barvinok>
7268 #include <isl/vertices.h>
7269 __isl_give isl_vertices *isl_basic_set_compute_vertices(
7270 __isl_keep isl_basic_set *bset);
7272 The function C<isl_basic_set_compute_vertices> performs the
7273 actual computation of the parametric vertices and the chamber
7274 decomposition and store the result in an C<isl_vertices> object.
7275 This information can be queried by either iterating over all
7276 the vertices or iterating over all the chambers or cells
7277 and then iterating over all vertices that are active on the chamber.
7279 isl_stat isl_vertices_foreach_vertex(
7280 __isl_keep isl_vertices *vertices,
7281 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7282 void *user), void *user);
7284 isl_stat isl_vertices_foreach_cell(
7285 __isl_keep isl_vertices *vertices,
7286 isl_stat (*fn)(__isl_take isl_cell *cell,
7287 void *user), void *user);
7288 isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7289 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7290 void *user), void *user);
7292 Other operations that can be performed on an C<isl_vertices> object are
7295 int isl_vertices_get_n_vertices(
7296 __isl_keep isl_vertices *vertices);
7297 void isl_vertices_free(__isl_take isl_vertices *vertices);
7299 Vertices can be inspected and destroyed using the following functions.
7301 int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7302 __isl_give isl_basic_set *isl_vertex_get_domain(
7303 __isl_keep isl_vertex *vertex);
7304 __isl_give isl_multi_aff *isl_vertex_get_expr(
7305 __isl_keep isl_vertex *vertex);
7306 void isl_vertex_free(__isl_take isl_vertex *vertex);
7308 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7309 describing the vertex in terms of the parameters,
7310 while C<isl_vertex_get_domain> returns the activity domain
7313 Chambers can be inspected and destroyed using the following functions.
7315 __isl_give isl_basic_set *isl_cell_get_domain(
7316 __isl_keep isl_cell *cell);
7317 void isl_cell_free(__isl_take isl_cell *cell);
7319 =head1 Polyhedral Compilation Library
7321 This section collects functionality in C<isl> that has been specifically
7322 designed for use during polyhedral compilation.
7324 =head2 Schedule Trees
7326 A schedule tree is a structured representation of a schedule,
7327 assigning a relative order to a set of domain elements.
7328 The relative order expressed by the schedule tree is
7329 defined recursively. In particular, the order between
7330 two domain elements is determined by the node that is closest
7331 to the root that refers to both elements and that orders them apart.
7332 Each node in the tree is of one of several types.
7333 The root node is always of type C<isl_schedule_node_domain>
7334 (or C<isl_schedule_node_extension>)
7335 and it describes the (extra) domain elements to which the schedule applies.
7336 The other types of nodes are as follows.
7340 =item C<isl_schedule_node_band>
7342 A band of schedule dimensions. Each schedule dimension is represented
7343 by a union piecewise quasi-affine expression. If this expression
7344 assigns a different value to two domain elements, while all previous
7345 schedule dimensions in the same band assign them the same value,
7346 then the two domain elements are ordered according to these two
7349 =item C<isl_schedule_node_expansion>
7351 An expansion node maps each of the domain elements that reach the node
7352 to one or more domain elements. The image of this mapping forms
7353 the set of domain elements that reach the child of the expansion node.
7354 The function that maps each of the expanded domain elements
7355 to the original domain element from which it was expanded
7356 is called the contraction.
7358 =item C<isl_schedule_node_filter>
7360 A filter node does not impose any ordering, but rather intersects
7361 the set of domain elements that the current subtree refers to
7362 with a given union set. The subtree of the filter node only
7363 refers to domain elements in the intersection.
7364 A filter node is typically only used a child of a sequence or
7367 =item C<isl_schedule_node_leaf>
7369 A leaf of the schedule tree. Leaf nodes do not impose any ordering.
7371 =item C<isl_schedule_node_mark>
7373 A mark node can be used to attach any kind of information to a subtree
7374 of the schedule tree.
7376 =item C<isl_schedule_node_sequence>
7378 A sequence node has one or more children, each of which is a filter node.
7379 The filters on these filter nodes form a partition of
7380 the domain elements that the current subtree refers to.
7381 If two domain elements appear in distinct filters then the sequence
7382 node orders them according to the child positions of the corresponding
7385 =item C<isl_schedule_node_set>
7387 A set node is similar to a sequence node, except that
7388 it expresses that domain elements appearing in distinct filters
7389 may have any order. The order of the children of a set node
7390 is therefore also immaterial.
7394 The following node types are only supported by the AST generator.
7398 =item C<isl_schedule_node_context>
7400 The context describes constraints on the parameters and
7401 the schedule dimensions of outer
7402 bands that the AST generator may assume to hold. It is also the only
7403 kind of node that may introduce additional parameters.
7404 The space of the context is that of the flat product of the outer
7405 band nodes. In particular, if there are no outer band nodes, then
7406 this space is the unnamed zero-dimensional space.
7407 Since a context node references the outer band nodes, any tree
7408 containing a context node is considered to be anchored.
7410 =item C<isl_schedule_node_extension>
7412 An extension node instructs the AST generator to add additional
7413 domain elements that need to be scheduled.
7414 The additional domain elements are described by the range of
7415 the extension map in terms of the outer schedule dimensions,
7416 i.e., the flat product of the outer band nodes.
7417 Note that domain elements are added whenever the AST generator
7418 reaches the extension node, meaning that there are still some
7419 active domain elements for which an AST needs to be generated.
7420 The conditions under which some domain elements are still active
7421 may however not be completely described by the outer AST nodes
7422 generated at that point.
7424 An extension node may also appear as the root of a schedule tree,
7425 when it is intended to be inserted into another tree
7426 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
7427 In this case, the domain of the extension node should
7428 correspond to the flat product of the outer band nodes
7429 in this other schedule tree at the point where the extension tree
7432 =item C<isl_schedule_node_guard>
7434 The guard describes constraints on the parameters and
7435 the schedule dimensions of outer
7436 bands that need to be enforced by the outer nodes
7437 in the generated AST.
7438 The space of the guard is that of the flat product of the outer
7439 band nodes. In particular, if there are no outer band nodes, then
7440 this space is the unnamed zero-dimensional space.
7441 Since a guard node references the outer band nodes, any tree
7442 containing a guard node is considered to be anchored.
7446 Except for the C<isl_schedule_node_context> nodes,
7447 none of the nodes may introduce any parameters that were not
7448 already present in the root domain node.
7450 A schedule tree is encapsulated in an C<isl_schedule> object.
7451 The simplest such objects, those with a tree consisting of single domain node,
7452 can be created using the following functions with either an empty
7453 domain or a given domain.
7455 #include <isl/schedule.h>
7456 __isl_give isl_schedule *isl_schedule_empty(
7457 __isl_take isl_space *space);
7458 __isl_give isl_schedule *isl_schedule_from_domain(
7459 __isl_take isl_union_set *domain);
7461 The function C<isl_schedule_constraints_compute_schedule> described
7462 in L</"Scheduling"> can also be used to construct schedules.
7464 C<isl_schedule> objects may be copied and freed using the following functions.
7466 #include <isl/schedule.h>
7467 __isl_give isl_schedule *isl_schedule_copy(
7468 __isl_keep isl_schedule *sched);
7469 __isl_null isl_schedule *isl_schedule_free(
7470 __isl_take isl_schedule *sched);
7472 The following functions checks whether two C<isl_schedule> objects
7473 are obviously the same.
7475 #include <isl/schedule.h>
7476 isl_bool isl_schedule_plain_is_equal(
7477 __isl_keep isl_schedule *schedule1,
7478 __isl_keep isl_schedule *schedule2);
7480 The domain of the schedule, i.e., the domain described by the root node,
7481 can be obtained using the following function.
7483 #include <isl/schedule.h>
7484 __isl_give isl_union_set *isl_schedule_get_domain(
7485 __isl_keep isl_schedule *schedule);
7487 An extra top-level band node (right underneath the domain node) can
7488 be introduced into the schedule using the following function.
7489 The schedule tree is assumed not to have any anchored nodes.
7491 #include <isl/schedule.h>
7492 __isl_give isl_schedule *
7493 isl_schedule_insert_partial_schedule(
7494 __isl_take isl_schedule *schedule,
7495 __isl_take isl_multi_union_pw_aff *partial);
7497 A top-level context node (right underneath the domain node) can
7498 be introduced into the schedule using the following function.
7500 #include <isl/schedule.h>
7501 __isl_give isl_schedule *isl_schedule_insert_context(
7502 __isl_take isl_schedule *schedule,
7503 __isl_take isl_set *context)
7505 A top-level guard node (right underneath the domain node) can
7506 be introduced into the schedule using the following function.
7508 #include <isl/schedule.h>
7509 __isl_give isl_schedule *isl_schedule_insert_guard(
7510 __isl_take isl_schedule *schedule,
7511 __isl_take isl_set *guard)
7513 A schedule that combines two schedules either in the given
7514 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
7515 or an C<isl_schedule_node_set> node,
7516 can be created using the following functions.
7518 #include <isl/schedule.h>
7519 __isl_give isl_schedule *isl_schedule_sequence(
7520 __isl_take isl_schedule *schedule1,
7521 __isl_take isl_schedule *schedule2);
7522 __isl_give isl_schedule *isl_schedule_set(
7523 __isl_take isl_schedule *schedule1,
7524 __isl_take isl_schedule *schedule2);
7526 The domains of the two input schedules need to be disjoint.
7528 The following function can be used to restrict the domain
7529 of a schedule with a domain node as root to be a subset of the given union set.
7530 This operation may remove nodes in the tree that have become
7533 #include <isl/schedule.h>
7534 __isl_give isl_schedule *isl_schedule_intersect_domain(
7535 __isl_take isl_schedule *schedule,
7536 __isl_take isl_union_set *domain);
7538 The following function resets the user pointers on all parameter
7539 and tuple identifiers referenced by the nodes of the given schedule.
7541 #include <isl/schedule.h>
7542 __isl_give isl_schedule *isl_schedule_reset_user(
7543 __isl_take isl_schedule *schedule);
7545 The following function aligns the parameters of all nodes
7546 in the given schedule to the given space.
7548 #include <isl/schedule.h>
7549 __isl_give isl_schedule *isl_schedule_align_params(
7550 __isl_take isl_schedule *schedule,
7551 __isl_take isl_space *space);
7553 The following function allows the user to plug in a given function
7554 in the iteration domains. The input schedule is not allowed to contain
7555 any expansion nodes.
7557 #include <isl/schedule.h>
7558 __isl_give isl_schedule *
7559 isl_schedule_pullback_union_pw_multi_aff(
7560 __isl_take isl_schedule *schedule,
7561 __isl_take isl_union_pw_multi_aff *upma);
7563 An C<isl_union_map> representation of the schedule can be obtained
7564 from an C<isl_schedule> using the following function.
7566 #include <isl/schedule.h>
7567 __isl_give isl_union_map *isl_schedule_get_map(
7568 __isl_keep isl_schedule *sched);
7570 The resulting relation encodes the same relative ordering as
7571 the schedule by mapping the domain elements to a common schedule space.
7572 If the schedule_separate_components option is set, then the order
7573 of the children of a set node is explicitly encoded in the result.
7574 If the tree contains any expansion nodes, then the relation
7575 is formulated in terms of the expanded domain elements.
7577 Schedules can be read from input using the following functions.
7579 #include <isl/schedule.h>
7580 __isl_give isl_schedule *isl_schedule_read_from_file(
7581 isl_ctx *ctx, FILE *input);
7582 __isl_give isl_schedule *isl_schedule_read_from_str(
7583 isl_ctx *ctx, const char *str);
7585 A representation of the schedule can be printed using
7587 #include <isl/schedule.h>
7588 __isl_give isl_printer *isl_printer_print_schedule(
7589 __isl_take isl_printer *p,
7590 __isl_keep isl_schedule *schedule);
7592 The schedule tree can be traversed through the use of
7593 C<isl_schedule_node> objects that point to a particular
7594 position in the schedule tree. Whenever a C<isl_schedule_node>
7595 is use to modify a node in the schedule tree, the original schedule
7596 tree is left untouched and the modifications are performed to a copy
7597 of the tree. The returned C<isl_schedule_node> then points to
7598 this modified copy of the tree.
7600 The root of the schedule tree can be obtained using the following function.
7602 #include <isl/schedule.h>
7603 __isl_give isl_schedule_node *isl_schedule_get_root(
7604 __isl_keep isl_schedule *schedule);
7606 A pointer to a newly created schedule tree with a single domain
7607 node can be created using the following functions.
7609 #include <isl/schedule_node.h>
7610 __isl_give isl_schedule_node *
7611 isl_schedule_node_from_domain(
7612 __isl_take isl_union_set *domain);
7613 __isl_give isl_schedule_node *
7614 isl_schedule_node_from_extension(
7615 __isl_take isl_union_map *extension);
7617 C<isl_schedule_node_from_extension> creates a tree with an extension
7620 Schedule nodes can be copied and freed using the following functions.
7622 #include <isl/schedule_node.h>
7623 __isl_give isl_schedule_node *isl_schedule_node_copy(
7624 __isl_keep isl_schedule_node *node);
7625 __isl_null isl_schedule_node *isl_schedule_node_free(
7626 __isl_take isl_schedule_node *node);
7628 The following functions can be used to check if two schedule
7629 nodes point to the same position in the same schedule.
7631 #include <isl/schedule_node.h>
7632 isl_bool isl_schedule_node_is_equal(
7633 __isl_keep isl_schedule_node *node1,
7634 __isl_keep isl_schedule_node *node2);
7636 The following properties can be obtained from a schedule node.
7638 #include <isl/schedule_node.h>
7639 enum isl_schedule_node_type isl_schedule_node_get_type(
7640 __isl_keep isl_schedule_node *node);
7641 enum isl_schedule_node_type
7642 isl_schedule_node_get_parent_type(
7643 __isl_keep isl_schedule_node *node);
7644 __isl_give isl_schedule *isl_schedule_node_get_schedule(
7645 __isl_keep isl_schedule_node *node);
7647 The function C<isl_schedule_node_get_type> returns the type of
7648 the node, while C<isl_schedule_node_get_parent_type> returns
7649 type of the parent of the node, which is required to exist.
7650 The function C<isl_schedule_node_get_schedule> returns a copy
7651 to the schedule to which the node belongs.
7653 The following functions can be used to move the schedule node
7654 to a different position in the tree or to check if such a position
7657 #include <isl/schedule_node.h>
7658 isl_bool isl_schedule_node_has_parent(
7659 __isl_keep isl_schedule_node *node);
7660 __isl_give isl_schedule_node *isl_schedule_node_parent(
7661 __isl_take isl_schedule_node *node);
7662 __isl_give isl_schedule_node *isl_schedule_node_root(
7663 __isl_take isl_schedule_node *node);
7664 __isl_give isl_schedule_node *isl_schedule_node_ancestor(
7665 __isl_take isl_schedule_node *node,
7667 int isl_schedule_node_n_children(
7668 __isl_keep isl_schedule_node *node);
7669 __isl_give isl_schedule_node *isl_schedule_node_child(
7670 __isl_take isl_schedule_node *node, int pos);
7671 isl_bool isl_schedule_node_has_children(
7672 __isl_keep isl_schedule_node *node);
7673 __isl_give isl_schedule_node *isl_schedule_node_first_child(
7674 __isl_take isl_schedule_node *node);
7675 isl_bool isl_schedule_node_has_previous_sibling(
7676 __isl_keep isl_schedule_node *node);
7677 __isl_give isl_schedule_node *
7678 isl_schedule_node_previous_sibling(
7679 __isl_take isl_schedule_node *node);
7680 isl_bool isl_schedule_node_has_next_sibling(
7681 __isl_keep isl_schedule_node *node);
7682 __isl_give isl_schedule_node *
7683 isl_schedule_node_next_sibling(
7684 __isl_take isl_schedule_node *node);
7686 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
7687 is the node itself, the ancestor of generation 1 is its parent and so on.
7689 It is also possible to query the number of ancestors of a node,
7690 the position of the current node
7691 within the children of its parent, the position of the subtree
7692 containing a node within the children of an ancestor
7693 or to obtain a copy of a given
7694 child without destroying the current node.
7695 Given two nodes that point to the same schedule, their closest
7696 shared ancestor can be obtained using
7697 C<isl_schedule_node_get_shared_ancestor>.
7699 #include <isl/schedule_node.h>
7700 int isl_schedule_node_get_tree_depth(
7701 __isl_keep isl_schedule_node *node);
7702 int isl_schedule_node_get_child_position(
7703 __isl_keep isl_schedule_node *node);
7704 int isl_schedule_node_get_ancestor_child_position(
7705 __isl_keep isl_schedule_node *node,
7706 __isl_keep isl_schedule_node *ancestor);
7707 __isl_give isl_schedule_node *isl_schedule_node_get_child(
7708 __isl_keep isl_schedule_node *node, int pos);
7709 __isl_give isl_schedule_node *
7710 isl_schedule_node_get_shared_ancestor(
7711 __isl_keep isl_schedule_node *node1,
7712 __isl_keep isl_schedule_node *node2);
7714 All nodes in a schedule tree or
7715 all descendants of a specific node (including the node) can be visited
7716 in depth-first pre-order using the following functions.
7718 #include <isl/schedule.h>
7719 isl_stat isl_schedule_foreach_schedule_node_top_down(
7720 __isl_keep isl_schedule *sched,
7721 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
7722 void *user), void *user);
7724 #include <isl/schedule_node.h>
7725 isl_stat isl_schedule_node_foreach_descendant_top_down(
7726 __isl_keep isl_schedule_node *node,
7727 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
7728 void *user), void *user);
7730 The callback function is slightly different from the usual
7731 callbacks in that it not only indicates success (non-negative result)
7732 or failure (negative result), but also indicates whether the children
7733 of the given node should be visited. In particular, if the callback
7734 returns a positive value, then the children are visited, but if
7735 the callback returns zero, then the children are not visited.
7737 The ancestors of a node in a schedule tree can be visited from
7738 the root down to and including the parent of the node using
7739 the following function.
7741 #include <isl/schedule_node.h>
7742 isl_stat isl_schedule_node_foreach_ancestor_top_down(
7743 __isl_keep isl_schedule_node *node,
7744 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
7745 void *user), void *user);
7747 The following functions allows for a depth-first post-order
7748 traversal of the nodes in a schedule tree or
7749 of the descendants of a specific node (including the node
7750 itself), where the user callback is allowed to modify the
7753 #include <isl/schedule.h>
7754 __isl_give isl_schedule *
7755 isl_schedule_map_schedule_node_bottom_up(
7756 __isl_take isl_schedule *schedule,
7757 __isl_give isl_schedule_node *(*fn)(
7758 __isl_take isl_schedule_node *node,
7759 void *user), void *user);
7761 #include <isl/schedule_node.h>
7762 __isl_give isl_schedule_node *
7763 isl_schedule_node_map_descendant_bottom_up(
7764 __isl_take isl_schedule_node *node,
7765 __isl_give isl_schedule_node *(*fn)(
7766 __isl_take isl_schedule_node *node,
7767 void *user), void *user);
7769 The traversal continues from the node returned by the callback function.
7770 It is the responsibility of the user to ensure that this does not
7771 lead to an infinite loop. It is safest to always return a pointer
7772 to the same position (same ancestors and child positions) as the input node.
7774 The following function removes a node (along with its descendants)
7775 from a schedule tree and returns a pointer to the leaf at the
7776 same position in the updated tree.
7777 It is not allowed to remove the root of a schedule tree or
7778 a child of a set or sequence node.
7780 #include <isl/schedule_node.h>
7781 __isl_give isl_schedule_node *isl_schedule_node_cut(
7782 __isl_take isl_schedule_node *node);
7784 The following function removes a single node
7785 from a schedule tree and returns a pointer to the child
7786 of the node, now located at the position of the original node
7787 or to a leaf node at that position if there was no child.
7788 It is not allowed to remove the root of a schedule tree,
7789 a set or sequence node, a child of a set or sequence node or
7790 a band node with an anchored subtree.
7792 #include <isl/schedule_node.h>
7793 __isl_give isl_schedule_node *isl_schedule_node_delete(
7794 __isl_take isl_schedule_node *node);
7796 Most nodes in a schedule tree only contain local information.
7797 In some cases, however, a node may also refer to outer band nodes.
7798 This means that the position of the node within the tree should
7799 not be changed, or at least that no changes are performed to the
7800 outer band nodes. The following function can be used to test
7801 whether the subtree rooted at a given node contains any such nodes.
7803 #include <isl/schedule_node.h>
7804 isl_bool isl_schedule_node_is_subtree_anchored(
7805 __isl_keep isl_schedule_node *node);
7807 The following function resets the user pointers on all parameter
7808 and tuple identifiers referenced by the given schedule node.
7810 #include <isl/schedule_node.h>
7811 __isl_give isl_schedule_node *isl_schedule_node_reset_user(
7812 __isl_take isl_schedule_node *node);
7814 The following function aligns the parameters of the given schedule
7815 node to the given space.
7817 #include <isl/schedule_node.h>
7818 __isl_give isl_schedule_node *
7819 isl_schedule_node_align_params(
7820 __isl_take isl_schedule_node *node,
7821 __isl_take isl_space *space);
7823 Several node types have their own functions for querying
7824 (and in some cases setting) some node type specific properties.
7826 #include <isl/schedule_node.h>
7827 __isl_give isl_space *isl_schedule_node_band_get_space(
7828 __isl_keep isl_schedule_node *node);
7829 __isl_give isl_multi_union_pw_aff *
7830 isl_schedule_node_band_get_partial_schedule(
7831 __isl_keep isl_schedule_node *node);
7832 __isl_give isl_union_map *
7833 isl_schedule_node_band_get_partial_schedule_union_map(
7834 __isl_keep isl_schedule_node *node);
7835 unsigned isl_schedule_node_band_n_member(
7836 __isl_keep isl_schedule_node *node);
7837 isl_bool isl_schedule_node_band_member_get_coincident(
7838 __isl_keep isl_schedule_node *node, int pos);
7839 __isl_give isl_schedule_node *
7840 isl_schedule_node_band_member_set_coincident(
7841 __isl_take isl_schedule_node *node, int pos,
7843 isl_bool isl_schedule_node_band_get_permutable(
7844 __isl_keep isl_schedule_node *node);
7845 __isl_give isl_schedule_node *
7846 isl_schedule_node_band_set_permutable(
7847 __isl_take isl_schedule_node *node, int permutable);
7848 enum isl_ast_loop_type
7849 isl_schedule_node_band_member_get_ast_loop_type(
7850 __isl_keep isl_schedule_node *node, int pos);
7851 __isl_give isl_schedule_node *
7852 isl_schedule_node_band_member_set_ast_loop_type(
7853 __isl_take isl_schedule_node *node, int pos,
7854 enum isl_ast_loop_type type);
7855 __isl_give isl_union_set *
7856 enum isl_ast_loop_type
7857 isl_schedule_node_band_member_get_isolate_ast_loop_type(
7858 __isl_keep isl_schedule_node *node, int pos);
7859 __isl_give isl_schedule_node *
7860 isl_schedule_node_band_member_set_isolate_ast_loop_type(
7861 __isl_take isl_schedule_node *node, int pos,
7862 enum isl_ast_loop_type type);
7863 isl_schedule_node_band_get_ast_build_options(
7864 __isl_keep isl_schedule_node *node);
7865 __isl_give isl_schedule_node *
7866 isl_schedule_node_band_set_ast_build_options(
7867 __isl_take isl_schedule_node *node,
7868 __isl_take isl_union_set *options);
7870 The function C<isl_schedule_node_band_get_space> returns the space
7871 of the partial schedule of the band.
7872 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
7873 returns a representation of the partial schedule of the band node
7874 in the form of an C<isl_union_map>.
7875 The coincident and permutable properties are set by
7876 C<isl_schedule_constraints_compute_schedule> on the schedule tree
7878 A scheduling dimension is considered to be ``coincident''
7879 if it satisfies the coincidence constraints within its band.
7880 That is, if the dependence distances of the coincidence
7881 constraints are all zero in that direction (for fixed
7882 iterations of outer bands).
7883 A band is marked permutable if it was produced using the Pluto-like scheduler.
7884 Note that the scheduler may have to resort to a Feautrier style scheduling
7885 step even if the default scheduler is used.
7886 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
7887 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
7888 For the meaning of these loop AST generation types and the difference
7889 between the regular loop AST generation type and the isolate
7890 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
7891 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
7892 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
7893 may return C<isl_ast_loop_error> if an error occurs.
7894 The AST build options govern how an AST is generated for
7895 the individual schedule dimensions during AST generation.
7896 See L</"AST Generation Options (Schedule Tree)">.
7898 #include <isl/schedule_node.h>
7899 __isl_give isl_set *
7900 isl_schedule_node_context_get_context(
7901 __isl_keep isl_schedule_node *node);
7903 #include <isl/schedule_node.h>
7904 __isl_give isl_union_set *
7905 isl_schedule_node_domain_get_domain(
7906 __isl_keep isl_schedule_node *node);
7908 #include <isl/schedule_node.h>
7909 __isl_give isl_union_map *
7910 isl_schedule_node_expansion_get_expansion(
7911 __isl_keep isl_schedule_node *node);
7912 __isl_give isl_union_pw_multi_aff *
7913 isl_schedule_node_expansion_get_contraction(
7914 __isl_keep isl_schedule_node *node);
7916 #include <isl/schedule_node.h>
7917 __isl_give isl_union_map *
7918 isl_schedule_node_extension_get_extension(
7919 __isl_keep isl_schedule_node *node);
7921 #include <isl/schedule_node.h>
7922 __isl_give isl_union_set *
7923 isl_schedule_node_filter_get_filter(
7924 __isl_keep isl_schedule_node *node);
7926 #include <isl/schedule_node.h>
7927 __isl_give isl_set *isl_schedule_node_guard_get_guard(
7928 __isl_keep isl_schedule_node *node);
7930 #include <isl/schedule_node.h>
7931 __isl_give isl_id *isl_schedule_node_mark_get_id(
7932 __isl_keep isl_schedule_node *node);
7934 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
7935 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
7936 partial schedules related to the node.
7938 #include <isl/schedule_node.h>
7939 __isl_give isl_multi_union_pw_aff *
7940 isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
7941 __isl_keep isl_schedule_node *node);
7942 __isl_give isl_union_pw_multi_aff *
7943 isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
7944 __isl_keep isl_schedule_node *node);
7945 __isl_give isl_union_map *
7946 isl_schedule_node_get_prefix_schedule_union_map(
7947 __isl_keep isl_schedule_node *node);
7948 __isl_give isl_union_map *
7949 isl_schedule_node_get_prefix_schedule_relation(
7950 __isl_keep isl_schedule_node *node);
7951 __isl_give isl_union_map *
7952 isl_schedule_node_get_subtree_schedule_union_map(
7953 __isl_keep isl_schedule_node *node);
7955 In particular, the functions
7956 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
7957 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
7958 and C<isl_schedule_node_get_prefix_schedule_union_map>
7959 return a relative ordering on the domain elements that reach the given
7960 node determined by its ancestors.
7961 The function C<isl_schedule_node_get_prefix_schedule_relation>
7962 additionally includes the domain constraints in the result.
7963 The function C<isl_schedule_node_get_subtree_schedule_union_map>
7964 returns a representation of the partial schedule defined by the
7965 subtree rooted at the given node.
7966 If the tree contains any expansion nodes, then the subtree schedule
7967 is formulated in terms of the expanded domain elements.
7968 The tree passed to functions returning a prefix schedule
7969 may only contain extension nodes if these would not affect
7970 the result of these functions. That is, if one of the ancestors
7971 is an extension node, then all of the domain elements that were
7972 added by the extension node need to have been filtered out
7973 by filter nodes between the extension node and the input node.
7974 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
7975 may not contain in extension nodes in the selected subtree.
7977 The expansion/contraction defined by an entire subtree, combining
7978 the expansions/contractions
7979 on the expansion nodes in the subtree, can be obtained using
7980 the following functions.
7982 #include <isl/schedule_node.h>
7983 __isl_give isl_union_map *
7984 isl_schedule_node_get_subtree_expansion(
7985 __isl_keep isl_schedule_node *node);
7986 __isl_give isl_union_pw_multi_aff *
7987 isl_schedule_node_get_subtree_contraction(
7988 __isl_keep isl_schedule_node *node);
7990 The total number of outer band members of given node, i.e.,
7991 the shared output dimension of the maps in the result
7992 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
7993 using the following function.
7995 #include <isl/schedule_node.h>
7996 int isl_schedule_node_get_schedule_depth(
7997 __isl_keep isl_schedule_node *node);
7999 The following functions return the elements that reach the given node
8000 or the union of universes in the spaces that contain these elements.
8002 #include <isl/schedule_node.h>
8003 __isl_give isl_union_set *
8004 isl_schedule_node_get_domain(
8005 __isl_keep isl_schedule_node *node);
8006 __isl_give isl_union_set *
8007 isl_schedule_node_get_universe_domain(
8008 __isl_keep isl_schedule_node *node);
8010 The input tree of C<isl_schedule_node_get_domain>
8011 may only contain extension nodes if these would not affect
8012 the result of this function. That is, if one of the ancestors
8013 is an extension node, then all of the domain elements that were
8014 added by the extension node need to have been filtered out
8015 by filter nodes between the extension node and the input node.
8017 The following functions can be used to introduce additional nodes
8018 in the schedule tree. The new node is introduced at the point
8019 in the tree where the C<isl_schedule_node> points to and
8020 the results points to the new node.
8022 #include <isl/schedule_node.h>
8023 __isl_give isl_schedule_node *
8024 isl_schedule_node_insert_partial_schedule(
8025 __isl_take isl_schedule_node *node,
8026 __isl_take isl_multi_union_pw_aff *schedule);
8028 This function inserts a new band node with (the greatest integer
8029 part of) the given partial schedule.
8030 The subtree rooted at the given node is assumed not to have
8033 #include <isl/schedule_node.h>
8034 __isl_give isl_schedule_node *
8035 isl_schedule_node_insert_context(
8036 __isl_take isl_schedule_node *node,
8037 __isl_take isl_set *context);
8039 This function inserts a new context node with the given context constraints.
8041 #include <isl/schedule_node.h>
8042 __isl_give isl_schedule_node *
8043 isl_schedule_node_insert_filter(
8044 __isl_take isl_schedule_node *node,
8045 __isl_take isl_union_set *filter);
8047 This function inserts a new filter node with the given filter.
8048 If the original node already pointed to a filter node, then the
8049 two filter nodes are merged into one.
8051 #include <isl/schedule_node.h>
8052 __isl_give isl_schedule_node *
8053 isl_schedule_node_insert_guard(
8054 __isl_take isl_schedule_node *node,
8055 __isl_take isl_set *guard);
8057 This function inserts a new guard node with the given guard constraints.
8059 #include <isl/schedule_node.h>
8060 __isl_give isl_schedule_node *
8061 isl_schedule_node_insert_mark(
8062 __isl_take isl_schedule_node *node,
8063 __isl_take isl_id *mark);
8065 This function inserts a new mark node with the give mark identifier.
8067 #include <isl/schedule_node.h>
8068 __isl_give isl_schedule_node *
8069 isl_schedule_node_insert_sequence(
8070 __isl_take isl_schedule_node *node,
8071 __isl_take isl_union_set_list *filters);
8072 __isl_give isl_schedule_node *
8073 isl_schedule_node_insert_set(
8074 __isl_take isl_schedule_node *node,
8075 __isl_take isl_union_set_list *filters);
8077 These functions insert a new sequence or set node with the given
8078 filters as children.
8080 #include <isl/schedule_node.h>
8081 __isl_give isl_schedule_node *isl_schedule_node_group(
8082 __isl_take isl_schedule_node *node,
8083 __isl_take isl_id *group_id);
8085 This function introduces an expansion node in between the current
8086 node and its parent that expands instances of a space with tuple
8087 identifier C<group_id> to the original domain elements that reach
8088 the node. The group instances are identified by the prefix schedule
8089 of those domain elements. The ancestors of the node are adjusted
8090 to refer to the group instances instead of the original domain
8091 elements. The return value points to the same node in the updated
8092 schedule tree as the input node, i.e., to the child of the newly
8093 introduced expansion node. Grouping instances of different statements
8094 ensures that they will be treated as a single statement by the
8095 AST generator up to the point of the expansion node.
8097 The partial schedule of a band node can be scaled (down) using
8098 the following functions.
8100 #include <isl/schedule_node.h>
8101 __isl_give isl_schedule_node *
8102 isl_schedule_node_band_scale(
8103 __isl_take isl_schedule_node *node,
8104 __isl_take isl_multi_val *mv);
8105 __isl_give isl_schedule_node *
8106 isl_schedule_node_band_scale_down(
8107 __isl_take isl_schedule_node *node,
8108 __isl_take isl_multi_val *mv);
8110 The spaces of the two arguments need to match.
8111 After scaling, the partial schedule is replaced by its greatest
8112 integer part to ensure that the schedule remains integral.
8114 A band node can be tiled using the following function.
8116 #include <isl/schedule_node.h>
8117 __isl_give isl_schedule_node *isl_schedule_node_band_tile(
8118 __isl_take isl_schedule_node *node,
8119 __isl_take isl_multi_val *sizes);
8121 isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8123 int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8124 isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8126 int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8128 The C<isl_schedule_node_band_tile> function tiles
8129 the band using the given tile sizes inside its schedule.
8130 A new child band node is created to represent the point loops and it is
8131 inserted between the modified band and its children.
8132 The subtree rooted at the given node is assumed not to have
8134 The C<tile_scale_tile_loops> option specifies whether the tile
8135 loops iterators should be scaled by the tile sizes.
8136 If the C<tile_shift_point_loops> option is set, then the point loops
8137 are shifted to start at zero.
8139 A band node can be split into two nested band nodes
8140 using the following function.
8142 #include <isl/schedule_node.h>
8143 __isl_give isl_schedule_node *isl_schedule_node_band_split(
8144 __isl_take isl_schedule_node *node, int pos);
8146 The resulting outer band node contains the first C<pos> dimensions of
8147 the schedule of C<node> while the inner band contains the remaining dimensions.
8148 The schedules of the two band nodes live in anonymous spaces.
8150 A band node can be moved down to the leaves of the subtree rooted
8151 at the band node using the following function.
8153 #include <isl/schedule_node.h>
8154 __isl_give isl_schedule_node *isl_schedule_node_band_sink(
8155 __isl_take isl_schedule_node *node);
8157 The subtree rooted at the given node is assumed not to have
8159 The result points to the node in the resulting tree that is in the same
8160 position as the node pointed to by C<node> in the original tree.
8162 #include <isl/schedule_node.h>
8163 __isl_give isl_schedule_node *
8164 isl_schedule_node_order_after(
8165 __isl_take isl_schedule_node *node,
8166 __isl_take isl_union_set *filter);
8168 This function splits the domain elements that reach C<node>
8169 into those that satisfy C<filter> and those that do not and
8170 arranges for the elements that do satisfy the filter to be
8171 executed after those that do not. The order is imposed by
8172 a sequence node, possibly reusing the grandparent of C<node>
8173 on two copies of the subtree attached to the original C<node>.
8174 Both copies are simplified with respect to their filter.
8176 Return a pointer to the copy of the subtree that does not
8177 satisfy C<filter>. If there is no such copy (because all
8178 reaching domain elements satisfy the filter), then return
8179 the original pointer.
8181 #include <isl/schedule_node.h>
8182 __isl_give isl_schedule_node *
8183 isl_schedule_node_graft_before(
8184 __isl_take isl_schedule_node *node,
8185 __isl_take isl_schedule_node *graft);
8186 __isl_give isl_schedule_node *
8187 isl_schedule_node_graft_after(
8188 __isl_take isl_schedule_node *node,
8189 __isl_take isl_schedule_node *graft);
8191 This function inserts the C<graft> tree into the tree containing C<node>
8192 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
8193 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
8194 The root node of C<graft>
8195 should be an extension node where the domain of the extension
8196 is the flat product of all outer band nodes of C<node>.
8197 The root node may also be a domain node.
8198 The elements of the domain or the range of the extension may not
8199 intersect with the domain elements that reach "node".
8200 The schedule tree of C<graft> may not be anchored.
8202 The schedule tree of C<node> is modified to include an extension node
8203 corresponding to the root node of C<graft> as a child of the original
8204 parent of C<node>. The original node that C<node> points to and the
8205 child of the root node of C<graft> are attached to this extension node
8206 through a sequence, with appropriate filters and with the child
8207 of C<graft> appearing before or after the original C<node>.
8209 If C<node> already appears inside a sequence that is the child of
8210 an extension node and if the spaces of the new domain elements
8211 do not overlap with those of the original domain elements,
8212 then that extension node is extended with the new extension
8213 rather than introducing a new segment of extension and sequence nodes.
8215 Return a pointer to the same node in the modified tree that
8216 C<node> pointed to in the original tree.
8218 A representation of the schedule node can be printed using
8220 #include <isl/schedule_node.h>
8221 __isl_give isl_printer *isl_printer_print_schedule_node(
8222 __isl_take isl_printer *p,
8223 __isl_keep isl_schedule_node *node);
8225 =head2 Dependence Analysis
8227 C<isl> contains specialized functionality for performing
8228 array dataflow analysis. That is, given a I<sink> access relation
8229 and a collection of possible I<source> access relations,
8230 C<isl> can compute relations that describe
8231 for each iteration of the sink access, which iteration
8232 of which of the source access relations was the last
8233 to access the same data element before the given iteration
8235 The resulting dependence relations map source iterations
8236 to the corresponding sink iterations.
8237 To compute standard flow dependences, the sink should be
8238 a read, while the sources should be writes.
8239 If any of the source accesses are marked as being I<may>
8240 accesses, then there will be a dependence from the last
8241 I<must> access B<and> from any I<may> access that follows
8242 this last I<must> access.
8243 In particular, if I<all> sources are I<may> accesses,
8244 then memory based dependence analysis is performed.
8245 If, on the other hand, all sources are I<must> accesses,
8246 then value based dependence analysis is performed.
8248 =head3 High-level Interface
8250 A high-level interface to dependence analysis is provided
8251 by the following function.
8253 #include <isl/flow.h>
8254 __isl_give isl_union_flow *
8255 isl_union_access_info_compute_flow(
8256 __isl_take isl_union_access_info *access);
8258 The input C<isl_union_access_info> object describes the sink
8259 access relations, the source access relations and a schedule,
8260 while the output C<isl_union_flow> object describes
8261 the resulting dependence relations and the subsets of the
8262 sink relations for which no source was found.
8264 An C<isl_union_access_info> is created, modified, copied and freed using
8265 the following functions.
8267 #include <isl/flow.h>
8268 __isl_give isl_union_access_info *
8269 isl_union_access_info_from_sink(
8270 __isl_take isl_union_map *sink);
8271 __isl_give isl_union_access_info *
8272 isl_union_access_info_set_must_source(
8273 __isl_take isl_union_access_info *access,
8274 __isl_take isl_union_map *must_source);
8275 __isl_give isl_union_access_info *
8276 isl_union_access_info_set_may_source(
8277 __isl_take isl_union_access_info *access,
8278 __isl_take isl_union_map *may_source);
8279 __isl_give isl_union_access_info *
8280 isl_union_access_info_set_schedule(
8281 __isl_take isl_union_access_info *access,
8282 __isl_take isl_schedule *schedule);
8283 __isl_give isl_union_access_info *
8284 isl_union_access_info_set_schedule_map(
8285 __isl_take isl_union_access_info *access,
8286 __isl_take isl_union_map *schedule_map);
8287 __isl_give isl_union_access_info *
8288 isl_union_access_info_copy(
8289 __isl_keep isl_union_access_info *access);
8290 __isl_null isl_union_access_info *
8291 isl_union_access_info_free(
8292 __isl_take isl_union_access_info *access);
8294 The may sources set by C<isl_union_access_info_set_may_source>
8295 do not need to include the must sources set by
8296 C<isl_union_access_info_set_must_source> as a subset.
8297 The user is free not to call one (or both) of these functions,
8298 in which case the corresponding set is kept to its empty default.
8299 Similarly, the default schedule initialized by
8300 C<isl_union_access_info_from_sink> is empty.
8301 The current schedule is determined by the last call to either
8302 C<isl_union_access_info_set_schedule> or
8303 C<isl_union_access_info_set_schedule_map>.
8304 The domain of the schedule corresponds to the domains of
8305 the access relations. In particular, the domains of the access
8306 relations are effectively intersected with the domain of the schedule
8307 and only the resulting accesses are considered by the dependence analysis.
8309 The output of C<isl_union_access_info_compute_flow> can be examined
8310 and freed using the following functions.
8312 #include <isl/flow.h>
8313 __isl_give isl_union_map *isl_union_flow_get_must_dependence(
8314 __isl_keep isl_union_flow *flow);
8315 __isl_give isl_union_map *isl_union_flow_get_may_dependence(
8316 __isl_keep isl_union_flow *flow);
8317 __isl_give isl_union_map *isl_union_flow_get_must_no_source(
8318 __isl_keep isl_union_flow *flow);
8319 __isl_give isl_union_map *isl_union_flow_get_may_no_source(
8320 __isl_keep isl_union_flow *flow);
8321 __isl_null isl_union_flow *isl_union_flow_free(
8322 __isl_take isl_union_flow *flow);
8324 The relation returned by C<isl_union_flow_get_must_dependence>
8325 relates domain elements of must sources to domain elements of the sink.
8326 The relation returned by C<isl_union_flow_get_may_dependence>
8327 relates domain elements of must or may sources to domain elements of the sink
8328 and includes the previous relation as a subset.
8329 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
8330 of the sink relation for which no dependences have been found.
8331 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
8332 of the sink relation for which no definite dependences have been found.
8333 That is, it contains those sink access that do not contribute to any
8334 of the elements in the relation returned
8335 by C<isl_union_flow_get_must_dependence>.
8337 =head3 Low-level Interface
8339 A lower-level interface is provided by the following functions.
8341 #include <isl/flow.h>
8343 typedef int (*isl_access_level_before)(void *first, void *second);
8345 __isl_give isl_access_info *isl_access_info_alloc(
8346 __isl_take isl_map *sink,
8347 void *sink_user, isl_access_level_before fn,
8349 __isl_give isl_access_info *isl_access_info_add_source(
8350 __isl_take isl_access_info *acc,
8351 __isl_take isl_map *source, int must,
8353 __isl_null isl_access_info *isl_access_info_free(
8354 __isl_take isl_access_info *acc);
8356 __isl_give isl_flow *isl_access_info_compute_flow(
8357 __isl_take isl_access_info *acc);
8359 isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
8360 isl_stat (*fn)(__isl_take isl_map *dep, int must,
8361 void *dep_user, void *user),
8363 __isl_give isl_map *isl_flow_get_no_source(
8364 __isl_keep isl_flow *deps, int must);
8365 void isl_flow_free(__isl_take isl_flow *deps);
8367 The function C<isl_access_info_compute_flow> performs the actual
8368 dependence analysis. The other functions are used to construct
8369 the input for this function or to read off the output.
8371 The input is collected in an C<isl_access_info>, which can
8372 be created through a call to C<isl_access_info_alloc>.
8373 The arguments to this functions are the sink access relation
8374 C<sink>, a token C<sink_user> used to identify the sink
8375 access to the user, a callback function for specifying the
8376 relative order of source and sink accesses, and the number
8377 of source access relations that will be added.
8378 The callback function has type C<int (*)(void *first, void *second)>.
8379 The function is called with two user supplied tokens identifying
8380 either a source or the sink and it should return the shared nesting
8381 level and the relative order of the two accesses.
8382 In particular, let I<n> be the number of loops shared by
8383 the two accesses. If C<first> precedes C<second> textually,
8384 then the function should return I<2 * n + 1>; otherwise,
8385 it should return I<2 * n>.
8386 The sources can be added to the C<isl_access_info> by performing
8387 (at most) C<max_source> calls to C<isl_access_info_add_source>.
8388 C<must> indicates whether the source is a I<must> access
8389 or a I<may> access. Note that a multi-valued access relation
8390 should only be marked I<must> if every iteration in the domain
8391 of the relation accesses I<all> elements in its image.
8392 The C<source_user> token is again used to identify
8393 the source access. The range of the source access relation
8394 C<source> should have the same dimension as the range
8395 of the sink access relation.
8396 The C<isl_access_info_free> function should usually not be
8397 called explicitly, because it is called implicitly by
8398 C<isl_access_info_compute_flow>.
8400 The result of the dependence analysis is collected in an
8401 C<isl_flow>. There may be elements of
8402 the sink access for which no preceding source access could be
8403 found or for which all preceding sources are I<may> accesses.
8404 The relations containing these elements can be obtained through
8405 calls to C<isl_flow_get_no_source>, the first with C<must> set
8406 and the second with C<must> unset.
8407 In the case of standard flow dependence analysis,
8408 with the sink a read and the sources I<must> writes,
8409 the first relation corresponds to the reads from uninitialized
8410 array elements and the second relation is empty.
8411 The actual flow dependences can be extracted using
8412 C<isl_flow_foreach>. This function will call the user-specified
8413 callback function C<fn> for each B<non-empty> dependence between
8414 a source and the sink. The callback function is called
8415 with four arguments, the actual flow dependence relation
8416 mapping source iterations to sink iterations, a boolean that
8417 indicates whether it is a I<must> or I<may> dependence, a token
8418 identifying the source and an additional C<void *> with value
8419 equal to the third argument of the C<isl_flow_foreach> call.
8420 A dependence is marked I<must> if it originates from a I<must>
8421 source and if it is not followed by any I<may> sources.
8423 After finishing with an C<isl_flow>, the user should call
8424 C<isl_flow_free> to free all associated memory.
8426 =head3 Interaction with the Low-level Interface
8428 During the dependence analysis, we frequently need to perform
8429 the following operation. Given a relation between sink iterations
8430 and potential source iterations from a particular source domain,
8431 what is the last potential source iteration corresponding to each
8432 sink iteration. It can sometimes be convenient to adjust
8433 the set of potential source iterations before or after each such operation.
8434 The prototypical example is fuzzy array dataflow analysis,
8435 where we need to analyze if, based on data-dependent constraints,
8436 the sink iteration can ever be executed without one or more of
8437 the corresponding potential source iterations being executed.
8438 If so, we can introduce extra parameters and select an unknown
8439 but fixed source iteration from the potential source iterations.
8440 To be able to perform such manipulations, C<isl> provides the following
8443 #include <isl/flow.h>
8445 typedef __isl_give isl_restriction *(*isl_access_restrict)(
8446 __isl_keep isl_map *source_map,
8447 __isl_keep isl_set *sink, void *source_user,
8449 __isl_give isl_access_info *isl_access_info_set_restrict(
8450 __isl_take isl_access_info *acc,
8451 isl_access_restrict fn, void *user);
8453 The function C<isl_access_info_set_restrict> should be called
8454 before calling C<isl_access_info_compute_flow> and registers a callback function
8455 that will be called any time C<isl> is about to compute the last
8456 potential source. The first argument is the (reverse) proto-dependence,
8457 mapping sink iterations to potential source iterations.
8458 The second argument represents the sink iterations for which
8459 we want to compute the last source iteration.
8460 The third argument is the token corresponding to the source
8461 and the final argument is the token passed to C<isl_access_info_set_restrict>.
8462 The callback is expected to return a restriction on either the input or
8463 the output of the operation computing the last potential source.
8464 If the input needs to be restricted then restrictions are needed
8465 for both the source and the sink iterations. The sink iterations
8466 and the potential source iterations will be intersected with these sets.
8467 If the output needs to be restricted then only a restriction on the source
8468 iterations is required.
8469 If any error occurs, the callback should return C<NULL>.
8470 An C<isl_restriction> object can be created, freed and inspected
8471 using the following functions.
8473 #include <isl/flow.h>
8475 __isl_give isl_restriction *isl_restriction_input(
8476 __isl_take isl_set *source_restr,
8477 __isl_take isl_set *sink_restr);
8478 __isl_give isl_restriction *isl_restriction_output(
8479 __isl_take isl_set *source_restr);
8480 __isl_give isl_restriction *isl_restriction_none(
8481 __isl_take isl_map *source_map);
8482 __isl_give isl_restriction *isl_restriction_empty(
8483 __isl_take isl_map *source_map);
8484 __isl_null isl_restriction *isl_restriction_free(
8485 __isl_take isl_restriction *restr);
8487 C<isl_restriction_none> and C<isl_restriction_empty> are special
8488 cases of C<isl_restriction_input>. C<isl_restriction_none>
8489 is essentially equivalent to
8491 isl_restriction_input(isl_set_universe(
8492 isl_space_range(isl_map_get_space(source_map))),
8494 isl_space_domain(isl_map_get_space(source_map))));
8496 whereas C<isl_restriction_empty> is essentially equivalent to
8498 isl_restriction_input(isl_set_empty(
8499 isl_space_range(isl_map_get_space(source_map))),
8501 isl_space_domain(isl_map_get_space(source_map))));
8505 B<The functionality described in this section is fairly new
8506 and may be subject to change.>
8508 #include <isl/schedule.h>
8509 __isl_give isl_schedule *
8510 isl_schedule_constraints_compute_schedule(
8511 __isl_take isl_schedule_constraints *sc);
8513 The function C<isl_schedule_constraints_compute_schedule> can be
8514 used to compute a schedule that satisfies the given schedule constraints.
8515 These schedule constraints include the iteration domain for which
8516 a schedule should be computed and dependences between pairs of
8517 iterations. In particular, these dependences include
8518 I<validity> dependences and I<proximity> dependences.
8519 By default, the algorithm used to construct the schedule is similar
8520 to that of C<Pluto>.
8521 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
8523 The generated schedule respects all validity dependences.
8524 That is, all dependence distances over these dependences in the
8525 scheduled space are lexicographically positive.
8527 The default algorithm tries to ensure that the dependence distances
8528 over coincidence constraints are zero and to minimize the
8529 dependence distances over proximity dependences.
8530 Moreover, it tries to obtain sequences (bands) of schedule dimensions
8531 for groups of domains where the dependence distances over validity
8532 dependences have only non-negative values.
8533 Note that when minimizing the maximal dependence distance
8534 over proximity dependences, a single affine expression in the parameters
8535 is constructed that bounds all dependence distances. If no such expression
8536 exists, then the algorithm will fail and resort to an alternative
8537 scheduling algorithm. In particular, this means that adding proximity
8538 dependences may eliminate valid solutions. A typical example where this
8539 phenomenon may occur is when some subset of the proximity dependences
8540 has no restriction on some parameter, forcing the coefficient of that
8541 parameter to be zero, while some other subset forces the dependence
8542 distance to depend on that parameter, requiring the same coefficient
8544 When using Feautrier's algorithm, the coincidence and proximity constraints
8545 are only taken into account during the extension to a
8546 full-dimensional schedule.
8548 An C<isl_schedule_constraints> object can be constructed
8549 and manipulated using the following functions.
8551 #include <isl/schedule.h>
8552 __isl_give isl_schedule_constraints *
8553 isl_schedule_constraints_copy(
8554 __isl_keep isl_schedule_constraints *sc);
8555 __isl_give isl_schedule_constraints *
8556 isl_schedule_constraints_on_domain(
8557 __isl_take isl_union_set *domain);
8558 __isl_give isl_schedule_constraints *
8559 isl_schedule_constraints_set_context(
8560 __isl_take isl_schedule_constraints *sc,
8561 __isl_take isl_set *context);
8562 __isl_give isl_schedule_constraints *
8563 isl_schedule_constraints_set_validity(
8564 __isl_take isl_schedule_constraints *sc,
8565 __isl_take isl_union_map *validity);
8566 __isl_give isl_schedule_constraints *
8567 isl_schedule_constraints_set_coincidence(
8568 __isl_take isl_schedule_constraints *sc,
8569 __isl_take isl_union_map *coincidence);
8570 __isl_give isl_schedule_constraints *
8571 isl_schedule_constraints_set_proximity(
8572 __isl_take isl_schedule_constraints *sc,
8573 __isl_take isl_union_map *proximity);
8574 __isl_give isl_schedule_constraints *
8575 isl_schedule_constraints_set_conditional_validity(
8576 __isl_take isl_schedule_constraints *sc,
8577 __isl_take isl_union_map *condition,
8578 __isl_take isl_union_map *validity);
8579 __isl_null isl_schedule_constraints *
8580 isl_schedule_constraints_free(
8581 __isl_take isl_schedule_constraints *sc);
8583 The initial C<isl_schedule_constraints> object created by
8584 C<isl_schedule_constraints_on_domain> does not impose any constraints.
8585 That is, it has an empty set of dependences.
8586 The function C<isl_schedule_constraints_set_context> allows the user
8587 to specify additional constraints on the parameters that may
8588 be assumed to hold during the construction of the schedule.
8589 The function C<isl_schedule_constraints_set_validity> replaces the
8590 validity dependences, mapping domain elements I<i> to domain
8591 elements that should be scheduled after I<i>.
8592 The function C<isl_schedule_constraints_set_coincidence> replaces the
8593 coincidence dependences, mapping domain elements I<i> to domain
8594 elements that should be scheduled together with I<I>, if possible.
8595 The function C<isl_schedule_constraints_set_proximity> replaces the
8596 proximity dependences, mapping domain elements I<i> to domain
8597 elements that should be scheduled either before I<I>
8598 or as early as possible after I<i>.
8600 The function C<isl_schedule_constraints_set_conditional_validity>
8601 replaces the conditional validity constraints.
8602 A conditional validity constraint is only imposed when any of the corresponding
8603 conditions is satisfied, i.e., when any of them is non-zero.
8604 That is, the scheduler ensures that within each band if the dependence
8605 distances over the condition constraints are not all zero
8606 then all corresponding conditional validity constraints are respected.
8607 A conditional validity constraint corresponds to a condition
8608 if the two are adjacent, i.e., if the domain of one relation intersect
8609 the range of the other relation.
8610 The typical use case of conditional validity constraints is
8611 to allow order constraints between live ranges to be violated
8612 as long as the live ranges themselves are local to the band.
8613 To allow more fine-grained control over which conditions correspond
8614 to which conditional validity constraints, the domains and ranges
8615 of these relations may include I<tags>. That is, the domains and
8616 ranges of those relation may themselves be wrapped relations
8617 where the iteration domain appears in the domain of those wrapped relations
8618 and the range of the wrapped relations can be arbitrarily chosen
8619 by the user. Conditions and conditional validity constraints are only
8620 considered adjacent to each other if the entire wrapped relation matches.
8621 In particular, a relation with a tag will never be considered adjacent
8622 to a relation without a tag.
8624 An C<isl_schedule_constraints> object can be inspected
8625 using the following functions.
8627 #include <isl/schedule.h>
8628 __isl_give isl_union_map *
8629 isl_schedule_constraints_get_validity(
8630 __isl_keep isl_schedule_constraints *sc);
8631 __isl_give isl_union_map *
8632 isl_schedule_constraints_get_coincidence(
8633 __isl_keep isl_schedule_constraints *sc);
8634 __isl_give isl_union_map *
8635 isl_schedule_constraints_get_conditional_validity(
8636 __isl_keep isl_schedule_constraints *sc);
8637 __isl_give isl_union_map *
8638 isl_schedule_constraints_get_conditional_validity_condition(
8639 __isl_keep isl_schedule_constraints *sc);
8641 The following function computes a schedule directly from
8642 an iteration domain and validity and proximity dependences
8643 and is implemented in terms of the functions described above.
8644 The use of C<isl_union_set_compute_schedule> is discouraged.
8646 #include <isl/schedule.h>
8647 __isl_give isl_schedule *isl_union_set_compute_schedule(
8648 __isl_take isl_union_set *domain,
8649 __isl_take isl_union_map *validity,
8650 __isl_take isl_union_map *proximity);
8652 The generated schedule represents a schedule tree.
8653 For more information on schedule trees, see
8654 L</"Schedule Trees">.
8658 #include <isl/schedule.h>
8659 isl_stat isl_options_set_schedule_max_coefficient(
8660 isl_ctx *ctx, int val);
8661 int isl_options_get_schedule_max_coefficient(
8663 isl_stat isl_options_set_schedule_max_constant_term(
8664 isl_ctx *ctx, int val);
8665 int isl_options_get_schedule_max_constant_term(
8667 isl_stat isl_options_set_schedule_serialize_sccs(
8668 isl_ctx *ctx, int val);
8669 int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
8670 isl_stat isl_options_set_schedule_maximize_band_depth(
8671 isl_ctx *ctx, int val);
8672 int isl_options_get_schedule_maximize_band_depth(
8674 isl_stat isl_options_set_schedule_outer_coincidence(
8675 isl_ctx *ctx, int val);
8676 int isl_options_get_schedule_outer_coincidence(
8678 isl_stat isl_options_set_schedule_split_scaled(
8679 isl_ctx *ctx, int val);
8680 int isl_options_get_schedule_split_scaled(
8682 isl_stat isl_options_set_schedule_algorithm(
8683 isl_ctx *ctx, int val);
8684 int isl_options_get_schedule_algorithm(
8686 isl_stat isl_options_set_schedule_separate_components(
8687 isl_ctx *ctx, int val);
8688 int isl_options_get_schedule_separate_components(
8693 =item * schedule_max_coefficient
8695 This option enforces that the coefficients for variable and parameter
8696 dimensions in the calculated schedule are not larger than the specified value.
8697 This option can significantly increase the speed of the scheduling calculation
8698 and may also prevent fusing of unrelated dimensions. A value of -1 means that
8699 this option does not introduce bounds on the variable or parameter
8702 =item * schedule_max_constant_term
8704 This option enforces that the constant coefficients in the calculated schedule
8705 are not larger than the maximal constant term. This option can significantly
8706 increase the speed of the scheduling calculation and may also prevent fusing of
8707 unrelated dimensions. A value of -1 means that this option does not introduce
8708 bounds on the constant coefficients.
8710 =item * schedule_serialize_sccs
8712 If this option is set, then all strongly connected components
8713 in the dependence graph are serialized as soon as they are detected.
8714 This means in particular that instances of statements will only
8715 appear in the same band node if these statements belong
8716 to the same strongly connected component at the point where
8717 the band node is constructed.
8719 =item * schedule_maximize_band_depth
8721 If this option is set, we do not split bands at the point
8722 where we detect splitting is necessary. Instead, we
8723 backtrack and split bands as early as possible. This
8724 reduces the number of splits and maximizes the width of
8725 the bands. Wider bands give more possibilities for tiling.
8726 Note that if the C<schedule_serialize_sccs> options is set,
8727 then bands will be split as early as possible, even if there is no need.
8728 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
8730 =item * schedule_outer_coincidence
8732 If this option is set, then we try to construct schedules
8733 where the outermost scheduling dimension in each band
8734 satisfies the coincidence constraints.
8736 =item * schedule_split_scaled
8738 If this option is set, then we try to construct schedules in which the
8739 constant term is split off from the linear part if the linear parts of
8740 the scheduling rows for all nodes in the graphs have a common non-trivial
8742 The constant term is then placed in a separate band and the linear
8745 =item * schedule_algorithm
8747 Selects the scheduling algorithm to be used.
8748 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
8749 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
8751 =item * schedule_separate_components
8753 If this option is set then the function C<isl_schedule_get_map>
8754 will treat set nodes in the same way as sequence nodes.
8758 =head2 AST Generation
8760 This section describes the C<isl> functionality for generating
8761 ASTs that visit all the elements
8762 in a domain in an order specified by a schedule tree or
8764 In case the schedule given as a C<isl_union_map>, an AST is generated
8765 that visits all the elements in the domain of the C<isl_union_map>
8766 according to the lexicographic order of the corresponding image
8767 element(s). If the range of the C<isl_union_map> consists of
8768 elements in more than one space, then each of these spaces is handled
8769 separately in an arbitrary order.
8770 It should be noted that the schedule tree or the image elements
8771 in a schedule map only specify the I<order>
8772 in which the corresponding domain elements should be visited.
8773 No direct relation between the partial schedule values
8774 or the image elements on the one hand and the loop iterators
8775 in the generated AST on the other hand should be assumed.
8777 Each AST is generated within a build. The initial build
8778 simply specifies the constraints on the parameters (if any)
8779 and can be created, inspected, copied and freed using the following functions.
8781 #include <isl/ast_build.h>
8782 __isl_give isl_ast_build *isl_ast_build_alloc(
8784 __isl_give isl_ast_build *isl_ast_build_from_context(
8785 __isl_take isl_set *set);
8786 __isl_give isl_ast_build *isl_ast_build_copy(
8787 __isl_keep isl_ast_build *build);
8788 __isl_null isl_ast_build *isl_ast_build_free(
8789 __isl_take isl_ast_build *build);
8791 The C<set> argument is usually a parameter set with zero or more parameters.
8792 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
8793 this set is required to be a parameter set.
8794 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
8795 specify any parameter constraints.
8796 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
8797 and L</"Fine-grained Control over AST Generation">.
8798 Finally, the AST itself can be constructed using one of the following
8801 #include <isl/ast_build.h>
8802 __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
8803 __isl_keep isl_ast_build *build,
8804 __isl_take isl_schedule *schedule);
8805 __isl_give isl_ast_node *
8806 isl_ast_build_node_from_schedule_map(
8807 __isl_keep isl_ast_build *build,
8808 __isl_take isl_union_map *schedule);
8810 =head3 Inspecting the AST
8812 The basic properties of an AST node can be obtained as follows.
8814 #include <isl/ast.h>
8815 enum isl_ast_node_type isl_ast_node_get_type(
8816 __isl_keep isl_ast_node *node);
8818 The type of an AST node is one of
8819 C<isl_ast_node_for>,
8821 C<isl_ast_node_block>,
8822 C<isl_ast_node_mark> or
8823 C<isl_ast_node_user>.
8824 An C<isl_ast_node_for> represents a for node.
8825 An C<isl_ast_node_if> represents an if node.
8826 An C<isl_ast_node_block> represents a compound node.
8827 An C<isl_ast_node_mark> introduces a mark in the AST.
8828 An C<isl_ast_node_user> represents an expression statement.
8829 An expression statement typically corresponds to a domain element, i.e.,
8830 one of the elements that is visited by the AST.
8832 Each type of node has its own additional properties.
8834 #include <isl/ast.h>
8835 __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
8836 __isl_keep isl_ast_node *node);
8837 __isl_give isl_ast_expr *isl_ast_node_for_get_init(
8838 __isl_keep isl_ast_node *node);
8839 __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
8840 __isl_keep isl_ast_node *node);
8841 __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
8842 __isl_keep isl_ast_node *node);
8843 __isl_give isl_ast_node *isl_ast_node_for_get_body(
8844 __isl_keep isl_ast_node *node);
8845 isl_bool isl_ast_node_for_is_degenerate(
8846 __isl_keep isl_ast_node *node);
8848 An C<isl_ast_for> is considered degenerate if it is known to execute
8851 #include <isl/ast.h>
8852 __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
8853 __isl_keep isl_ast_node *node);
8854 __isl_give isl_ast_node *isl_ast_node_if_get_then(
8855 __isl_keep isl_ast_node *node);
8856 isl_bool isl_ast_node_if_has_else(
8857 __isl_keep isl_ast_node *node);
8858 __isl_give isl_ast_node *isl_ast_node_if_get_else(
8859 __isl_keep isl_ast_node *node);
8861 __isl_give isl_ast_node_list *
8862 isl_ast_node_block_get_children(
8863 __isl_keep isl_ast_node *node);
8865 __isl_give isl_id *isl_ast_node_mark_get_id(
8866 __isl_keep isl_ast_node *node);
8867 __isl_give isl_ast_node *isl_ast_node_mark_get_node(
8868 __isl_keep isl_ast_node *node);
8870 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
8871 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
8873 #include <isl/ast.h>
8874 __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
8875 __isl_keep isl_ast_node *node);
8877 Each of the returned C<isl_ast_expr>s can in turn be inspected using
8878 the following functions.
8880 #include <isl/ast.h>
8881 enum isl_ast_expr_type isl_ast_expr_get_type(
8882 __isl_keep isl_ast_expr *expr);
8884 The type of an AST expression is one of
8886 C<isl_ast_expr_id> or
8887 C<isl_ast_expr_int>.
8888 An C<isl_ast_expr_op> represents the result of an operation.
8889 An C<isl_ast_expr_id> represents an identifier.
8890 An C<isl_ast_expr_int> represents an integer value.
8892 Each type of expression has its own additional properties.
8894 #include <isl/ast.h>
8895 enum isl_ast_op_type isl_ast_expr_get_op_type(
8896 __isl_keep isl_ast_expr *expr);
8897 int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
8898 __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
8899 __isl_keep isl_ast_expr *expr, int pos);
8900 isl_stat isl_ast_node_foreach_ast_op_type(
8901 __isl_keep isl_ast_node *node,
8902 isl_stat (*fn)(enum isl_ast_op_type type,
8903 void *user), void *user);
8905 C<isl_ast_expr_get_op_type> returns the type of the operation
8906 performed. C<isl_ast_expr_get_op_n_arg> returns the number of
8907 arguments. C<isl_ast_expr_get_op_arg> returns the specified
8909 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
8910 C<isl_ast_op_type> that appears in C<node>.
8911 The operation type is one of the following.
8915 =item C<isl_ast_op_and>
8917 Logical I<and> of two arguments.
8918 Both arguments can be evaluated.
8920 =item C<isl_ast_op_and_then>
8922 Logical I<and> of two arguments.
8923 The second argument can only be evaluated if the first evaluates to true.
8925 =item C<isl_ast_op_or>
8927 Logical I<or> of two arguments.
8928 Both arguments can be evaluated.
8930 =item C<isl_ast_op_or_else>
8932 Logical I<or> of two arguments.
8933 The second argument can only be evaluated if the first evaluates to false.
8935 =item C<isl_ast_op_max>
8937 Maximum of two or more arguments.
8939 =item C<isl_ast_op_min>
8941 Minimum of two or more arguments.
8943 =item C<isl_ast_op_minus>
8947 =item C<isl_ast_op_add>
8949 Sum of two arguments.
8951 =item C<isl_ast_op_sub>
8953 Difference of two arguments.
8955 =item C<isl_ast_op_mul>
8957 Product of two arguments.
8959 =item C<isl_ast_op_div>
8961 Exact division. That is, the result is known to be an integer.
8963 =item C<isl_ast_op_fdiv_q>
8965 Result of integer division, rounded towards negative
8968 =item C<isl_ast_op_pdiv_q>
8970 Result of integer division, where dividend is known to be non-negative.
8972 =item C<isl_ast_op_pdiv_r>
8974 Remainder of integer division, where dividend is known to be non-negative.
8976 =item C<isl_ast_op_zdiv_r>
8978 Equal to zero iff the remainder on integer division is zero.
8980 =item C<isl_ast_op_cond>
8982 Conditional operator defined on three arguments.
8983 If the first argument evaluates to true, then the result
8984 is equal to the second argument. Otherwise, the result
8985 is equal to the third argument.
8986 The second and third argument may only be evaluated if
8987 the first argument evaluates to true and false, respectively.
8988 Corresponds to C<a ? b : c> in C.
8990 =item C<isl_ast_op_select>
8992 Conditional operator defined on three arguments.
8993 If the first argument evaluates to true, then the result
8994 is equal to the second argument. Otherwise, the result
8995 is equal to the third argument.
8996 The second and third argument may be evaluated independently
8997 of the value of the first argument.
8998 Corresponds to C<a * b + (1 - a) * c> in C.
9000 =item C<isl_ast_op_eq>
9004 =item C<isl_ast_op_le>
9006 Less than or equal relation.
9008 =item C<isl_ast_op_lt>
9012 =item C<isl_ast_op_ge>
9014 Greater than or equal relation.
9016 =item C<isl_ast_op_gt>
9018 Greater than relation.
9020 =item C<isl_ast_op_call>
9023 The number of arguments of the C<isl_ast_expr> is one more than
9024 the number of arguments in the function call, the first argument
9025 representing the function being called.
9027 =item C<isl_ast_op_access>
9030 The number of arguments of the C<isl_ast_expr> is one more than
9031 the number of index expressions in the array access, the first argument
9032 representing the array being accessed.
9034 =item C<isl_ast_op_member>
9037 This operation has two arguments, a structure and the name of
9038 the member of the structure being accessed.
9042 #include <isl/ast.h>
9043 __isl_give isl_id *isl_ast_expr_get_id(
9044 __isl_keep isl_ast_expr *expr);
9046 Return the identifier represented by the AST expression.
9048 #include <isl/ast.h>
9049 __isl_give isl_val *isl_ast_expr_get_val(
9050 __isl_keep isl_ast_expr *expr);
9052 Return the integer represented by the AST expression.
9054 =head3 Properties of ASTs
9056 #include <isl/ast.h>
9057 isl_bool isl_ast_expr_is_equal(
9058 __isl_keep isl_ast_expr *expr1,
9059 __isl_keep isl_ast_expr *expr2);
9061 Check if two C<isl_ast_expr>s are equal to each other.
9063 =head3 Manipulating and printing the AST
9065 AST nodes can be copied and freed using the following functions.
9067 #include <isl/ast.h>
9068 __isl_give isl_ast_node *isl_ast_node_copy(
9069 __isl_keep isl_ast_node *node);
9070 __isl_null isl_ast_node *isl_ast_node_free(
9071 __isl_take isl_ast_node *node);
9073 AST expressions can be copied and freed using the following functions.
9075 #include <isl/ast.h>
9076 __isl_give isl_ast_expr *isl_ast_expr_copy(
9077 __isl_keep isl_ast_expr *expr);
9078 __isl_null isl_ast_expr *isl_ast_expr_free(
9079 __isl_take isl_ast_expr *expr);
9081 New AST expressions can be created either directly or within
9082 the context of an C<isl_ast_build>.
9084 #include <isl/ast.h>
9085 __isl_give isl_ast_expr *isl_ast_expr_from_val(
9086 __isl_take isl_val *v);
9087 __isl_give isl_ast_expr *isl_ast_expr_from_id(
9088 __isl_take isl_id *id);
9089 __isl_give isl_ast_expr *isl_ast_expr_neg(
9090 __isl_take isl_ast_expr *expr);
9091 __isl_give isl_ast_expr *isl_ast_expr_address_of(
9092 __isl_take isl_ast_expr *expr);
9093 __isl_give isl_ast_expr *isl_ast_expr_add(
9094 __isl_take isl_ast_expr *expr1,
9095 __isl_take isl_ast_expr *expr2);
9096 __isl_give isl_ast_expr *isl_ast_expr_sub(
9097 __isl_take isl_ast_expr *expr1,
9098 __isl_take isl_ast_expr *expr2);
9099 __isl_give isl_ast_expr *isl_ast_expr_mul(
9100 __isl_take isl_ast_expr *expr1,
9101 __isl_take isl_ast_expr *expr2);
9102 __isl_give isl_ast_expr *isl_ast_expr_div(
9103 __isl_take isl_ast_expr *expr1,
9104 __isl_take isl_ast_expr *expr2);
9105 __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
9106 __isl_take isl_ast_expr *expr1,
9107 __isl_take isl_ast_expr *expr2);
9108 __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
9109 __isl_take isl_ast_expr *expr1,
9110 __isl_take isl_ast_expr *expr2);
9111 __isl_give isl_ast_expr *isl_ast_expr_and(
9112 __isl_take isl_ast_expr *expr1,
9113 __isl_take isl_ast_expr *expr2)
9114 __isl_give isl_ast_expr *isl_ast_expr_and_then(
9115 __isl_take isl_ast_expr *expr1,
9116 __isl_take isl_ast_expr *expr2)
9117 __isl_give isl_ast_expr *isl_ast_expr_or(
9118 __isl_take isl_ast_expr *expr1,
9119 __isl_take isl_ast_expr *expr2)
9120 __isl_give isl_ast_expr *isl_ast_expr_or_else(
9121 __isl_take isl_ast_expr *expr1,
9122 __isl_take isl_ast_expr *expr2)
9123 __isl_give isl_ast_expr *isl_ast_expr_eq(
9124 __isl_take isl_ast_expr *expr1,
9125 __isl_take isl_ast_expr *expr2);
9126 __isl_give isl_ast_expr *isl_ast_expr_le(
9127 __isl_take isl_ast_expr *expr1,
9128 __isl_take isl_ast_expr *expr2);
9129 __isl_give isl_ast_expr *isl_ast_expr_lt(
9130 __isl_take isl_ast_expr *expr1,
9131 __isl_take isl_ast_expr *expr2);
9132 __isl_give isl_ast_expr *isl_ast_expr_ge(
9133 __isl_take isl_ast_expr *expr1,
9134 __isl_take isl_ast_expr *expr2);
9135 __isl_give isl_ast_expr *isl_ast_expr_gt(
9136 __isl_take isl_ast_expr *expr1,
9137 __isl_take isl_ast_expr *expr2);
9138 __isl_give isl_ast_expr *isl_ast_expr_access(
9139 __isl_take isl_ast_expr *array,
9140 __isl_take isl_ast_expr_list *indices);
9141 __isl_give isl_ast_expr *isl_ast_expr_call(
9142 __isl_take isl_ast_expr *function,
9143 __isl_take isl_ast_expr_list *arguments);
9145 The function C<isl_ast_expr_address_of> can be applied to an
9146 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
9147 to represent the address of the C<isl_ast_expr_access>. The function
9148 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
9149 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
9151 #include <isl/ast_build.h>
9152 __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
9153 __isl_keep isl_ast_build *build,
9154 __isl_take isl_set *set);
9155 __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
9156 __isl_keep isl_ast_build *build,
9157 __isl_take isl_pw_aff *pa);
9158 __isl_give isl_ast_expr *
9159 isl_ast_build_access_from_pw_multi_aff(
9160 __isl_keep isl_ast_build *build,
9161 __isl_take isl_pw_multi_aff *pma);
9162 __isl_give isl_ast_expr *
9163 isl_ast_build_access_from_multi_pw_aff(
9164 __isl_keep isl_ast_build *build,
9165 __isl_take isl_multi_pw_aff *mpa);
9166 __isl_give isl_ast_expr *
9167 isl_ast_build_call_from_pw_multi_aff(
9168 __isl_keep isl_ast_build *build,
9169 __isl_take isl_pw_multi_aff *pma);
9170 __isl_give isl_ast_expr *
9171 isl_ast_build_call_from_multi_pw_aff(
9172 __isl_keep isl_ast_build *build,
9173 __isl_take isl_multi_pw_aff *mpa);
9176 the domains of C<pa>, C<mpa> and C<pma> should correspond
9177 to the schedule space of C<build>.
9178 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
9179 the function being called.
9180 If the accessed space is a nested relation, then it is taken
9181 to represent an access of the member specified by the range
9182 of this nested relation of the structure specified by the domain
9183 of the nested relation.
9185 The following functions can be used to modify an C<isl_ast_expr>.
9187 #include <isl/ast.h>
9188 __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
9189 __isl_take isl_ast_expr *expr, int pos,
9190 __isl_take isl_ast_expr *arg);
9192 Replace the argument of C<expr> at position C<pos> by C<arg>.
9194 #include <isl/ast.h>
9195 __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
9196 __isl_take isl_ast_expr *expr,
9197 __isl_take isl_id_to_ast_expr *id2expr);
9199 The function C<isl_ast_expr_substitute_ids> replaces the
9200 subexpressions of C<expr> of type C<isl_ast_expr_id>
9201 by the corresponding expression in C<id2expr>, if there is any.
9204 User specified data can be attached to an C<isl_ast_node> and obtained
9205 from the same C<isl_ast_node> using the following functions.
9207 #include <isl/ast.h>
9208 __isl_give isl_ast_node *isl_ast_node_set_annotation(
9209 __isl_take isl_ast_node *node,
9210 __isl_take isl_id *annotation);
9211 __isl_give isl_id *isl_ast_node_get_annotation(
9212 __isl_keep isl_ast_node *node);
9214 Basic printing can be performed using the following functions.
9216 #include <isl/ast.h>
9217 __isl_give isl_printer *isl_printer_print_ast_expr(
9218 __isl_take isl_printer *p,
9219 __isl_keep isl_ast_expr *expr);
9220 __isl_give isl_printer *isl_printer_print_ast_node(
9221 __isl_take isl_printer *p,
9222 __isl_keep isl_ast_node *node);
9223 __isl_give char *isl_ast_expr_to_str(
9224 __isl_keep isl_ast_expr *expr);
9226 More advanced printing can be performed using the following functions.
9228 #include <isl/ast.h>
9229 __isl_give isl_printer *isl_ast_op_type_print_macro(
9230 enum isl_ast_op_type type,
9231 __isl_take isl_printer *p);
9232 __isl_give isl_printer *isl_ast_node_print_macros(
9233 __isl_keep isl_ast_node *node,
9234 __isl_take isl_printer *p);
9235 __isl_give isl_printer *isl_ast_node_print(
9236 __isl_keep isl_ast_node *node,
9237 __isl_take isl_printer *p,
9238 __isl_take isl_ast_print_options *options);
9239 __isl_give isl_printer *isl_ast_node_for_print(
9240 __isl_keep isl_ast_node *node,
9241 __isl_take isl_printer *p,
9242 __isl_take isl_ast_print_options *options);
9243 __isl_give isl_printer *isl_ast_node_if_print(
9244 __isl_keep isl_ast_node *node,
9245 __isl_take isl_printer *p,
9246 __isl_take isl_ast_print_options *options);
9248 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
9249 C<isl> may print out an AST that makes use of macros such
9250 as C<floord>, C<min> and C<max>.
9251 C<isl_ast_op_type_print_macro> prints out the macro
9252 corresponding to a specific C<isl_ast_op_type>.
9253 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
9254 for expressions where these macros would be used and prints
9255 out the required macro definitions.
9256 Essentially, C<isl_ast_node_print_macros> calls
9257 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
9258 as function argument.
9259 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
9260 C<isl_ast_node_if_print> print an C<isl_ast_node>
9261 in C<ISL_FORMAT_C>, but allow for some extra control
9262 through an C<isl_ast_print_options> object.
9263 This object can be created using the following functions.
9265 #include <isl/ast.h>
9266 __isl_give isl_ast_print_options *
9267 isl_ast_print_options_alloc(isl_ctx *ctx);
9268 __isl_give isl_ast_print_options *
9269 isl_ast_print_options_copy(
9270 __isl_keep isl_ast_print_options *options);
9271 __isl_null isl_ast_print_options *
9272 isl_ast_print_options_free(
9273 __isl_take isl_ast_print_options *options);
9275 __isl_give isl_ast_print_options *
9276 isl_ast_print_options_set_print_user(
9277 __isl_take isl_ast_print_options *options,
9278 __isl_give isl_printer *(*print_user)(
9279 __isl_take isl_printer *p,
9280 __isl_take isl_ast_print_options *options,
9281 __isl_keep isl_ast_node *node, void *user),
9283 __isl_give isl_ast_print_options *
9284 isl_ast_print_options_set_print_for(
9285 __isl_take isl_ast_print_options *options,
9286 __isl_give isl_printer *(*print_for)(
9287 __isl_take isl_printer *p,
9288 __isl_take isl_ast_print_options *options,
9289 __isl_keep isl_ast_node *node, void *user),
9292 The callback set by C<isl_ast_print_options_set_print_user>
9293 is called whenever a node of type C<isl_ast_node_user> needs to
9295 The callback set by C<isl_ast_print_options_set_print_for>
9296 is called whenever a node of type C<isl_ast_node_for> needs to
9298 Note that C<isl_ast_node_for_print> will I<not> call the
9299 callback set by C<isl_ast_print_options_set_print_for> on the node
9300 on which C<isl_ast_node_for_print> is called, but only on nested
9301 nodes of type C<isl_ast_node_for>. It is therefore safe to
9302 call C<isl_ast_node_for_print> from within the callback set by
9303 C<isl_ast_print_options_set_print_for>.
9305 The following option determines the type to be used for iterators
9306 while printing the AST.
9308 isl_stat isl_options_set_ast_iterator_type(
9309 isl_ctx *ctx, const char *val);
9310 const char *isl_options_get_ast_iterator_type(
9313 The AST printer only prints body nodes as blocks if these
9314 blocks cannot be safely omitted.
9315 For example, a C<for> node with one body node will not be
9316 surrounded with braces in C<ISL_FORMAT_C>.
9317 A block will always be printed by setting the following option.
9319 isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
9321 int isl_options_get_ast_always_print_block(isl_ctx *ctx);
9325 #include <isl/ast_build.h>
9326 isl_stat isl_options_set_ast_build_atomic_upper_bound(
9327 isl_ctx *ctx, int val);
9328 int isl_options_get_ast_build_atomic_upper_bound(
9330 isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
9332 int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
9333 isl_stat isl_options_set_ast_build_exploit_nested_bounds(
9334 isl_ctx *ctx, int val);
9335 int isl_options_get_ast_build_exploit_nested_bounds(
9337 isl_stat isl_options_set_ast_build_group_coscheduled(
9338 isl_ctx *ctx, int val);
9339 int isl_options_get_ast_build_group_coscheduled(
9341 isl_stat isl_options_set_ast_build_scale_strides(
9342 isl_ctx *ctx, int val);
9343 int isl_options_get_ast_build_scale_strides(
9345 isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
9347 int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
9348 isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
9350 int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
9354 =item * ast_build_atomic_upper_bound
9356 Generate loop upper bounds that consist of the current loop iterator,
9357 an operator and an expression not involving the iterator.
9358 If this option is not set, then the current loop iterator may appear
9359 several times in the upper bound.
9360 For example, when this option is turned off, AST generation
9363 [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
9367 for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
9370 When the option is turned on, the following AST is generated
9372 for (int c0 = 0; c0 <= min(100, n); c0 += 1)
9375 =item * ast_build_prefer_pdiv
9377 If this option is turned off, then the AST generation will
9378 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
9379 operators, but no C<isl_ast_op_pdiv_q> or
9380 C<isl_ast_op_pdiv_r> operators.
9381 If this options is turned on, then C<isl> will try to convert
9382 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
9383 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
9385 =item * ast_build_exploit_nested_bounds
9387 Simplify conditions based on bounds of nested for loops.
9388 In particular, remove conditions that are implied by the fact
9389 that one or more nested loops have at least one iteration,
9390 meaning that the upper bound is at least as large as the lower bound.
9391 For example, when this option is turned off, AST generation
9394 [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
9400 for (int c0 = 0; c0 <= N; c0 += 1)
9401 for (int c1 = 0; c1 <= M; c1 += 1)
9404 When the option is turned on, the following AST is generated
9406 for (int c0 = 0; c0 <= N; c0 += 1)
9407 for (int c1 = 0; c1 <= M; c1 += 1)
9410 =item * ast_build_group_coscheduled
9412 If two domain elements are assigned the same schedule point, then
9413 they may be executed in any order and they may even appear in different
9414 loops. If this options is set, then the AST generator will make
9415 sure that coscheduled domain elements do not appear in separate parts
9416 of the AST. This is useful in case of nested AST generation
9417 if the outer AST generation is given only part of a schedule
9418 and the inner AST generation should handle the domains that are
9419 coscheduled by this initial part of the schedule together.
9420 For example if an AST is generated for a schedule
9422 { A[i] -> [0]; B[i] -> [0] }
9424 then the C<isl_ast_build_set_create_leaf> callback described
9425 below may get called twice, once for each domain.
9426 Setting this option ensures that the callback is only called once
9427 on both domains together.
9429 =item * ast_build_separation_bounds
9431 This option specifies which bounds to use during separation.
9432 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
9433 then all (possibly implicit) bounds on the current dimension will
9434 be used during separation.
9435 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
9436 then only those bounds that are explicitly available will
9437 be used during separation.
9439 =item * ast_build_scale_strides
9441 This option specifies whether the AST generator is allowed
9442 to scale down iterators of strided loops.
9444 =item * ast_build_allow_else
9446 This option specifies whether the AST generator is allowed
9447 to construct if statements with else branches.
9449 =item * ast_build_allow_or
9451 This option specifies whether the AST generator is allowed
9452 to construct if conditions with disjunctions.
9456 =head3 AST Generation Options (Schedule Tree)
9458 In case of AST construction from a schedule tree, the options
9459 that control how an AST is created from the individual schedule
9460 dimensions are stored in the band nodes of the tree
9461 (see L</"Schedule Trees">).
9463 In particular, a schedule dimension can be handled in four
9464 different ways, atomic, separate, unroll or the default.
9465 This loop AST generation type can be set using
9466 C<isl_schedule_node_band_member_set_ast_loop_type>.
9468 the first three can be selected by including a one-dimensional
9469 element with as value the position of the schedule dimension
9470 within the band and as name one of C<atomic>, C<separate>
9471 or C<unroll> in the options
9472 set by C<isl_schedule_node_band_set_ast_build_options>.
9473 Only one of these three may be specified for
9474 any given schedule dimension within a band node.
9475 If none of these is specified, then the default
9476 is used. The meaning of the options is as follows.
9482 When this option is specified, the AST generator will make
9483 sure that a given domains space only appears in a single
9484 loop at the specified level.
9486 For example, for the schedule tree
9488 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
9490 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
9491 options: "{ atomic[x] }"
9493 the following AST will be generated
9495 for (int c0 = 0; c0 <= 10; c0 += 1) {
9502 On the other hand, for the schedule tree
9504 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
9506 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
9507 options: "{ separate[x] }"
9509 the following AST will be generated
9513 for (int c0 = 1; c0 <= 9; c0 += 1) {
9520 If neither C<atomic> nor C<separate> is specified, then the AST generator
9521 may produce either of these two results or some intermediate form.
9525 When this option is specified, the AST generator will
9526 split the domain of the specified schedule dimension
9527 into pieces with a fixed set of statements for which
9528 instances need to be executed by the iterations in
9529 the schedule domain part. This option tends to avoid
9530 the generation of guards inside the corresponding loops.
9531 See also the C<atomic> option.
9535 When this option is specified, the AST generator will
9536 I<completely> unroll the corresponding schedule dimension.
9537 It is the responsibility of the user to ensure that such
9538 unrolling is possible.
9539 To obtain a partial unrolling, the user should apply an additional
9540 strip-mining to the schedule and fully unroll the inner schedule
9545 The C<isolate> option is a bit more involved. It allows the user
9546 to isolate a range of schedule dimension values from smaller and
9547 greater values. Additionally, the user may specify a different
9548 atomic/separate/unroll choice for the isolated part and the remaining
9549 parts. The typical use case of the C<isolate> option is to isolate
9550 full tiles from partial tiles.
9551 The part that needs to be isolated may depend on outer schedule dimensions.
9552 The option therefore needs to be able to reference those outer schedule
9553 dimensions. In particular, the space of the C<isolate> option is that
9554 of a wrapped map with as domain the flat product of all outer band nodes
9555 and as range the space of the current band node.
9556 The atomic/separate/unroll choice for the isolated part is determined
9557 by an option that lives in an unnamed wrapped space with as domain
9558 a zero-dimensional C<isolate> space and as range the regular
9559 C<atomic>, C<separate> or C<unroll> space.
9560 This option may also be set directly using
9561 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
9562 The atomic/separate/unroll choice for the remaining part is determined
9563 by the regular C<atomic>, C<separate> or C<unroll> option.
9564 The use of the C<isolate> option causes any tree containing the node
9565 to be considered anchored.
9567 As an example, consider the isolation of full tiles from partial tiles
9568 in a tiling of a triangular domain. The original schedule is as follows.
9570 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9572 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9573 { A[i,j] -> [floor(j/10)] }, \
9574 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9578 for (int c0 = 0; c0 <= 10; c0 += 1)
9579 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9580 for (int c2 = 10 * c0;
9581 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9582 for (int c3 = 10 * c1;
9583 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9586 Isolating the full tiles, we have the following input
9588 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9590 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9591 { A[i,j] -> [floor(j/10)] }, \
9592 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9593 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
9594 10a+9+10b+9 <= 100 }"
9599 for (int c0 = 0; c0 <= 8; c0 += 1) {
9600 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9601 for (int c2 = 10 * c0;
9602 c2 <= 10 * c0 + 9; c2 += 1)
9603 for (int c3 = 10 * c1;
9604 c3 <= 10 * c1 + 9; c3 += 1)
9606 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9607 for (int c2 = 10 * c0;
9608 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9609 for (int c3 = 10 * c1;
9610 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9613 for (int c0 = 9; c0 <= 10; c0 += 1)
9614 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9615 for (int c2 = 10 * c0;
9616 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9617 for (int c3 = 10 * c1;
9618 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9622 We may then additionally unroll the innermost loop of the isolated part
9624 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9626 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9627 { A[i,j] -> [floor(j/10)] }, \
9628 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9629 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
9630 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
9635 for (int c0 = 0; c0 <= 8; c0 += 1) {
9636 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9637 for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
9649 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9650 for (int c2 = 10 * c0;
9651 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9652 for (int c3 = 10 * c1;
9653 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9656 for (int c0 = 9; c0 <= 10; c0 += 1)
9657 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9658 for (int c2 = 10 * c0;
9659 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9660 for (int c3 = 10 * c1;
9661 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9666 =head3 AST Generation Options (Schedule Map)
9668 In case of AST construction using
9669 C<isl_ast_build_node_from_schedule_map>, the options
9670 that control how an AST is created from the individual schedule
9671 dimensions are stored in the C<isl_ast_build>.
9672 They can be set using the following function.
9674 #include <isl/ast_build.h>
9675 __isl_give isl_ast_build *
9676 isl_ast_build_set_options(
9677 __isl_take isl_ast_build *control,
9678 __isl_take isl_union_map *options);
9680 The options are encoded in an C<isl_union_map>.
9681 The domain of this union relation refers to the schedule domain,
9682 i.e., the range of the schedule passed
9683 to C<isl_ast_build_node_from_schedule_map>.
9684 In the case of nested AST generation (see L</"Nested AST Generation">),
9685 the domain of C<options> should refer to the extra piece of the schedule.
9686 That is, it should be equal to the range of the wrapped relation in the
9687 range of the schedule.
9688 The range of the options can consist of elements in one or more spaces,
9689 the names of which determine the effect of the option.
9690 The values of the range typically also refer to the schedule dimension
9691 to which the option applies. In case of nested AST generation
9692 (see L</"Nested AST Generation">), these values refer to the position
9693 of the schedule dimension within the innermost AST generation.
9694 The constraints on the domain elements of
9695 the option should only refer to this dimension and earlier dimensions.
9696 We consider the following spaces.
9700 =item C<separation_class>
9702 B<This option has been deprecated. Use the isolate option on
9703 schedule trees instead.>
9705 This space is a wrapped relation between two one dimensional spaces.
9706 The input space represents the schedule dimension to which the option
9707 applies and the output space represents the separation class.
9708 While constructing a loop corresponding to the specified schedule
9709 dimension(s), the AST generator will try to generate separate loops
9710 for domain elements that are assigned different classes.
9711 If only some of the elements are assigned a class, then those elements
9712 that are not assigned any class will be treated as belonging to a class
9713 that is separate from the explicitly assigned classes.
9714 The typical use case for this option is to separate full tiles from
9716 The other options, described below, are applied after the separation
9719 As an example, consider the separation into full and partial tiles
9720 of a tiling of a triangular domain.
9721 Take, for example, the domain
9723 { A[i,j] : 0 <= i,j and i + j <= 100 }
9725 and a tiling into tiles of 10 by 10. The input to the AST generator
9726 is then the schedule
9728 { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
9731 Without any options, the following AST is generated
9733 for (int c0 = 0; c0 <= 10; c0 += 1)
9734 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9735 for (int c2 = 10 * c0;
9736 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9738 for (int c3 = 10 * c1;
9739 c3 <= min(10 * c1 + 9, -c2 + 100);
9743 Separation into full and partial tiles can be obtained by assigning
9744 a class, say C<0>, to the full tiles. The full tiles are represented by those
9745 values of the first and second schedule dimensions for which there are
9746 values of the third and fourth dimensions to cover an entire tile.
9747 That is, we need to specify the following option
9749 { [a,b,c,d] -> separation_class[[0]->[0]] :
9750 exists b': 0 <= 10a,10b' and
9751 10a+9+10b'+9 <= 100;
9752 [a,b,c,d] -> separation_class[[1]->[0]] :
9753 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
9757 { [a, b, c, d] -> separation_class[[1] -> [0]] :
9758 a >= 0 and b >= 0 and b <= 8 - a;
9759 [a, b, c, d] -> separation_class[[0] -> [0]] :
9762 With this option, the generated AST is as follows
9765 for (int c0 = 0; c0 <= 8; c0 += 1) {
9766 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9767 for (int c2 = 10 * c0;
9768 c2 <= 10 * c0 + 9; c2 += 1)
9769 for (int c3 = 10 * c1;
9770 c3 <= 10 * c1 + 9; c3 += 1)
9772 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9773 for (int c2 = 10 * c0;
9774 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9776 for (int c3 = 10 * c1;
9777 c3 <= min(-c2 + 100, 10 * c1 + 9);
9781 for (int c0 = 9; c0 <= 10; c0 += 1)
9782 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9783 for (int c2 = 10 * c0;
9784 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9786 for (int c3 = 10 * c1;
9787 c3 <= min(10 * c1 + 9, -c2 + 100);
9794 This is a single-dimensional space representing the schedule dimension(s)
9795 to which ``separation'' should be applied. Separation tries to split
9796 a loop into several pieces if this can avoid the generation of guards
9798 See also the C<atomic> option.
9802 This is a single-dimensional space representing the schedule dimension(s)
9803 for which the domains should be considered ``atomic''. That is, the
9804 AST generator will make sure that any given domain space will only appear
9805 in a single loop at the specified level.
9807 Consider the following schedule
9809 { a[i] -> [i] : 0 <= i < 10;
9810 b[i] -> [i+1] : 0 <= i < 10 }
9812 If the following option is specified
9814 { [i] -> separate[x] }
9816 then the following AST will be generated
9820 for (int c0 = 1; c0 <= 9; c0 += 1) {
9827 If, on the other hand, the following option is specified
9829 { [i] -> atomic[x] }
9831 then the following AST will be generated
9833 for (int c0 = 0; c0 <= 10; c0 += 1) {
9840 If neither C<atomic> nor C<separate> is specified, then the AST generator
9841 may produce either of these two results or some intermediate form.
9845 This is a single-dimensional space representing the schedule dimension(s)
9846 that should be I<completely> unrolled.
9847 To obtain a partial unrolling, the user should apply an additional
9848 strip-mining to the schedule and fully unroll the inner loop.
9852 =head3 Fine-grained Control over AST Generation
9854 Besides specifying the constraints on the parameters,
9855 an C<isl_ast_build> object can be used to control
9856 various aspects of the AST generation process.
9857 In case of AST construction using
9858 C<isl_ast_build_node_from_schedule_map>,
9859 the most prominent way of control is through ``options'',
9862 Additional control is available through the following functions.
9864 #include <isl/ast_build.h>
9865 __isl_give isl_ast_build *
9866 isl_ast_build_set_iterators(
9867 __isl_take isl_ast_build *control,
9868 __isl_take isl_id_list *iterators);
9870 The function C<isl_ast_build_set_iterators> allows the user to
9871 specify a list of iterator C<isl_id>s to be used as iterators.
9872 If the input schedule is injective, then
9873 the number of elements in this list should be as large as the dimension
9874 of the schedule space, but no direct correspondence should be assumed
9875 between dimensions and elements.
9876 If the input schedule is not injective, then an additional number
9877 of C<isl_id>s equal to the largest dimension of the input domains
9879 If the number of provided C<isl_id>s is insufficient, then additional
9880 names are automatically generated.
9882 #include <isl/ast_build.h>
9883 __isl_give isl_ast_build *
9884 isl_ast_build_set_create_leaf(
9885 __isl_take isl_ast_build *control,
9886 __isl_give isl_ast_node *(*fn)(
9887 __isl_take isl_ast_build *build,
9888 void *user), void *user);
9891 C<isl_ast_build_set_create_leaf> function allows for the
9892 specification of a callback that should be called whenever the AST
9893 generator arrives at an element of the schedule domain.
9894 The callback should return an AST node that should be inserted
9895 at the corresponding position of the AST. The default action (when
9896 the callback is not set) is to continue generating parts of the AST to scan
9897 all the domain elements associated to the schedule domain element
9898 and to insert user nodes, ``calling'' the domain element, for each of them.
9899 The C<build> argument contains the current state of the C<isl_ast_build>.
9900 To ease nested AST generation (see L</"Nested AST Generation">),
9901 all control information that is
9902 specific to the current AST generation such as the options and
9903 the callbacks has been removed from this C<isl_ast_build>.
9904 The callback would typically return the result of a nested
9906 user defined node created using the following function.
9908 #include <isl/ast.h>
9909 __isl_give isl_ast_node *isl_ast_node_alloc_user(
9910 __isl_take isl_ast_expr *expr);
9912 #include <isl/ast_build.h>
9913 __isl_give isl_ast_build *
9914 isl_ast_build_set_at_each_domain(
9915 __isl_take isl_ast_build *build,
9916 __isl_give isl_ast_node *(*fn)(
9917 __isl_take isl_ast_node *node,
9918 __isl_keep isl_ast_build *build,
9919 void *user), void *user);
9920 __isl_give isl_ast_build *
9921 isl_ast_build_set_before_each_for(
9922 __isl_take isl_ast_build *build,
9923 __isl_give isl_id *(*fn)(
9924 __isl_keep isl_ast_build *build,
9925 void *user), void *user);
9926 __isl_give isl_ast_build *
9927 isl_ast_build_set_after_each_for(
9928 __isl_take isl_ast_build *build,
9929 __isl_give isl_ast_node *(*fn)(
9930 __isl_take isl_ast_node *node,
9931 __isl_keep isl_ast_build *build,
9932 void *user), void *user);
9933 __isl_give isl_ast_build *
9934 isl_ast_build_set_before_each_mark(
9935 __isl_take isl_ast_build *build,
9936 isl_stat (*fn)(__isl_keep isl_id *mark,
9937 __isl_keep isl_ast_build *build,
9938 void *user), void *user);
9939 __isl_give isl_ast_build *
9940 isl_ast_build_set_after_each_mark(
9941 __isl_take isl_ast_build *build,
9942 __isl_give isl_ast_node *(*fn)(
9943 __isl_take isl_ast_node *node,
9944 __isl_keep isl_ast_build *build,
9945 void *user), void *user);
9947 The callback set by C<isl_ast_build_set_at_each_domain> will
9948 be called for each domain AST node.
9949 The callbacks set by C<isl_ast_build_set_before_each_for>
9950 and C<isl_ast_build_set_after_each_for> will be called
9951 for each for AST node. The first will be called in depth-first
9952 pre-order, while the second will be called in depth-first post-order.
9953 Since C<isl_ast_build_set_before_each_for> is called before the for
9954 node is actually constructed, it is only passed an C<isl_ast_build>.
9955 The returned C<isl_id> will be added as an annotation (using
9956 C<isl_ast_node_set_annotation>) to the constructed for node.
9957 In particular, if the user has also specified an C<after_each_for>
9958 callback, then the annotation can be retrieved from the node passed to
9959 that callback using C<isl_ast_node_get_annotation>.
9960 The callbacks set by C<isl_ast_build_set_before_each_mark>
9961 and C<isl_ast_build_set_after_each_mark> will be called for each
9962 mark AST node that is created, i.e., for each mark schedule node
9963 in the input schedule tree. The first will be called in depth-first
9964 pre-order, while the second will be called in depth-first post-order.
9965 Since the callback set by C<isl_ast_build_set_before_each_mark>
9966 is called before the mark AST node is actually constructed, it is passed
9967 the identifier of the mark node.
9968 All callbacks should C<NULL> (or -1) on failure.
9969 The given C<isl_ast_build> can be used to create new
9970 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
9971 or C<isl_ast_build_call_from_pw_multi_aff>.
9973 =head3 Nested AST Generation
9975 C<isl> allows the user to create an AST within the context
9976 of another AST. These nested ASTs are created using the
9977 same C<isl_ast_build_node_from_schedule_map> function that is used to create
9978 the outer AST. The C<build> argument should be an C<isl_ast_build>
9979 passed to a callback set by
9980 C<isl_ast_build_set_create_leaf>.
9981 The space of the range of the C<schedule> argument should refer
9982 to this build. In particular, the space should be a wrapped
9983 relation and the domain of this wrapped relation should be the
9984 same as that of the range of the schedule returned by
9985 C<isl_ast_build_get_schedule> below.
9986 In practice, the new schedule is typically
9987 created by calling C<isl_union_map_range_product> on the old schedule
9988 and some extra piece of the schedule.
9989 The space of the schedule domain is also available from
9990 the C<isl_ast_build>.
9992 #include <isl/ast_build.h>
9993 __isl_give isl_union_map *isl_ast_build_get_schedule(
9994 __isl_keep isl_ast_build *build);
9995 __isl_give isl_space *isl_ast_build_get_schedule_space(
9996 __isl_keep isl_ast_build *build);
9997 __isl_give isl_ast_build *isl_ast_build_restrict(
9998 __isl_take isl_ast_build *build,
9999 __isl_take isl_set *set);
10001 The C<isl_ast_build_get_schedule> function returns a (partial)
10002 schedule for the domains elements for which part of the AST still needs to
10003 be generated in the current build.
10004 In particular, the domain elements are mapped to those iterations of the loops
10005 enclosing the current point of the AST generation inside which
10006 the domain elements are executed.
10007 No direct correspondence between
10008 the input schedule and this schedule should be assumed.
10009 The space obtained from C<isl_ast_build_get_schedule_space> can be used
10010 to create a set for C<isl_ast_build_restrict> to intersect
10011 with the current build. In particular, the set passed to
10012 C<isl_ast_build_restrict> can have additional parameters.
10013 The ids of the set dimensions in the space returned by
10014 C<isl_ast_build_get_schedule_space> correspond to the
10015 iterators of the already generated loops.
10016 The user should not rely on the ids of the output dimensions
10017 of the relations in the union relation returned by
10018 C<isl_ast_build_get_schedule> having any particular value.
10020 =head1 Applications
10022 Although C<isl> is mainly meant to be used as a library,
10023 it also contains some basic applications that use some
10024 of the functionality of C<isl>.
10025 The input may be specified in either the L<isl format>
10026 or the L<PolyLib format>.
10028 =head2 C<isl_polyhedron_sample>
10030 C<isl_polyhedron_sample> takes a polyhedron as input and prints
10031 an integer element of the polyhedron, if there is any.
10032 The first column in the output is the denominator and is always
10033 equal to 1. If the polyhedron contains no integer points,
10034 then a vector of length zero is printed.
10038 C<isl_pip> takes the same input as the C<example> program
10039 from the C<piplib> distribution, i.e., a set of constraints
10040 on the parameters, a line containing only -1 and finally a set
10041 of constraints on a parametric polyhedron.
10042 The coefficients of the parameters appear in the last columns
10043 (but before the final constant column).
10044 The output is the lexicographic minimum of the parametric polyhedron.
10045 As C<isl> currently does not have its own output format, the output
10046 is just a dump of the internal state.
10048 =head2 C<isl_polyhedron_minimize>
10050 C<isl_polyhedron_minimize> computes the minimum of some linear
10051 or affine objective function over the integer points in a polyhedron.
10052 If an affine objective function
10053 is given, then the constant should appear in the last column.
10055 =head2 C<isl_polytope_scan>
10057 Given a polytope, C<isl_polytope_scan> prints
10058 all integer points in the polytope.
10060 =head2 C<isl_codegen>
10062 Given a schedule, a context set and an options relation,
10063 C<isl_codegen> prints out an AST that scans the domain elements
10064 of the schedule in the order of their image(s) taking into account
10065 the constraints in the context set.