3 C<isl> is a thread-safe C library for manipulating
4 sets and relations of integer points bounded by affine constraints.
5 The descriptions of the sets and relations may involve
6 both parameters and existentially quantified variables.
7 All computations are performed in exact integer arithmetic
8 using C<GMP> or C<imath>.
9 The C<isl> library offers functionality that is similar
10 to that offered by the C<Omega> and C<Omega+> libraries,
11 but the underlying algorithms are in most cases completely different.
13 The library is by no means complete and some fairly basic
14 functionality is still missing.
15 Still, even in its current form, the library has been successfully
16 used as a backend polyhedral library for the polyhedral
17 scanner C<CLooG> and as part of an equivalence checker of
18 static affine programs.
19 For bug reports, feature requests and questions,
20 visit the discussion group at
21 L<http://groups.google.com/group/isl-development>.
23 =head2 Backward Incompatible Changes
25 =head3 Changes since isl-0.02
29 =item * The old printing functions have been deprecated
30 and replaced by C<isl_printer> functions, see L<Input and Output>.
32 =item * Most functions related to dependence analysis have acquired
33 an extra C<must> argument. To obtain the old behavior, this argument
34 should be given the value 1. See L<Dependence Analysis>.
38 =head3 Changes since isl-0.03
42 =item * The function C<isl_pw_qpolynomial_fold_add> has been
43 renamed to C<isl_pw_qpolynomial_fold_fold>.
44 Similarly, C<isl_union_pw_qpolynomial_fold_add> has been
45 renamed to C<isl_union_pw_qpolynomial_fold_fold>.
49 =head3 Changes since isl-0.04
53 =item * All header files have been renamed from C<isl_header.h>
58 =head3 Changes since isl-0.05
62 =item * The functions C<isl_printer_print_basic_set> and
63 C<isl_printer_print_basic_map> no longer print a newline.
65 =item * The functions C<isl_flow_get_no_source>
66 and C<isl_union_map_compute_flow> now return
67 the accesses for which no source could be found instead of
68 the iterations where those accesses occur.
70 =item * The functions C<isl_basic_map_identity> and
71 C<isl_map_identity> now take a B<map> space as input. An old call
72 C<isl_map_identity(space)> can be rewritten to
73 C<isl_map_identity(isl_space_map_from_set(space))>.
75 =item * The function C<isl_map_power> no longer takes
76 a parameter position as input. Instead, the exponent
77 is now expressed as the domain of the resulting relation.
81 =head3 Changes since isl-0.06
85 =item * The format of C<isl_printer_print_qpolynomial>'s
86 C<ISL_FORMAT_ISL> output has changed.
87 Use C<ISL_FORMAT_C> to obtain the old output.
89 =item * The C<*_fast_*> functions have been renamed to C<*_plain_*>.
90 Some of the old names have been kept for backward compatibility,
91 but they will be removed in the future.
95 =head3 Changes since isl-0.07
99 =item * The function C<isl_pw_aff_max> has been renamed to
100 C<isl_pw_aff_union_max>.
101 Similarly, the function C<isl_pw_aff_add> has been renamed to
102 C<isl_pw_aff_union_add>.
104 =item * The C<isl_dim> type has been renamed to C<isl_space>
105 along with the associated functions.
106 Some of the old names have been kept for backward compatibility,
107 but they will be removed in the future.
109 =item * Spaces of maps, sets and parameter domains are now
110 treated differently. The distinction between map spaces and set spaces
111 has always been made on a conceptual level, but proper use of such spaces
112 was never checked. Furthermore, up until isl-0.07 there was no way
113 of explicitly creating a parameter space. These can now be created
114 directly using C<isl_space_params_alloc> or from other spaces using
117 =item * The space in which C<isl_aff>, C<isl_pw_aff>, C<isl_qpolynomial>,
118 C<isl_pw_qpolynomial>, C<isl_qpolynomial_fold> and C<isl_pw_qpolynomial_fold>
119 objects live is now a map space
120 instead of a set space. This means, for example, that the dimensions
121 of the domain of an C<isl_aff> are now considered to be of type
122 C<isl_dim_in> instead of C<isl_dim_set>. Extra functions have been
123 added to obtain the domain space. Some of the constructors still
124 take a domain space and have therefore been renamed.
126 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
127 now take an C<isl_local_space> instead of an C<isl_space>.
128 An C<isl_local_space> can be created from an C<isl_space>
129 using C<isl_local_space_from_space>.
131 =item * The C<isl_div> type has been removed. Functions that used
132 to return an C<isl_div> now return an C<isl_aff>.
133 Note that the space of an C<isl_aff> is that of relation.
134 When replacing a call to C<isl_div_get_coefficient> by a call to
135 C<isl_aff_get_coefficient> any C<isl_dim_set> argument needs
136 to be replaced by C<isl_dim_in>.
137 A call to C<isl_aff_from_div> can be replaced by a call
139 A call to C<isl_qpolynomial_div(div)> call be replaced by
142 isl_qpolynomial_from_aff(isl_aff_floor(div))
144 The function C<isl_constraint_div> has also been renamed
145 to C<isl_constraint_get_div>.
147 =item * The C<nparam> argument has been removed from
148 C<isl_map_read_from_str> and similar functions.
149 When reading input in the original PolyLib format,
150 the result will have no parameters.
151 If parameters are expected, the caller may want to perform
152 dimension manipulation on the result.
156 =head3 Changes since isl-0.09
160 =item * The C<schedule_split_parallel> option has been replaced
161 by the C<schedule_split_scaled> option.
163 =item * The first argument of C<isl_pw_aff_cond> is now
164 an C<isl_pw_aff> instead of an C<isl_set>.
165 A call C<isl_pw_aff_cond(a, b, c)> can be replaced by
167 isl_pw_aff_cond(isl_set_indicator_function(a), b, c)
171 =head3 Changes since isl-0.10
175 =item * The functions C<isl_set_dim_has_lower_bound> and
176 C<isl_set_dim_has_upper_bound> have been renamed to
177 C<isl_set_dim_has_any_lower_bound> and
178 C<isl_set_dim_has_any_upper_bound>.
179 The new C<isl_set_dim_has_lower_bound> and
180 C<isl_set_dim_has_upper_bound> have slightly different meanings.
184 =head3 Changes since isl-0.12
188 =item * C<isl_int> has been replaced by C<isl_val>.
189 Some of the old functions are still available in C<isl/deprecated/*.h>
190 but they will be removed in the future.
192 =item * The functions C<isl_pw_qpolynomial_eval>,
193 C<isl_union_pw_qpolynomial_eval>, C<isl_pw_qpolynomial_fold_eval>
194 and C<isl_union_pw_qpolynomial_fold_eval> have been changed to return
195 an C<isl_val> instead of an C<isl_qpolynomial>.
197 =item * The function C<isl_band_member_is_zero_distance>
198 has been removed. Essentially the same functionality is available
199 through C<isl_band_member_is_coincident>, except that it requires
200 setting up coincidence constraints.
201 The option C<schedule_outer_zero_distance> has accordingly been
202 replaced by the option C<schedule_outer_coincidence>.
204 =item * The function C<isl_vertex_get_expr> has been changed
205 to return an C<isl_multi_aff> instead of a rational C<isl_basic_set>.
206 The function C<isl_vertex_get_domain> has been changed to return
207 a regular basic set, rather than a rational basic set.
211 =head3 Changes since isl-0.14
215 =item * The function C<isl_union_pw_multi_aff_add> now consistently
216 computes the sum on the shared definition domain.
217 The function C<isl_union_pw_multi_aff_union_add> has been added
218 to compute the sum on the union of definition domains.
219 The original behavior of C<isl_union_pw_multi_aff_add> was
220 confused and is no longer available.
222 =item * Band forests have been replaced by schedule trees.
224 =item * The function C<isl_union_map_compute_flow> has been
225 replaced by the function C<isl_union_access_info_compute_flow>.
226 Note that the may dependence relation returned by
227 C<isl_union_flow_get_may_dependence> is the union of
228 the two dependence relations returned by
229 C<isl_union_map_compute_flow>. Similarly for the no source relations.
230 The function C<isl_union_map_compute_flow> is still available
231 for backward compatibility, but it will be removed in the future.
233 =item * The function C<isl_basic_set_drop_constraint> has been
236 =item * The function C<isl_ast_build_ast_from_schedule> has been
237 renamed to C<isl_ast_build_node_from_schedule_map>.
238 The original name is still available
239 for backward compatibility, but it will be removed in the future.
241 =item * The C<separation_class> AST generation option has been
244 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
245 have been renamed to C<isl_constraint_alloc_equality> and
246 C<isl_constraint_alloc_inequality>. The original names have been
247 kept for backward compatibility, but they will be removed in the future.
249 =item * The C<schedule_fuse> option has been replaced
250 by the C<schedule_serialize_sccs> option. The effect
251 of setting the C<schedule_fuse> option to C<ISL_SCHEDULE_FUSE_MIN>
252 is now obtained by turning on the C<schedule_serialize_sccs> option.
256 =head3 Changes since isl-0.17
260 =item * The function C<isl_printer_print_ast_expr> no longer prints
261 in C format by default. To print in C format, the output format
262 of the printer needs to have been explicitly set to C<ISL_FORMAT_C>.
263 As a result, the function C<isl_ast_expr_to_str> no longer prints
264 the expression in C format. Use C<isl_ast_expr_to_C_str> instead.
270 C<isl> is released under the MIT license.
274 Permission is hereby granted, free of charge, to any person obtaining a copy of
275 this software and associated documentation files (the "Software"), to deal in
276 the Software without restriction, including without limitation the rights to
277 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
278 of the Software, and to permit persons to whom the Software is furnished to do
279 so, subject to the following conditions:
281 The above copyright notice and this permission notice shall be included in all
282 copies or substantial portions of the Software.
284 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
285 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
286 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
287 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
288 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
289 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
294 Note that by default C<isl> requires C<GMP>, which is released
295 under the GNU Lesser General Public License (LGPL). This means
296 that code linked against C<isl> is also linked against LGPL code.
298 When configuring with C<--with-int=imath> or C<--with-int=imath-32>, C<isl>
299 will link against C<imath>, a library for exact integer arithmetic released
300 under the MIT license.
304 The source of C<isl> can be obtained either as a tarball
305 or from the git repository. Both are available from
306 L<http://isl.gforge.inria.fr/>.
307 The installation process depends on how you obtained
310 =head2 Installation from the git repository
314 =item 1 Clone or update the repository
316 The first time the source is obtained, you need to clone
319 git clone git://repo.or.cz/isl.git
321 To obtain updates, you need to pull in the latest changes
325 =item 2 Optionally get C<imath> submodule
327 To build C<isl> with C<imath>, you need to obtain the C<imath>
328 submodule by running in the git source tree of C<isl>
333 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
335 =item 2 Generate C<configure>
341 After performing the above steps, continue
342 with the L<Common installation instructions>.
344 =head2 Common installation instructions
348 =item 1 Obtain C<GMP>
350 By default, building C<isl> requires C<GMP>, including its headers files.
351 Your distribution may not provide these header files by default
352 and you may need to install a package called C<gmp-devel> or something
353 similar. Alternatively, C<GMP> can be built from
354 source, available from L<http://gmplib.org/>.
355 C<GMP> is not needed if you build C<isl> with C<imath>.
359 C<isl> uses the standard C<autoconf> C<configure> script.
364 optionally followed by some configure options.
365 A complete list of options can be obtained by running
369 Below we discuss some of the more common options.
375 Installation prefix for C<isl>
377 =item C<--with-int=[gmp|imath|imath-32]>
379 Select the integer library to be used by C<isl>, the default is C<gmp>.
380 With C<imath-32>, C<isl> will use 32 bit integers, but fall back to C<imath>
381 for values out of the 32 bit range. In most applications, C<isl> will run
382 fastest with the C<imath-32> option, followed by C<gmp> and C<imath>, the
385 =item C<--with-gmp-prefix>
387 Installation prefix for C<GMP> (architecture-independent files).
389 =item C<--with-gmp-exec-prefix>
391 Installation prefix for C<GMP> (architecture-dependent files).
399 =item 4 Install (optional)
405 =head1 Integer Set Library
407 =head2 Memory Management
409 Since a high-level operation on isl objects usually involves
410 several substeps and since the user is usually not interested in
411 the intermediate results, most functions that return a new object
412 will also release all the objects passed as arguments.
413 If the user still wants to use one or more of these arguments
414 after the function call, she should pass along a copy of the
415 object rather than the object itself.
416 The user is then responsible for making sure that the original
417 object gets used somewhere else or is explicitly freed.
419 The arguments and return values of all documented functions are
420 annotated to make clear which arguments are released and which
421 arguments are preserved. In particular, the following annotations
428 C<__isl_give> means that a new object is returned.
429 The user should make sure that the returned pointer is
430 used exactly once as a value for an C<__isl_take> argument.
431 In between, it can be used as a value for as many
432 C<__isl_keep> arguments as the user likes.
433 There is one exception, and that is the case where the
434 pointer returned is C<NULL>. Is this case, the user
435 is free to use it as an C<__isl_take> argument or not.
436 When applied to a C<char *>, the returned pointer needs to be
441 C<__isl_null> means that a C<NULL> value is returned.
445 C<__isl_take> means that the object the argument points to
446 is taken over by the function and may no longer be used
447 by the user as an argument to any other function.
448 The pointer value must be one returned by a function
449 returning an C<__isl_give> pointer.
450 If the user passes in a C<NULL> value, then this will
451 be treated as an error in the sense that the function will
452 not perform its usual operation. However, it will still
453 make sure that all the other C<__isl_take> arguments
458 C<__isl_keep> means that the function will only use the object
459 temporarily. After the function has finished, the user
460 can still use it as an argument to other functions.
461 A C<NULL> value will be treated in the same way as
462 a C<NULL> value for an C<__isl_take> argument.
463 This annotation may also be used on return values of
464 type C<const char *>, in which case the returned pointer should
465 not be freed by the user and is only valid until the object
466 from which it was derived is updated or freed.
470 =head2 Initialization
472 All manipulations of integer sets and relations occur within
473 the context of an C<isl_ctx>.
474 A given C<isl_ctx> can only be used within a single thread.
475 All arguments of a function are required to have been allocated
476 within the same context.
477 There are currently no functions available for moving an object
478 from one C<isl_ctx> to another C<isl_ctx>. This means that
479 there is currently no way of safely moving an object from one
480 thread to another, unless the whole C<isl_ctx> is moved.
482 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
483 freed using C<isl_ctx_free>.
484 All objects allocated within an C<isl_ctx> should be freed
485 before the C<isl_ctx> itself is freed.
487 isl_ctx *isl_ctx_alloc();
488 void isl_ctx_free(isl_ctx *ctx);
490 The user can impose a bound on the number of low-level I<operations>
491 that can be performed by an C<isl_ctx>. This bound can be set and
492 retrieved using the following functions. A bound of zero means that
493 no bound is imposed. The number of operations performed can be
494 reset using C<isl_ctx_reset_operations>. Note that the number
495 of low-level operations needed to perform a high-level computation
496 may differ significantly across different versions
497 of C<isl>, but it should be the same across different platforms
498 for the same version of C<isl>.
500 Warning: This feature is experimental. C<isl> has good support to abort and
501 bail out during the computation, but this feature may exercise error code paths
502 that are normally not used that much. Consequently, it is not unlikely that
503 hidden bugs will be exposed.
505 void isl_ctx_set_max_operations(isl_ctx *ctx,
506 unsigned long max_operations);
507 unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
508 void isl_ctx_reset_operations(isl_ctx *ctx);
510 In order to be able to create an object in the same context
511 as another object, most object types (described later in
512 this document) provide a function to obtain the context
513 in which the object was created.
516 isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
517 isl_ctx *isl_multi_val_get_ctx(
518 __isl_keep isl_multi_val *mv);
521 isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
523 #include <isl/local_space.h>
524 isl_ctx *isl_local_space_get_ctx(
525 __isl_keep isl_local_space *ls);
528 isl_ctx *isl_set_list_get_ctx(
529 __isl_keep isl_set_list *list);
532 isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
533 isl_ctx *isl_multi_aff_get_ctx(
534 __isl_keep isl_multi_aff *maff);
535 isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
536 isl_ctx *isl_pw_multi_aff_get_ctx(
537 __isl_keep isl_pw_multi_aff *pma);
538 isl_ctx *isl_multi_pw_aff_get_ctx(
539 __isl_keep isl_multi_pw_aff *mpa);
540 isl_ctx *isl_union_pw_aff_get_ctx(
541 __isl_keep isl_union_pw_aff *upa);
542 isl_ctx *isl_union_pw_multi_aff_get_ctx(
543 __isl_keep isl_union_pw_multi_aff *upma);
544 isl_ctx *isl_multi_union_pw_aff_get_ctx(
545 __isl_keep isl_multi_union_pw_aff *mupa);
547 #include <isl/id_to_ast_expr.h>
548 isl_ctx *isl_id_to_ast_expr_get_ctx(
549 __isl_keep isl_id_to_ast_expr *id2expr);
551 #include <isl/point.h>
552 isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
555 isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
558 isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
560 #include <isl/vertices.h>
561 isl_ctx *isl_vertices_get_ctx(
562 __isl_keep isl_vertices *vertices);
563 isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
564 isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
566 #include <isl/flow.h>
567 isl_ctx *isl_restriction_get_ctx(
568 __isl_keep isl_restriction *restr);
569 isl_ctx *isl_union_access_info_get_ctx(
570 __isl_keep isl_union_access_info *access);
571 isl_ctx *isl_union_flow_get_ctx(
572 __isl_keep isl_union_flow *flow);
574 #include <isl/schedule.h>
575 isl_ctx *isl_schedule_get_ctx(
576 __isl_keep isl_schedule *sched);
577 isl_ctx *isl_schedule_constraints_get_ctx(
578 __isl_keep isl_schedule_constraints *sc);
580 #include <isl/schedule_node.h>
581 isl_ctx *isl_schedule_node_get_ctx(
582 __isl_keep isl_schedule_node *node);
584 #include <isl/band.h>
585 isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
587 #include <isl/ast_build.h>
588 isl_ctx *isl_ast_build_get_ctx(
589 __isl_keep isl_ast_build *build);
592 isl_ctx *isl_ast_expr_get_ctx(
593 __isl_keep isl_ast_expr *expr);
594 isl_ctx *isl_ast_node_get_ctx(
595 __isl_keep isl_ast_node *node);
599 C<isl> uses two special return types for functions that either return
600 a boolean or that in principle do not return anything.
601 In particular, the C<isl_bool> type has three possible values:
602 C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
603 C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
604 C<isl_bool_error> (a negative integer value), indicating that something
605 went wrong. The following function can be used to negate an C<isl_bool>,
606 where the negation of C<isl_bool_error> is C<isl_bool_error> again.
609 isl_bool isl_bool_not(isl_bool b);
611 The C<isl_stat> type has two possible values:
612 C<isl_stat_ok> (the integer value zero), indicating a successful
614 C<isl_stat_error> (a negative integer value), indicating that something
616 See L</"Error Handling"> for more information on
617 C<isl_bool_error> and C<isl_stat_error>.
621 An C<isl_val> represents an integer value, a rational value
622 or one of three special values, infinity, negative infinity and NaN.
623 Some predefined values can be created using the following functions.
626 __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
627 __isl_give isl_val *isl_val_one(isl_ctx *ctx);
628 __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
629 __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
630 __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
631 __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
633 Specific integer values can be created using the following functions.
636 __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
638 __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
640 __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
641 size_t n, size_t size, const void *chunks);
643 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
644 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
645 The least significant digit is assumed to be stored first.
647 Value objects can be copied and freed using the following functions.
650 __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
651 __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
653 They can be inspected using the following functions.
656 long isl_val_get_num_si(__isl_keep isl_val *v);
657 long isl_val_get_den_si(__isl_keep isl_val *v);
658 __isl_give isl_val *isl_val_get_den_val(
659 __isl_keep isl_val *v);
660 double isl_val_get_d(__isl_keep isl_val *v);
661 size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
663 int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
664 size_t size, void *chunks);
666 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
667 of C<size> bytes needed to store the absolute value of the
669 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
670 which is assumed to have been preallocated by the caller.
671 The least significant digit is stored first.
672 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
673 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
674 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
676 An C<isl_val> can be modified using the following function.
679 __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
682 The following unary properties are defined on C<isl_val>s.
685 int isl_val_sgn(__isl_keep isl_val *v);
686 isl_bool isl_val_is_zero(__isl_keep isl_val *v);
687 isl_bool isl_val_is_one(__isl_keep isl_val *v);
688 isl_bool isl_val_is_negone(__isl_keep isl_val *v);
689 isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
690 isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
691 isl_bool isl_val_is_pos(__isl_keep isl_val *v);
692 isl_bool isl_val_is_neg(__isl_keep isl_val *v);
693 isl_bool isl_val_is_int(__isl_keep isl_val *v);
694 isl_bool isl_val_is_rat(__isl_keep isl_val *v);
695 isl_bool isl_val_is_nan(__isl_keep isl_val *v);
696 isl_bool isl_val_is_infty(__isl_keep isl_val *v);
697 isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
699 Note that the sign of NaN is undefined.
701 The following binary properties are defined on pairs of C<isl_val>s.
704 isl_bool isl_val_lt(__isl_keep isl_val *v1,
705 __isl_keep isl_val *v2);
706 isl_bool isl_val_le(__isl_keep isl_val *v1,
707 __isl_keep isl_val *v2);
708 isl_bool isl_val_gt(__isl_keep isl_val *v1,
709 __isl_keep isl_val *v2);
710 isl_bool isl_val_ge(__isl_keep isl_val *v1,
711 __isl_keep isl_val *v2);
712 isl_bool isl_val_eq(__isl_keep isl_val *v1,
713 __isl_keep isl_val *v2);
714 isl_bool isl_val_ne(__isl_keep isl_val *v1,
715 __isl_keep isl_val *v2);
716 isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
717 __isl_keep isl_val *v2);
719 The function C<isl_val_abs_eq> checks whether its two arguments
720 are equal in absolute value.
722 For integer C<isl_val>s we additionally have the following binary property.
725 isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
726 __isl_keep isl_val *v2);
728 An C<isl_val> can also be compared to an integer using the following
729 function. The result is undefined for NaN.
732 int isl_val_cmp_si(__isl_keep isl_val *v, long i);
734 The following unary operations are available on C<isl_val>s.
737 __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
738 __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
739 __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
740 __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
741 __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
742 __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
743 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
745 The following binary operations are available on C<isl_val>s.
748 __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
749 __isl_take isl_val *v2);
750 __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
751 __isl_take isl_val *v2);
752 __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
753 __isl_take isl_val *v2);
754 __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
756 __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
757 __isl_take isl_val *v2);
758 __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
760 __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
761 __isl_take isl_val *v2);
762 __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
764 __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
765 __isl_take isl_val *v2);
767 On integer values, we additionally have the following operations.
770 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
771 __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
772 __isl_take isl_val *v2);
773 __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
774 __isl_take isl_val *v2);
775 __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
776 __isl_take isl_val *v2, __isl_give isl_val **x,
777 __isl_give isl_val **y);
779 The function C<isl_val_gcdext> returns the greatest common divisor g
780 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
781 that C<*x> * C<v1> + C<*y> * C<v2> = g.
783 =head3 GMP specific functions
785 These functions are only available if C<isl> has been compiled with C<GMP>
788 Specific integer and rational values can be created from C<GMP> values using
789 the following functions.
791 #include <isl/val_gmp.h>
792 __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
794 __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
795 const mpz_t n, const mpz_t d);
797 The numerator and denominator of a rational value can be extracted as
798 C<GMP> values using the following functions.
800 #include <isl/val_gmp.h>
801 int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
802 int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
804 =head2 Sets and Relations
806 C<isl> uses six types of objects for representing sets and relations,
807 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
808 C<isl_union_set> and C<isl_union_map>.
809 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
810 can be described as a conjunction of affine constraints, while
811 C<isl_set> and C<isl_map> represent unions of
812 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
813 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
814 to live in the same space. C<isl_union_set>s and C<isl_union_map>s
815 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
816 where spaces are considered different if they have a different number
817 of dimensions and/or different names (see L<"Spaces">).
818 The difference between sets and relations (maps) is that sets have
819 one set of variables, while relations have two sets of variables,
820 input variables and output variables.
822 =head2 Error Handling
824 C<isl> supports different ways to react in case a runtime error is triggered.
825 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
826 with two maps that have incompatible spaces. There are three possible ways
827 to react on error: to warn, to continue or to abort.
829 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
830 the last error in the corresponding C<isl_ctx> and the function in which the
831 error was triggered returns a value indicating that some error has
832 occurred. In case of functions returning a pointer, this value is
833 C<NULL>. In case of functions returning an C<isl_bool> or an
834 C<isl_stat>, this valus is C<isl_bool_error> or C<isl_stat_error>.
835 An error does not corrupt internal state,
836 such that isl can continue to be used. C<isl> also provides functions to
837 read the last error and to reset the memory that stores the last error. The
838 last error is only stored for information purposes. Its presence does not
839 change the behavior of C<isl>. Hence, resetting an error is not required to
840 continue to use isl, but only to observe new errors.
843 enum isl_error isl_ctx_last_error(isl_ctx *ctx);
844 void isl_ctx_reset_error(isl_ctx *ctx);
846 Another option is to continue on error. This is similar to warn on error mode,
847 except that C<isl> does not print any warning. This allows a program to
848 implement its own error reporting.
850 The last option is to directly abort the execution of the program from within
851 the isl library. This makes it obviously impossible to recover from an error,
852 but it allows to directly spot the error location. By aborting on error,
853 debuggers break at the location the error occurred and can provide a stack
854 trace. Other tools that automatically provide stack traces on abort or that do
855 not want to continue execution after an error was triggered may also prefer to
858 The on error behavior of isl can be specified by calling
859 C<isl_options_set_on_error> or by setting the command line option
860 C<--isl-on-error>. Valid arguments for the function call are
861 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
862 choices for the command line option are C<warn>, C<continue> and C<abort>.
863 It is also possible to query the current error mode.
865 #include <isl/options.h>
866 isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
867 int isl_options_get_on_error(isl_ctx *ctx);
871 Identifiers are used to identify both individual dimensions
872 and tuples of dimensions. They consist of an optional name and an optional
873 user pointer. The name and the user pointer cannot both be C<NULL>, however.
874 Identifiers with the same name but different pointer values
875 are considered to be distinct.
876 Similarly, identifiers with different names but the same pointer value
877 are also considered to be distinct.
878 Equal identifiers are represented using the same object.
879 Pairs of identifiers can therefore be tested for equality using the
881 Identifiers can be constructed, copied, freed, inspected and printed
882 using the following functions.
885 __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
886 __isl_keep const char *name, void *user);
887 __isl_give isl_id *isl_id_set_free_user(
888 __isl_take isl_id *id,
889 void (*free_user)(void *user));
890 __isl_give isl_id *isl_id_copy(isl_id *id);
891 __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
893 void *isl_id_get_user(__isl_keep isl_id *id);
894 __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
896 __isl_give isl_printer *isl_printer_print_id(
897 __isl_take isl_printer *p, __isl_keep isl_id *id);
899 The callback set by C<isl_id_set_free_user> is called on the user
900 pointer when the last reference to the C<isl_id> is freed.
901 Note that C<isl_id_get_name> returns a pointer to some internal
902 data structure, so the result can only be used while the
903 corresponding C<isl_id> is alive.
907 Whenever a new set, relation or similar object is created from scratch,
908 the space in which it lives needs to be specified using an C<isl_space>.
909 Each space involves zero or more parameters and zero, one or two
910 tuples of set or input/output dimensions. The parameters and dimensions
911 are identified by an C<isl_dim_type> and a position.
912 The type C<isl_dim_param> refers to parameters,
913 the type C<isl_dim_set> refers to set dimensions (for spaces
914 with a single tuple of dimensions) and the types C<isl_dim_in>
915 and C<isl_dim_out> refer to input and output dimensions
916 (for spaces with two tuples of dimensions).
917 Local spaces (see L</"Local Spaces">) also contain dimensions
918 of type C<isl_dim_div>.
919 Note that parameters are only identified by their position within
920 a given object. Across different objects, parameters are (usually)
921 identified by their names or identifiers. Only unnamed parameters
922 are identified by their positions across objects. The use of unnamed
923 parameters is discouraged.
925 #include <isl/space.h>
926 __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
927 unsigned nparam, unsigned n_in, unsigned n_out);
928 __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
930 __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
931 unsigned nparam, unsigned dim);
932 __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
933 __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
935 The space used for creating a parameter domain
936 needs to be created using C<isl_space_params_alloc>.
937 For other sets, the space
938 needs to be created using C<isl_space_set_alloc>, while
939 for a relation, the space
940 needs to be created using C<isl_space_alloc>.
942 To check whether a given space is that of a set or a map
943 or whether it is a parameter space, use these functions:
945 #include <isl/space.h>
946 isl_bool isl_space_is_params(__isl_keep isl_space *space);
947 isl_bool isl_space_is_set(__isl_keep isl_space *space);
948 isl_bool isl_space_is_map(__isl_keep isl_space *space);
950 Spaces can be compared using the following functions:
952 #include <isl/space.h>
953 isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
954 __isl_keep isl_space *space2);
955 isl_bool isl_space_has_equal_tuples(
956 __isl_keep isl_space *space1,
957 __isl_keep isl_space *space2);
958 isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
959 __isl_keep isl_space *space2);
960 isl_bool isl_space_is_range(__isl_keep isl_space *space1,
961 __isl_keep isl_space *space2);
962 isl_bool isl_space_tuple_is_equal(
963 __isl_keep isl_space *space1,
964 enum isl_dim_type type1,
965 __isl_keep isl_space *space2,
966 enum isl_dim_type type2);
968 C<isl_space_is_domain> checks whether the first argument is equal
969 to the domain of the second argument. This requires in particular that
970 the first argument is a set space and that the second argument
971 is a map space. C<isl_space_tuple_is_equal> checks whether the given
972 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
973 spaces are the same. That is, it checks if they have the same
974 identifier (if any), the same dimension and the same internal structure
976 C<isl_space_is_equal> checks whether two spaces are identical.
977 In particular, it checks whether they have the same type
978 (parameter, set or map space), the same tuples
979 (if they are not parameter spaces) in the sense
980 of C<isl_space_tuple_is_equal> and the same parameters
982 C<isl_space_has_equal_tuples> check whether two spaces have
983 the same tuples. In contrast to C<isl_space_is_equal>, it does not check the
984 parameters. This is useful because many C<isl> functions align the
985 parameters before they perform their operations, such that equivalence
988 It is often useful to create objects that live in the
989 same space as some other object. This can be accomplished
990 by creating the new objects
991 (see L</"Creating New Sets and Relations"> or
992 L</"Functions">) based on the space
993 of the original object.
996 __isl_give isl_space *isl_basic_set_get_space(
997 __isl_keep isl_basic_set *bset);
998 __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
1000 #include <isl/union_set.h>
1001 __isl_give isl_space *isl_union_set_get_space(
1002 __isl_keep isl_union_set *uset);
1004 #include <isl/map.h>
1005 __isl_give isl_space *isl_basic_map_get_space(
1006 __isl_keep isl_basic_map *bmap);
1007 __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
1009 #include <isl/union_map.h>
1010 __isl_give isl_space *isl_union_map_get_space(
1011 __isl_keep isl_union_map *umap);
1013 #include <isl/constraint.h>
1014 __isl_give isl_space *isl_constraint_get_space(
1015 __isl_keep isl_constraint *constraint);
1017 #include <isl/polynomial.h>
1018 __isl_give isl_space *isl_qpolynomial_get_domain_space(
1019 __isl_keep isl_qpolynomial *qp);
1020 __isl_give isl_space *isl_qpolynomial_get_space(
1021 __isl_keep isl_qpolynomial *qp);
1022 __isl_give isl_space *
1023 isl_qpolynomial_fold_get_domain_space(
1024 __isl_keep isl_qpolynomial_fold *fold);
1025 __isl_give isl_space *isl_qpolynomial_fold_get_space(
1026 __isl_keep isl_qpolynomial_fold *fold);
1027 __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
1028 __isl_keep isl_pw_qpolynomial *pwqp);
1029 __isl_give isl_space *isl_pw_qpolynomial_get_space(
1030 __isl_keep isl_pw_qpolynomial *pwqp);
1031 __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
1032 __isl_keep isl_pw_qpolynomial_fold *pwf);
1033 __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1034 __isl_keep isl_pw_qpolynomial_fold *pwf);
1035 __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1036 __isl_keep isl_union_pw_qpolynomial *upwqp);
1037 __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1038 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1040 #include <isl/val.h>
1041 __isl_give isl_space *isl_multi_val_get_space(
1042 __isl_keep isl_multi_val *mv);
1044 #include <isl/aff.h>
1045 __isl_give isl_space *isl_aff_get_domain_space(
1046 __isl_keep isl_aff *aff);
1047 __isl_give isl_space *isl_aff_get_space(
1048 __isl_keep isl_aff *aff);
1049 __isl_give isl_space *isl_pw_aff_get_domain_space(
1050 __isl_keep isl_pw_aff *pwaff);
1051 __isl_give isl_space *isl_pw_aff_get_space(
1052 __isl_keep isl_pw_aff *pwaff);
1053 __isl_give isl_space *isl_multi_aff_get_domain_space(
1054 __isl_keep isl_multi_aff *maff);
1055 __isl_give isl_space *isl_multi_aff_get_space(
1056 __isl_keep isl_multi_aff *maff);
1057 __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1058 __isl_keep isl_pw_multi_aff *pma);
1059 __isl_give isl_space *isl_pw_multi_aff_get_space(
1060 __isl_keep isl_pw_multi_aff *pma);
1061 __isl_give isl_space *isl_union_pw_aff_get_space(
1062 __isl_keep isl_union_pw_aff *upa);
1063 __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1064 __isl_keep isl_union_pw_multi_aff *upma);
1065 __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1066 __isl_keep isl_multi_pw_aff *mpa);
1067 __isl_give isl_space *isl_multi_pw_aff_get_space(
1068 __isl_keep isl_multi_pw_aff *mpa);
1069 __isl_give isl_space *
1070 isl_multi_union_pw_aff_get_domain_space(
1071 __isl_keep isl_multi_union_pw_aff *mupa);
1072 __isl_give isl_space *
1073 isl_multi_union_pw_aff_get_space(
1074 __isl_keep isl_multi_union_pw_aff *mupa);
1076 #include <isl/point.h>
1077 __isl_give isl_space *isl_point_get_space(
1078 __isl_keep isl_point *pnt);
1080 The number of dimensions of a given type of space
1081 may be read off from a space or an object that lives
1082 in a space using the following functions.
1083 In case of C<isl_space_dim>, type may be
1084 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1085 C<isl_dim_out> (only for relations), C<isl_dim_set>
1086 (only for sets) or C<isl_dim_all>.
1088 #include <isl/space.h>
1089 unsigned isl_space_dim(__isl_keep isl_space *space,
1090 enum isl_dim_type type);
1092 #include <isl/local_space.h>
1093 int isl_local_space_dim(__isl_keep isl_local_space *ls,
1094 enum isl_dim_type type);
1096 #include <isl/set.h>
1097 unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1098 enum isl_dim_type type);
1099 unsigned isl_set_dim(__isl_keep isl_set *set,
1100 enum isl_dim_type type);
1102 #include <isl/union_set.h>
1103 unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1104 enum isl_dim_type type);
1106 #include <isl/map.h>
1107 unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1108 enum isl_dim_type type);
1109 unsigned isl_map_dim(__isl_keep isl_map *map,
1110 enum isl_dim_type type);
1112 #include <isl/union_map.h>
1113 unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1114 enum isl_dim_type type);
1116 #include <isl/val.h>
1117 unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1118 enum isl_dim_type type);
1120 #include <isl/aff.h>
1121 int isl_aff_dim(__isl_keep isl_aff *aff,
1122 enum isl_dim_type type);
1123 unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1124 enum isl_dim_type type);
1125 unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1126 enum isl_dim_type type);
1127 unsigned isl_pw_multi_aff_dim(
1128 __isl_keep isl_pw_multi_aff *pma,
1129 enum isl_dim_type type);
1130 unsigned isl_multi_pw_aff_dim(
1131 __isl_keep isl_multi_pw_aff *mpa,
1132 enum isl_dim_type type);
1133 unsigned isl_union_pw_aff_dim(
1134 __isl_keep isl_union_pw_aff *upa,
1135 enum isl_dim_type type);
1136 unsigned isl_union_pw_multi_aff_dim(
1137 __isl_keep isl_union_pw_multi_aff *upma,
1138 enum isl_dim_type type);
1139 unsigned isl_multi_union_pw_aff_dim(
1140 __isl_keep isl_multi_union_pw_aff *mupa,
1141 enum isl_dim_type type);
1143 #include <isl/polynomial.h>
1144 unsigned isl_union_pw_qpolynomial_dim(
1145 __isl_keep isl_union_pw_qpolynomial *upwqp,
1146 enum isl_dim_type type);
1147 unsigned isl_union_pw_qpolynomial_fold_dim(
1148 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1149 enum isl_dim_type type);
1151 Note that an C<isl_union_set>, an C<isl_union_map>,
1152 an C<isl_union_pw_multi_aff>,
1153 an C<isl_union_pw_qpolynomial> and
1154 an C<isl_union_pw_qpolynomial_fold>
1155 only have parameters.
1157 The identifiers or names of the individual dimensions of spaces
1158 may be set or read off using the following functions on spaces
1159 or objects that live in spaces.
1160 These functions are mostly useful to obtain the identifiers, positions
1161 or names of the parameters. Identifiers of individual dimensions are
1162 essentially only useful for printing. They are ignored by all other
1163 operations and may not be preserved across those operations.
1165 #include <isl/space.h>
1166 __isl_give isl_space *isl_space_set_dim_id(
1167 __isl_take isl_space *space,
1168 enum isl_dim_type type, unsigned pos,
1169 __isl_take isl_id *id);
1170 isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1171 enum isl_dim_type type, unsigned pos);
1172 __isl_give isl_id *isl_space_get_dim_id(
1173 __isl_keep isl_space *space,
1174 enum isl_dim_type type, unsigned pos);
1175 __isl_give isl_space *isl_space_set_dim_name(
1176 __isl_take isl_space *space,
1177 enum isl_dim_type type, unsigned pos,
1178 __isl_keep const char *name);
1179 isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1180 enum isl_dim_type type, unsigned pos);
1181 __isl_keep const char *isl_space_get_dim_name(
1182 __isl_keep isl_space *space,
1183 enum isl_dim_type type, unsigned pos);
1185 #include <isl/local_space.h>
1186 __isl_give isl_local_space *isl_local_space_set_dim_id(
1187 __isl_take isl_local_space *ls,
1188 enum isl_dim_type type, unsigned pos,
1189 __isl_take isl_id *id);
1190 isl_bool isl_local_space_has_dim_id(
1191 __isl_keep isl_local_space *ls,
1192 enum isl_dim_type type, unsigned pos);
1193 __isl_give isl_id *isl_local_space_get_dim_id(
1194 __isl_keep isl_local_space *ls,
1195 enum isl_dim_type type, unsigned pos);
1196 __isl_give isl_local_space *isl_local_space_set_dim_name(
1197 __isl_take isl_local_space *ls,
1198 enum isl_dim_type type, unsigned pos, const char *s);
1199 isl_bool isl_local_space_has_dim_name(
1200 __isl_keep isl_local_space *ls,
1201 enum isl_dim_type type, unsigned pos)
1202 const char *isl_local_space_get_dim_name(
1203 __isl_keep isl_local_space *ls,
1204 enum isl_dim_type type, unsigned pos);
1206 #include <isl/constraint.h>
1207 const char *isl_constraint_get_dim_name(
1208 __isl_keep isl_constraint *constraint,
1209 enum isl_dim_type type, unsigned pos);
1211 #include <isl/set.h>
1212 __isl_give isl_id *isl_basic_set_get_dim_id(
1213 __isl_keep isl_basic_set *bset,
1214 enum isl_dim_type type, unsigned pos);
1215 __isl_give isl_set *isl_set_set_dim_id(
1216 __isl_take isl_set *set, enum isl_dim_type type,
1217 unsigned pos, __isl_take isl_id *id);
1218 isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1219 enum isl_dim_type type, unsigned pos);
1220 __isl_give isl_id *isl_set_get_dim_id(
1221 __isl_keep isl_set *set, enum isl_dim_type type,
1223 const char *isl_basic_set_get_dim_name(
1224 __isl_keep isl_basic_set *bset,
1225 enum isl_dim_type type, unsigned pos);
1226 isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1227 enum isl_dim_type type, unsigned pos);
1228 const char *isl_set_get_dim_name(
1229 __isl_keep isl_set *set,
1230 enum isl_dim_type type, unsigned pos);
1232 #include <isl/map.h>
1233 __isl_give isl_map *isl_map_set_dim_id(
1234 __isl_take isl_map *map, enum isl_dim_type type,
1235 unsigned pos, __isl_take isl_id *id);
1236 isl_bool isl_basic_map_has_dim_id(
1237 __isl_keep isl_basic_map *bmap,
1238 enum isl_dim_type type, unsigned pos);
1239 isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1240 enum isl_dim_type type, unsigned pos);
1241 __isl_give isl_id *isl_map_get_dim_id(
1242 __isl_keep isl_map *map, enum isl_dim_type type,
1244 __isl_give isl_id *isl_union_map_get_dim_id(
1245 __isl_keep isl_union_map *umap,
1246 enum isl_dim_type type, unsigned pos);
1247 const char *isl_basic_map_get_dim_name(
1248 __isl_keep isl_basic_map *bmap,
1249 enum isl_dim_type type, unsigned pos);
1250 isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1251 enum isl_dim_type type, unsigned pos);
1252 const char *isl_map_get_dim_name(
1253 __isl_keep isl_map *map,
1254 enum isl_dim_type type, unsigned pos);
1256 #include <isl/val.h>
1257 __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1258 __isl_take isl_multi_val *mv,
1259 enum isl_dim_type type, unsigned pos,
1260 __isl_take isl_id *id);
1261 __isl_give isl_id *isl_multi_val_get_dim_id(
1262 __isl_keep isl_multi_val *mv,
1263 enum isl_dim_type type, unsigned pos);
1264 __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1265 __isl_take isl_multi_val *mv,
1266 enum isl_dim_type type, unsigned pos, const char *s);
1268 #include <isl/aff.h>
1269 __isl_give isl_aff *isl_aff_set_dim_id(
1270 __isl_take isl_aff *aff, enum isl_dim_type type,
1271 unsigned pos, __isl_take isl_id *id);
1272 __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1273 __isl_take isl_multi_aff *maff,
1274 enum isl_dim_type type, unsigned pos,
1275 __isl_take isl_id *id);
1276 __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1277 __isl_take isl_pw_aff *pma,
1278 enum isl_dim_type type, unsigned pos,
1279 __isl_take isl_id *id);
1280 __isl_give isl_multi_pw_aff *
1281 isl_multi_pw_aff_set_dim_id(
1282 __isl_take isl_multi_pw_aff *mpa,
1283 enum isl_dim_type type, unsigned pos,
1284 __isl_take isl_id *id);
1285 __isl_give isl_multi_union_pw_aff *
1286 isl_multi_union_pw_aff_set_dim_id(
1287 __isl_take isl_multi_union_pw_aff *mupa,
1288 enum isl_dim_type type, unsigned pos,
1289 __isl_take isl_id *id);
1290 __isl_give isl_id *isl_multi_aff_get_dim_id(
1291 __isl_keep isl_multi_aff *ma,
1292 enum isl_dim_type type, unsigned pos);
1293 isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1294 enum isl_dim_type type, unsigned pos);
1295 __isl_give isl_id *isl_pw_aff_get_dim_id(
1296 __isl_keep isl_pw_aff *pa,
1297 enum isl_dim_type type, unsigned pos);
1298 __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1299 __isl_keep isl_pw_multi_aff *pma,
1300 enum isl_dim_type type, unsigned pos);
1301 __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1302 __isl_keep isl_multi_pw_aff *mpa,
1303 enum isl_dim_type type, unsigned pos);
1304 __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1305 __isl_keep isl_multi_union_pw_aff *mupa,
1306 enum isl_dim_type type, unsigned pos);
1307 __isl_give isl_aff *isl_aff_set_dim_name(
1308 __isl_take isl_aff *aff, enum isl_dim_type type,
1309 unsigned pos, const char *s);
1310 __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1311 __isl_take isl_multi_aff *maff,
1312 enum isl_dim_type type, unsigned pos, const char *s);
1313 __isl_give isl_multi_pw_aff *
1314 isl_multi_pw_aff_set_dim_name(
1315 __isl_take isl_multi_pw_aff *mpa,
1316 enum isl_dim_type type, unsigned pos, const char *s);
1317 __isl_give isl_union_pw_aff *
1318 isl_union_pw_aff_set_dim_name(
1319 __isl_take isl_union_pw_aff *upa,
1320 enum isl_dim_type type, unsigned pos,
1322 __isl_give isl_union_pw_multi_aff *
1323 isl_union_pw_multi_aff_set_dim_name(
1324 __isl_take isl_union_pw_multi_aff *upma,
1325 enum isl_dim_type type, unsigned pos,
1327 __isl_give isl_multi_union_pw_aff *
1328 isl_multi_union_pw_aff_set_dim_name(
1329 __isl_take isl_multi_union_pw_aff *mupa,
1330 enum isl_dim_type type, unsigned pos,
1331 const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1332 enum isl_dim_type type, unsigned pos);
1333 const char *isl_pw_aff_get_dim_name(
1334 __isl_keep isl_pw_aff *pa,
1335 enum isl_dim_type type, unsigned pos);
1336 const char *isl_pw_multi_aff_get_dim_name(
1337 __isl_keep isl_pw_multi_aff *pma,
1338 enum isl_dim_type type, unsigned pos);
1340 #include <isl/polynomial.h>
1341 __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1342 __isl_take isl_qpolynomial *qp,
1343 enum isl_dim_type type, unsigned pos,
1345 __isl_give isl_pw_qpolynomial *
1346 isl_pw_qpolynomial_set_dim_name(
1347 __isl_take isl_pw_qpolynomial *pwqp,
1348 enum isl_dim_type type, unsigned pos,
1350 __isl_give isl_pw_qpolynomial_fold *
1351 isl_pw_qpolynomial_fold_set_dim_name(
1352 __isl_take isl_pw_qpolynomial_fold *pwf,
1353 enum isl_dim_type type, unsigned pos,
1355 __isl_give isl_union_pw_qpolynomial *
1356 isl_union_pw_qpolynomial_set_dim_name(
1357 __isl_take isl_union_pw_qpolynomial *upwqp,
1358 enum isl_dim_type type, unsigned pos,
1360 __isl_give isl_union_pw_qpolynomial_fold *
1361 isl_union_pw_qpolynomial_fold_set_dim_name(
1362 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1363 enum isl_dim_type type, unsigned pos,
1366 Note that C<isl_space_get_name> returns a pointer to some internal
1367 data structure, so the result can only be used while the
1368 corresponding C<isl_space> is alive.
1369 Also note that every function that operates on two sets or relations
1370 requires that both arguments have the same parameters. This also
1371 means that if one of the arguments has named parameters, then the
1372 other needs to have named parameters too and the names need to match.
1373 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1374 arguments may have different parameters (as long as they are named),
1375 in which case the result will have as parameters the union of the parameters of
1378 Given the identifier or name of a dimension (typically a parameter),
1379 its position can be obtained from the following functions.
1381 #include <isl/space.h>
1382 int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1383 enum isl_dim_type type, __isl_keep isl_id *id);
1384 int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1385 enum isl_dim_type type, const char *name);
1387 #include <isl/local_space.h>
1388 int isl_local_space_find_dim_by_name(
1389 __isl_keep isl_local_space *ls,
1390 enum isl_dim_type type, const char *name);
1392 #include <isl/val.h>
1393 int isl_multi_val_find_dim_by_id(
1394 __isl_keep isl_multi_val *mv,
1395 enum isl_dim_type type, __isl_keep isl_id *id);
1396 int isl_multi_val_find_dim_by_name(
1397 __isl_keep isl_multi_val *mv,
1398 enum isl_dim_type type, const char *name);
1400 #include <isl/set.h>
1401 int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1402 enum isl_dim_type type, __isl_keep isl_id *id);
1403 int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1404 enum isl_dim_type type, const char *name);
1406 #include <isl/map.h>
1407 int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1408 enum isl_dim_type type, __isl_keep isl_id *id);
1409 int isl_basic_map_find_dim_by_name(
1410 __isl_keep isl_basic_map *bmap,
1411 enum isl_dim_type type, const char *name);
1412 int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1413 enum isl_dim_type type, const char *name);
1414 int isl_union_map_find_dim_by_name(
1415 __isl_keep isl_union_map *umap,
1416 enum isl_dim_type type, const char *name);
1418 #include <isl/aff.h>
1419 int isl_multi_aff_find_dim_by_id(
1420 __isl_keep isl_multi_aff *ma,
1421 enum isl_dim_type type, __isl_keep isl_id *id);
1422 int isl_multi_pw_aff_find_dim_by_id(
1423 __isl_keep isl_multi_pw_aff *mpa,
1424 enum isl_dim_type type, __isl_keep isl_id *id);
1425 int isl_multi_union_pw_aff_find_dim_by_id(
1426 __isl_keep isl_union_multi_pw_aff *mupa,
1427 enum isl_dim_type type, __isl_keep isl_id *id);
1428 int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1429 enum isl_dim_type type, const char *name);
1430 int isl_multi_aff_find_dim_by_name(
1431 __isl_keep isl_multi_aff *ma,
1432 enum isl_dim_type type, const char *name);
1433 int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1434 enum isl_dim_type type, const char *name);
1435 int isl_multi_pw_aff_find_dim_by_name(
1436 __isl_keep isl_multi_pw_aff *mpa,
1437 enum isl_dim_type type, const char *name);
1438 int isl_pw_multi_aff_find_dim_by_name(
1439 __isl_keep isl_pw_multi_aff *pma,
1440 enum isl_dim_type type, const char *name);
1441 int isl_union_pw_aff_find_dim_by_name(
1442 __isl_keep isl_union_pw_aff *upa,
1443 enum isl_dim_type type, const char *name);
1444 int isl_union_pw_multi_aff_find_dim_by_name(
1445 __isl_keep isl_union_pw_multi_aff *upma,
1446 enum isl_dim_type type, const char *name);
1447 int isl_multi_union_pw_aff_find_dim_by_name(
1448 __isl_keep isl_multi_union_pw_aff *mupa,
1449 enum isl_dim_type type, const char *name);
1451 #include <isl/polynomial.h>
1452 int isl_pw_qpolynomial_find_dim_by_name(
1453 __isl_keep isl_pw_qpolynomial *pwqp,
1454 enum isl_dim_type type, const char *name);
1455 int isl_pw_qpolynomial_fold_find_dim_by_name(
1456 __isl_keep isl_pw_qpolynomial_fold *pwf,
1457 enum isl_dim_type type, const char *name);
1458 int isl_union_pw_qpolynomial_find_dim_by_name(
1459 __isl_keep isl_union_pw_qpolynomial *upwqp,
1460 enum isl_dim_type type, const char *name);
1461 int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1462 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1463 enum isl_dim_type type, const char *name);
1465 The identifiers or names of entire spaces may be set or read off
1466 using the following functions.
1468 #include <isl/space.h>
1469 __isl_give isl_space *isl_space_set_tuple_id(
1470 __isl_take isl_space *space,
1471 enum isl_dim_type type, __isl_take isl_id *id);
1472 __isl_give isl_space *isl_space_reset_tuple_id(
1473 __isl_take isl_space *space, enum isl_dim_type type);
1474 isl_bool isl_space_has_tuple_id(
1475 __isl_keep isl_space *space,
1476 enum isl_dim_type type);
1477 __isl_give isl_id *isl_space_get_tuple_id(
1478 __isl_keep isl_space *space, enum isl_dim_type type);
1479 __isl_give isl_space *isl_space_set_tuple_name(
1480 __isl_take isl_space *space,
1481 enum isl_dim_type type, const char *s);
1482 isl_bool isl_space_has_tuple_name(
1483 __isl_keep isl_space *space,
1484 enum isl_dim_type type);
1485 const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1486 enum isl_dim_type type);
1488 #include <isl/local_space.h>
1489 __isl_give isl_local_space *isl_local_space_set_tuple_id(
1490 __isl_take isl_local_space *ls,
1491 enum isl_dim_type type, __isl_take isl_id *id);
1493 #include <isl/set.h>
1494 __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1495 __isl_take isl_basic_set *bset,
1496 __isl_take isl_id *id);
1497 __isl_give isl_set *isl_set_set_tuple_id(
1498 __isl_take isl_set *set, __isl_take isl_id *id);
1499 __isl_give isl_set *isl_set_reset_tuple_id(
1500 __isl_take isl_set *set);
1501 isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1502 __isl_give isl_id *isl_set_get_tuple_id(
1503 __isl_keep isl_set *set);
1504 __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1505 __isl_take isl_basic_set *set, const char *s);
1506 __isl_give isl_set *isl_set_set_tuple_name(
1507 __isl_take isl_set *set, const char *s);
1508 const char *isl_basic_set_get_tuple_name(
1509 __isl_keep isl_basic_set *bset);
1510 isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1511 const char *isl_set_get_tuple_name(
1512 __isl_keep isl_set *set);
1514 #include <isl/map.h>
1515 __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1516 __isl_take isl_basic_map *bmap,
1517 enum isl_dim_type type, __isl_take isl_id *id);
1518 __isl_give isl_map *isl_map_set_tuple_id(
1519 __isl_take isl_map *map, enum isl_dim_type type,
1520 __isl_take isl_id *id);
1521 __isl_give isl_map *isl_map_reset_tuple_id(
1522 __isl_take isl_map *map, enum isl_dim_type type);
1523 isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1524 enum isl_dim_type type);
1525 __isl_give isl_id *isl_map_get_tuple_id(
1526 __isl_keep isl_map *map, enum isl_dim_type type);
1527 __isl_give isl_map *isl_map_set_tuple_name(
1528 __isl_take isl_map *map,
1529 enum isl_dim_type type, const char *s);
1530 const char *isl_basic_map_get_tuple_name(
1531 __isl_keep isl_basic_map *bmap,
1532 enum isl_dim_type type);
1533 __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1534 __isl_take isl_basic_map *bmap,
1535 enum isl_dim_type type, const char *s);
1536 isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1537 enum isl_dim_type type);
1538 const char *isl_map_get_tuple_name(
1539 __isl_keep isl_map *map,
1540 enum isl_dim_type type);
1542 #include <isl/val.h>
1543 __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1544 __isl_take isl_multi_val *mv,
1545 enum isl_dim_type type, __isl_take isl_id *id);
1546 __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1547 __isl_take isl_multi_val *mv,
1548 enum isl_dim_type type);
1549 isl_bool isl_multi_val_has_tuple_id(
1550 __isl_keep isl_multi_val *mv,
1551 enum isl_dim_type type);
1552 __isl_give isl_id *isl_multi_val_get_tuple_id(
1553 __isl_keep isl_multi_val *mv,
1554 enum isl_dim_type type);
1555 __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1556 __isl_take isl_multi_val *mv,
1557 enum isl_dim_type type, const char *s);
1558 const char *isl_multi_val_get_tuple_name(
1559 __isl_keep isl_multi_val *mv,
1560 enum isl_dim_type type);
1562 #include <isl/aff.h>
1563 __isl_give isl_aff *isl_aff_set_tuple_id(
1564 __isl_take isl_aff *aff,
1565 enum isl_dim_type type, __isl_take isl_id *id);
1566 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1567 __isl_take isl_multi_aff *maff,
1568 enum isl_dim_type type, __isl_take isl_id *id);
1569 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1570 __isl_take isl_pw_aff *pwaff,
1571 enum isl_dim_type type, __isl_take isl_id *id);
1572 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1573 __isl_take isl_pw_multi_aff *pma,
1574 enum isl_dim_type type, __isl_take isl_id *id);
1575 __isl_give isl_multi_union_pw_aff *
1576 isl_multi_union_pw_aff_set_tuple_id(
1577 __isl_take isl_multi_union_pw_aff *mupa,
1578 enum isl_dim_type type, __isl_take isl_id *id);
1579 __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1580 __isl_take isl_multi_aff *ma,
1581 enum isl_dim_type type);
1582 __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1583 __isl_take isl_pw_aff *pa,
1584 enum isl_dim_type type);
1585 __isl_give isl_multi_pw_aff *
1586 isl_multi_pw_aff_reset_tuple_id(
1587 __isl_take isl_multi_pw_aff *mpa,
1588 enum isl_dim_type type);
1589 __isl_give isl_pw_multi_aff *
1590 isl_pw_multi_aff_reset_tuple_id(
1591 __isl_take isl_pw_multi_aff *pma,
1592 enum isl_dim_type type);
1593 __isl_give isl_multi_union_pw_aff *
1594 isl_multi_union_pw_aff_reset_tuple_id(
1595 __isl_take isl_multi_union_pw_aff *mupa,
1596 enum isl_dim_type type);
1597 isl_bool isl_multi_aff_has_tuple_id(
1598 __isl_keep isl_multi_aff *ma,
1599 enum isl_dim_type type);
1600 __isl_give isl_id *isl_multi_aff_get_tuple_id(
1601 __isl_keep isl_multi_aff *ma,
1602 enum isl_dim_type type);
1603 isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1604 enum isl_dim_type type);
1605 __isl_give isl_id *isl_pw_aff_get_tuple_id(
1606 __isl_keep isl_pw_aff *pa,
1607 enum isl_dim_type type);
1608 isl_bool isl_pw_multi_aff_has_tuple_id(
1609 __isl_keep isl_pw_multi_aff *pma,
1610 enum isl_dim_type type);
1611 __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1612 __isl_keep isl_pw_multi_aff *pma,
1613 enum isl_dim_type type);
1614 isl_bool isl_multi_pw_aff_has_tuple_id(
1615 __isl_keep isl_multi_pw_aff *mpa,
1616 enum isl_dim_type type);
1617 __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1618 __isl_keep isl_multi_pw_aff *mpa,
1619 enum isl_dim_type type);
1620 isl_bool isl_multi_union_pw_aff_has_tuple_id(
1621 __isl_keep isl_multi_union_pw_aff *mupa,
1622 enum isl_dim_type type);
1623 __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1624 __isl_keep isl_multi_union_pw_aff *mupa,
1625 enum isl_dim_type type);
1626 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1627 __isl_take isl_multi_aff *maff,
1628 enum isl_dim_type type, const char *s);
1629 __isl_give isl_multi_pw_aff *
1630 isl_multi_pw_aff_set_tuple_name(
1631 __isl_take isl_multi_pw_aff *mpa,
1632 enum isl_dim_type type, const char *s);
1633 __isl_give isl_multi_union_pw_aff *
1634 isl_multi_union_pw_aff_set_tuple_name(
1635 __isl_take isl_multi_union_pw_aff *mupa,
1636 enum isl_dim_type type, const char *s);
1637 const char *isl_multi_aff_get_tuple_name(
1638 __isl_keep isl_multi_aff *multi,
1639 enum isl_dim_type type);
1640 isl_bool isl_pw_multi_aff_has_tuple_name(
1641 __isl_keep isl_pw_multi_aff *pma,
1642 enum isl_dim_type type);
1643 const char *isl_pw_multi_aff_get_tuple_name(
1644 __isl_keep isl_pw_multi_aff *pma,
1645 enum isl_dim_type type);
1646 const char *isl_multi_union_pw_aff_get_tuple_name(
1647 __isl_keep isl_multi_union_pw_aff *mupa,
1648 enum isl_dim_type type);
1650 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1651 or C<isl_dim_set>. As with C<isl_space_get_name>,
1652 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1654 Binary operations require the corresponding spaces of their arguments
1655 to have the same name.
1657 To keep the names of all parameters and tuples, but reset the user pointers
1658 of all the corresponding identifiers, use the following function.
1660 #include <isl/space.h>
1661 __isl_give isl_space *isl_space_reset_user(
1662 __isl_take isl_space *space);
1664 #include <isl/set.h>
1665 __isl_give isl_set *isl_set_reset_user(
1666 __isl_take isl_set *set);
1668 #include <isl/map.h>
1669 __isl_give isl_map *isl_map_reset_user(
1670 __isl_take isl_map *map);
1672 #include <isl/union_set.h>
1673 __isl_give isl_union_set *isl_union_set_reset_user(
1674 __isl_take isl_union_set *uset);
1676 #include <isl/union_map.h>
1677 __isl_give isl_union_map *isl_union_map_reset_user(
1678 __isl_take isl_union_map *umap);
1680 #include <isl/val.h>
1681 __isl_give isl_multi_val *isl_multi_val_reset_user(
1682 __isl_take isl_multi_val *mv);
1684 #include <isl/aff.h>
1685 __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1686 __isl_take isl_multi_aff *ma);
1687 __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1688 __isl_take isl_pw_aff *pa);
1689 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1690 __isl_take isl_multi_pw_aff *mpa);
1691 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1692 __isl_take isl_pw_multi_aff *pma);
1693 __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1694 __isl_take isl_union_pw_aff *upa);
1695 __isl_give isl_multi_union_pw_aff *
1696 isl_multi_union_pw_aff_reset_user(
1697 __isl_take isl_multi_union_pw_aff *mupa);
1698 __isl_give isl_union_pw_multi_aff *
1699 isl_union_pw_multi_aff_reset_user(
1700 __isl_take isl_union_pw_multi_aff *upma);
1702 #include <isl/polynomial.h>
1703 __isl_give isl_pw_qpolynomial *
1704 isl_pw_qpolynomial_reset_user(
1705 __isl_take isl_pw_qpolynomial *pwqp);
1706 __isl_give isl_union_pw_qpolynomial *
1707 isl_union_pw_qpolynomial_reset_user(
1708 __isl_take isl_union_pw_qpolynomial *upwqp);
1709 __isl_give isl_pw_qpolynomial_fold *
1710 isl_pw_qpolynomial_fold_reset_user(
1711 __isl_take isl_pw_qpolynomial_fold *pwf);
1712 __isl_give isl_union_pw_qpolynomial_fold *
1713 isl_union_pw_qpolynomial_fold_reset_user(
1714 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1716 Spaces can be nested. In particular, the domain of a set or
1717 the domain or range of a relation can be a nested relation.
1718 This process is also called I<wrapping>.
1719 The functions for detecting, constructing and deconstructing
1720 such nested spaces can be found in the wrapping properties
1721 of L</"Unary Properties">, the wrapping operations
1722 of L</"Unary Operations"> and the Cartesian product operations
1723 of L</"Basic Operations">.
1725 Spaces can be created from other spaces
1726 using the functions described in L</"Unary Operations">
1727 and L</"Binary Operations">.
1731 A local space is essentially a space with
1732 zero or more existentially quantified variables.
1733 The local space of various objects can be obtained
1734 using the following functions.
1736 #include <isl/constraint.h>
1737 __isl_give isl_local_space *isl_constraint_get_local_space(
1738 __isl_keep isl_constraint *constraint);
1740 #include <isl/set.h>
1741 __isl_give isl_local_space *isl_basic_set_get_local_space(
1742 __isl_keep isl_basic_set *bset);
1744 #include <isl/map.h>
1745 __isl_give isl_local_space *isl_basic_map_get_local_space(
1746 __isl_keep isl_basic_map *bmap);
1748 #include <isl/aff.h>
1749 __isl_give isl_local_space *isl_aff_get_domain_local_space(
1750 __isl_keep isl_aff *aff);
1751 __isl_give isl_local_space *isl_aff_get_local_space(
1752 __isl_keep isl_aff *aff);
1754 A new local space can be created from a space using
1756 #include <isl/local_space.h>
1757 __isl_give isl_local_space *isl_local_space_from_space(
1758 __isl_take isl_space *space);
1760 They can be inspected, modified, copied and freed using the following functions.
1762 #include <isl/local_space.h>
1763 isl_bool isl_local_space_is_params(
1764 __isl_keep isl_local_space *ls);
1765 isl_bool isl_local_space_is_set(
1766 __isl_keep isl_local_space *ls);
1767 __isl_give isl_space *isl_local_space_get_space(
1768 __isl_keep isl_local_space *ls);
1769 __isl_give isl_aff *isl_local_space_get_div(
1770 __isl_keep isl_local_space *ls, int pos);
1771 __isl_give isl_local_space *isl_local_space_copy(
1772 __isl_keep isl_local_space *ls);
1773 __isl_null isl_local_space *isl_local_space_free(
1774 __isl_take isl_local_space *ls);
1776 Note that C<isl_local_space_get_div> can only be used on local spaces
1779 Two local spaces can be compared using
1781 isl_bool isl_local_space_is_equal(
1782 __isl_keep isl_local_space *ls1,
1783 __isl_keep isl_local_space *ls2);
1785 Local spaces can be created from other local spaces
1786 using the functions described in L</"Unary Operations">
1787 and L</"Binary Operations">.
1789 =head2 Creating New Sets and Relations
1791 C<isl> has functions for creating some standard sets and relations.
1795 =item * Empty sets and relations
1797 __isl_give isl_basic_set *isl_basic_set_empty(
1798 __isl_take isl_space *space);
1799 __isl_give isl_basic_map *isl_basic_map_empty(
1800 __isl_take isl_space *space);
1801 __isl_give isl_set *isl_set_empty(
1802 __isl_take isl_space *space);
1803 __isl_give isl_map *isl_map_empty(
1804 __isl_take isl_space *space);
1805 __isl_give isl_union_set *isl_union_set_empty(
1806 __isl_take isl_space *space);
1807 __isl_give isl_union_map *isl_union_map_empty(
1808 __isl_take isl_space *space);
1810 For C<isl_union_set>s and C<isl_union_map>s, the space
1811 is only used to specify the parameters.
1813 =item * Universe sets and relations
1815 __isl_give isl_basic_set *isl_basic_set_universe(
1816 __isl_take isl_space *space);
1817 __isl_give isl_basic_map *isl_basic_map_universe(
1818 __isl_take isl_space *space);
1819 __isl_give isl_set *isl_set_universe(
1820 __isl_take isl_space *space);
1821 __isl_give isl_map *isl_map_universe(
1822 __isl_take isl_space *space);
1823 __isl_give isl_union_set *isl_union_set_universe(
1824 __isl_take isl_union_set *uset);
1825 __isl_give isl_union_map *isl_union_map_universe(
1826 __isl_take isl_union_map *umap);
1828 The sets and relations constructed by the functions above
1829 contain all integer values, while those constructed by the
1830 functions below only contain non-negative values.
1832 __isl_give isl_basic_set *isl_basic_set_nat_universe(
1833 __isl_take isl_space *space);
1834 __isl_give isl_basic_map *isl_basic_map_nat_universe(
1835 __isl_take isl_space *space);
1836 __isl_give isl_set *isl_set_nat_universe(
1837 __isl_take isl_space *space);
1838 __isl_give isl_map *isl_map_nat_universe(
1839 __isl_take isl_space *space);
1841 =item * Identity relations
1843 __isl_give isl_basic_map *isl_basic_map_identity(
1844 __isl_take isl_space *space);
1845 __isl_give isl_map *isl_map_identity(
1846 __isl_take isl_space *space);
1848 The number of input and output dimensions in C<space> needs
1851 =item * Lexicographic order
1853 __isl_give isl_map *isl_map_lex_lt(
1854 __isl_take isl_space *set_space);
1855 __isl_give isl_map *isl_map_lex_le(
1856 __isl_take isl_space *set_space);
1857 __isl_give isl_map *isl_map_lex_gt(
1858 __isl_take isl_space *set_space);
1859 __isl_give isl_map *isl_map_lex_ge(
1860 __isl_take isl_space *set_space);
1861 __isl_give isl_map *isl_map_lex_lt_first(
1862 __isl_take isl_space *space, unsigned n);
1863 __isl_give isl_map *isl_map_lex_le_first(
1864 __isl_take isl_space *space, unsigned n);
1865 __isl_give isl_map *isl_map_lex_gt_first(
1866 __isl_take isl_space *space, unsigned n);
1867 __isl_give isl_map *isl_map_lex_ge_first(
1868 __isl_take isl_space *space, unsigned n);
1870 The first four functions take a space for a B<set>
1871 and return relations that express that the elements in the domain
1872 are lexicographically less
1873 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1874 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1875 than the elements in the range.
1876 The last four functions take a space for a map
1877 and return relations that express that the first C<n> dimensions
1878 in the domain are lexicographically less
1879 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1880 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1881 than the first C<n> dimensions in the range.
1885 A basic set or relation can be converted to a set or relation
1886 using the following functions.
1888 __isl_give isl_set *isl_set_from_basic_set(
1889 __isl_take isl_basic_set *bset);
1890 __isl_give isl_map *isl_map_from_basic_map(
1891 __isl_take isl_basic_map *bmap);
1893 Sets and relations can be converted to union sets and relations
1894 using the following functions.
1896 __isl_give isl_union_set *isl_union_set_from_basic_set(
1897 __isl_take isl_basic_set *bset);
1898 __isl_give isl_union_map *isl_union_map_from_basic_map(
1899 __isl_take isl_basic_map *bmap);
1900 __isl_give isl_union_set *isl_union_set_from_set(
1901 __isl_take isl_set *set);
1902 __isl_give isl_union_map *isl_union_map_from_map(
1903 __isl_take isl_map *map);
1905 The inverse conversions below can only be used if the input
1906 union set or relation is known to contain elements in exactly one
1909 __isl_give isl_set *isl_set_from_union_set(
1910 __isl_take isl_union_set *uset);
1911 __isl_give isl_map *isl_map_from_union_map(
1912 __isl_take isl_union_map *umap);
1914 Sets and relations can be copied and freed again using the following
1917 __isl_give isl_basic_set *isl_basic_set_copy(
1918 __isl_keep isl_basic_set *bset);
1919 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1920 __isl_give isl_union_set *isl_union_set_copy(
1921 __isl_keep isl_union_set *uset);
1922 __isl_give isl_basic_map *isl_basic_map_copy(
1923 __isl_keep isl_basic_map *bmap);
1924 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1925 __isl_give isl_union_map *isl_union_map_copy(
1926 __isl_keep isl_union_map *umap);
1927 __isl_null isl_basic_set *isl_basic_set_free(
1928 __isl_take isl_basic_set *bset);
1929 __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1930 __isl_null isl_union_set *isl_union_set_free(
1931 __isl_take isl_union_set *uset);
1932 __isl_null isl_basic_map *isl_basic_map_free(
1933 __isl_take isl_basic_map *bmap);
1934 __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1935 __isl_null isl_union_map *isl_union_map_free(
1936 __isl_take isl_union_map *umap);
1938 Other sets and relations can be constructed by starting
1939 from a universe set or relation, adding equality and/or
1940 inequality constraints and then projecting out the
1941 existentially quantified variables, if any.
1942 Constraints can be constructed, manipulated and
1943 added to (or removed from) (basic) sets and relations
1944 using the following functions.
1946 #include <isl/constraint.h>
1947 __isl_give isl_constraint *isl_constraint_alloc_equality(
1948 __isl_take isl_local_space *ls);
1949 __isl_give isl_constraint *isl_constraint_alloc_inequality(
1950 __isl_take isl_local_space *ls);
1951 __isl_give isl_constraint *isl_constraint_set_constant_si(
1952 __isl_take isl_constraint *constraint, int v);
1953 __isl_give isl_constraint *isl_constraint_set_constant_val(
1954 __isl_take isl_constraint *constraint,
1955 __isl_take isl_val *v);
1956 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1957 __isl_take isl_constraint *constraint,
1958 enum isl_dim_type type, int pos, int v);
1959 __isl_give isl_constraint *
1960 isl_constraint_set_coefficient_val(
1961 __isl_take isl_constraint *constraint,
1962 enum isl_dim_type type, int pos,
1963 __isl_take isl_val *v);
1964 __isl_give isl_basic_map *isl_basic_map_add_constraint(
1965 __isl_take isl_basic_map *bmap,
1966 __isl_take isl_constraint *constraint);
1967 __isl_give isl_basic_set *isl_basic_set_add_constraint(
1968 __isl_take isl_basic_set *bset,
1969 __isl_take isl_constraint *constraint);
1970 __isl_give isl_map *isl_map_add_constraint(
1971 __isl_take isl_map *map,
1972 __isl_take isl_constraint *constraint);
1973 __isl_give isl_set *isl_set_add_constraint(
1974 __isl_take isl_set *set,
1975 __isl_take isl_constraint *constraint);
1977 For example, to create a set containing the even integers
1978 between 10 and 42, you would use the following code.
1981 isl_local_space *ls;
1983 isl_basic_set *bset;
1985 space = isl_space_set_alloc(ctx, 0, 2);
1986 bset = isl_basic_set_universe(isl_space_copy(space));
1987 ls = isl_local_space_from_space(space);
1989 c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
1990 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1991 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1992 bset = isl_basic_set_add_constraint(bset, c);
1994 c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
1995 c = isl_constraint_set_constant_si(c, -10);
1996 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1997 bset = isl_basic_set_add_constraint(bset, c);
1999 c = isl_constraint_alloc_inequality(ls);
2000 c = isl_constraint_set_constant_si(c, 42);
2001 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2002 bset = isl_basic_set_add_constraint(bset, c);
2004 bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
2008 isl_basic_set *bset;
2009 bset = isl_basic_set_read_from_str(ctx,
2010 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
2012 A basic set or relation can also be constructed from two matrices
2013 describing the equalities and the inequalities.
2015 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
2016 __isl_take isl_space *space,
2017 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2018 enum isl_dim_type c1,
2019 enum isl_dim_type c2, enum isl_dim_type c3,
2020 enum isl_dim_type c4);
2021 __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
2022 __isl_take isl_space *space,
2023 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2024 enum isl_dim_type c1,
2025 enum isl_dim_type c2, enum isl_dim_type c3,
2026 enum isl_dim_type c4, enum isl_dim_type c5);
2028 The C<isl_dim_type> arguments indicate the order in which
2029 different kinds of variables appear in the input matrices
2030 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
2031 C<isl_dim_set> and C<isl_dim_div> for sets and
2032 of C<isl_dim_cst>, C<isl_dim_param>,
2033 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2035 A (basic or union) set or relation can also be constructed from a
2036 (union) (piecewise) (multiple) affine expression
2037 or a list of affine expressions
2038 (See L</"Functions">), provided these affine expressions do not
2041 __isl_give isl_basic_map *isl_basic_map_from_aff(
2042 __isl_take isl_aff *aff);
2043 __isl_give isl_map *isl_map_from_aff(
2044 __isl_take isl_aff *aff);
2045 __isl_give isl_set *isl_set_from_pw_aff(
2046 __isl_take isl_pw_aff *pwaff);
2047 __isl_give isl_map *isl_map_from_pw_aff(
2048 __isl_take isl_pw_aff *pwaff);
2049 __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2050 __isl_take isl_space *domain_space,
2051 __isl_take isl_aff_list *list);
2052 __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2053 __isl_take isl_multi_aff *maff)
2054 __isl_give isl_map *isl_map_from_multi_aff(
2055 __isl_take isl_multi_aff *maff)
2056 __isl_give isl_set *isl_set_from_pw_multi_aff(
2057 __isl_take isl_pw_multi_aff *pma);
2058 __isl_give isl_map *isl_map_from_pw_multi_aff(
2059 __isl_take isl_pw_multi_aff *pma);
2060 __isl_give isl_set *isl_set_from_multi_pw_aff(
2061 __isl_take isl_multi_pw_aff *mpa);
2062 __isl_give isl_map *isl_map_from_multi_pw_aff(
2063 __isl_take isl_multi_pw_aff *mpa);
2064 __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2065 __isl_take isl_union_pw_aff *upa);
2066 __isl_give isl_union_map *
2067 isl_union_map_from_union_pw_multi_aff(
2068 __isl_take isl_union_pw_multi_aff *upma);
2069 __isl_give isl_union_map *
2070 isl_union_map_from_multi_union_pw_aff(
2071 __isl_take isl_multi_union_pw_aff *mupa);
2073 The C<domain_space> argument describes the domain of the resulting
2074 basic relation. It is required because the C<list> may consist
2075 of zero affine expressions.
2076 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2077 is not allowed to be zero-dimensional. The domain of the result
2078 is the shared domain of the union piecewise affine elements.
2080 =head2 Inspecting Sets and Relations
2082 Usually, the user should not have to care about the actual constraints
2083 of the sets and maps, but should instead apply the abstract operations
2084 explained in the following sections.
2085 Occasionally, however, it may be required to inspect the individual
2086 coefficients of the constraints. This section explains how to do so.
2087 In these cases, it may also be useful to have C<isl> compute
2088 an explicit representation of the existentially quantified variables.
2090 __isl_give isl_set *isl_set_compute_divs(
2091 __isl_take isl_set *set);
2092 __isl_give isl_map *isl_map_compute_divs(
2093 __isl_take isl_map *map);
2094 __isl_give isl_union_set *isl_union_set_compute_divs(
2095 __isl_take isl_union_set *uset);
2096 __isl_give isl_union_map *isl_union_map_compute_divs(
2097 __isl_take isl_union_map *umap);
2099 This explicit representation defines the existentially quantified
2100 variables as integer divisions of the other variables, possibly
2101 including earlier existentially quantified variables.
2102 An explicitly represented existentially quantified variable therefore
2103 has a unique value when the values of the other variables are known.
2104 If, furthermore, the same existentials, i.e., existentials
2105 with the same explicit representations, should appear in the
2106 same order in each of the disjuncts of a set or map, then the user should call
2107 either of the following functions.
2109 __isl_give isl_set *isl_set_align_divs(
2110 __isl_take isl_set *set);
2111 __isl_give isl_map *isl_map_align_divs(
2112 __isl_take isl_map *map);
2114 Alternatively, the existentially quantified variables can be removed
2115 using the following functions, which compute an overapproximation.
2117 __isl_give isl_basic_set *isl_basic_set_remove_divs(
2118 __isl_take isl_basic_set *bset);
2119 __isl_give isl_basic_map *isl_basic_map_remove_divs(
2120 __isl_take isl_basic_map *bmap);
2121 __isl_give isl_set *isl_set_remove_divs(
2122 __isl_take isl_set *set);
2123 __isl_give isl_map *isl_map_remove_divs(
2124 __isl_take isl_map *map);
2126 It is also possible to only remove those divs that are defined
2127 in terms of a given range of dimensions or only those for which
2128 no explicit representation is known.
2130 __isl_give isl_basic_set *
2131 isl_basic_set_remove_divs_involving_dims(
2132 __isl_take isl_basic_set *bset,
2133 enum isl_dim_type type,
2134 unsigned first, unsigned n);
2135 __isl_give isl_basic_map *
2136 isl_basic_map_remove_divs_involving_dims(
2137 __isl_take isl_basic_map *bmap,
2138 enum isl_dim_type type,
2139 unsigned first, unsigned n);
2140 __isl_give isl_set *isl_set_remove_divs_involving_dims(
2141 __isl_take isl_set *set, enum isl_dim_type type,
2142 unsigned first, unsigned n);
2143 __isl_give isl_map *isl_map_remove_divs_involving_dims(
2144 __isl_take isl_map *map, enum isl_dim_type type,
2145 unsigned first, unsigned n);
2147 __isl_give isl_basic_set *
2148 isl_basic_set_remove_unknown_divs(
2149 __isl_take isl_basic_set *bset);
2150 __isl_give isl_set *isl_set_remove_unknown_divs(
2151 __isl_take isl_set *set);
2152 __isl_give isl_map *isl_map_remove_unknown_divs(
2153 __isl_take isl_map *map);
2155 To iterate over all the sets or maps in a union set or map, use
2157 isl_stat isl_union_set_foreach_set(
2158 __isl_keep isl_union_set *uset,
2159 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2161 isl_stat isl_union_map_foreach_map(
2162 __isl_keep isl_union_map *umap,
2163 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2166 These functions call the callback function once for each
2167 (pair of) space(s) for which there are elements in the input.
2168 The argument to the callback contains all elements in the input
2169 with that (pair of) space(s).
2171 The number of sets or maps in a union set or map can be obtained
2174 int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2175 int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2177 To extract the set or map in a given space from a union, use
2179 __isl_give isl_set *isl_union_set_extract_set(
2180 __isl_keep isl_union_set *uset,
2181 __isl_take isl_space *space);
2182 __isl_give isl_map *isl_union_map_extract_map(
2183 __isl_keep isl_union_map *umap,
2184 __isl_take isl_space *space);
2186 To iterate over all the basic sets or maps in a set or map, use
2188 isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2189 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2192 isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2193 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2197 The callback function C<fn> should return 0 if successful and
2198 -1 if an error occurs. In the latter case, or if any other error
2199 occurs, the above functions will return -1.
2201 It should be noted that C<isl> does not guarantee that
2202 the basic sets or maps passed to C<fn> are disjoint.
2203 If this is required, then the user should call one of
2204 the following functions first.
2206 __isl_give isl_set *isl_set_make_disjoint(
2207 __isl_take isl_set *set);
2208 __isl_give isl_map *isl_map_make_disjoint(
2209 __isl_take isl_map *map);
2211 The number of basic sets in a set can be obtained
2212 or the number of basic maps in a map can be obtained
2215 #include <isl/set.h>
2216 int isl_set_n_basic_set(__isl_keep isl_set *set);
2218 #include <isl/map.h>
2219 int isl_map_n_basic_map(__isl_keep isl_map *map);
2221 It is also possible to obtain a list of basic sets from a set
2223 #include <isl/set.h>
2224 __isl_give isl_basic_set_list *isl_set_get_basic_set_list(
2225 __isl_keep isl_set *set);
2227 The returned list can be manipulated using the functions in L<"Lists">.
2229 To iterate over the constraints of a basic set or map, use
2231 #include <isl/constraint.h>
2233 int isl_basic_set_n_constraint(
2234 __isl_keep isl_basic_set *bset);
2235 isl_stat isl_basic_set_foreach_constraint(
2236 __isl_keep isl_basic_set *bset,
2237 isl_stat (*fn)(__isl_take isl_constraint *c,
2240 int isl_basic_map_n_constraint(
2241 __isl_keep isl_basic_map *bmap);
2242 isl_stat isl_basic_map_foreach_constraint(
2243 __isl_keep isl_basic_map *bmap,
2244 isl_stat (*fn)(__isl_take isl_constraint *c,
2247 __isl_null isl_constraint *isl_constraint_free(
2248 __isl_take isl_constraint *c);
2250 Again, the callback function C<fn> should return 0 if successful and
2251 -1 if an error occurs. In the latter case, or if any other error
2252 occurs, the above functions will return -1.
2253 The constraint C<c> represents either an equality or an inequality.
2254 Use the following function to find out whether a constraint
2255 represents an equality. If not, it represents an inequality.
2257 isl_bool isl_constraint_is_equality(
2258 __isl_keep isl_constraint *constraint);
2260 It is also possible to obtain a list of constraints from a basic
2263 #include <isl/constraint.h>
2264 __isl_give isl_constraint_list *
2265 isl_basic_map_get_constraint_list(
2266 __isl_keep isl_basic_map *bmap);
2267 __isl_give isl_constraint_list *
2268 isl_basic_set_get_constraint_list(
2269 __isl_keep isl_basic_set *bset);
2271 These functions require that all existentially quantified variables
2272 have an explicit representation.
2273 The returned list can be manipulated using the functions in L<"Lists">.
2275 The coefficients of the constraints can be inspected using
2276 the following functions.
2278 isl_bool isl_constraint_is_lower_bound(
2279 __isl_keep isl_constraint *constraint,
2280 enum isl_dim_type type, unsigned pos);
2281 isl_bool isl_constraint_is_upper_bound(
2282 __isl_keep isl_constraint *constraint,
2283 enum isl_dim_type type, unsigned pos);
2284 __isl_give isl_val *isl_constraint_get_constant_val(
2285 __isl_keep isl_constraint *constraint);
2286 __isl_give isl_val *isl_constraint_get_coefficient_val(
2287 __isl_keep isl_constraint *constraint,
2288 enum isl_dim_type type, int pos);
2290 The explicit representations of the existentially quantified
2291 variables can be inspected using the following function.
2292 Note that the user is only allowed to use this function
2293 if the inspected set or map is the result of a call
2294 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2295 The existentially quantified variable is equal to the floor
2296 of the returned affine expression. The affine expression
2297 itself can be inspected using the functions in
2300 __isl_give isl_aff *isl_constraint_get_div(
2301 __isl_keep isl_constraint *constraint, int pos);
2303 To obtain the constraints of a basic set or map in matrix
2304 form, use the following functions.
2306 __isl_give isl_mat *isl_basic_set_equalities_matrix(
2307 __isl_keep isl_basic_set *bset,
2308 enum isl_dim_type c1, enum isl_dim_type c2,
2309 enum isl_dim_type c3, enum isl_dim_type c4);
2310 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2311 __isl_keep isl_basic_set *bset,
2312 enum isl_dim_type c1, enum isl_dim_type c2,
2313 enum isl_dim_type c3, enum isl_dim_type c4);
2314 __isl_give isl_mat *isl_basic_map_equalities_matrix(
2315 __isl_keep isl_basic_map *bmap,
2316 enum isl_dim_type c1,
2317 enum isl_dim_type c2, enum isl_dim_type c3,
2318 enum isl_dim_type c4, enum isl_dim_type c5);
2319 __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2320 __isl_keep isl_basic_map *bmap,
2321 enum isl_dim_type c1,
2322 enum isl_dim_type c2, enum isl_dim_type c3,
2323 enum isl_dim_type c4, enum isl_dim_type c5);
2325 The C<isl_dim_type> arguments dictate the order in which
2326 different kinds of variables appear in the resulting matrix.
2327 For set inputs, they should be a permutation of
2328 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2329 For map inputs, they should be a permutation of
2330 C<isl_dim_cst>, C<isl_dim_param>,
2331 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2335 Points are elements of a set. They can be used to construct
2336 simple sets (boxes) or they can be used to represent the
2337 individual elements of a set.
2338 The zero point (the origin) can be created using
2340 __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2342 The coordinates of a point can be inspected, set and changed
2345 __isl_give isl_val *isl_point_get_coordinate_val(
2346 __isl_keep isl_point *pnt,
2347 enum isl_dim_type type, int pos);
2348 __isl_give isl_point *isl_point_set_coordinate_val(
2349 __isl_take isl_point *pnt,
2350 enum isl_dim_type type, int pos,
2351 __isl_take isl_val *v);
2353 __isl_give isl_point *isl_point_add_ui(
2354 __isl_take isl_point *pnt,
2355 enum isl_dim_type type, int pos, unsigned val);
2356 __isl_give isl_point *isl_point_sub_ui(
2357 __isl_take isl_point *pnt,
2358 enum isl_dim_type type, int pos, unsigned val);
2360 Points can be copied or freed using
2362 __isl_give isl_point *isl_point_copy(
2363 __isl_keep isl_point *pnt);
2364 void isl_point_free(__isl_take isl_point *pnt);
2366 A singleton set can be created from a point using
2368 __isl_give isl_basic_set *isl_basic_set_from_point(
2369 __isl_take isl_point *pnt);
2370 __isl_give isl_set *isl_set_from_point(
2371 __isl_take isl_point *pnt);
2372 __isl_give isl_union_set *isl_union_set_from_point(
2373 __isl_take isl_point *pnt);
2375 and a box can be created from two opposite extremal points using
2377 __isl_give isl_basic_set *isl_basic_set_box_from_points(
2378 __isl_take isl_point *pnt1,
2379 __isl_take isl_point *pnt2);
2380 __isl_give isl_set *isl_set_box_from_points(
2381 __isl_take isl_point *pnt1,
2382 __isl_take isl_point *pnt2);
2384 All elements of a B<bounded> (union) set can be enumerated using
2385 the following functions.
2387 isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2388 isl_stat (*fn)(__isl_take isl_point *pnt,
2391 isl_stat isl_union_set_foreach_point(
2392 __isl_keep isl_union_set *uset,
2393 isl_stat (*fn)(__isl_take isl_point *pnt,
2397 The function C<fn> is called for each integer point in
2398 C<set> with as second argument the last argument of
2399 the C<isl_set_foreach_point> call. The function C<fn>
2400 should return C<0> on success and C<-1> on failure.
2401 In the latter case, C<isl_set_foreach_point> will stop
2402 enumerating and return C<-1> as well.
2403 If the enumeration is performed successfully and to completion,
2404 then C<isl_set_foreach_point> returns C<0>.
2406 To obtain a single point of a (basic or union) set, use
2408 __isl_give isl_point *isl_basic_set_sample_point(
2409 __isl_take isl_basic_set *bset);
2410 __isl_give isl_point *isl_set_sample_point(
2411 __isl_take isl_set *set);
2412 __isl_give isl_point *isl_union_set_sample_point(
2413 __isl_take isl_union_set *uset);
2415 If C<set> does not contain any (integer) points, then the
2416 resulting point will be ``void'', a property that can be
2419 isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2423 Besides sets and relation, C<isl> also supports various types of functions.
2424 Each of these types is derived from the value type (see L</"Values">)
2425 or from one of two primitive function types
2426 through the application of zero or more type constructors.
2427 We first describe the primitive type and then we describe
2428 the types derived from these primitive types.
2430 =head3 Primitive Functions
2432 C<isl> support two primitive function types, quasi-affine
2433 expressions and quasipolynomials.
2434 A quasi-affine expression is defined either over a parameter
2435 space or over a set and is composed of integer constants,
2436 parameters and set variables, addition, subtraction and
2437 integer division by an integer constant.
2438 For example, the quasi-affine expression
2440 [n] -> { [x] -> [2*floor((4 n + x)/9] }
2442 maps C<x> to C<2*floor((4 n + x)/9>.
2443 A quasipolynomial is a polynomial expression in quasi-affine
2444 expression. That is, it additionally allows for multiplication.
2445 Note, though, that it is not allowed to construct an integer
2446 division of an expression involving multiplications.
2447 Here is an example of a quasipolynomial that is not
2448 quasi-affine expression
2450 [n] -> { [x] -> (n*floor((4 n + x)/9) }
2452 Note that the external representations of quasi-affine expressions
2453 and quasipolynomials are different. Quasi-affine expressions
2454 use a notation with square brackets just like binary relations,
2455 while quasipolynomials do not. This might change at some point.
2457 If a primitive function is defined over a parameter space,
2458 then the space of the function itself is that of a set.
2459 If it is defined over a set, then the space of the function
2460 is that of a relation. In both cases, the set space (or
2461 the output space) is single-dimensional, anonymous and unstructured.
2462 To create functions with multiple dimensions or with other kinds
2463 of set or output spaces, use multiple expressions
2464 (see L</"Multiple Expressions">).
2468 =item * Quasi-affine Expressions
2470 Besides the expressions described above, a quasi-affine
2471 expression can also be set to NaN. Such expressions
2472 typically represent a failure to represent a result
2473 as a quasi-affine expression.
2475 The zero quasi affine expression or the quasi affine expression
2476 that is equal to a given value or
2477 a specified dimension on a given domain can be created using
2479 #include <isl/aff.h>
2480 __isl_give isl_aff *isl_aff_zero_on_domain(
2481 __isl_take isl_local_space *ls);
2482 __isl_give isl_aff *isl_aff_val_on_domain(
2483 __isl_take isl_local_space *ls,
2484 __isl_take isl_val *val);
2485 __isl_give isl_aff *isl_aff_var_on_domain(
2486 __isl_take isl_local_space *ls,
2487 enum isl_dim_type type, unsigned pos);
2488 __isl_give isl_aff *isl_aff_nan_on_domain(
2489 __isl_take isl_local_space *ls);
2491 Quasi affine expressions can be copied and freed using
2493 #include <isl/aff.h>
2494 __isl_give isl_aff *isl_aff_copy(
2495 __isl_keep isl_aff *aff);
2496 __isl_null isl_aff *isl_aff_free(
2497 __isl_take isl_aff *aff);
2499 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2500 using the following function. The constraint is required to have
2501 a non-zero coefficient for the specified dimension.
2503 #include <isl/constraint.h>
2504 __isl_give isl_aff *isl_constraint_get_bound(
2505 __isl_keep isl_constraint *constraint,
2506 enum isl_dim_type type, int pos);
2508 The entire affine expression of the constraint can also be extracted
2509 using the following function.
2511 #include <isl/constraint.h>
2512 __isl_give isl_aff *isl_constraint_get_aff(
2513 __isl_keep isl_constraint *constraint);
2515 Conversely, an equality constraint equating
2516 the affine expression to zero or an inequality constraint enforcing
2517 the affine expression to be non-negative, can be constructed using
2519 __isl_give isl_constraint *isl_equality_from_aff(
2520 __isl_take isl_aff *aff);
2521 __isl_give isl_constraint *isl_inequality_from_aff(
2522 __isl_take isl_aff *aff);
2524 The coefficients and the integer divisions of an affine expression
2525 can be inspected using the following functions.
2527 #include <isl/aff.h>
2528 __isl_give isl_val *isl_aff_get_constant_val(
2529 __isl_keep isl_aff *aff);
2530 __isl_give isl_val *isl_aff_get_coefficient_val(
2531 __isl_keep isl_aff *aff,
2532 enum isl_dim_type type, int pos);
2533 int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2534 enum isl_dim_type type, int pos);
2535 __isl_give isl_val *isl_aff_get_denominator_val(
2536 __isl_keep isl_aff *aff);
2537 __isl_give isl_aff *isl_aff_get_div(
2538 __isl_keep isl_aff *aff, int pos);
2540 They can be modified using the following functions.
2542 #include <isl/aff.h>
2543 __isl_give isl_aff *isl_aff_set_constant_si(
2544 __isl_take isl_aff *aff, int v);
2545 __isl_give isl_aff *isl_aff_set_constant_val(
2546 __isl_take isl_aff *aff, __isl_take isl_val *v);
2547 __isl_give isl_aff *isl_aff_set_coefficient_si(
2548 __isl_take isl_aff *aff,
2549 enum isl_dim_type type, int pos, int v);
2550 __isl_give isl_aff *isl_aff_set_coefficient_val(
2551 __isl_take isl_aff *aff,
2552 enum isl_dim_type type, int pos,
2553 __isl_take isl_val *v);
2555 __isl_give isl_aff *isl_aff_add_constant_si(
2556 __isl_take isl_aff *aff, int v);
2557 __isl_give isl_aff *isl_aff_add_constant_val(
2558 __isl_take isl_aff *aff, __isl_take isl_val *v);
2559 __isl_give isl_aff *isl_aff_add_constant_num_si(
2560 __isl_take isl_aff *aff, int v);
2561 __isl_give isl_aff *isl_aff_add_coefficient_si(
2562 __isl_take isl_aff *aff,
2563 enum isl_dim_type type, int pos, int v);
2564 __isl_give isl_aff *isl_aff_add_coefficient_val(
2565 __isl_take isl_aff *aff,
2566 enum isl_dim_type type, int pos,
2567 __isl_take isl_val *v);
2569 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2570 set the I<numerator> of the constant or coefficient, while
2571 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2572 the constant or coefficient as a whole.
2573 The C<add_constant> and C<add_coefficient> functions add an integer
2574 or rational value to
2575 the possibly rational constant or coefficient.
2576 The C<add_constant_num> functions add an integer value to
2579 =item * Quasipolynomials
2581 Some simple quasipolynomials can be created using the following functions.
2583 #include <isl/polynomial.h>
2584 __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2585 __isl_take isl_space *domain);
2586 __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2587 __isl_take isl_space *domain);
2588 __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2589 __isl_take isl_space *domain);
2590 __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2591 __isl_take isl_space *domain);
2592 __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2593 __isl_take isl_space *domain);
2594 __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2595 __isl_take isl_space *domain,
2596 __isl_take isl_val *val);
2597 __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2598 __isl_take isl_space *domain,
2599 enum isl_dim_type type, unsigned pos);
2600 __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2601 __isl_take isl_aff *aff);
2603 Recall that the space in which a quasipolynomial lives is a map space
2604 with a one-dimensional range. The C<domain> argument in some of
2605 the functions above corresponds to the domain of this map space.
2607 Quasipolynomials can be copied and freed again using the following
2610 #include <isl/polynomial.h>
2611 __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2612 __isl_keep isl_qpolynomial *qp);
2613 __isl_null isl_qpolynomial *isl_qpolynomial_free(
2614 __isl_take isl_qpolynomial *qp);
2616 The constant term of a quasipolynomial can be extracted using
2618 __isl_give isl_val *isl_qpolynomial_get_constant_val(
2619 __isl_keep isl_qpolynomial *qp);
2621 To iterate over all terms in a quasipolynomial,
2624 isl_stat isl_qpolynomial_foreach_term(
2625 __isl_keep isl_qpolynomial *qp,
2626 isl_stat (*fn)(__isl_take isl_term *term,
2627 void *user), void *user);
2629 The terms themselves can be inspected and freed using
2632 unsigned isl_term_dim(__isl_keep isl_term *term,
2633 enum isl_dim_type type);
2634 __isl_give isl_val *isl_term_get_coefficient_val(
2635 __isl_keep isl_term *term);
2636 int isl_term_get_exp(__isl_keep isl_term *term,
2637 enum isl_dim_type type, unsigned pos);
2638 __isl_give isl_aff *isl_term_get_div(
2639 __isl_keep isl_term *term, unsigned pos);
2640 void isl_term_free(__isl_take isl_term *term);
2642 Each term is a product of parameters, set variables and
2643 integer divisions. The function C<isl_term_get_exp>
2644 returns the exponent of a given dimensions in the given term.
2650 A reduction represents a maximum or a minimum of its
2652 The only reduction type defined by C<isl> is
2653 C<isl_qpolynomial_fold>.
2655 There are currently no functions to directly create such
2656 objects, but they do appear in the piecewise quasipolynomial
2657 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2659 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2661 Reductions can be copied and freed using
2662 the following functions.
2664 #include <isl/polynomial.h>
2665 __isl_give isl_qpolynomial_fold *
2666 isl_qpolynomial_fold_copy(
2667 __isl_keep isl_qpolynomial_fold *fold);
2668 void isl_qpolynomial_fold_free(
2669 __isl_take isl_qpolynomial_fold *fold);
2671 To iterate over all quasipolynomials in a reduction, use
2673 isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2674 __isl_keep isl_qpolynomial_fold *fold,
2675 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2676 void *user), void *user);
2678 =head3 Multiple Expressions
2680 A multiple expression represents a sequence of zero or
2681 more base expressions, all defined on the same domain space.
2682 The domain space of the multiple expression is the same
2683 as that of the base expressions, but the range space
2684 can be any space. In case the base expressions have
2685 a set space, the corresponding multiple expression
2686 also has a set space.
2687 Objects of the value type do not have an associated space.
2688 The space of a multiple value is therefore always a set space.
2689 Similarly, the space of a multiple union piecewise
2690 affine expression is always a set space.
2692 The multiple expression types defined by C<isl>
2693 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2694 C<isl_multi_union_pw_aff>.
2696 A multiple expression with the value zero for
2697 each output (or set) dimension can be created
2698 using the following functions.
2700 #include <isl/val.h>
2701 __isl_give isl_multi_val *isl_multi_val_zero(
2702 __isl_take isl_space *space);
2704 #include <isl/aff.h>
2705 __isl_give isl_multi_aff *isl_multi_aff_zero(
2706 __isl_take isl_space *space);
2707 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2708 __isl_take isl_space *space);
2709 __isl_give isl_multi_union_pw_aff *
2710 isl_multi_union_pw_aff_zero(
2711 __isl_take isl_space *space);
2713 Since there is no canonical way of representing a zero
2714 value of type C<isl_union_pw_aff>, the space passed
2715 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2717 An identity function can be created using the following
2718 functions. The space needs to be that of a relation
2719 with the same number of input and output dimensions.
2721 #include <isl/aff.h>
2722 __isl_give isl_multi_aff *isl_multi_aff_identity(
2723 __isl_take isl_space *space);
2724 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2725 __isl_take isl_space *space);
2727 A function that performs a projection on a universe
2728 relation or set can be created using the following functions.
2729 See also the corresponding
2730 projection operations in L</"Unary Operations">.
2732 #include <isl/aff.h>
2733 __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2734 __isl_take isl_space *space);
2735 __isl_give isl_multi_aff *isl_multi_aff_range_map(
2736 __isl_take isl_space *space);
2737 __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2738 __isl_take isl_space *space,
2739 enum isl_dim_type type,
2740 unsigned first, unsigned n);
2742 A multiple expression can be created from a single
2743 base expression using the following functions.
2744 The space of the created multiple expression is the same
2745 as that of the base expression, except for
2746 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2747 lives in a parameter space and the output lives
2748 in a single-dimensional set space.
2750 #include <isl/aff.h>
2751 __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2752 __isl_take isl_aff *aff);
2753 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2754 __isl_take isl_pw_aff *pa);
2755 __isl_give isl_multi_union_pw_aff *
2756 isl_multi_union_pw_aff_from_union_pw_aff(
2757 __isl_take isl_union_pw_aff *upa);
2759 A multiple expression can be created from a list
2760 of base expression in a specified space.
2761 The domain of this space needs to be the same
2762 as the domains of the base expressions in the list.
2763 If the base expressions have a set space (or no associated space),
2764 then this space also needs to be a set space.
2766 #include <isl/val.h>
2767 __isl_give isl_multi_val *isl_multi_val_from_val_list(
2768 __isl_take isl_space *space,
2769 __isl_take isl_val_list *list);
2771 #include <isl/aff.h>
2772 __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2773 __isl_take isl_space *space,
2774 __isl_take isl_aff_list *list);
2775 __isl_give isl_multi_pw_aff *
2776 isl_multi_pw_aff_from_pw_aff_list(
2777 __isl_take isl_space *space,
2778 __isl_take isl_pw_aff_list *list);
2779 __isl_give isl_multi_union_pw_aff *
2780 isl_multi_union_pw_aff_from_union_pw_aff_list(
2781 __isl_take isl_space *space,
2782 __isl_take isl_union_pw_aff_list *list);
2784 As a convenience, a multiple piecewise expression can
2785 also be created from a multiple expression.
2786 Each piecewise expression in the result has a single
2789 #include <isl/aff.h>
2790 __isl_give isl_multi_pw_aff *
2791 isl_multi_pw_aff_from_multi_aff(
2792 __isl_take isl_multi_aff *ma);
2794 Similarly, a multiple union expression can be
2795 created from a multiple expression.
2797 #include <isl/aff.h>
2798 __isl_give isl_multi_union_pw_aff *
2799 isl_multi_union_pw_aff_from_multi_aff(
2800 __isl_take isl_multi_aff *ma);
2801 __isl_give isl_multi_union_pw_aff *
2802 isl_multi_union_pw_aff_from_multi_pw_aff(
2803 __isl_take isl_multi_pw_aff *mpa);
2805 A multiple quasi-affine expression can be created from
2806 a multiple value with a given domain space using the following
2809 #include <isl/aff.h>
2810 __isl_give isl_multi_aff *
2811 isl_multi_aff_multi_val_on_space(
2812 __isl_take isl_space *space,
2813 __isl_take isl_multi_val *mv);
2816 a multiple union piecewise affine expression can be created from
2817 a multiple value with a given domain or
2818 a multiple affine expression with a given domain
2819 using the following functions.
2821 #include <isl/aff.h>
2822 __isl_give isl_multi_union_pw_aff *
2823 isl_multi_union_pw_aff_multi_val_on_domain(
2824 __isl_take isl_union_set *domain,
2825 __isl_take isl_multi_val *mv);
2826 __isl_give isl_multi_union_pw_aff *
2827 isl_multi_union_pw_aff_multi_aff_on_domain(
2828 __isl_take isl_union_set *domain,
2829 __isl_take isl_multi_aff *ma);
2831 Multiple expressions can be copied and freed using
2832 the following functions.
2834 #include <isl/val.h>
2835 __isl_give isl_multi_val *isl_multi_val_copy(
2836 __isl_keep isl_multi_val *mv);
2837 __isl_null isl_multi_val *isl_multi_val_free(
2838 __isl_take isl_multi_val *mv);
2840 #include <isl/aff.h>
2841 __isl_give isl_multi_aff *isl_multi_aff_copy(
2842 __isl_keep isl_multi_aff *maff);
2843 __isl_null isl_multi_aff *isl_multi_aff_free(
2844 __isl_take isl_multi_aff *maff);
2845 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2846 __isl_keep isl_multi_pw_aff *mpa);
2847 __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2848 __isl_take isl_multi_pw_aff *mpa);
2849 __isl_give isl_multi_union_pw_aff *
2850 isl_multi_union_pw_aff_copy(
2851 __isl_keep isl_multi_union_pw_aff *mupa);
2852 __isl_null isl_multi_union_pw_aff *
2853 isl_multi_union_pw_aff_free(
2854 __isl_take isl_multi_union_pw_aff *mupa);
2856 The base expression at a given position of a multiple
2857 expression can be extracted using the following functions.
2859 #include <isl/val.h>
2860 __isl_give isl_val *isl_multi_val_get_val(
2861 __isl_keep isl_multi_val *mv, int pos);
2863 #include <isl/aff.h>
2864 __isl_give isl_aff *isl_multi_aff_get_aff(
2865 __isl_keep isl_multi_aff *multi, int pos);
2866 __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2867 __isl_keep isl_multi_pw_aff *mpa, int pos);
2868 __isl_give isl_union_pw_aff *
2869 isl_multi_union_pw_aff_get_union_pw_aff(
2870 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2872 It can be replaced using the following functions.
2874 #include <isl/val.h>
2875 __isl_give isl_multi_val *isl_multi_val_set_val(
2876 __isl_take isl_multi_val *mv, int pos,
2877 __isl_take isl_val *val);
2879 #include <isl/aff.h>
2880 __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2881 __isl_take isl_multi_aff *multi, int pos,
2882 __isl_take isl_aff *aff);
2883 __isl_give isl_multi_union_pw_aff *
2884 isl_multi_union_pw_aff_set_union_pw_aff(
2885 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2886 __isl_take isl_union_pw_aff *upa);
2888 As a convenience, a sequence of base expressions that have
2889 their domains in a given space can be extracted from a sequence
2890 of union expressions using the following function.
2892 #include <isl/aff.h>
2893 __isl_give isl_multi_pw_aff *
2894 isl_multi_union_pw_aff_extract_multi_pw_aff(
2895 __isl_keep isl_multi_union_pw_aff *mupa,
2896 __isl_take isl_space *space);
2898 Note that there is a difference between C<isl_multi_union_pw_aff>
2899 and C<isl_union_pw_multi_aff> objects. The first is a sequence
2900 of unions of piecewise expressions, while the second is a union
2901 of piecewise sequences. In particular, multiple affine expressions
2902 in an C<isl_union_pw_multi_aff> may live in different spaces,
2903 while there is only a single multiple expression in
2904 an C<isl_multi_union_pw_aff>, which can therefore only live
2905 in a single space. This means that not every
2906 C<isl_union_pw_multi_aff> can be converted to
2907 an C<isl_multi_union_pw_aff>. Conversely, a zero-dimensional
2908 C<isl_multi_union_pw_aff> carries no information
2909 about any possible domain and therefore cannot be converted
2910 to an C<isl_union_pw_multi_aff>. Moreover, the elements
2911 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2912 while each multiple expression inside an C<isl_union_pw_multi_aff>
2913 has a single domain. The conversion of an C<isl_union_pw_multi_aff>
2914 of dimension greater than one may therefore not be exact.
2915 The following functions can
2916 be used to perform these conversions when they are possible.
2918 #include <isl/aff.h>
2919 __isl_give isl_multi_union_pw_aff *
2920 isl_multi_union_pw_aff_from_union_pw_multi_aff(
2921 __isl_take isl_union_pw_multi_aff *upma);
2922 __isl_give isl_union_pw_multi_aff *
2923 isl_union_pw_multi_aff_from_multi_union_pw_aff(
2924 __isl_take isl_multi_union_pw_aff *mupa);
2926 =head3 Piecewise Expressions
2928 A piecewise expression is an expression that is described
2929 using zero or more base expression defined over the same
2930 number of cells in the domain space of the base expressions.
2931 All base expressions are defined over the same
2932 domain space and the cells are disjoint.
2933 The space of a piecewise expression is the same as
2934 that of the base expressions.
2935 If the union of the cells is a strict subset of the domain
2936 space, then the value of the piecewise expression outside
2937 this union is different for types derived from quasi-affine
2938 expressions and those derived from quasipolynomials.
2939 Piecewise expressions derived from quasi-affine expressions
2940 are considered to be undefined outside the union of their cells.
2941 Piecewise expressions derived from quasipolynomials
2942 are considered to be zero outside the union of their cells.
2944 Piecewise quasipolynomials are mainly used by the C<barvinok>
2945 library for representing the number of elements in a parametric set or map.
2946 For example, the piecewise quasipolynomial
2948 [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2950 represents the number of points in the map
2952 [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2954 The piecewise expression types defined by C<isl>
2955 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2956 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2958 A piecewise expression with no cells can be created using
2959 the following functions.
2961 #include <isl/aff.h>
2962 __isl_give isl_pw_aff *isl_pw_aff_empty(
2963 __isl_take isl_space *space);
2964 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2965 __isl_take isl_space *space);
2967 A piecewise expression with a single universe cell can be
2968 created using the following functions.
2970 #include <isl/aff.h>
2971 __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2972 __isl_take isl_aff *aff);
2973 __isl_give isl_pw_multi_aff *
2974 isl_pw_multi_aff_from_multi_aff(
2975 __isl_take isl_multi_aff *ma);
2977 #include <isl/polynomial.h>
2978 __isl_give isl_pw_qpolynomial *
2979 isl_pw_qpolynomial_from_qpolynomial(
2980 __isl_take isl_qpolynomial *qp);
2982 A piecewise expression with a single specified cell can be
2983 created using the following functions.
2985 #include <isl/aff.h>
2986 __isl_give isl_pw_aff *isl_pw_aff_alloc(
2987 __isl_take isl_set *set, __isl_take isl_aff *aff);
2988 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2989 __isl_take isl_set *set,
2990 __isl_take isl_multi_aff *maff);
2992 #include <isl/polynomial.h>
2993 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2994 __isl_take isl_set *set,
2995 __isl_take isl_qpolynomial *qp);
2997 The following convenience functions first create a base expression and
2998 then create a piecewise expression over a universe domain.
3000 #include <isl/aff.h>
3001 __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
3002 __isl_take isl_local_space *ls);
3003 __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
3004 __isl_take isl_local_space *ls,
3005 enum isl_dim_type type, unsigned pos);
3006 __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
3007 __isl_take isl_local_space *ls);
3008 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
3009 __isl_take isl_space *space);
3010 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
3011 __isl_take isl_space *space);
3012 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
3013 __isl_take isl_space *space);
3014 __isl_give isl_pw_multi_aff *
3015 isl_pw_multi_aff_project_out_map(
3016 __isl_take isl_space *space,
3017 enum isl_dim_type type,
3018 unsigned first, unsigned n);
3020 #include <isl/polynomial.h>
3021 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
3022 __isl_take isl_space *space);
3024 The following convenience functions first create a base expression and
3025 then create a piecewise expression over a given domain.
3027 #include <isl/aff.h>
3028 __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
3029 __isl_take isl_set *domain,
3030 __isl_take isl_val *v);
3031 __isl_give isl_pw_multi_aff *
3032 isl_pw_multi_aff_multi_val_on_domain(
3033 __isl_take isl_set *domain,
3034 __isl_take isl_multi_val *mv);
3036 As a convenience, a piecewise multiple expression can
3037 also be created from a piecewise expression.
3038 Each multiple expression in the result is derived
3039 from the corresponding base expression.
3041 #include <isl/aff.h>
3042 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
3043 __isl_take isl_pw_aff *pa);
3045 Similarly, a piecewise quasipolynomial can be
3046 created from a piecewise quasi-affine expression using
3047 the following function.
3049 #include <isl/polynomial.h>
3050 __isl_give isl_pw_qpolynomial *
3051 isl_pw_qpolynomial_from_pw_aff(
3052 __isl_take isl_pw_aff *pwaff);
3054 Piecewise expressions can be copied and freed using the following functions.
3056 #include <isl/aff.h>
3057 __isl_give isl_pw_aff *isl_pw_aff_copy(
3058 __isl_keep isl_pw_aff *pwaff);
3059 __isl_null isl_pw_aff *isl_pw_aff_free(
3060 __isl_take isl_pw_aff *pwaff);
3061 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3062 __isl_keep isl_pw_multi_aff *pma);
3063 __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3064 __isl_take isl_pw_multi_aff *pma);
3066 #include <isl/polynomial.h>
3067 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3068 __isl_keep isl_pw_qpolynomial *pwqp);
3069 __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3070 __isl_take isl_pw_qpolynomial *pwqp);
3071 __isl_give isl_pw_qpolynomial_fold *
3072 isl_pw_qpolynomial_fold_copy(
3073 __isl_keep isl_pw_qpolynomial_fold *pwf);
3074 __isl_null isl_pw_qpolynomial_fold *
3075 isl_pw_qpolynomial_fold_free(
3076 __isl_take isl_pw_qpolynomial_fold *pwf);
3078 To iterate over the different cells of a piecewise expression,
3079 use the following functions.
3081 #include <isl/aff.h>
3082 isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3083 int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3084 isl_stat isl_pw_aff_foreach_piece(
3085 __isl_keep isl_pw_aff *pwaff,
3086 isl_stat (*fn)(__isl_take isl_set *set,
3087 __isl_take isl_aff *aff,
3088 void *user), void *user);
3089 isl_stat isl_pw_multi_aff_foreach_piece(
3090 __isl_keep isl_pw_multi_aff *pma,
3091 isl_stat (*fn)(__isl_take isl_set *set,
3092 __isl_take isl_multi_aff *maff,
3093 void *user), void *user);
3095 #include <isl/polynomial.h>
3096 isl_stat isl_pw_qpolynomial_foreach_piece(
3097 __isl_keep isl_pw_qpolynomial *pwqp,
3098 isl_stat (*fn)(__isl_take isl_set *set,
3099 __isl_take isl_qpolynomial *qp,
3100 void *user), void *user);
3101 isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3102 __isl_keep isl_pw_qpolynomial *pwqp,
3103 isl_stat (*fn)(__isl_take isl_set *set,
3104 __isl_take isl_qpolynomial *qp,
3105 void *user), void *user);
3106 isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3107 __isl_keep isl_pw_qpolynomial_fold *pwf,
3108 isl_stat (*fn)(__isl_take isl_set *set,
3109 __isl_take isl_qpolynomial_fold *fold,
3110 void *user), void *user);
3111 isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3112 __isl_keep isl_pw_qpolynomial_fold *pwf,
3113 isl_stat (*fn)(__isl_take isl_set *set,
3114 __isl_take isl_qpolynomial_fold *fold,
3115 void *user), void *user);
3117 As usual, the function C<fn> should return C<0> on success
3118 and C<-1> on failure. The difference between
3119 C<isl_pw_qpolynomial_foreach_piece> and
3120 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3121 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3122 compute unique representations for all existentially quantified
3123 variables and then turn these existentially quantified variables
3124 into extra set variables, adapting the associated quasipolynomial
3125 accordingly. This means that the C<set> passed to C<fn>
3126 will not have any existentially quantified variables, but that
3127 the dimensions of the sets may be different for different
3128 invocations of C<fn>.
3129 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3130 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3132 A piecewise expression consisting of the expressions at a given
3133 position of a piecewise multiple expression can be extracted
3134 using the following function.
3136 #include <isl/aff.h>
3137 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3138 __isl_keep isl_pw_multi_aff *pma, int pos);
3140 These expressions can be replaced using the following function.
3142 #include <isl/aff.h>
3143 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3144 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3145 __isl_take isl_pw_aff *pa);
3147 Note that there is a difference between C<isl_multi_pw_aff> and
3148 C<isl_pw_multi_aff> objects. The first is a sequence of piecewise
3149 affine expressions, while the second is a piecewise sequence
3150 of affine expressions. In particular, each of the piecewise
3151 affine expressions in an C<isl_multi_pw_aff> may have a different
3152 domain, while all multiple expressions associated to a cell
3153 in an C<isl_pw_multi_aff> have the same domain.
3154 It is possible to convert between the two, but when converting
3155 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3156 of the result is the intersection of the domains of the input.
3157 The reverse conversion is exact.
3159 #include <isl/aff.h>
3160 __isl_give isl_pw_multi_aff *
3161 isl_pw_multi_aff_from_multi_pw_aff(
3162 __isl_take isl_multi_pw_aff *mpa);
3163 __isl_give isl_multi_pw_aff *
3164 isl_multi_pw_aff_from_pw_multi_aff(
3165 __isl_take isl_pw_multi_aff *pma);
3167 =head3 Union Expressions
3169 A union expression collects base expressions defined
3170 over different domains. The space of a union expression
3171 is that of the shared parameter space.
3173 The union expression types defined by C<isl>
3174 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3175 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3177 C<isl_union_pw_aff>,
3178 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>,
3179 there can be at most one base expression for a given domain space.
3181 C<isl_union_pw_multi_aff>,
3182 there can be multiple such expressions for a given domain space,
3183 but the domains of these expressions need to be disjoint.
3185 An empty union expression can be created using the following functions.
3187 #include <isl/aff.h>
3188 __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3189 __isl_take isl_space *space);
3190 __isl_give isl_union_pw_multi_aff *
3191 isl_union_pw_multi_aff_empty(
3192 __isl_take isl_space *space);
3194 #include <isl/polynomial.h>
3195 __isl_give isl_union_pw_qpolynomial *
3196 isl_union_pw_qpolynomial_zero(
3197 __isl_take isl_space *space);
3199 A union expression containing a single base expression
3200 can be created using the following functions.
3202 #include <isl/aff.h>
3203 __isl_give isl_union_pw_aff *
3204 isl_union_pw_aff_from_pw_aff(
3205 __isl_take isl_pw_aff *pa);
3206 __isl_give isl_union_pw_multi_aff *
3207 isl_union_pw_multi_aff_from_aff(
3208 __isl_take isl_aff *aff);
3209 __isl_give isl_union_pw_multi_aff *
3210 isl_union_pw_multi_aff_from_pw_multi_aff(
3211 __isl_take isl_pw_multi_aff *pma);
3213 #include <isl/polynomial.h>
3214 __isl_give isl_union_pw_qpolynomial *
3215 isl_union_pw_qpolynomial_from_pw_qpolynomial(
3216 __isl_take isl_pw_qpolynomial *pwqp);
3218 The following functions create a base expression on each
3219 of the sets in the union set and collect the results.
3221 #include <isl/aff.h>
3222 __isl_give isl_union_pw_multi_aff *
3223 isl_union_pw_multi_aff_from_union_pw_aff(
3224 __isl_take isl_union_pw_aff *upa);
3225 __isl_give isl_union_pw_aff *
3226 isl_union_pw_multi_aff_get_union_pw_aff(
3227 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3228 __isl_give isl_union_pw_aff *
3229 isl_union_pw_aff_val_on_domain(
3230 __isl_take isl_union_set *domain,
3231 __isl_take isl_val *v);
3232 __isl_give isl_union_pw_multi_aff *
3233 isl_union_pw_multi_aff_multi_val_on_domain(
3234 __isl_take isl_union_set *domain,
3235 __isl_take isl_multi_val *mv);
3237 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3238 expression on a given domain can be created using the following
3241 #include <isl/aff.h>
3242 __isl_give isl_union_pw_aff *
3243 isl_union_pw_aff_aff_on_domain(
3244 __isl_take isl_union_set *domain,
3245 __isl_take isl_aff *aff);
3247 A base expression can be added to a union expression using
3248 the following functions.
3250 #include <isl/aff.h>
3251 __isl_give isl_union_pw_aff *
3252 isl_union_pw_aff_add_pw_aff(
3253 __isl_take isl_union_pw_aff *upa,
3254 __isl_take isl_pw_aff *pa);
3255 __isl_give isl_union_pw_multi_aff *
3256 isl_union_pw_multi_aff_add_pw_multi_aff(
3257 __isl_take isl_union_pw_multi_aff *upma,
3258 __isl_take isl_pw_multi_aff *pma);
3260 #include <isl/polynomial.h>
3261 __isl_give isl_union_pw_qpolynomial *
3262 isl_union_pw_qpolynomial_add_pw_qpolynomial(
3263 __isl_take isl_union_pw_qpolynomial *upwqp,
3264 __isl_take isl_pw_qpolynomial *pwqp);
3266 Union expressions can be copied and freed using
3267 the following functions.
3269 #include <isl/aff.h>
3270 __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3271 __isl_keep isl_union_pw_aff *upa);
3272 __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3273 __isl_take isl_union_pw_aff *upa);
3274 __isl_give isl_union_pw_multi_aff *
3275 isl_union_pw_multi_aff_copy(
3276 __isl_keep isl_union_pw_multi_aff *upma);
3277 __isl_null isl_union_pw_multi_aff *
3278 isl_union_pw_multi_aff_free(
3279 __isl_take isl_union_pw_multi_aff *upma);
3281 #include <isl/polynomial.h>
3282 __isl_give isl_union_pw_qpolynomial *
3283 isl_union_pw_qpolynomial_copy(
3284 __isl_keep isl_union_pw_qpolynomial *upwqp);
3285 __isl_null isl_union_pw_qpolynomial *
3286 isl_union_pw_qpolynomial_free(
3287 __isl_take isl_union_pw_qpolynomial *upwqp);
3288 __isl_give isl_union_pw_qpolynomial_fold *
3289 isl_union_pw_qpolynomial_fold_copy(
3290 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3291 __isl_null isl_union_pw_qpolynomial_fold *
3292 isl_union_pw_qpolynomial_fold_free(
3293 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3295 To iterate over the base expressions in a union expression,
3296 use the following functions.
3298 #include <isl/aff.h>
3299 int isl_union_pw_aff_n_pw_aff(
3300 __isl_keep isl_union_pw_aff *upa);
3301 isl_stat isl_union_pw_aff_foreach_pw_aff(
3302 __isl_keep isl_union_pw_aff *upa,
3303 isl_stat (*fn)(__isl_take isl_pw_aff *pa,
3304 void *user), void *user);
3305 int isl_union_pw_multi_aff_n_pw_multi_aff(
3306 __isl_keep isl_union_pw_multi_aff *upma);
3307 isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3308 __isl_keep isl_union_pw_multi_aff *upma,
3309 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3310 void *user), void *user);
3312 #include <isl/polynomial.h>
3313 int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3314 __isl_keep isl_union_pw_qpolynomial *upwqp);
3315 isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3316 __isl_keep isl_union_pw_qpolynomial *upwqp,
3317 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3318 void *user), void *user);
3319 int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3320 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3321 isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3322 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3323 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3324 void *user), void *user);
3326 To extract the base expression in a given space from a union, use
3327 the following functions.
3329 #include <isl/aff.h>
3330 __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3331 __isl_keep isl_union_pw_aff *upa,
3332 __isl_take isl_space *space);
3333 __isl_give isl_pw_multi_aff *
3334 isl_union_pw_multi_aff_extract_pw_multi_aff(
3335 __isl_keep isl_union_pw_multi_aff *upma,
3336 __isl_take isl_space *space);
3338 #include <isl/polynomial.h>
3339 __isl_give isl_pw_qpolynomial *
3340 isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3341 __isl_keep isl_union_pw_qpolynomial *upwqp,
3342 __isl_take isl_space *space);
3344 =head2 Input and Output
3346 For set and relation,
3347 C<isl> supports its own input/output format, which is similar
3348 to the C<Omega> format, but also supports the C<PolyLib> format
3350 For other object types, typically only an C<isl> format is supported.
3352 =head3 C<isl> format
3354 The C<isl> format is similar to that of C<Omega>, but has a different
3355 syntax for describing the parameters and allows for the definition
3356 of an existentially quantified variable as the integer division
3357 of an affine expression.
3358 For example, the set of integers C<i> between C<0> and C<n>
3359 such that C<i % 10 <= 6> can be described as
3361 [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3364 A set or relation can have several disjuncts, separated
3365 by the keyword C<or>. Each disjunct is either a conjunction
3366 of constraints or a projection (C<exists>) of a conjunction
3367 of constraints. The constraints are separated by the keyword
3370 =head3 C<PolyLib> format
3372 If the represented set is a union, then the first line
3373 contains a single number representing the number of disjuncts.
3374 Otherwise, a line containing the number C<1> is optional.
3376 Each disjunct is represented by a matrix of constraints.
3377 The first line contains two numbers representing
3378 the number of rows and columns,
3379 where the number of rows is equal to the number of constraints
3380 and the number of columns is equal to two plus the number of variables.
3381 The following lines contain the actual rows of the constraint matrix.
3382 In each row, the first column indicates whether the constraint
3383 is an equality (C<0>) or inequality (C<1>). The final column
3384 corresponds to the constant term.
3386 If the set is parametric, then the coefficients of the parameters
3387 appear in the last columns before the constant column.
3388 The coefficients of any existentially quantified variables appear
3389 between those of the set variables and those of the parameters.
3391 =head3 Extended C<PolyLib> format
3393 The extended C<PolyLib> format is nearly identical to the
3394 C<PolyLib> format. The only difference is that the line
3395 containing the number of rows and columns of a constraint matrix
3396 also contains four additional numbers:
3397 the number of output dimensions, the number of input dimensions,
3398 the number of local dimensions (i.e., the number of existentially
3399 quantified variables) and the number of parameters.
3400 For sets, the number of ``output'' dimensions is equal
3401 to the number of set dimensions, while the number of ``input''
3406 Objects can be read from input using the following functions.
3408 #include <isl/val.h>
3409 __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3411 __isl_give isl_multi_val *isl_multi_val_read_from_str(
3412 isl_ctx *ctx, const char *str);
3414 #include <isl/set.h>
3415 __isl_give isl_basic_set *isl_basic_set_read_from_file(
3416 isl_ctx *ctx, FILE *input);
3417 __isl_give isl_basic_set *isl_basic_set_read_from_str(
3418 isl_ctx *ctx, const char *str);
3419 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3421 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3424 #include <isl/map.h>
3425 __isl_give isl_basic_map *isl_basic_map_read_from_file(
3426 isl_ctx *ctx, FILE *input);
3427 __isl_give isl_basic_map *isl_basic_map_read_from_str(
3428 isl_ctx *ctx, const char *str);
3429 __isl_give isl_map *isl_map_read_from_file(
3430 isl_ctx *ctx, FILE *input);
3431 __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3434 #include <isl/union_set.h>
3435 __isl_give isl_union_set *isl_union_set_read_from_file(
3436 isl_ctx *ctx, FILE *input);
3437 __isl_give isl_union_set *isl_union_set_read_from_str(
3438 isl_ctx *ctx, const char *str);
3440 #include <isl/union_map.h>
3441 __isl_give isl_union_map *isl_union_map_read_from_file(
3442 isl_ctx *ctx, FILE *input);
3443 __isl_give isl_union_map *isl_union_map_read_from_str(
3444 isl_ctx *ctx, const char *str);
3446 #include <isl/aff.h>
3447 __isl_give isl_aff *isl_aff_read_from_str(
3448 isl_ctx *ctx, const char *str);
3449 __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3450 isl_ctx *ctx, const char *str);
3451 __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3452 isl_ctx *ctx, const char *str);
3453 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3454 isl_ctx *ctx, const char *str);
3455 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3456 isl_ctx *ctx, const char *str);
3457 __isl_give isl_union_pw_aff *
3458 isl_union_pw_aff_read_from_str(
3459 isl_ctx *ctx, const char *str);
3460 __isl_give isl_union_pw_multi_aff *
3461 isl_union_pw_multi_aff_read_from_str(
3462 isl_ctx *ctx, const char *str);
3463 __isl_give isl_multi_union_pw_aff *
3464 isl_multi_union_pw_aff_read_from_str(
3465 isl_ctx *ctx, const char *str);
3467 #include <isl/polynomial.h>
3468 __isl_give isl_union_pw_qpolynomial *
3469 isl_union_pw_qpolynomial_read_from_str(
3470 isl_ctx *ctx, const char *str);
3472 For sets and relations,
3473 the input format is autodetected and may be either the C<PolyLib> format
3474 or the C<isl> format.
3478 Before anything can be printed, an C<isl_printer> needs to
3481 __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3483 __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3484 __isl_null isl_printer *isl_printer_free(
3485 __isl_take isl_printer *printer);
3487 C<isl_printer_to_file> prints to the given file, while
3488 C<isl_printer_to_str> prints to a string that can be extracted
3489 using the following function.
3491 #include <isl/printer.h>
3492 __isl_give char *isl_printer_get_str(
3493 __isl_keep isl_printer *printer);
3495 The printer can be inspected using the following functions.
3497 FILE *isl_printer_get_file(
3498 __isl_keep isl_printer *printer);
3499 int isl_printer_get_output_format(
3500 __isl_keep isl_printer *p);
3501 int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3503 The behavior of the printer can be modified in various ways
3505 __isl_give isl_printer *isl_printer_set_output_format(
3506 __isl_take isl_printer *p, int output_format);
3507 __isl_give isl_printer *isl_printer_set_indent(
3508 __isl_take isl_printer *p, int indent);
3509 __isl_give isl_printer *isl_printer_set_indent_prefix(
3510 __isl_take isl_printer *p, const char *prefix);
3511 __isl_give isl_printer *isl_printer_indent(
3512 __isl_take isl_printer *p, int indent);
3513 __isl_give isl_printer *isl_printer_set_prefix(
3514 __isl_take isl_printer *p, const char *prefix);
3515 __isl_give isl_printer *isl_printer_set_suffix(
3516 __isl_take isl_printer *p, const char *suffix);
3517 __isl_give isl_printer *isl_printer_set_yaml_style(
3518 __isl_take isl_printer *p, int yaml_style);
3520 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3521 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3522 and defaults to C<ISL_FORMAT_ISL>.
3523 Each line in the output is prefixed by C<indent_prefix>,
3524 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3525 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3526 In the C<PolyLib> format output,
3527 the coefficients of the existentially quantified variables
3528 appear between those of the set variables and those
3530 The function C<isl_printer_indent> increases the indentation
3531 by the specified amount (which may be negative).
3532 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3533 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3536 To actually print something, use
3538 #include <isl/printer.h>
3539 __isl_give isl_printer *isl_printer_print_double(
3540 __isl_take isl_printer *p, double d);
3542 #include <isl/val.h>
3543 __isl_give isl_printer *isl_printer_print_val(
3544 __isl_take isl_printer *p, __isl_keep isl_val *v);
3546 #include <isl/set.h>
3547 __isl_give isl_printer *isl_printer_print_basic_set(
3548 __isl_take isl_printer *printer,
3549 __isl_keep isl_basic_set *bset);
3550 __isl_give isl_printer *isl_printer_print_set(
3551 __isl_take isl_printer *printer,
3552 __isl_keep isl_set *set);
3554 #include <isl/map.h>
3555 __isl_give isl_printer *isl_printer_print_basic_map(
3556 __isl_take isl_printer *printer,
3557 __isl_keep isl_basic_map *bmap);
3558 __isl_give isl_printer *isl_printer_print_map(
3559 __isl_take isl_printer *printer,
3560 __isl_keep isl_map *map);
3562 #include <isl/union_set.h>
3563 __isl_give isl_printer *isl_printer_print_union_set(
3564 __isl_take isl_printer *p,
3565 __isl_keep isl_union_set *uset);
3567 #include <isl/union_map.h>
3568 __isl_give isl_printer *isl_printer_print_union_map(
3569 __isl_take isl_printer *p,
3570 __isl_keep isl_union_map *umap);
3572 #include <isl/val.h>
3573 __isl_give isl_printer *isl_printer_print_multi_val(
3574 __isl_take isl_printer *p,
3575 __isl_keep isl_multi_val *mv);
3577 #include <isl/aff.h>
3578 __isl_give isl_printer *isl_printer_print_aff(
3579 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3580 __isl_give isl_printer *isl_printer_print_multi_aff(
3581 __isl_take isl_printer *p,
3582 __isl_keep isl_multi_aff *maff);
3583 __isl_give isl_printer *isl_printer_print_pw_aff(
3584 __isl_take isl_printer *p,
3585 __isl_keep isl_pw_aff *pwaff);
3586 __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3587 __isl_take isl_printer *p,
3588 __isl_keep isl_pw_multi_aff *pma);
3589 __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3590 __isl_take isl_printer *p,
3591 __isl_keep isl_multi_pw_aff *mpa);
3592 __isl_give isl_printer *isl_printer_print_union_pw_aff(
3593 __isl_take isl_printer *p,
3594 __isl_keep isl_union_pw_aff *upa);
3595 __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3596 __isl_take isl_printer *p,
3597 __isl_keep isl_union_pw_multi_aff *upma);
3598 __isl_give isl_printer *
3599 isl_printer_print_multi_union_pw_aff(
3600 __isl_take isl_printer *p,
3601 __isl_keep isl_multi_union_pw_aff *mupa);
3603 #include <isl/polynomial.h>
3604 __isl_give isl_printer *isl_printer_print_qpolynomial(
3605 __isl_take isl_printer *p,
3606 __isl_keep isl_qpolynomial *qp);
3607 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3608 __isl_take isl_printer *p,
3609 __isl_keep isl_pw_qpolynomial *pwqp);
3610 __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3611 __isl_take isl_printer *p,
3612 __isl_keep isl_union_pw_qpolynomial *upwqp);
3614 __isl_give isl_printer *
3615 isl_printer_print_pw_qpolynomial_fold(
3616 __isl_take isl_printer *p,
3617 __isl_keep isl_pw_qpolynomial_fold *pwf);
3618 __isl_give isl_printer *
3619 isl_printer_print_union_pw_qpolynomial_fold(
3620 __isl_take isl_printer *p,
3621 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3623 For C<isl_printer_print_qpolynomial>,
3624 C<isl_printer_print_pw_qpolynomial> and
3625 C<isl_printer_print_pw_qpolynomial_fold>,
3626 the output format of the printer
3627 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3628 For C<isl_printer_print_union_pw_qpolynomial> and
3629 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3631 In case of printing in C<ISL_FORMAT_C>, the user may want
3632 to set the names of all dimensions first.
3634 C<isl> also provides limited support for printing YAML documents,
3635 just enough for the internal use for printing such documents.
3637 #include <isl/printer.h>
3638 __isl_give isl_printer *isl_printer_yaml_start_mapping(
3639 __isl_take isl_printer *p);
3640 __isl_give isl_printer *isl_printer_yaml_end_mapping(
3641 __isl_take isl_printer *p);
3642 __isl_give isl_printer *isl_printer_yaml_start_sequence(
3643 __isl_take isl_printer *p);
3644 __isl_give isl_printer *isl_printer_yaml_end_sequence(
3645 __isl_take isl_printer *p);
3646 __isl_give isl_printer *isl_printer_yaml_next(
3647 __isl_take isl_printer *p);
3649 A document is started by a call to either
3650 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3651 Anything printed to the printer after such a call belong to the
3652 first key of the mapping or the first element in the sequence.
3653 The function C<isl_printer_yaml_next> moves to the value if
3654 we are currently printing a mapping key, the next key if we
3655 are printing a value or the next element if we are printing
3656 an element in a sequence.
3657 Nested mappings and sequences are initiated by the same
3658 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3659 Each call to these functions needs to have a corresponding call to
3660 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3662 When called on a file printer, the following function flushes
3663 the file. When called on a string printer, the buffer is cleared.
3665 __isl_give isl_printer *isl_printer_flush(
3666 __isl_take isl_printer *p);
3668 The following functions allow the user to attach
3669 notes to a printer in order to keep track of additional state.
3671 #include <isl/printer.h>
3672 isl_bool isl_printer_has_note(__isl_keep isl_printer *p,
3673 __isl_keep isl_id *id);
3674 __isl_give isl_id *isl_printer_get_note(
3675 __isl_keep isl_printer *p, __isl_take isl_id *id);
3676 __isl_give isl_printer *isl_printer_set_note(
3677 __isl_take isl_printer *p,
3678 __isl_take isl_id *id, __isl_take isl_id *note);
3680 C<isl_printer_set_note> associates the given note to the given
3681 identifier in the printer.
3682 C<isl_printer_get_note> retrieves a note associated to an
3684 C<isl_printer_has_note> checks if there is such a note.
3685 C<isl_printer_get_note> fails if the requested note does not exist.
3687 Alternatively, a string representation can be obtained
3688 directly using the following functions, which always print
3691 #include <isl/space.h>
3692 __isl_give char *isl_space_to_str(
3693 __isl_keep isl_space *space);
3695 #include <isl/val.h>
3696 __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3697 __isl_give char *isl_multi_val_to_str(
3698 __isl_keep isl_multi_val *mv);
3700 #include <isl/set.h>
3701 __isl_give char *isl_basic_set_to_str(
3702 __isl_keep isl_basic_set *bset);
3703 __isl_give char *isl_set_to_str(
3704 __isl_keep isl_set *set);
3706 #include <isl/union_set.h>
3707 __isl_give char *isl_union_set_to_str(
3708 __isl_keep isl_union_set *uset);
3710 #include <isl/map.h>
3711 __isl_give char *isl_basic_map_to_str(
3712 __isl_keep isl_basic_map *bmap);
3713 __isl_give char *isl_map_to_str(
3714 __isl_keep isl_map *map);
3716 #include <isl/union_map.h>
3717 __isl_give char *isl_union_map_to_str(
3718 __isl_keep isl_union_map *umap);
3720 #include <isl/aff.h>
3721 __isl_give char *isl_aff_to_str(__isl_keep isl_aff *aff);
3722 __isl_give char *isl_pw_aff_to_str(
3723 __isl_keep isl_pw_aff *pa);
3724 __isl_give char *isl_multi_aff_to_str(
3725 __isl_keep isl_multi_aff *ma);
3726 __isl_give char *isl_pw_multi_aff_to_str(
3727 __isl_keep isl_pw_multi_aff *pma);
3728 __isl_give char *isl_multi_pw_aff_to_str(
3729 __isl_keep isl_multi_pw_aff *mpa);
3730 __isl_give char *isl_union_pw_aff_to_str(
3731 __isl_keep isl_union_pw_aff *upa);
3732 __isl_give char *isl_union_pw_multi_aff_to_str(
3733 __isl_keep isl_union_pw_multi_aff *upma);
3734 __isl_give char *isl_multi_union_pw_aff_to_str(
3735 __isl_keep isl_multi_union_pw_aff *mupa);
3737 #include <isl/point.h>
3738 __isl_give char *isl_point_to_str(
3739 __isl_keep isl_point *pnt);
3741 #include <isl/polynomial.h>
3742 __isl_give char *isl_pw_qpolynomial_to_str(
3743 __isl_keep isl_pw_qpolynomial *pwqp);
3744 __isl_give char *isl_union_pw_qpolynomial_to_str(
3745 __isl_keep isl_union_pw_qpolynomial *upwqp);
3749 =head3 Unary Properties
3755 The following functions test whether the given set or relation
3756 contains any integer points. The ``plain'' variants do not perform
3757 any computations, but simply check if the given set or relation
3758 is already known to be empty.
3760 isl_bool isl_basic_set_plain_is_empty(
3761 __isl_keep isl_basic_set *bset);
3762 isl_bool isl_basic_set_is_empty(
3763 __isl_keep isl_basic_set *bset);
3764 isl_bool isl_set_plain_is_empty(
3765 __isl_keep isl_set *set);
3766 isl_bool isl_set_is_empty(__isl_keep isl_set *set);
3767 isl_bool isl_union_set_is_empty(
3768 __isl_keep isl_union_set *uset);
3769 isl_bool isl_basic_map_plain_is_empty(
3770 __isl_keep isl_basic_map *bmap);
3771 isl_bool isl_basic_map_is_empty(
3772 __isl_keep isl_basic_map *bmap);
3773 isl_bool isl_map_plain_is_empty(
3774 __isl_keep isl_map *map);
3775 isl_bool isl_map_is_empty(__isl_keep isl_map *map);
3776 isl_bool isl_union_map_is_empty(
3777 __isl_keep isl_union_map *umap);
3779 =item * Universality
3781 isl_bool isl_basic_set_plain_is_universe(
3782 __isl_keep isl_basic_set *bset);
3783 isl_bool isl_basic_set_is_universe(
3784 __isl_keep isl_basic_set *bset);
3785 isl_bool isl_basic_map_plain_is_universe(
3786 __isl_keep isl_basic_map *bmap);
3787 isl_bool isl_basic_map_is_universe(
3788 __isl_keep isl_basic_map *bmap);
3789 isl_bool isl_set_plain_is_universe(
3790 __isl_keep isl_set *set);
3791 isl_bool isl_map_plain_is_universe(
3792 __isl_keep isl_map *map);
3794 =item * Single-valuedness
3796 #include <isl/set.h>
3797 isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
3799 #include <isl/map.h>
3800 isl_bool isl_basic_map_is_single_valued(
3801 __isl_keep isl_basic_map *bmap);
3802 isl_bool isl_map_plain_is_single_valued(
3803 __isl_keep isl_map *map);
3804 isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
3806 #include <isl/union_map.h>
3807 isl_bool isl_union_map_is_single_valued(
3808 __isl_keep isl_union_map *umap);
3812 isl_bool isl_map_plain_is_injective(
3813 __isl_keep isl_map *map);
3814 isl_bool isl_map_is_injective(
3815 __isl_keep isl_map *map);
3816 isl_bool isl_union_map_plain_is_injective(
3817 __isl_keep isl_union_map *umap);
3818 isl_bool isl_union_map_is_injective(
3819 __isl_keep isl_union_map *umap);
3823 isl_bool isl_map_is_bijective(
3824 __isl_keep isl_map *map);
3825 isl_bool isl_union_map_is_bijective(
3826 __isl_keep isl_union_map *umap);
3830 The following functions test whether the given relation
3831 only maps elements to themselves.
3833 #include <isl/map.h>
3834 isl_bool isl_map_is_identity(
3835 __isl_keep isl_map *map);
3837 #include <isl/union_map.h>
3838 isl_bool isl_union_map_is_identity(
3839 __isl_keep isl_union_map *umap);
3843 __isl_give isl_val *
3844 isl_basic_map_plain_get_val_if_fixed(
3845 __isl_keep isl_basic_map *bmap,
3846 enum isl_dim_type type, unsigned pos);
3847 __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3848 __isl_keep isl_set *set,
3849 enum isl_dim_type type, unsigned pos);
3850 __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3851 __isl_keep isl_map *map,
3852 enum isl_dim_type type, unsigned pos);
3854 If the set or relation obviously lies on a hyperplane where the given dimension
3855 has a fixed value, then return that value.
3856 Otherwise return NaN.
3860 isl_stat isl_set_dim_residue_class_val(
3861 __isl_keep isl_set *set,
3862 int pos, __isl_give isl_val **modulo,
3863 __isl_give isl_val **residue);
3865 Check if the values of the given set dimension are equal to a fixed
3866 value modulo some integer value. If so, assign the modulo to C<*modulo>
3867 and the fixed value to C<*residue>. If the given dimension attains only
3868 a single value, then assign C<0> to C<*modulo> and the fixed value to
3870 If the dimension does not attain only a single value and if no modulo
3871 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3875 To check whether the description of a set, relation or function depends
3876 on one or more given dimensions,
3877 the following functions can be used.
3879 #include <isl/constraint.h>
3880 isl_bool isl_constraint_involves_dims(
3881 __isl_keep isl_constraint *constraint,
3882 enum isl_dim_type type, unsigned first, unsigned n);
3884 #include <isl/set.h>
3885 isl_bool isl_basic_set_involves_dims(
3886 __isl_keep isl_basic_set *bset,
3887 enum isl_dim_type type, unsigned first, unsigned n);
3888 isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
3889 enum isl_dim_type type, unsigned first, unsigned n);
3891 #include <isl/map.h>
3892 isl_bool isl_basic_map_involves_dims(
3893 __isl_keep isl_basic_map *bmap,
3894 enum isl_dim_type type, unsigned first, unsigned n);
3895 isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
3896 enum isl_dim_type type, unsigned first, unsigned n);
3898 #include <isl/union_map.h>
3899 isl_bool isl_union_map_involves_dims(
3900 __isl_keep isl_union_map *umap,
3901 enum isl_dim_type type, unsigned first, unsigned n);
3903 #include <isl/aff.h>
3904 isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
3905 enum isl_dim_type type, unsigned first, unsigned n);
3906 isl_bool isl_pw_aff_involves_dims(
3907 __isl_keep isl_pw_aff *pwaff,
3908 enum isl_dim_type type, unsigned first, unsigned n);
3909 isl_bool isl_multi_aff_involves_dims(
3910 __isl_keep isl_multi_aff *ma,
3911 enum isl_dim_type type, unsigned first, unsigned n);
3912 isl_bool isl_multi_pw_aff_involves_dims(
3913 __isl_keep isl_multi_pw_aff *mpa,
3914 enum isl_dim_type type, unsigned first, unsigned n);
3916 #include <isl/polynomial.h>
3917 isl_bool isl_qpolynomial_involves_dims(
3918 __isl_keep isl_qpolynomial *qp,
3919 enum isl_dim_type type, unsigned first, unsigned n);
3921 Similarly, the following functions can be used to check whether
3922 a given dimension is involved in any lower or upper bound.
3924 #include <isl/set.h>
3925 isl_bool isl_set_dim_has_any_lower_bound(
3926 __isl_keep isl_set *set,
3927 enum isl_dim_type type, unsigned pos);
3928 isl_bool isl_set_dim_has_any_upper_bound(
3929 __isl_keep isl_set *set,
3930 enum isl_dim_type type, unsigned pos);
3932 Note that these functions return true even if there is a bound on
3933 the dimension on only some of the basic sets of C<set>.
3934 To check if they have a bound for all of the basic sets in C<set>,
3935 use the following functions instead.
3937 #include <isl/set.h>
3938 isl_bool isl_set_dim_has_lower_bound(
3939 __isl_keep isl_set *set,
3940 enum isl_dim_type type, unsigned pos);
3941 isl_bool isl_set_dim_has_upper_bound(
3942 __isl_keep isl_set *set,
3943 enum isl_dim_type type, unsigned pos);
3947 To check whether a set is a parameter domain, use this function:
3949 isl_bool isl_set_is_params(__isl_keep isl_set *set);
3950 isl_bool isl_union_set_is_params(
3951 __isl_keep isl_union_set *uset);
3955 The following functions check whether the space of the given
3956 (basic) set or relation range is a wrapped relation.
3958 #include <isl/space.h>
3959 isl_bool isl_space_is_wrapping(
3960 __isl_keep isl_space *space);
3961 isl_bool isl_space_domain_is_wrapping(
3962 __isl_keep isl_space *space);
3963 isl_bool isl_space_range_is_wrapping(
3964 __isl_keep isl_space *space);
3966 #include <isl/set.h>
3967 isl_bool isl_basic_set_is_wrapping(
3968 __isl_keep isl_basic_set *bset);
3969 isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
3971 #include <isl/map.h>
3972 isl_bool isl_map_domain_is_wrapping(
3973 __isl_keep isl_map *map);
3974 isl_bool isl_map_range_is_wrapping(
3975 __isl_keep isl_map *map);
3977 #include <isl/val.h>
3978 isl_bool isl_multi_val_range_is_wrapping(
3979 __isl_keep isl_multi_val *mv);
3981 #include <isl/aff.h>
3982 isl_bool isl_multi_aff_range_is_wrapping(
3983 __isl_keep isl_multi_aff *ma);
3984 isl_bool isl_multi_pw_aff_range_is_wrapping(
3985 __isl_keep isl_multi_pw_aff *mpa);
3986 isl_bool isl_multi_union_pw_aff_range_is_wrapping(
3987 __isl_keep isl_multi_union_pw_aff *mupa);
3989 The input to C<isl_space_is_wrapping> should
3990 be the space of a set, while that of
3991 C<isl_space_domain_is_wrapping> and
3992 C<isl_space_range_is_wrapping> should be the space of a relation.
3994 =item * Internal Product
3996 isl_bool isl_basic_map_can_zip(
3997 __isl_keep isl_basic_map *bmap);
3998 isl_bool isl_map_can_zip(__isl_keep isl_map *map);
4000 Check whether the product of domain and range of the given relation
4002 i.e., whether both domain and range are nested relations.
4006 #include <isl/space.h>
4007 isl_bool isl_space_can_curry(
4008 __isl_keep isl_space *space);
4010 #include <isl/map.h>
4011 isl_bool isl_basic_map_can_curry(
4012 __isl_keep isl_basic_map *bmap);
4013 isl_bool isl_map_can_curry(__isl_keep isl_map *map);
4015 Check whether the domain of the (basic) relation is a wrapped relation.
4017 #include <isl/space.h>
4018 __isl_give isl_space *isl_space_uncurry(
4019 __isl_take isl_space *space);
4021 #include <isl/map.h>
4022 isl_bool isl_basic_map_can_uncurry(
4023 __isl_keep isl_basic_map *bmap);
4024 isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
4026 Check whether the range of the (basic) relation is a wrapped relation.
4028 #include <isl/space.h>
4029 isl_bool isl_space_can_range_curry(
4030 __isl_keep isl_space *space);
4032 #include <isl/map.h>
4033 isl_bool isl_map_can_range_curry(
4034 __isl_keep isl_map *map);
4036 Check whether the domain of the relation wrapped in the range of
4037 the input is itself a wrapped relation.
4039 =item * Special Values
4041 #include <isl/aff.h>
4042 isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
4043 isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
4044 isl_bool isl_multi_pw_aff_is_cst(
4045 __isl_keep isl_multi_pw_aff *mpa);
4047 Check whether the given expression is a constant.
4049 #include <isl/aff.h>
4050 isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
4051 isl_bool isl_pw_aff_involves_nan(
4052 __isl_keep isl_pw_aff *pa);
4054 #include <isl/polynomial.h>
4055 isl_bool isl_qpolynomial_fold_is_nan(
4056 __isl_keep isl_qpolynomial_fold *fold);
4058 Check whether the given expression is equal to or involves NaN.
4060 #include <isl/aff.h>
4061 isl_bool isl_aff_plain_is_zero(
4062 __isl_keep isl_aff *aff);
4064 Check whether the affine expression is obviously zero.
4068 =head3 Binary Properties
4074 The following functions check whether two objects
4075 represent the same set, relation or function.
4076 The C<plain> variants only return true if the objects
4077 are obviously the same. That is, they may return false
4078 even if the objects are the same, but they will never
4079 return true if the objects are not the same.
4081 #include <isl/set.h>
4082 isl_bool isl_basic_set_plain_is_equal(
4083 __isl_keep isl_basic_set *bset1,
4084 __isl_keep isl_basic_set *bset2);
4085 isl_bool isl_basic_set_is_equal(
4086 __isl_keep isl_basic_set *bset1,
4087 __isl_keep isl_basic_set *bset2);
4088 isl_bool isl_set_plain_is_equal(
4089 __isl_keep isl_set *set1,
4090 __isl_keep isl_set *set2);
4091 isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
4092 __isl_keep isl_set *set2);
4094 #include <isl/map.h>
4095 isl_bool isl_basic_map_is_equal(
4096 __isl_keep isl_basic_map *bmap1,
4097 __isl_keep isl_basic_map *bmap2);
4098 isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
4099 __isl_keep isl_map *map2);
4100 isl_bool isl_map_plain_is_equal(
4101 __isl_keep isl_map *map1,
4102 __isl_keep isl_map *map2);
4104 #include <isl/union_set.h>
4105 isl_bool isl_union_set_is_equal(
4106 __isl_keep isl_union_set *uset1,
4107 __isl_keep isl_union_set *uset2);
4109 #include <isl/union_map.h>
4110 isl_bool isl_union_map_is_equal(
4111 __isl_keep isl_union_map *umap1,
4112 __isl_keep isl_union_map *umap2);
4114 #include <isl/aff.h>
4115 isl_bool isl_aff_plain_is_equal(
4116 __isl_keep isl_aff *aff1,
4117 __isl_keep isl_aff *aff2);
4118 isl_bool isl_multi_aff_plain_is_equal(
4119 __isl_keep isl_multi_aff *maff1,
4120 __isl_keep isl_multi_aff *maff2);
4121 isl_bool isl_pw_aff_plain_is_equal(
4122 __isl_keep isl_pw_aff *pwaff1,
4123 __isl_keep isl_pw_aff *pwaff2);
4124 isl_bool isl_pw_multi_aff_plain_is_equal(
4125 __isl_keep isl_pw_multi_aff *pma1,
4126 __isl_keep isl_pw_multi_aff *pma2);
4127 isl_bool isl_multi_pw_aff_plain_is_equal(
4128 __isl_keep isl_multi_pw_aff *mpa1,
4129 __isl_keep isl_multi_pw_aff *mpa2);
4130 isl_bool isl_multi_pw_aff_is_equal(
4131 __isl_keep isl_multi_pw_aff *mpa1,
4132 __isl_keep isl_multi_pw_aff *mpa2);
4133 isl_bool isl_union_pw_aff_plain_is_equal(
4134 __isl_keep isl_union_pw_aff *upa1,
4135 __isl_keep isl_union_pw_aff *upa2);
4136 isl_bool isl_union_pw_multi_aff_plain_is_equal(
4137 __isl_keep isl_union_pw_multi_aff *upma1,
4138 __isl_keep isl_union_pw_multi_aff *upma2);
4139 isl_bool isl_multi_union_pw_aff_plain_is_equal(
4140 __isl_keep isl_multi_union_pw_aff *mupa1,
4141 __isl_keep isl_multi_union_pw_aff *mupa2);
4143 #include <isl/polynomial.h>
4144 isl_bool isl_union_pw_qpolynomial_plain_is_equal(
4145 __isl_keep isl_union_pw_qpolynomial *upwqp1,
4146 __isl_keep isl_union_pw_qpolynomial *upwqp2);
4147 isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
4148 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
4149 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
4151 =item * Disjointness
4153 #include <isl/set.h>
4154 isl_bool isl_basic_set_is_disjoint(
4155 __isl_keep isl_basic_set *bset1,
4156 __isl_keep isl_basic_set *bset2);
4157 isl_bool isl_set_plain_is_disjoint(
4158 __isl_keep isl_set *set1,
4159 __isl_keep isl_set *set2);
4160 isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
4161 __isl_keep isl_set *set2);
4163 #include <isl/map.h>
4164 isl_bool isl_basic_map_is_disjoint(
4165 __isl_keep isl_basic_map *bmap1,
4166 __isl_keep isl_basic_map *bmap2);
4167 isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
4168 __isl_keep isl_map *map2);
4170 #include <isl/union_set.h>
4171 isl_bool isl_union_set_is_disjoint(
4172 __isl_keep isl_union_set *uset1,
4173 __isl_keep isl_union_set *uset2);
4175 #include <isl/union_map.h>
4176 isl_bool isl_union_map_is_disjoint(
4177 __isl_keep isl_union_map *umap1,
4178 __isl_keep isl_union_map *umap2);
4182 isl_bool isl_basic_set_is_subset(
4183 __isl_keep isl_basic_set *bset1,
4184 __isl_keep isl_basic_set *bset2);
4185 isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4186 __isl_keep isl_set *set2);
4187 isl_bool isl_set_is_strict_subset(
4188 __isl_keep isl_set *set1,
4189 __isl_keep isl_set *set2);
4190 isl_bool isl_union_set_is_subset(
4191 __isl_keep isl_union_set *uset1,
4192 __isl_keep isl_union_set *uset2);
4193 isl_bool isl_union_set_is_strict_subset(
4194 __isl_keep isl_union_set *uset1,
4195 __isl_keep isl_union_set *uset2);
4196 isl_bool isl_basic_map_is_subset(
4197 __isl_keep isl_basic_map *bmap1,
4198 __isl_keep isl_basic_map *bmap2);
4199 isl_bool isl_basic_map_is_strict_subset(
4200 __isl_keep isl_basic_map *bmap1,
4201 __isl_keep isl_basic_map *bmap2);
4202 isl_bool isl_map_is_subset(
4203 __isl_keep isl_map *map1,
4204 __isl_keep isl_map *map2);
4205 isl_bool isl_map_is_strict_subset(
4206 __isl_keep isl_map *map1,
4207 __isl_keep isl_map *map2);
4208 isl_bool isl_union_map_is_subset(
4209 __isl_keep isl_union_map *umap1,
4210 __isl_keep isl_union_map *umap2);
4211 isl_bool isl_union_map_is_strict_subset(
4212 __isl_keep isl_union_map *umap1,
4213 __isl_keep isl_union_map *umap2);
4215 Check whether the first argument is a (strict) subset of the
4220 Every comparison function returns a negative value if the first
4221 argument is considered smaller than the second, a positive value
4222 if the first argument is considered greater and zero if the two
4223 constraints are considered the same by the comparison criterion.
4225 #include <isl/constraint.h>
4226 int isl_constraint_plain_cmp(
4227 __isl_keep isl_constraint *c1,
4228 __isl_keep isl_constraint *c2);
4230 This function is useful for sorting C<isl_constraint>s.
4231 The order depends on the internal representation of the inputs.
4232 The order is fixed over different calls to the function (assuming
4233 the internal representation of the inputs has not changed), but may
4234 change over different versions of C<isl>.
4236 #include <isl/constraint.h>
4237 int isl_constraint_cmp_last_non_zero(
4238 __isl_keep isl_constraint *c1,
4239 __isl_keep isl_constraint *c2);
4241 This function can be used to sort constraints that live in the same
4242 local space. Constraints that involve ``earlier'' dimensions or
4243 that have a smaller coefficient for the shared latest dimension
4244 are considered smaller than other constraints.
4245 This function only defines a B<partial> order.
4247 #include <isl/set.h>
4248 int isl_set_plain_cmp(__isl_keep isl_set *set1,
4249 __isl_keep isl_set *set2);
4251 This function is useful for sorting C<isl_set>s.
4252 The order depends on the internal representation of the inputs.
4253 The order is fixed over different calls to the function (assuming
4254 the internal representation of the inputs has not changed), but may
4255 change over different versions of C<isl>.
4257 #include <isl/aff.h>
4258 int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4259 __isl_keep isl_pw_aff *pa2);
4261 The function C<isl_pw_aff_plain_cmp> can be used to sort
4262 C<isl_pw_aff>s. The order is not strictly defined.
4263 The current order sorts expressions that only involve
4264 earlier dimensions before those that involve later dimensions.
4268 =head2 Unary Operations
4274 __isl_give isl_set *isl_set_complement(
4275 __isl_take isl_set *set);
4276 __isl_give isl_map *isl_map_complement(
4277 __isl_take isl_map *map);
4281 #include <isl/space.h>
4282 __isl_give isl_space *isl_space_reverse(
4283 __isl_take isl_space *space);
4285 #include <isl/map.h>
4286 __isl_give isl_basic_map *isl_basic_map_reverse(
4287 __isl_take isl_basic_map *bmap);
4288 __isl_give isl_map *isl_map_reverse(
4289 __isl_take isl_map *map);
4291 #include <isl/union_map.h>
4292 __isl_give isl_union_map *isl_union_map_reverse(
4293 __isl_take isl_union_map *umap);
4297 #include <isl/space.h>
4298 __isl_give isl_space *isl_space_domain(
4299 __isl_take isl_space *space);
4300 __isl_give isl_space *isl_space_range(
4301 __isl_take isl_space *space);
4302 __isl_give isl_space *isl_space_params(
4303 __isl_take isl_space *space);
4305 #include <isl/local_space.h>
4306 __isl_give isl_local_space *isl_local_space_domain(
4307 __isl_take isl_local_space *ls);
4308 __isl_give isl_local_space *isl_local_space_range(
4309 __isl_take isl_local_space *ls);
4311 #include <isl/set.h>
4312 __isl_give isl_basic_set *isl_basic_set_project_out(
4313 __isl_take isl_basic_set *bset,
4314 enum isl_dim_type type, unsigned first, unsigned n);
4315 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4316 enum isl_dim_type type, unsigned first, unsigned n);
4317 __isl_give isl_map *isl_set_project_onto_map(
4318 __isl_take isl_set *set,
4319 enum isl_dim_type type, unsigned first,
4321 __isl_give isl_basic_set *isl_basic_set_params(
4322 __isl_take isl_basic_set *bset);
4323 __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4325 The function C<isl_set_project_onto_map> returns a relation
4326 that projects the input set onto the given set dimensions.
4328 #include <isl/map.h>
4329 __isl_give isl_basic_map *isl_basic_map_project_out(
4330 __isl_take isl_basic_map *bmap,
4331 enum isl_dim_type type, unsigned first, unsigned n);
4332 __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4333 enum isl_dim_type type, unsigned first, unsigned n);
4334 __isl_give isl_basic_set *isl_basic_map_domain(
4335 __isl_take isl_basic_map *bmap);
4336 __isl_give isl_basic_set *isl_basic_map_range(
4337 __isl_take isl_basic_map *bmap);
4338 __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4339 __isl_give isl_set *isl_map_domain(
4340 __isl_take isl_map *bmap);
4341 __isl_give isl_set *isl_map_range(
4342 __isl_take isl_map *map);
4344 #include <isl/union_set.h>
4345 __isl_give isl_union_set *isl_union_set_project_out(
4346 __isl_take isl_union_set *uset,
4347 enum isl_dim_type type,
4348 unsigned first, unsigned n);
4349 __isl_give isl_set *isl_union_set_params(
4350 __isl_take isl_union_set *uset);
4352 The function C<isl_union_set_project_out> can only project out
4355 #include <isl/union_map.h>
4356 __isl_give isl_union_map *isl_union_map_project_out(
4357 __isl_take isl_union_map *umap,
4358 enum isl_dim_type type, unsigned first, unsigned n);
4359 __isl_give isl_set *isl_union_map_params(
4360 __isl_take isl_union_map *umap);
4361 __isl_give isl_union_set *isl_union_map_domain(
4362 __isl_take isl_union_map *umap);
4363 __isl_give isl_union_set *isl_union_map_range(
4364 __isl_take isl_union_map *umap);
4366 The function C<isl_union_map_project_out> can only project out
4369 #include <isl/aff.h>
4370 __isl_give isl_aff *isl_aff_project_domain_on_params(
4371 __isl_take isl_aff *aff);
4372 __isl_give isl_pw_multi_aff *
4373 isl_pw_multi_aff_project_domain_on_params(
4374 __isl_take isl_pw_multi_aff *pma);
4375 __isl_give isl_set *isl_pw_aff_domain(
4376 __isl_take isl_pw_aff *pwaff);
4377 __isl_give isl_set *isl_pw_multi_aff_domain(
4378 __isl_take isl_pw_multi_aff *pma);
4379 __isl_give isl_set *isl_multi_pw_aff_domain(
4380 __isl_take isl_multi_pw_aff *mpa);
4381 __isl_give isl_union_set *isl_union_pw_aff_domain(
4382 __isl_take isl_union_pw_aff *upa);
4383 __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4384 __isl_take isl_union_pw_multi_aff *upma);
4385 __isl_give isl_union_set *
4386 isl_multi_union_pw_aff_domain(
4387 __isl_take isl_multi_union_pw_aff *mupa);
4388 __isl_give isl_set *isl_pw_aff_params(
4389 __isl_take isl_pw_aff *pwa);
4391 The function C<isl_multi_union_pw_aff_domain> requires its
4392 input to have at least one set dimension.
4394 #include <isl/polynomial.h>
4395 __isl_give isl_qpolynomial *
4396 isl_qpolynomial_project_domain_on_params(
4397 __isl_take isl_qpolynomial *qp);
4398 __isl_give isl_pw_qpolynomial *
4399 isl_pw_qpolynomial_project_domain_on_params(
4400 __isl_take isl_pw_qpolynomial *pwqp);
4401 __isl_give isl_pw_qpolynomial_fold *
4402 isl_pw_qpolynomial_fold_project_domain_on_params(
4403 __isl_take isl_pw_qpolynomial_fold *pwf);
4404 __isl_give isl_set *isl_pw_qpolynomial_domain(
4405 __isl_take isl_pw_qpolynomial *pwqp);
4406 __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4407 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4408 __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4409 __isl_take isl_union_pw_qpolynomial *upwqp);
4411 #include <isl/space.h>
4412 __isl_give isl_space *isl_space_domain_map(
4413 __isl_take isl_space *space);
4414 __isl_give isl_space *isl_space_range_map(
4415 __isl_take isl_space *space);
4417 #include <isl/map.h>
4418 __isl_give isl_map *isl_set_wrapped_domain_map(
4419 __isl_take isl_set *set);
4420 __isl_give isl_basic_map *isl_basic_map_domain_map(
4421 __isl_take isl_basic_map *bmap);
4422 __isl_give isl_basic_map *isl_basic_map_range_map(
4423 __isl_take isl_basic_map *bmap);
4424 __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4425 __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4427 #include <isl/union_map.h>
4428 __isl_give isl_union_map *isl_union_map_domain_map(
4429 __isl_take isl_union_map *umap);
4430 __isl_give isl_union_pw_multi_aff *
4431 isl_union_map_domain_map_union_pw_multi_aff(
4432 __isl_take isl_union_map *umap);
4433 __isl_give isl_union_map *isl_union_map_range_map(
4434 __isl_take isl_union_map *umap);
4435 __isl_give isl_union_map *
4436 isl_union_set_wrapped_domain_map(
4437 __isl_take isl_union_set *uset);
4439 The functions above construct a (basic, regular or union) relation
4440 that maps (a wrapped version of) the input relation to its domain or range.
4441 C<isl_set_wrapped_domain_map> maps the input set to the domain
4442 of its wrapped relation.
4446 __isl_give isl_basic_set *isl_basic_set_eliminate(
4447 __isl_take isl_basic_set *bset,
4448 enum isl_dim_type type,
4449 unsigned first, unsigned n);
4450 __isl_give isl_set *isl_set_eliminate(
4451 __isl_take isl_set *set, enum isl_dim_type type,
4452 unsigned first, unsigned n);
4453 __isl_give isl_basic_map *isl_basic_map_eliminate(
4454 __isl_take isl_basic_map *bmap,
4455 enum isl_dim_type type,
4456 unsigned first, unsigned n);
4457 __isl_give isl_map *isl_map_eliminate(
4458 __isl_take isl_map *map, enum isl_dim_type type,
4459 unsigned first, unsigned n);
4461 Eliminate the coefficients for the given dimensions from the constraints,
4462 without removing the dimensions.
4464 =item * Constructing a set from a parameter domain
4466 A zero-dimensional space or (basic) set can be constructed
4467 on a given parameter domain using the following functions.
4469 #include <isl/space.h>
4470 __isl_give isl_space *isl_space_set_from_params(
4471 __isl_take isl_space *space);
4473 #include <isl/set.h>
4474 __isl_give isl_basic_set *isl_basic_set_from_params(
4475 __isl_take isl_basic_set *bset);
4476 __isl_give isl_set *isl_set_from_params(
4477 __isl_take isl_set *set);
4479 =item * Constructing a relation from one or two sets
4481 Create a relation with the given set(s) as domain and/or range.
4482 If only the domain or the range is specified, then
4483 the range or domain of the created relation is a zero-dimensional
4484 flat anonymous space.
4486 #include <isl/space.h>
4487 __isl_give isl_space *isl_space_from_domain(
4488 __isl_take isl_space *space);
4489 __isl_give isl_space *isl_space_from_range(
4490 __isl_take isl_space *space);
4491 __isl_give isl_space *isl_space_map_from_set(
4492 __isl_take isl_space *space);
4493 __isl_give isl_space *isl_space_map_from_domain_and_range(
4494 __isl_take isl_space *domain,
4495 __isl_take isl_space *range);
4497 #include <isl/local_space.h>
4498 __isl_give isl_local_space *isl_local_space_from_domain(
4499 __isl_take isl_local_space *ls);
4501 #include <isl/map.h>
4502 __isl_give isl_map *isl_map_from_domain(
4503 __isl_take isl_set *set);
4504 __isl_give isl_map *isl_map_from_range(
4505 __isl_take isl_set *set);
4507 #include <isl/union_map.h>
4508 __isl_give isl_union_map *
4509 isl_union_map_from_domain_and_range(
4510 __isl_take isl_union_set *domain,
4511 __isl_take isl_union_set *range);
4513 #include <isl/val.h>
4514 __isl_give isl_multi_val *isl_multi_val_from_range(
4515 __isl_take isl_multi_val *mv);
4517 #include <isl/aff.h>
4518 __isl_give isl_multi_aff *isl_multi_aff_from_range(
4519 __isl_take isl_multi_aff *ma);
4520 __isl_give isl_pw_aff *isl_pw_aff_from_range(
4521 __isl_take isl_pw_aff *pwa);
4522 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4523 __isl_take isl_multi_pw_aff *mpa);
4524 __isl_give isl_multi_union_pw_aff *
4525 isl_multi_union_pw_aff_from_range(
4526 __isl_take isl_multi_union_pw_aff *mupa);
4527 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4528 __isl_take isl_set *set);
4529 __isl_give isl_union_pw_multi_aff *
4530 isl_union_pw_multi_aff_from_domain(
4531 __isl_take isl_union_set *uset);
4535 #include <isl/set.h>
4536 __isl_give isl_basic_set *isl_basic_set_fix_si(
4537 __isl_take isl_basic_set *bset,
4538 enum isl_dim_type type, unsigned pos, int value);
4539 __isl_give isl_basic_set *isl_basic_set_fix_val(
4540 __isl_take isl_basic_set *bset,
4541 enum isl_dim_type type, unsigned pos,
4542 __isl_take isl_val *v);
4543 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4544 enum isl_dim_type type, unsigned pos, int value);
4545 __isl_give isl_set *isl_set_fix_val(
4546 __isl_take isl_set *set,
4547 enum isl_dim_type type, unsigned pos,
4548 __isl_take isl_val *v);
4550 #include <isl/map.h>
4551 __isl_give isl_basic_map *isl_basic_map_fix_si(
4552 __isl_take isl_basic_map *bmap,
4553 enum isl_dim_type type, unsigned pos, int value);
4554 __isl_give isl_basic_map *isl_basic_map_fix_val(
4555 __isl_take isl_basic_map *bmap,
4556 enum isl_dim_type type, unsigned pos,
4557 __isl_take isl_val *v);
4558 __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4559 enum isl_dim_type type, unsigned pos, int value);
4560 __isl_give isl_map *isl_map_fix_val(
4561 __isl_take isl_map *map,
4562 enum isl_dim_type type, unsigned pos,
4563 __isl_take isl_val *v);
4565 #include <isl/aff.h>
4566 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4567 __isl_take isl_pw_multi_aff *pma,
4568 enum isl_dim_type type, unsigned pos, int value);
4570 #include <isl/polynomial.h>
4571 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4572 __isl_take isl_pw_qpolynomial *pwqp,
4573 enum isl_dim_type type, unsigned n,
4574 __isl_take isl_val *v);
4576 Intersect the set, relation or function domain
4577 with the hyperplane where the given
4578 dimension has the fixed given value.
4580 __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4581 __isl_take isl_basic_map *bmap,
4582 enum isl_dim_type type, unsigned pos, int value);
4583 __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4584 __isl_take isl_basic_map *bmap,
4585 enum isl_dim_type type, unsigned pos, int value);
4586 __isl_give isl_set *isl_set_lower_bound_si(
4587 __isl_take isl_set *set,
4588 enum isl_dim_type type, unsigned pos, int value);
4589 __isl_give isl_set *isl_set_lower_bound_val(
4590 __isl_take isl_set *set,
4591 enum isl_dim_type type, unsigned pos,
4592 __isl_take isl_val *value);
4593 __isl_give isl_map *isl_map_lower_bound_si(
4594 __isl_take isl_map *map,
4595 enum isl_dim_type type, unsigned pos, int value);
4596 __isl_give isl_set *isl_set_upper_bound_si(
4597 __isl_take isl_set *set,
4598 enum isl_dim_type type, unsigned pos, int value);
4599 __isl_give isl_set *isl_set_upper_bound_val(
4600 __isl_take isl_set *set,
4601 enum isl_dim_type type, unsigned pos,
4602 __isl_take isl_val *value);
4603 __isl_give isl_map *isl_map_upper_bound_si(
4604 __isl_take isl_map *map,
4605 enum isl_dim_type type, unsigned pos, int value);
4607 Intersect the set or relation with the half-space where the given
4608 dimension has a value bounded by the fixed given integer value.
4610 __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4611 enum isl_dim_type type1, int pos1,
4612 enum isl_dim_type type2, int pos2);
4613 __isl_give isl_basic_map *isl_basic_map_equate(
4614 __isl_take isl_basic_map *bmap,
4615 enum isl_dim_type type1, int pos1,
4616 enum isl_dim_type type2, int pos2);
4617 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4618 enum isl_dim_type type1, int pos1,
4619 enum isl_dim_type type2, int pos2);
4621 Intersect the set or relation with the hyperplane where the given
4622 dimensions are equal to each other.
4624 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4625 enum isl_dim_type type1, int pos1,
4626 enum isl_dim_type type2, int pos2);
4628 Intersect the relation with the hyperplane where the given
4629 dimensions have opposite values.
4631 __isl_give isl_map *isl_map_order_le(
4632 __isl_take isl_map *map,
4633 enum isl_dim_type type1, int pos1,
4634 enum isl_dim_type type2, int pos2);
4635 __isl_give isl_basic_map *isl_basic_map_order_ge(
4636 __isl_take isl_basic_map *bmap,
4637 enum isl_dim_type type1, int pos1,
4638 enum isl_dim_type type2, int pos2);
4639 __isl_give isl_map *isl_map_order_ge(
4640 __isl_take isl_map *map,
4641 enum isl_dim_type type1, int pos1,
4642 enum isl_dim_type type2, int pos2);
4643 __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4644 enum isl_dim_type type1, int pos1,
4645 enum isl_dim_type type2, int pos2);
4646 __isl_give isl_basic_map *isl_basic_map_order_gt(
4647 __isl_take isl_basic_map *bmap,
4648 enum isl_dim_type type1, int pos1,
4649 enum isl_dim_type type2, int pos2);
4650 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4651 enum isl_dim_type type1, int pos1,
4652 enum isl_dim_type type2, int pos2);
4654 Intersect the relation with the half-space where the given
4655 dimensions satisfy the given ordering.
4659 #include <isl/aff.h>
4660 __isl_give isl_basic_set *isl_aff_zero_basic_set(
4661 __isl_take isl_aff *aff);
4662 __isl_give isl_basic_set *isl_aff_neg_basic_set(
4663 __isl_take isl_aff *aff);
4664 __isl_give isl_set *isl_pw_aff_pos_set(
4665 __isl_take isl_pw_aff *pa);
4666 __isl_give isl_set *isl_pw_aff_nonneg_set(
4667 __isl_take isl_pw_aff *pwaff);
4668 __isl_give isl_set *isl_pw_aff_zero_set(
4669 __isl_take isl_pw_aff *pwaff);
4670 __isl_give isl_set *isl_pw_aff_non_zero_set(
4671 __isl_take isl_pw_aff *pwaff);
4672 __isl_give isl_union_set *
4673 isl_union_pw_aff_zero_union_set(
4674 __isl_take isl_union_pw_aff *upa);
4675 __isl_give isl_union_set *
4676 isl_multi_union_pw_aff_zero_union_set(
4677 __isl_take isl_multi_union_pw_aff *mupa);
4679 The function C<isl_aff_neg_basic_set> returns a basic set
4680 containing those elements in the domain space
4681 of C<aff> where C<aff> is negative.
4682 The function C<isl_pw_aff_nonneg_set> returns a set
4683 containing those elements in the domain
4684 of C<pwaff> where C<pwaff> is non-negative.
4685 The function C<isl_multi_union_pw_aff_zero_union_set>
4686 returns a union set containing those elements
4687 in the domains of its elements where they are all zero.
4691 __isl_give isl_map *isl_set_identity(
4692 __isl_take isl_set *set);
4693 __isl_give isl_union_map *isl_union_set_identity(
4694 __isl_take isl_union_set *uset);
4695 __isl_give isl_union_pw_multi_aff *
4696 isl_union_set_identity_union_pw_multi_aff(
4697 __isl_take isl_union_set *uset);
4699 Construct an identity relation on the given (union) set.
4701 =item * Function Extraction
4703 A piecewise quasi affine expression that is equal to 1 on a set
4704 and 0 outside the set can be created using the following function.
4706 #include <isl/aff.h>
4707 __isl_give isl_pw_aff *isl_set_indicator_function(
4708 __isl_take isl_set *set);
4710 A piecewise multiple quasi affine expression can be extracted
4711 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4712 and the C<isl_map> is single-valued.
4713 In case of a conversion from an C<isl_union_map>
4714 to an C<isl_union_pw_multi_aff>, these properties need to hold
4715 in each domain space.
4716 A conversion to a C<isl_multi_union_pw_aff> additionally
4717 requires that the input is non-empty and involves only a single
4720 #include <isl/aff.h>
4721 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4722 __isl_take isl_set *set);
4723 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4724 __isl_take isl_map *map);
4726 __isl_give isl_union_pw_multi_aff *
4727 isl_union_pw_multi_aff_from_union_set(
4728 __isl_take isl_union_set *uset);
4729 __isl_give isl_union_pw_multi_aff *
4730 isl_union_pw_multi_aff_from_union_map(
4731 __isl_take isl_union_map *umap);
4733 __isl_give isl_multi_union_pw_aff *
4734 isl_multi_union_pw_aff_from_union_map(
4735 __isl_take isl_union_map *umap);
4739 __isl_give isl_basic_set *isl_basic_map_deltas(
4740 __isl_take isl_basic_map *bmap);
4741 __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4742 __isl_give isl_union_set *isl_union_map_deltas(
4743 __isl_take isl_union_map *umap);
4745 These functions return a (basic) set containing the differences
4746 between image elements and corresponding domain elements in the input.
4748 __isl_give isl_basic_map *isl_basic_map_deltas_map(
4749 __isl_take isl_basic_map *bmap);
4750 __isl_give isl_map *isl_map_deltas_map(
4751 __isl_take isl_map *map);
4752 __isl_give isl_union_map *isl_union_map_deltas_map(
4753 __isl_take isl_union_map *umap);
4755 The functions above construct a (basic, regular or union) relation
4756 that maps (a wrapped version of) the input relation to its delta set.
4760 Simplify the representation of a set, relation or functions by trying
4761 to combine pairs of basic sets or relations into a single
4762 basic set or relation.
4764 #include <isl/set.h>
4765 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4767 #include <isl/map.h>
4768 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4770 #include <isl/union_set.h>
4771 __isl_give isl_union_set *isl_union_set_coalesce(
4772 __isl_take isl_union_set *uset);
4774 #include <isl/union_map.h>
4775 __isl_give isl_union_map *isl_union_map_coalesce(
4776 __isl_take isl_union_map *umap);
4778 #include <isl/aff.h>
4779 __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4780 __isl_take isl_pw_aff *pwqp);
4781 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4782 __isl_take isl_pw_multi_aff *pma);
4783 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4784 __isl_take isl_multi_pw_aff *mpa);
4785 __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4786 __isl_take isl_union_pw_aff *upa);
4787 __isl_give isl_union_pw_multi_aff *
4788 isl_union_pw_multi_aff_coalesce(
4789 __isl_take isl_union_pw_multi_aff *upma);
4790 __isl_give isl_multi_union_pw_aff *
4791 isl_multi_union_pw_aff_coalesce(
4792 __isl_take isl_multi_union_pw_aff *aff);
4794 #include <isl/polynomial.h>
4795 __isl_give isl_pw_qpolynomial_fold *
4796 isl_pw_qpolynomial_fold_coalesce(
4797 __isl_take isl_pw_qpolynomial_fold *pwf);
4798 __isl_give isl_union_pw_qpolynomial *
4799 isl_union_pw_qpolynomial_coalesce(
4800 __isl_take isl_union_pw_qpolynomial *upwqp);
4801 __isl_give isl_union_pw_qpolynomial_fold *
4802 isl_union_pw_qpolynomial_fold_coalesce(
4803 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4805 One of the methods for combining pairs of basic sets or relations
4806 can result in coefficients that are much larger than those that appear
4807 in the constraints of the input. By default, the coefficients are
4808 not allowed to grow larger, but this can be changed by unsetting
4809 the following option.
4811 isl_stat isl_options_set_coalesce_bounded_wrapping(
4812 isl_ctx *ctx, int val);
4813 int isl_options_get_coalesce_bounded_wrapping(
4816 =item * Detecting equalities
4818 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4819 __isl_take isl_basic_set *bset);
4820 __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4821 __isl_take isl_basic_map *bmap);
4822 __isl_give isl_set *isl_set_detect_equalities(
4823 __isl_take isl_set *set);
4824 __isl_give isl_map *isl_map_detect_equalities(
4825 __isl_take isl_map *map);
4826 __isl_give isl_union_set *isl_union_set_detect_equalities(
4827 __isl_take isl_union_set *uset);
4828 __isl_give isl_union_map *isl_union_map_detect_equalities(
4829 __isl_take isl_union_map *umap);
4831 Simplify the representation of a set or relation by detecting implicit
4834 =item * Removing redundant constraints
4836 #include <isl/set.h>
4837 __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4838 __isl_take isl_basic_set *bset);
4839 __isl_give isl_set *isl_set_remove_redundancies(
4840 __isl_take isl_set *set);
4842 #include <isl/union_set.h>
4843 __isl_give isl_union_set *
4844 isl_union_set_remove_redundancies(
4845 __isl_take isl_union_set *uset);
4847 #include <isl/map.h>
4848 __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4849 __isl_take isl_basic_map *bmap);
4850 __isl_give isl_map *isl_map_remove_redundancies(
4851 __isl_take isl_map *map);
4853 #include <isl/union_map.h>
4854 __isl_give isl_union_map *
4855 isl_union_map_remove_redundancies(
4856 __isl_take isl_union_map *umap);
4860 __isl_give isl_basic_set *isl_set_convex_hull(
4861 __isl_take isl_set *set);
4862 __isl_give isl_basic_map *isl_map_convex_hull(
4863 __isl_take isl_map *map);
4865 If the input set or relation has any existentially quantified
4866 variables, then the result of these operations is currently undefined.
4870 #include <isl/set.h>
4871 __isl_give isl_basic_set *
4872 isl_set_unshifted_simple_hull(
4873 __isl_take isl_set *set);
4874 __isl_give isl_basic_set *isl_set_simple_hull(
4875 __isl_take isl_set *set);
4876 __isl_give isl_basic_set *
4877 isl_set_plain_unshifted_simple_hull(
4878 __isl_take isl_set *set);
4879 __isl_give isl_basic_set *
4880 isl_set_unshifted_simple_hull_from_set_list(
4881 __isl_take isl_set *set,
4882 __isl_take isl_set_list *list);
4884 #include <isl/map.h>
4885 __isl_give isl_basic_map *
4886 isl_map_unshifted_simple_hull(
4887 __isl_take isl_map *map);
4888 __isl_give isl_basic_map *isl_map_simple_hull(
4889 __isl_take isl_map *map);
4890 __isl_give isl_basic_map *
4891 isl_map_plain_unshifted_simple_hull(
4892 __isl_take isl_map *map);
4893 __isl_give isl_basic_map *
4894 isl_map_unshifted_simple_hull_from_map_list(
4895 __isl_take isl_map *map,
4896 __isl_take isl_map_list *list);
4898 #include <isl/union_map.h>
4899 __isl_give isl_union_map *isl_union_map_simple_hull(
4900 __isl_take isl_union_map *umap);
4902 These functions compute a single basic set or relation
4903 that contains the whole input set or relation.
4904 In particular, the output is described by translates
4905 of the constraints describing the basic sets or relations in the input.
4906 In case of C<isl_set_unshifted_simple_hull>, only the original
4907 constraints are used, without any translation.
4908 In case of C<isl_set_plain_unshifted_simple_hull> and
4909 C<isl_map_plain_unshifted_simple_hull>, the result is described
4910 by original constraints that are obviously satisfied
4911 by the entire input set or relation.
4912 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4913 C<isl_map_unshifted_simple_hull_from_map_list>, the
4914 constraints are taken from the elements of the second argument.
4918 (See \autoref{s:simple hull}.)
4924 __isl_give isl_basic_set *isl_basic_set_affine_hull(
4925 __isl_take isl_basic_set *bset);
4926 __isl_give isl_basic_set *isl_set_affine_hull(
4927 __isl_take isl_set *set);
4928 __isl_give isl_union_set *isl_union_set_affine_hull(
4929 __isl_take isl_union_set *uset);
4930 __isl_give isl_basic_map *isl_basic_map_affine_hull(
4931 __isl_take isl_basic_map *bmap);
4932 __isl_give isl_basic_map *isl_map_affine_hull(
4933 __isl_take isl_map *map);
4934 __isl_give isl_union_map *isl_union_map_affine_hull(
4935 __isl_take isl_union_map *umap);
4937 In case of union sets and relations, the affine hull is computed
4940 =item * Polyhedral hull
4942 __isl_give isl_basic_set *isl_set_polyhedral_hull(
4943 __isl_take isl_set *set);
4944 __isl_give isl_basic_map *isl_map_polyhedral_hull(
4945 __isl_take isl_map *map);
4946 __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4947 __isl_take isl_union_set *uset);
4948 __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4949 __isl_take isl_union_map *umap);
4951 These functions compute a single basic set or relation
4952 not involving any existentially quantified variables
4953 that contains the whole input set or relation.
4954 In case of union sets and relations, the polyhedral hull is computed
4957 =item * Other approximations
4959 #include <isl/set.h>
4960 __isl_give isl_basic_set *
4961 isl_basic_set_drop_constraints_involving_dims(
4962 __isl_take isl_basic_set *bset,
4963 enum isl_dim_type type,
4964 unsigned first, unsigned n);
4965 __isl_give isl_basic_set *
4966 isl_basic_set_drop_constraints_not_involving_dims(
4967 __isl_take isl_basic_set *bset,
4968 enum isl_dim_type type,
4969 unsigned first, unsigned n);
4970 __isl_give isl_set *
4971 isl_set_drop_constraints_involving_dims(
4972 __isl_take isl_set *set,
4973 enum isl_dim_type type,
4974 unsigned first, unsigned n);
4975 __isl_give isl_set *
4976 isl_set_drop_constraints_not_involving_dims(
4977 __isl_take isl_set *set,
4978 enum isl_dim_type type,
4979 unsigned first, unsigned n);
4981 #include <isl/map.h>
4982 __isl_give isl_basic_map *
4983 isl_basic_map_drop_constraints_involving_dims(
4984 __isl_take isl_basic_map *bmap,
4985 enum isl_dim_type type,
4986 unsigned first, unsigned n);
4987 __isl_give isl_basic_map *
4988 isl_basic_map_drop_constraints_not_involving_dims(
4989 __isl_take isl_basic_map *bmap,
4990 enum isl_dim_type type,
4991 unsigned first, unsigned n);
4992 __isl_give isl_map *
4993 isl_map_drop_constraints_involving_dims(
4994 __isl_take isl_map *map,
4995 enum isl_dim_type type,
4996 unsigned first, unsigned n);
4997 __isl_give isl_map *
4998 isl_map_drop_constraints_not_involving_dims(
4999 __isl_take isl_map *map,
5000 enum isl_dim_type type,
5001 unsigned first, unsigned n);
5003 These functions drop any constraints (not) involving the specified dimensions.
5004 Note that the result depends on the representation of the input.
5006 #include <isl/polynomial.h>
5007 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
5008 __isl_take isl_pw_qpolynomial *pwqp, int sign);
5009 __isl_give isl_union_pw_qpolynomial *
5010 isl_union_pw_qpolynomial_to_polynomial(
5011 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
5013 Approximate each quasipolynomial by a polynomial. If C<sign> is positive,
5014 the polynomial will be an overapproximation. If C<sign> is negative,
5015 it will be an underapproximation. If C<sign> is zero, the approximation
5016 will lie somewhere in between.
5020 __isl_give isl_basic_set *isl_basic_set_sample(
5021 __isl_take isl_basic_set *bset);
5022 __isl_give isl_basic_set *isl_set_sample(
5023 __isl_take isl_set *set);
5024 __isl_give isl_basic_map *isl_basic_map_sample(
5025 __isl_take isl_basic_map *bmap);
5026 __isl_give isl_basic_map *isl_map_sample(
5027 __isl_take isl_map *map);
5029 If the input (basic) set or relation is non-empty, then return
5030 a singleton subset of the input. Otherwise, return an empty set.
5032 =item * Optimization
5034 #include <isl/ilp.h>
5035 __isl_give isl_val *isl_basic_set_max_val(
5036 __isl_keep isl_basic_set *bset,
5037 __isl_keep isl_aff *obj);
5038 __isl_give isl_val *isl_set_min_val(
5039 __isl_keep isl_set *set,
5040 __isl_keep isl_aff *obj);
5041 __isl_give isl_val *isl_set_max_val(
5042 __isl_keep isl_set *set,
5043 __isl_keep isl_aff *obj);
5044 __isl_give isl_multi_val *
5045 isl_union_set_min_multi_union_pw_aff(
5046 __isl_keep isl_union_set *set,
5047 __isl_keep isl_multi_union_pw_aff *obj);
5049 Compute the minimum or maximum of the integer affine expression C<obj>
5050 over the points in C<set>, returning the result in C<opt>.
5051 The result is C<NULL> in case of an error, the optimal value in case
5052 there is one, negative infinity or infinity if the problem is unbounded and
5053 NaN if the problem is empty.
5055 =item * Parametric optimization
5057 __isl_give isl_pw_aff *isl_set_dim_min(
5058 __isl_take isl_set *set, int pos);
5059 __isl_give isl_pw_aff *isl_set_dim_max(
5060 __isl_take isl_set *set, int pos);
5061 __isl_give isl_pw_aff *isl_map_dim_min(
5062 __isl_take isl_map *map, int pos);
5063 __isl_give isl_pw_aff *isl_map_dim_max(
5064 __isl_take isl_map *map, int pos);
5066 Compute the minimum or maximum of the given set or output dimension
5067 as a function of the parameters (and input dimensions), but independently
5068 of the other set or output dimensions.
5069 For lexicographic optimization, see L<"Lexicographic Optimization">.
5073 The following functions compute either the set of (rational) coefficient
5074 values of valid constraints for the given set or the set of (rational)
5075 values satisfying the constraints with coefficients from the given set.
5076 Internally, these two sets of functions perform essentially the
5077 same operations, except that the set of coefficients is assumed to
5078 be a cone, while the set of values may be any polyhedron.
5079 The current implementation is based on the Farkas lemma and
5080 Fourier-Motzkin elimination, but this may change or be made optional
5081 in future. In particular, future implementations may use different
5082 dualization algorithms or skip the elimination step.
5084 __isl_give isl_basic_set *isl_basic_set_coefficients(
5085 __isl_take isl_basic_set *bset);
5086 __isl_give isl_basic_set *isl_set_coefficients(
5087 __isl_take isl_set *set);
5088 __isl_give isl_union_set *isl_union_set_coefficients(
5089 __isl_take isl_union_set *bset);
5090 __isl_give isl_basic_set *isl_basic_set_solutions(
5091 __isl_take isl_basic_set *bset);
5092 __isl_give isl_basic_set *isl_set_solutions(
5093 __isl_take isl_set *set);
5094 __isl_give isl_union_set *isl_union_set_solutions(
5095 __isl_take isl_union_set *bset);
5099 __isl_give isl_map *isl_map_fixed_power_val(
5100 __isl_take isl_map *map,
5101 __isl_take isl_val *exp);
5102 __isl_give isl_union_map *
5103 isl_union_map_fixed_power_val(
5104 __isl_take isl_union_map *umap,
5105 __isl_take isl_val *exp);
5107 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
5108 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
5109 of C<map> is computed.
5111 __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
5113 __isl_give isl_union_map *isl_union_map_power(
5114 __isl_take isl_union_map *umap, int *exact);
5116 Compute a parametric representation for all positive powers I<k> of C<map>.
5117 The result maps I<k> to a nested relation corresponding to the
5118 I<k>th power of C<map>.
5119 The result may be an overapproximation. If the result is known to be exact,
5120 then C<*exact> is set to C<1>.
5122 =item * Transitive closure
5124 __isl_give isl_map *isl_map_transitive_closure(
5125 __isl_take isl_map *map, int *exact);
5126 __isl_give isl_union_map *isl_union_map_transitive_closure(
5127 __isl_take isl_union_map *umap, int *exact);
5129 Compute the transitive closure of C<map>.
5130 The result may be an overapproximation. If the result is known to be exact,
5131 then C<*exact> is set to C<1>.
5133 =item * Reaching path lengths
5135 __isl_give isl_map *isl_map_reaching_path_lengths(
5136 __isl_take isl_map *map, int *exact);
5138 Compute a relation that maps each element in the range of C<map>
5139 to the lengths of all paths composed of edges in C<map> that
5140 end up in the given element.
5141 The result may be an overapproximation. If the result is known to be exact,
5142 then C<*exact> is set to C<1>.
5143 To compute the I<maximal> path length, the resulting relation
5144 should be postprocessed by C<isl_map_lexmax>.
5145 In particular, if the input relation is a dependence relation
5146 (mapping sources to sinks), then the maximal path length corresponds
5147 to the free schedule.
5148 Note, however, that C<isl_map_lexmax> expects the maximum to be
5149 finite, so if the path lengths are unbounded (possibly due to
5150 the overapproximation), then you will get an error message.
5154 #include <isl/space.h>
5155 __isl_give isl_space *isl_space_wrap(
5156 __isl_take isl_space *space);
5157 __isl_give isl_space *isl_space_unwrap(
5158 __isl_take isl_space *space);
5160 #include <isl/local_space.h>
5161 __isl_give isl_local_space *isl_local_space_wrap(
5162 __isl_take isl_local_space *ls);
5164 #include <isl/set.h>
5165 __isl_give isl_basic_map *isl_basic_set_unwrap(
5166 __isl_take isl_basic_set *bset);
5167 __isl_give isl_map *isl_set_unwrap(
5168 __isl_take isl_set *set);
5170 #include <isl/map.h>
5171 __isl_give isl_basic_set *isl_basic_map_wrap(
5172 __isl_take isl_basic_map *bmap);
5173 __isl_give isl_set *isl_map_wrap(
5174 __isl_take isl_map *map);
5176 #include <isl/union_set.h>
5177 __isl_give isl_union_map *isl_union_set_unwrap(
5178 __isl_take isl_union_set *uset);
5180 #include <isl/union_map.h>
5181 __isl_give isl_union_set *isl_union_map_wrap(
5182 __isl_take isl_union_map *umap);
5184 The input to C<isl_space_unwrap> should
5185 be the space of a set, while that of
5186 C<isl_space_wrap> should be the space of a relation.
5187 Conversely, the output of C<isl_space_unwrap> is the space
5188 of a relation, while that of C<isl_space_wrap> is the space of a set.
5192 Remove any internal structure of domain (and range) of the given
5193 set or relation. If there is any such internal structure in the input,
5194 then the name of the space is also removed.
5196 #include <isl/local_space.h>
5197 __isl_give isl_local_space *
5198 isl_local_space_flatten_domain(
5199 __isl_take isl_local_space *ls);
5200 __isl_give isl_local_space *
5201 isl_local_space_flatten_range(
5202 __isl_take isl_local_space *ls);
5204 #include <isl/set.h>
5205 __isl_give isl_basic_set *isl_basic_set_flatten(
5206 __isl_take isl_basic_set *bset);
5207 __isl_give isl_set *isl_set_flatten(
5208 __isl_take isl_set *set);
5210 #include <isl/map.h>
5211 __isl_give isl_basic_map *isl_basic_map_flatten_domain(
5212 __isl_take isl_basic_map *bmap);
5213 __isl_give isl_basic_map *isl_basic_map_flatten_range(
5214 __isl_take isl_basic_map *bmap);
5215 __isl_give isl_map *isl_map_flatten_range(
5216 __isl_take isl_map *map);
5217 __isl_give isl_map *isl_map_flatten_domain(
5218 __isl_take isl_map *map);
5219 __isl_give isl_basic_map *isl_basic_map_flatten(
5220 __isl_take isl_basic_map *bmap);
5221 __isl_give isl_map *isl_map_flatten(
5222 __isl_take isl_map *map);
5224 #include <isl/val.h>
5225 __isl_give isl_multi_val *isl_multi_val_flatten_range(
5226 __isl_take isl_multi_val *mv);
5228 #include <isl/aff.h>
5229 __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5230 __isl_take isl_multi_aff *ma);
5231 __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5232 __isl_take isl_multi_aff *ma);
5233 __isl_give isl_multi_pw_aff *
5234 isl_multi_pw_aff_flatten_range(
5235 __isl_take isl_multi_pw_aff *mpa);
5236 __isl_give isl_multi_union_pw_aff *
5237 isl_multi_union_pw_aff_flatten_range(
5238 __isl_take isl_multi_union_pw_aff *mupa);
5240 #include <isl/map.h>
5241 __isl_give isl_map *isl_set_flatten_map(
5242 __isl_take isl_set *set);
5244 The function above constructs a relation
5245 that maps the input set to a flattened version of the set.
5249 Lift the input set to a space with extra dimensions corresponding
5250 to the existentially quantified variables in the input.
5251 In particular, the result lives in a wrapped map where the domain
5252 is the original space and the range corresponds to the original
5253 existentially quantified variables.
5255 #include <isl/set.h>
5256 __isl_give isl_basic_set *isl_basic_set_lift(
5257 __isl_take isl_basic_set *bset);
5258 __isl_give isl_set *isl_set_lift(
5259 __isl_take isl_set *set);
5260 __isl_give isl_union_set *isl_union_set_lift(
5261 __isl_take isl_union_set *uset);
5263 Given a local space that contains the existentially quantified
5264 variables of a set, a basic relation that, when applied to
5265 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
5266 can be constructed using the following function.
5268 #include <isl/local_space.h>
5269 __isl_give isl_basic_map *isl_local_space_lifting(
5270 __isl_take isl_local_space *ls);
5272 #include <isl/aff.h>
5273 __isl_give isl_multi_aff *isl_multi_aff_lift(
5274 __isl_take isl_multi_aff *maff,
5275 __isl_give isl_local_space **ls);
5277 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
5278 then it is assigned the local space that lies at the basis of
5279 the lifting applied.
5281 =item * Internal Product
5283 #include <isl/space.h>
5284 __isl_give isl_space *isl_space_zip(
5285 __isl_take isl_space *space);
5287 #include <isl/map.h>
5288 __isl_give isl_basic_map *isl_basic_map_zip(
5289 __isl_take isl_basic_map *bmap);
5290 __isl_give isl_map *isl_map_zip(
5291 __isl_take isl_map *map);
5293 #include <isl/union_map.h>
5294 __isl_give isl_union_map *isl_union_map_zip(
5295 __isl_take isl_union_map *umap);
5297 Given a relation with nested relations for domain and range,
5298 interchange the range of the domain with the domain of the range.
5302 #include <isl/space.h>
5303 __isl_give isl_space *isl_space_curry(
5304 __isl_take isl_space *space);
5305 __isl_give isl_space *isl_space_uncurry(
5306 __isl_take isl_space *space);
5308 #include <isl/map.h>
5309 __isl_give isl_basic_map *isl_basic_map_curry(
5310 __isl_take isl_basic_map *bmap);
5311 __isl_give isl_basic_map *isl_basic_map_uncurry(
5312 __isl_take isl_basic_map *bmap);
5313 __isl_give isl_map *isl_map_curry(
5314 __isl_take isl_map *map);
5315 __isl_give isl_map *isl_map_uncurry(
5316 __isl_take isl_map *map);
5318 #include <isl/union_map.h>
5319 __isl_give isl_union_map *isl_union_map_curry(
5320 __isl_take isl_union_map *umap);
5321 __isl_give isl_union_map *isl_union_map_uncurry(
5322 __isl_take isl_union_map *umap);
5324 Given a relation with a nested relation for domain,
5325 the C<curry> functions
5326 move the range of the nested relation out of the domain
5327 and use it as the domain of a nested relation in the range,
5328 with the original range as range of this nested relation.
5329 The C<uncurry> functions perform the inverse operation.
5331 #include <isl/space.h>
5332 __isl_give isl_space *isl_space_range_curry(
5333 __isl_take isl_space *space);
5335 #include <isl/map.h>
5336 __isl_give isl_map *isl_map_range_curry(
5337 __isl_take isl_map *map);
5339 #include <isl/union_map.h>
5340 __isl_give isl_union_map *isl_union_map_range_curry(
5341 __isl_take isl_union_map *umap);
5343 These functions apply the currying to the relation that
5344 is nested inside the range of the input.
5346 =item * Aligning parameters
5348 Change the order of the parameters of the given set, relation
5350 such that the first parameters match those of C<model>.
5351 This may involve the introduction of extra parameters.
5352 All parameters need to be named.
5354 #include <isl/space.h>
5355 __isl_give isl_space *isl_space_align_params(
5356 __isl_take isl_space *space1,
5357 __isl_take isl_space *space2)
5359 #include <isl/set.h>
5360 __isl_give isl_basic_set *isl_basic_set_align_params(
5361 __isl_take isl_basic_set *bset,
5362 __isl_take isl_space *model);
5363 __isl_give isl_set *isl_set_align_params(
5364 __isl_take isl_set *set,
5365 __isl_take isl_space *model);
5367 #include <isl/map.h>
5368 __isl_give isl_basic_map *isl_basic_map_align_params(
5369 __isl_take isl_basic_map *bmap,
5370 __isl_take isl_space *model);
5371 __isl_give isl_map *isl_map_align_params(
5372 __isl_take isl_map *map,
5373 __isl_take isl_space *model);
5375 #include <isl/val.h>
5376 __isl_give isl_multi_val *isl_multi_val_align_params(
5377 __isl_take isl_multi_val *mv,
5378 __isl_take isl_space *model);
5380 #include <isl/aff.h>
5381 __isl_give isl_aff *isl_aff_align_params(
5382 __isl_take isl_aff *aff,
5383 __isl_take isl_space *model);
5384 __isl_give isl_multi_aff *isl_multi_aff_align_params(
5385 __isl_take isl_multi_aff *multi,
5386 __isl_take isl_space *model);
5387 __isl_give isl_pw_aff *isl_pw_aff_align_params(
5388 __isl_take isl_pw_aff *pwaff,
5389 __isl_take isl_space *model);
5390 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5391 __isl_take isl_pw_multi_aff *pma,
5392 __isl_take isl_space *model);
5393 __isl_give isl_union_pw_aff *
5394 isl_union_pw_aff_align_params(
5395 __isl_take isl_union_pw_aff *upa,
5396 __isl_take isl_space *model);
5397 __isl_give isl_union_pw_multi_aff *
5398 isl_union_pw_multi_aff_align_params(
5399 __isl_take isl_union_pw_multi_aff *upma,
5400 __isl_take isl_space *model);
5401 __isl_give isl_multi_union_pw_aff *
5402 isl_multi_union_pw_aff_align_params(
5403 __isl_take isl_multi_union_pw_aff *mupa,
5404 __isl_take isl_space *model);
5406 #include <isl/polynomial.h>
5407 __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5408 __isl_take isl_qpolynomial *qp,
5409 __isl_take isl_space *model);
5411 =item * Unary Arithmetic Operations
5413 #include <isl/set.h>
5414 __isl_give isl_set *isl_set_neg(
5415 __isl_take isl_set *set);
5416 #include <isl/map.h>
5417 __isl_give isl_map *isl_map_neg(
5418 __isl_take isl_map *map);
5420 C<isl_set_neg> constructs a set containing the opposites of
5421 the elements in its argument.
5422 The domain of the result of C<isl_map_neg> is the same
5423 as the domain of its argument. The corresponding range
5424 elements are the opposites of the corresponding range
5425 elements in the argument.
5427 #include <isl/val.h>
5428 __isl_give isl_multi_val *isl_multi_val_neg(
5429 __isl_take isl_multi_val *mv);
5431 #include <isl/aff.h>
5432 __isl_give isl_aff *isl_aff_neg(
5433 __isl_take isl_aff *aff);
5434 __isl_give isl_multi_aff *isl_multi_aff_neg(
5435 __isl_take isl_multi_aff *ma);
5436 __isl_give isl_pw_aff *isl_pw_aff_neg(
5437 __isl_take isl_pw_aff *pwaff);
5438 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5439 __isl_take isl_pw_multi_aff *pma);
5440 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5441 __isl_take isl_multi_pw_aff *mpa);
5442 __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5443 __isl_take isl_union_pw_aff *upa);
5444 __isl_give isl_union_pw_multi_aff *
5445 isl_union_pw_multi_aff_neg(
5446 __isl_take isl_union_pw_multi_aff *upma);
5447 __isl_give isl_multi_union_pw_aff *
5448 isl_multi_union_pw_aff_neg(
5449 __isl_take isl_multi_union_pw_aff *mupa);
5450 __isl_give isl_aff *isl_aff_ceil(
5451 __isl_take isl_aff *aff);
5452 __isl_give isl_pw_aff *isl_pw_aff_ceil(
5453 __isl_take isl_pw_aff *pwaff);
5454 __isl_give isl_aff *isl_aff_floor(
5455 __isl_take isl_aff *aff);
5456 __isl_give isl_multi_aff *isl_multi_aff_floor(
5457 __isl_take isl_multi_aff *ma);
5458 __isl_give isl_pw_aff *isl_pw_aff_floor(
5459 __isl_take isl_pw_aff *pwaff);
5460 __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5461 __isl_take isl_union_pw_aff *upa);
5462 __isl_give isl_multi_union_pw_aff *
5463 isl_multi_union_pw_aff_floor(
5464 __isl_take isl_multi_union_pw_aff *mupa);
5466 #include <isl/aff.h>
5467 __isl_give isl_pw_aff *isl_pw_aff_list_min(
5468 __isl_take isl_pw_aff_list *list);
5469 __isl_give isl_pw_aff *isl_pw_aff_list_max(
5470 __isl_take isl_pw_aff_list *list);
5472 #include <isl/polynomial.h>
5473 __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5474 __isl_take isl_qpolynomial *qp);
5475 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5476 __isl_take isl_pw_qpolynomial *pwqp);
5477 __isl_give isl_union_pw_qpolynomial *
5478 isl_union_pw_qpolynomial_neg(
5479 __isl_take isl_union_pw_qpolynomial *upwqp);
5480 __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5481 __isl_take isl_qpolynomial *qp,
5483 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5484 __isl_take isl_pw_qpolynomial *pwqp,
5489 The following functions evaluate a function in a point.
5491 #include <isl/polynomial.h>
5492 __isl_give isl_val *isl_pw_qpolynomial_eval(
5493 __isl_take isl_pw_qpolynomial *pwqp,
5494 __isl_take isl_point *pnt);
5495 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5496 __isl_take isl_pw_qpolynomial_fold *pwf,
5497 __isl_take isl_point *pnt);
5498 __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5499 __isl_take isl_union_pw_qpolynomial *upwqp,
5500 __isl_take isl_point *pnt);
5501 __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5502 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5503 __isl_take isl_point *pnt);
5505 =item * Dimension manipulation
5507 It is usually not advisable to directly change the (input or output)
5508 space of a set or a relation as this removes the name and the internal
5509 structure of the space. However, the functions below can be useful
5510 to add new parameters, assuming
5511 C<isl_set_align_params> and C<isl_map_align_params>
5514 #include <isl/space.h>
5515 __isl_give isl_space *isl_space_add_dims(
5516 __isl_take isl_space *space,
5517 enum isl_dim_type type, unsigned n);
5518 __isl_give isl_space *isl_space_insert_dims(
5519 __isl_take isl_space *space,
5520 enum isl_dim_type type, unsigned pos, unsigned n);
5521 __isl_give isl_space *isl_space_drop_dims(
5522 __isl_take isl_space *space,
5523 enum isl_dim_type type, unsigned first, unsigned n);
5524 __isl_give isl_space *isl_space_move_dims(
5525 __isl_take isl_space *space,
5526 enum isl_dim_type dst_type, unsigned dst_pos,
5527 enum isl_dim_type src_type, unsigned src_pos,
5530 #include <isl/local_space.h>
5531 __isl_give isl_local_space *isl_local_space_add_dims(
5532 __isl_take isl_local_space *ls,
5533 enum isl_dim_type type, unsigned n);
5534 __isl_give isl_local_space *isl_local_space_insert_dims(
5535 __isl_take isl_local_space *ls,
5536 enum isl_dim_type type, unsigned first, unsigned n);
5537 __isl_give isl_local_space *isl_local_space_drop_dims(
5538 __isl_take isl_local_space *ls,
5539 enum isl_dim_type type, unsigned first, unsigned n);
5541 #include <isl/set.h>
5542 __isl_give isl_basic_set *isl_basic_set_add_dims(
5543 __isl_take isl_basic_set *bset,
5544 enum isl_dim_type type, unsigned n);
5545 __isl_give isl_set *isl_set_add_dims(
5546 __isl_take isl_set *set,
5547 enum isl_dim_type type, unsigned n);
5548 __isl_give isl_basic_set *isl_basic_set_insert_dims(
5549 __isl_take isl_basic_set *bset,
5550 enum isl_dim_type type, unsigned pos,
5552 __isl_give isl_set *isl_set_insert_dims(
5553 __isl_take isl_set *set,
5554 enum isl_dim_type type, unsigned pos, unsigned n);
5555 __isl_give isl_basic_set *isl_basic_set_move_dims(
5556 __isl_take isl_basic_set *bset,
5557 enum isl_dim_type dst_type, unsigned dst_pos,
5558 enum isl_dim_type src_type, unsigned src_pos,
5560 __isl_give isl_set *isl_set_move_dims(
5561 __isl_take isl_set *set,
5562 enum isl_dim_type dst_type, unsigned dst_pos,
5563 enum isl_dim_type src_type, unsigned src_pos,
5566 #include <isl/map.h>
5567 __isl_give isl_basic_map *isl_basic_map_add_dims(
5568 __isl_take isl_basic_map *bmap,
5569 enum isl_dim_type type, unsigned n);
5570 __isl_give isl_map *isl_map_add_dims(
5571 __isl_take isl_map *map,
5572 enum isl_dim_type type, unsigned n);
5573 __isl_give isl_basic_map *isl_basic_map_insert_dims(
5574 __isl_take isl_basic_map *bmap,
5575 enum isl_dim_type type, unsigned pos,
5577 __isl_give isl_map *isl_map_insert_dims(
5578 __isl_take isl_map *map,
5579 enum isl_dim_type type, unsigned pos, unsigned n);
5580 __isl_give isl_basic_map *isl_basic_map_move_dims(
5581 __isl_take isl_basic_map *bmap,
5582 enum isl_dim_type dst_type, unsigned dst_pos,
5583 enum isl_dim_type src_type, unsigned src_pos,
5585 __isl_give isl_map *isl_map_move_dims(
5586 __isl_take isl_map *map,
5587 enum isl_dim_type dst_type, unsigned dst_pos,
5588 enum isl_dim_type src_type, unsigned src_pos,
5591 #include <isl/val.h>
5592 __isl_give isl_multi_val *isl_multi_val_insert_dims(
5593 __isl_take isl_multi_val *mv,
5594 enum isl_dim_type type, unsigned first, unsigned n);
5595 __isl_give isl_multi_val *isl_multi_val_add_dims(
5596 __isl_take isl_multi_val *mv,
5597 enum isl_dim_type type, unsigned n);
5598 __isl_give isl_multi_val *isl_multi_val_drop_dims(
5599 __isl_take isl_multi_val *mv,
5600 enum isl_dim_type type, unsigned first, unsigned n);
5602 #include <isl/aff.h>
5603 __isl_give isl_aff *isl_aff_insert_dims(
5604 __isl_take isl_aff *aff,
5605 enum isl_dim_type type, unsigned first, unsigned n);
5606 __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5607 __isl_take isl_multi_aff *ma,
5608 enum isl_dim_type type, unsigned first, unsigned n);
5609 __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5610 __isl_take isl_pw_aff *pwaff,
5611 enum isl_dim_type type, unsigned first, unsigned n);
5612 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5613 __isl_take isl_multi_pw_aff *mpa,
5614 enum isl_dim_type type, unsigned first, unsigned n);
5615 __isl_give isl_aff *isl_aff_add_dims(
5616 __isl_take isl_aff *aff,
5617 enum isl_dim_type type, unsigned n);
5618 __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5619 __isl_take isl_multi_aff *ma,
5620 enum isl_dim_type type, unsigned n);
5621 __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5622 __isl_take isl_pw_aff *pwaff,
5623 enum isl_dim_type type, unsigned n);
5624 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5625 __isl_take isl_multi_pw_aff *mpa,
5626 enum isl_dim_type type, unsigned n);
5627 __isl_give isl_aff *isl_aff_drop_dims(
5628 __isl_take isl_aff *aff,
5629 enum isl_dim_type type, unsigned first, unsigned n);
5630 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5631 __isl_take isl_multi_aff *maff,
5632 enum isl_dim_type type, unsigned first, unsigned n);
5633 __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5634 __isl_take isl_pw_aff *pwaff,
5635 enum isl_dim_type type, unsigned first, unsigned n);
5636 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5637 __isl_take isl_pw_multi_aff *pma,
5638 enum isl_dim_type type, unsigned first, unsigned n);
5639 __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5640 __isl_take isl_union_pw_aff *upa,
5641 enum isl_dim_type type, unsigned first, unsigned n);
5642 __isl_give isl_union_pw_multi_aff *
5643 isl_union_pw_multi_aff_drop_dims(
5644 __isl_take isl_union_pw_multi_aff *upma,
5645 enum isl_dim_type type,
5646 unsigned first, unsigned n);
5647 __isl_give isl_multi_union_pw_aff *
5648 isl_multi_union_pw_aff_drop_dims(
5649 __isl_take isl_multi_union_pw_aff *mupa,
5650 enum isl_dim_type type, unsigned first,
5652 __isl_give isl_aff *isl_aff_move_dims(
5653 __isl_take isl_aff *aff,
5654 enum isl_dim_type dst_type, unsigned dst_pos,
5655 enum isl_dim_type src_type, unsigned src_pos,
5657 __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5658 __isl_take isl_multi_aff *ma,
5659 enum isl_dim_type dst_type, unsigned dst_pos,
5660 enum isl_dim_type src_type, unsigned src_pos,
5662 __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5663 __isl_take isl_pw_aff *pa,
5664 enum isl_dim_type dst_type, unsigned dst_pos,
5665 enum isl_dim_type src_type, unsigned src_pos,
5667 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5668 __isl_take isl_multi_pw_aff *pma,
5669 enum isl_dim_type dst_type, unsigned dst_pos,
5670 enum isl_dim_type src_type, unsigned src_pos,
5673 #include <isl/polynomial.h>
5674 __isl_give isl_union_pw_qpolynomial *
5675 isl_union_pw_qpolynomial_drop_dims(
5676 __isl_take isl_union_pw_qpolynomial *upwqp,
5677 enum isl_dim_type type,
5678 unsigned first, unsigned n);
5679 __isl_give isl_union_pw_qpolynomial_fold *
5680 isl_union_pw_qpolynomial_fold_drop_dims(
5681 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5682 enum isl_dim_type type,
5683 unsigned first, unsigned n);
5685 The operations on union expressions can only manipulate parameters.
5689 =head2 Binary Operations
5691 The two arguments of a binary operation not only need to live
5692 in the same C<isl_ctx>, they currently also need to have
5693 the same (number of) parameters.
5695 =head3 Basic Operations
5699 =item * Intersection
5701 #include <isl/local_space.h>
5702 __isl_give isl_local_space *isl_local_space_intersect(
5703 __isl_take isl_local_space *ls1,
5704 __isl_take isl_local_space *ls2);
5706 #include <isl/set.h>
5707 __isl_give isl_basic_set *isl_basic_set_intersect_params(
5708 __isl_take isl_basic_set *bset1,
5709 __isl_take isl_basic_set *bset2);
5710 __isl_give isl_basic_set *isl_basic_set_intersect(
5711 __isl_take isl_basic_set *bset1,
5712 __isl_take isl_basic_set *bset2);
5713 __isl_give isl_basic_set *isl_basic_set_list_intersect(
5714 __isl_take struct isl_basic_set_list *list);
5715 __isl_give isl_set *isl_set_intersect_params(
5716 __isl_take isl_set *set,
5717 __isl_take isl_set *params);
5718 __isl_give isl_set *isl_set_intersect(
5719 __isl_take isl_set *set1,
5720 __isl_take isl_set *set2);
5722 #include <isl/map.h>
5723 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5724 __isl_take isl_basic_map *bmap,
5725 __isl_take isl_basic_set *bset);
5726 __isl_give isl_basic_map *isl_basic_map_intersect_range(
5727 __isl_take isl_basic_map *bmap,
5728 __isl_take isl_basic_set *bset);
5729 __isl_give isl_basic_map *isl_basic_map_intersect(
5730 __isl_take isl_basic_map *bmap1,
5731 __isl_take isl_basic_map *bmap2);
5732 __isl_give isl_basic_map *isl_basic_map_list_intersect(
5733 __isl_take isl_basic_map_list *list);
5734 __isl_give isl_map *isl_map_intersect_params(
5735 __isl_take isl_map *map,
5736 __isl_take isl_set *params);
5737 __isl_give isl_map *isl_map_intersect_domain(
5738 __isl_take isl_map *map,
5739 __isl_take isl_set *set);
5740 __isl_give isl_map *isl_map_intersect_range(
5741 __isl_take isl_map *map,
5742 __isl_take isl_set *set);
5743 __isl_give isl_map *isl_map_intersect(
5744 __isl_take isl_map *map1,
5745 __isl_take isl_map *map2);
5747 #include <isl/union_set.h>
5748 __isl_give isl_union_set *isl_union_set_intersect_params(
5749 __isl_take isl_union_set *uset,
5750 __isl_take isl_set *set);
5751 __isl_give isl_union_set *isl_union_set_intersect(
5752 __isl_take isl_union_set *uset1,
5753 __isl_take isl_union_set *uset2);
5755 #include <isl/union_map.h>
5756 __isl_give isl_union_map *isl_union_map_intersect_params(
5757 __isl_take isl_union_map *umap,
5758 __isl_take isl_set *set);
5759 __isl_give isl_union_map *isl_union_map_intersect_domain(
5760 __isl_take isl_union_map *umap,
5761 __isl_take isl_union_set *uset);
5762 __isl_give isl_union_map *isl_union_map_intersect_range(
5763 __isl_take isl_union_map *umap,
5764 __isl_take isl_union_set *uset);
5765 __isl_give isl_union_map *isl_union_map_intersect(
5766 __isl_take isl_union_map *umap1,
5767 __isl_take isl_union_map *umap2);
5769 #include <isl/aff.h>
5770 __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5771 __isl_take isl_pw_aff *pa,
5772 __isl_take isl_set *set);
5773 __isl_give isl_multi_pw_aff *
5774 isl_multi_pw_aff_intersect_domain(
5775 __isl_take isl_multi_pw_aff *mpa,
5776 __isl_take isl_set *domain);
5777 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5778 __isl_take isl_pw_multi_aff *pma,
5779 __isl_take isl_set *set);
5780 __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5781 __isl_take isl_union_pw_aff *upa,
5782 __isl_take isl_union_set *uset);
5783 __isl_give isl_union_pw_multi_aff *
5784 isl_union_pw_multi_aff_intersect_domain(
5785 __isl_take isl_union_pw_multi_aff *upma,
5786 __isl_take isl_union_set *uset);
5787 __isl_give isl_multi_union_pw_aff *
5788 isl_multi_union_pw_aff_intersect_domain(
5789 __isl_take isl_multi_union_pw_aff *mupa,
5790 __isl_take isl_union_set *uset);
5791 __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5792 __isl_take isl_pw_aff *pa,
5793 __isl_take isl_set *set);
5794 __isl_give isl_multi_pw_aff *
5795 isl_multi_pw_aff_intersect_params(
5796 __isl_take isl_multi_pw_aff *mpa,
5797 __isl_take isl_set *set);
5798 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5799 __isl_take isl_pw_multi_aff *pma,
5800 __isl_take isl_set *set);
5801 __isl_give isl_union_pw_aff *
5802 isl_union_pw_aff_intersect_params(
5803 __isl_take isl_union_pw_aff *upa,
5804 __isl_give isl_union_pw_multi_aff *
5805 isl_union_pw_multi_aff_intersect_params(
5806 __isl_take isl_union_pw_multi_aff *upma,
5807 __isl_take isl_set *set);
5808 __isl_give isl_multi_union_pw_aff *
5809 isl_multi_union_pw_aff_intersect_params(
5810 __isl_take isl_multi_union_pw_aff *mupa,
5811 __isl_take isl_set *params);
5812 isl_multi_union_pw_aff_intersect_range(
5813 __isl_take isl_multi_union_pw_aff *mupa,
5814 __isl_take isl_set *set);
5816 #include <isl/polynomial.h>
5817 __isl_give isl_pw_qpolynomial *
5818 isl_pw_qpolynomial_intersect_domain(
5819 __isl_take isl_pw_qpolynomial *pwpq,
5820 __isl_take isl_set *set);
5821 __isl_give isl_union_pw_qpolynomial *
5822 isl_union_pw_qpolynomial_intersect_domain(
5823 __isl_take isl_union_pw_qpolynomial *upwpq,
5824 __isl_take isl_union_set *uset);
5825 __isl_give isl_union_pw_qpolynomial_fold *
5826 isl_union_pw_qpolynomial_fold_intersect_domain(
5827 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5828 __isl_take isl_union_set *uset);
5829 __isl_give isl_pw_qpolynomial *
5830 isl_pw_qpolynomial_intersect_params(
5831 __isl_take isl_pw_qpolynomial *pwpq,
5832 __isl_take isl_set *set);
5833 __isl_give isl_pw_qpolynomial_fold *
5834 isl_pw_qpolynomial_fold_intersect_params(
5835 __isl_take isl_pw_qpolynomial_fold *pwf,
5836 __isl_take isl_set *set);
5837 __isl_give isl_union_pw_qpolynomial *
5838 isl_union_pw_qpolynomial_intersect_params(
5839 __isl_take isl_union_pw_qpolynomial *upwpq,
5840 __isl_take isl_set *set);
5841 __isl_give isl_union_pw_qpolynomial_fold *
5842 isl_union_pw_qpolynomial_fold_intersect_params(
5843 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5844 __isl_take isl_set *set);
5846 The second argument to the C<_params> functions needs to be
5847 a parametric (basic) set. For the other functions, a parametric set
5848 for either argument is only allowed if the other argument is
5849 a parametric set as well.
5850 The list passed to C<isl_basic_set_list_intersect> needs to have
5851 at least one element and all elements need to live in the same space.
5852 The function C<isl_multi_union_pw_aff_intersect_range>
5853 restricts the input function to those shared domain elements
5854 that map to the specified range.
5858 #include <isl/set.h>
5859 __isl_give isl_set *isl_basic_set_union(
5860 __isl_take isl_basic_set *bset1,
5861 __isl_take isl_basic_set *bset2);
5862 __isl_give isl_set *isl_set_union(
5863 __isl_take isl_set *set1,
5864 __isl_take isl_set *set2);
5865 __isl_give isl_set *isl_set_list_union(
5866 __isl_take isl_set_list *list);
5868 #include <isl/map.h>
5869 __isl_give isl_map *isl_basic_map_union(
5870 __isl_take isl_basic_map *bmap1,
5871 __isl_take isl_basic_map *bmap2);
5872 __isl_give isl_map *isl_map_union(
5873 __isl_take isl_map *map1,
5874 __isl_take isl_map *map2);
5876 #include <isl/union_set.h>
5877 __isl_give isl_union_set *isl_union_set_union(
5878 __isl_take isl_union_set *uset1,
5879 __isl_take isl_union_set *uset2);
5880 __isl_give isl_union_set *isl_union_set_list_union(
5881 __isl_take isl_union_set_list *list);
5883 #include <isl/union_map.h>
5884 __isl_give isl_union_map *isl_union_map_union(
5885 __isl_take isl_union_map *umap1,
5886 __isl_take isl_union_map *umap2);
5888 The list passed to C<isl_set_list_union> needs to have
5889 at least one element and all elements need to live in the same space.
5891 =item * Set difference
5893 #include <isl/set.h>
5894 __isl_give isl_set *isl_set_subtract(
5895 __isl_take isl_set *set1,
5896 __isl_take isl_set *set2);
5898 #include <isl/map.h>
5899 __isl_give isl_map *isl_map_subtract(
5900 __isl_take isl_map *map1,
5901 __isl_take isl_map *map2);
5902 __isl_give isl_map *isl_map_subtract_domain(
5903 __isl_take isl_map *map,
5904 __isl_take isl_set *dom);
5905 __isl_give isl_map *isl_map_subtract_range(
5906 __isl_take isl_map *map,
5907 __isl_take isl_set *dom);
5909 #include <isl/union_set.h>
5910 __isl_give isl_union_set *isl_union_set_subtract(
5911 __isl_take isl_union_set *uset1,
5912 __isl_take isl_union_set *uset2);
5914 #include <isl/union_map.h>
5915 __isl_give isl_union_map *isl_union_map_subtract(
5916 __isl_take isl_union_map *umap1,
5917 __isl_take isl_union_map *umap2);
5918 __isl_give isl_union_map *isl_union_map_subtract_domain(
5919 __isl_take isl_union_map *umap,
5920 __isl_take isl_union_set *dom);
5921 __isl_give isl_union_map *isl_union_map_subtract_range(
5922 __isl_take isl_union_map *umap,
5923 __isl_take isl_union_set *dom);
5925 #include <isl/aff.h>
5926 __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5927 __isl_take isl_pw_aff *pa,
5928 __isl_take isl_set *set);
5929 __isl_give isl_pw_multi_aff *
5930 isl_pw_multi_aff_subtract_domain(
5931 __isl_take isl_pw_multi_aff *pma,
5932 __isl_take isl_set *set);
5933 __isl_give isl_union_pw_aff *
5934 isl_union_pw_aff_subtract_domain(
5935 __isl_take isl_union_pw_aff *upa,
5936 __isl_take isl_union_set *uset);
5937 __isl_give isl_union_pw_multi_aff *
5938 isl_union_pw_multi_aff_subtract_domain(
5939 __isl_take isl_union_pw_multi_aff *upma,
5940 __isl_take isl_set *set);
5942 #include <isl/polynomial.h>
5943 __isl_give isl_pw_qpolynomial *
5944 isl_pw_qpolynomial_subtract_domain(
5945 __isl_take isl_pw_qpolynomial *pwpq,
5946 __isl_take isl_set *set);
5947 __isl_give isl_pw_qpolynomial_fold *
5948 isl_pw_qpolynomial_fold_subtract_domain(
5949 __isl_take isl_pw_qpolynomial_fold *pwf,
5950 __isl_take isl_set *set);
5951 __isl_give isl_union_pw_qpolynomial *
5952 isl_union_pw_qpolynomial_subtract_domain(
5953 __isl_take isl_union_pw_qpolynomial *upwpq,
5954 __isl_take isl_union_set *uset);
5955 __isl_give isl_union_pw_qpolynomial_fold *
5956 isl_union_pw_qpolynomial_fold_subtract_domain(
5957 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5958 __isl_take isl_union_set *uset);
5962 #include <isl/space.h>
5963 __isl_give isl_space *isl_space_join(
5964 __isl_take isl_space *left,
5965 __isl_take isl_space *right);
5967 #include <isl/map.h>
5968 __isl_give isl_basic_set *isl_basic_set_apply(
5969 __isl_take isl_basic_set *bset,
5970 __isl_take isl_basic_map *bmap);
5971 __isl_give isl_set *isl_set_apply(
5972 __isl_take isl_set *set,
5973 __isl_take isl_map *map);
5974 __isl_give isl_union_set *isl_union_set_apply(
5975 __isl_take isl_union_set *uset,
5976 __isl_take isl_union_map *umap);
5977 __isl_give isl_basic_map *isl_basic_map_apply_domain(
5978 __isl_take isl_basic_map *bmap1,
5979 __isl_take isl_basic_map *bmap2);
5980 __isl_give isl_basic_map *isl_basic_map_apply_range(
5981 __isl_take isl_basic_map *bmap1,
5982 __isl_take isl_basic_map *bmap2);
5983 __isl_give isl_map *isl_map_apply_domain(
5984 __isl_take isl_map *map1,
5985 __isl_take isl_map *map2);
5986 __isl_give isl_map *isl_map_apply_range(
5987 __isl_take isl_map *map1,
5988 __isl_take isl_map *map2);
5990 #include <isl/union_map.h>
5991 __isl_give isl_union_map *isl_union_map_apply_domain(
5992 __isl_take isl_union_map *umap1,
5993 __isl_take isl_union_map *umap2);
5994 __isl_give isl_union_map *isl_union_map_apply_range(
5995 __isl_take isl_union_map *umap1,
5996 __isl_take isl_union_map *umap2);
5998 #include <isl/aff.h>
5999 __isl_give isl_union_pw_aff *
6000 isl_multi_union_pw_aff_apply_aff(
6001 __isl_take isl_multi_union_pw_aff *mupa,
6002 __isl_take isl_aff *aff);
6003 __isl_give isl_union_pw_aff *
6004 isl_multi_union_pw_aff_apply_pw_aff(
6005 __isl_take isl_multi_union_pw_aff *mupa,
6006 __isl_take isl_pw_aff *pa);
6007 __isl_give isl_multi_union_pw_aff *
6008 isl_multi_union_pw_aff_apply_multi_aff(
6009 __isl_take isl_multi_union_pw_aff *mupa,
6010 __isl_take isl_multi_aff *ma);
6011 __isl_give isl_multi_union_pw_aff *
6012 isl_multi_union_pw_aff_apply_pw_multi_aff(
6013 __isl_take isl_multi_union_pw_aff *mupa,
6014 __isl_take isl_pw_multi_aff *pma);
6016 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
6017 over the shared domain of the elements of the input. The dimension is
6018 required to be greater than zero.
6019 The C<isl_multi_union_pw_aff> argument of
6020 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
6021 but only if the range of the C<isl_multi_aff> argument
6022 is also zero-dimensional.
6023 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
6025 #include <isl/polynomial.h>
6026 __isl_give isl_pw_qpolynomial_fold *
6027 isl_set_apply_pw_qpolynomial_fold(
6028 __isl_take isl_set *set,
6029 __isl_take isl_pw_qpolynomial_fold *pwf,
6031 __isl_give isl_pw_qpolynomial_fold *
6032 isl_map_apply_pw_qpolynomial_fold(
6033 __isl_take isl_map *map,
6034 __isl_take isl_pw_qpolynomial_fold *pwf,
6036 __isl_give isl_union_pw_qpolynomial_fold *
6037 isl_union_set_apply_union_pw_qpolynomial_fold(
6038 __isl_take isl_union_set *uset,
6039 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6041 __isl_give isl_union_pw_qpolynomial_fold *
6042 isl_union_map_apply_union_pw_qpolynomial_fold(
6043 __isl_take isl_union_map *umap,
6044 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6047 The functions taking a map
6048 compose the given map with the given piecewise quasipolynomial reduction.
6049 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
6050 over all elements in the intersection of the range of the map
6051 and the domain of the piecewise quasipolynomial reduction
6052 as a function of an element in the domain of the map.
6053 The functions taking a set compute a bound over all elements in the
6054 intersection of the set and the domain of the
6055 piecewise quasipolynomial reduction.
6059 #include <isl/set.h>
6060 __isl_give isl_basic_set *
6061 isl_basic_set_preimage_multi_aff(
6062 __isl_take isl_basic_set *bset,
6063 __isl_take isl_multi_aff *ma);
6064 __isl_give isl_set *isl_set_preimage_multi_aff(
6065 __isl_take isl_set *set,
6066 __isl_take isl_multi_aff *ma);
6067 __isl_give isl_set *isl_set_preimage_pw_multi_aff(
6068 __isl_take isl_set *set,
6069 __isl_take isl_pw_multi_aff *pma);
6070 __isl_give isl_set *isl_set_preimage_multi_pw_aff(
6071 __isl_take isl_set *set,
6072 __isl_take isl_multi_pw_aff *mpa);
6074 #include <isl/union_set.h>
6075 __isl_give isl_union_set *
6076 isl_union_set_preimage_multi_aff(
6077 __isl_take isl_union_set *uset,
6078 __isl_take isl_multi_aff *ma);
6079 __isl_give isl_union_set *
6080 isl_union_set_preimage_pw_multi_aff(
6081 __isl_take isl_union_set *uset,
6082 __isl_take isl_pw_multi_aff *pma);
6083 __isl_give isl_union_set *
6084 isl_union_set_preimage_union_pw_multi_aff(
6085 __isl_take isl_union_set *uset,
6086 __isl_take isl_union_pw_multi_aff *upma);
6088 #include <isl/map.h>
6089 __isl_give isl_basic_map *
6090 isl_basic_map_preimage_domain_multi_aff(
6091 __isl_take isl_basic_map *bmap,
6092 __isl_take isl_multi_aff *ma);
6093 __isl_give isl_map *isl_map_preimage_domain_multi_aff(
6094 __isl_take isl_map *map,
6095 __isl_take isl_multi_aff *ma);
6096 __isl_give isl_map *isl_map_preimage_range_multi_aff(
6097 __isl_take isl_map *map,
6098 __isl_take isl_multi_aff *ma);
6099 __isl_give isl_map *
6100 isl_map_preimage_domain_pw_multi_aff(
6101 __isl_take isl_map *map,
6102 __isl_take isl_pw_multi_aff *pma);
6103 __isl_give isl_map *
6104 isl_map_preimage_range_pw_multi_aff(
6105 __isl_take isl_map *map,
6106 __isl_take isl_pw_multi_aff *pma);
6107 __isl_give isl_map *
6108 isl_map_preimage_domain_multi_pw_aff(
6109 __isl_take isl_map *map,
6110 __isl_take isl_multi_pw_aff *mpa);
6111 __isl_give isl_basic_map *
6112 isl_basic_map_preimage_range_multi_aff(
6113 __isl_take isl_basic_map *bmap,
6114 __isl_take isl_multi_aff *ma);
6116 #include <isl/union_map.h>
6117 __isl_give isl_union_map *
6118 isl_union_map_preimage_domain_multi_aff(
6119 __isl_take isl_union_map *umap,
6120 __isl_take isl_multi_aff *ma);
6121 __isl_give isl_union_map *
6122 isl_union_map_preimage_range_multi_aff(
6123 __isl_take isl_union_map *umap,
6124 __isl_take isl_multi_aff *ma);
6125 __isl_give isl_union_map *
6126 isl_union_map_preimage_domain_pw_multi_aff(
6127 __isl_take isl_union_map *umap,
6128 __isl_take isl_pw_multi_aff *pma);
6129 __isl_give isl_union_map *
6130 isl_union_map_preimage_range_pw_multi_aff(
6131 __isl_take isl_union_map *umap,
6132 __isl_take isl_pw_multi_aff *pma);
6133 __isl_give isl_union_map *
6134 isl_union_map_preimage_domain_union_pw_multi_aff(
6135 __isl_take isl_union_map *umap,
6136 __isl_take isl_union_pw_multi_aff *upma);
6137 __isl_give isl_union_map *
6138 isl_union_map_preimage_range_union_pw_multi_aff(
6139 __isl_take isl_union_map *umap,
6140 __isl_take isl_union_pw_multi_aff *upma);
6142 These functions compute the preimage of the given set or map domain/range under
6143 the given function. In other words, the expression is plugged
6144 into the set description or into the domain/range of the map.
6148 #include <isl/aff.h>
6149 __isl_give isl_aff *isl_aff_pullback_aff(
6150 __isl_take isl_aff *aff1,
6151 __isl_take isl_aff *aff2);
6152 __isl_give isl_aff *isl_aff_pullback_multi_aff(
6153 __isl_take isl_aff *aff,
6154 __isl_take isl_multi_aff *ma);
6155 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
6156 __isl_take isl_pw_aff *pa,
6157 __isl_take isl_multi_aff *ma);
6158 __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
6159 __isl_take isl_pw_aff *pa,
6160 __isl_take isl_pw_multi_aff *pma);
6161 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
6162 __isl_take isl_pw_aff *pa,
6163 __isl_take isl_multi_pw_aff *mpa);
6164 __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
6165 __isl_take isl_multi_aff *ma1,
6166 __isl_take isl_multi_aff *ma2);
6167 __isl_give isl_pw_multi_aff *
6168 isl_pw_multi_aff_pullback_multi_aff(
6169 __isl_take isl_pw_multi_aff *pma,
6170 __isl_take isl_multi_aff *ma);
6171 __isl_give isl_multi_pw_aff *
6172 isl_multi_pw_aff_pullback_multi_aff(
6173 __isl_take isl_multi_pw_aff *mpa,
6174 __isl_take isl_multi_aff *ma);
6175 __isl_give isl_pw_multi_aff *
6176 isl_pw_multi_aff_pullback_pw_multi_aff(
6177 __isl_take isl_pw_multi_aff *pma1,
6178 __isl_take isl_pw_multi_aff *pma2);
6179 __isl_give isl_multi_pw_aff *
6180 isl_multi_pw_aff_pullback_pw_multi_aff(
6181 __isl_take isl_multi_pw_aff *mpa,
6182 __isl_take isl_pw_multi_aff *pma);
6183 __isl_give isl_multi_pw_aff *
6184 isl_multi_pw_aff_pullback_multi_pw_aff(
6185 __isl_take isl_multi_pw_aff *mpa1,
6186 __isl_take isl_multi_pw_aff *mpa2);
6187 __isl_give isl_union_pw_aff *
6188 isl_union_pw_aff_pullback_union_pw_multi_aff(
6189 __isl_take isl_union_pw_aff *upa,
6190 __isl_take isl_union_pw_multi_aff *upma);
6191 __isl_give isl_union_pw_multi_aff *
6192 isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
6193 __isl_take isl_union_pw_multi_aff *upma1,
6194 __isl_take isl_union_pw_multi_aff *upma2);
6195 __isl_give isl_multi_union_pw_aff *
6196 isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
6197 __isl_take isl_multi_union_pw_aff *mupa,
6198 __isl_take isl_union_pw_multi_aff *upma);
6200 These functions precompose the first expression by the second function.
6201 In other words, the second function is plugged
6202 into the first expression.
6206 #include <isl/aff.h>
6207 __isl_give isl_basic_set *isl_aff_eq_basic_set(
6208 __isl_take isl_aff *aff1,
6209 __isl_take isl_aff *aff2);
6210 __isl_give isl_set *isl_aff_eq_set(
6211 __isl_take isl_aff *aff1,
6212 __isl_take isl_aff *aff2);
6213 __isl_give isl_basic_set *isl_aff_le_basic_set(
6214 __isl_take isl_aff *aff1,
6215 __isl_take isl_aff *aff2);
6216 __isl_give isl_set *isl_aff_le_set(
6217 __isl_take isl_aff *aff1,
6218 __isl_take isl_aff *aff2);
6219 __isl_give isl_basic_set *isl_aff_ge_basic_set(
6220 __isl_take isl_aff *aff1,
6221 __isl_take isl_aff *aff2);
6222 __isl_give isl_set *isl_aff_ge_set(
6223 __isl_take isl_aff *aff1,
6224 __isl_take isl_aff *aff2);
6225 __isl_give isl_set *isl_pw_aff_eq_set(
6226 __isl_take isl_pw_aff *pwaff1,
6227 __isl_take isl_pw_aff *pwaff2);
6228 __isl_give isl_set *isl_pw_aff_ne_set(
6229 __isl_take isl_pw_aff *pwaff1,
6230 __isl_take isl_pw_aff *pwaff2);
6231 __isl_give isl_set *isl_pw_aff_le_set(
6232 __isl_take isl_pw_aff *pwaff1,
6233 __isl_take isl_pw_aff *pwaff2);
6234 __isl_give isl_set *isl_pw_aff_lt_set(
6235 __isl_take isl_pw_aff *pwaff1,
6236 __isl_take isl_pw_aff *pwaff2);
6237 __isl_give isl_set *isl_pw_aff_ge_set(
6238 __isl_take isl_pw_aff *pwaff1,
6239 __isl_take isl_pw_aff *pwaff2);
6240 __isl_give isl_set *isl_pw_aff_gt_set(
6241 __isl_take isl_pw_aff *pwaff1,
6242 __isl_take isl_pw_aff *pwaff2);
6244 __isl_give isl_set *isl_multi_aff_lex_le_set(
6245 __isl_take isl_multi_aff *ma1,
6246 __isl_take isl_multi_aff *ma2);
6247 __isl_give isl_set *isl_multi_aff_lex_lt_set(
6248 __isl_take isl_multi_aff *ma1,
6249 __isl_take isl_multi_aff *ma2);
6250 __isl_give isl_set *isl_multi_aff_lex_ge_set(
6251 __isl_take isl_multi_aff *ma1,
6252 __isl_take isl_multi_aff *ma2);
6253 __isl_give isl_set *isl_multi_aff_lex_gt_set(
6254 __isl_take isl_multi_aff *ma1,
6255 __isl_take isl_multi_aff *ma2);
6257 __isl_give isl_set *isl_pw_aff_list_eq_set(
6258 __isl_take isl_pw_aff_list *list1,
6259 __isl_take isl_pw_aff_list *list2);
6260 __isl_give isl_set *isl_pw_aff_list_ne_set(
6261 __isl_take isl_pw_aff_list *list1,
6262 __isl_take isl_pw_aff_list *list2);
6263 __isl_give isl_set *isl_pw_aff_list_le_set(
6264 __isl_take isl_pw_aff_list *list1,
6265 __isl_take isl_pw_aff_list *list2);
6266 __isl_give isl_set *isl_pw_aff_list_lt_set(
6267 __isl_take isl_pw_aff_list *list1,
6268 __isl_take isl_pw_aff_list *list2);
6269 __isl_give isl_set *isl_pw_aff_list_ge_set(
6270 __isl_take isl_pw_aff_list *list1,
6271 __isl_take isl_pw_aff_list *list2);
6272 __isl_give isl_set *isl_pw_aff_list_gt_set(
6273 __isl_take isl_pw_aff_list *list1,
6274 __isl_take isl_pw_aff_list *list2);
6276 The function C<isl_aff_ge_basic_set> returns a basic set
6277 containing those elements in the shared space
6278 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
6279 The function C<isl_pw_aff_ge_set> returns a set
6280 containing those elements in the shared domain
6281 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
6282 greater than or equal to C<pwaff2>.
6283 The function C<isl_multi_aff_lex_le_set> returns a set
6284 containing those elements in the shared domain space
6285 where C<ma1> is lexicographically smaller than or
6287 The functions operating on C<isl_pw_aff_list> apply the corresponding
6288 C<isl_pw_aff> function to each pair of elements in the two lists.
6290 #include <isl/aff.h>
6291 __isl_give isl_map *isl_pw_aff_eq_map(
6292 __isl_take isl_pw_aff *pa1,
6293 __isl_take isl_pw_aff *pa2);
6294 __isl_give isl_map *isl_pw_aff_lt_map(
6295 __isl_take isl_pw_aff *pa1,
6296 __isl_take isl_pw_aff *pa2);
6297 __isl_give isl_map *isl_pw_aff_gt_map(
6298 __isl_take isl_pw_aff *pa1,
6299 __isl_take isl_pw_aff *pa2);
6301 __isl_give isl_map *isl_multi_pw_aff_eq_map(
6302 __isl_take isl_multi_pw_aff *mpa1,
6303 __isl_take isl_multi_pw_aff *mpa2);
6304 __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
6305 __isl_take isl_multi_pw_aff *mpa1,
6306 __isl_take isl_multi_pw_aff *mpa2);
6307 __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
6308 __isl_take isl_multi_pw_aff *mpa1,
6309 __isl_take isl_multi_pw_aff *mpa2);
6311 These functions return a map between domain elements of the arguments
6312 where the function values satisfy the given relation.
6314 #include <isl/union_map.h>
6315 __isl_give isl_union_map *
6316 isl_union_map_eq_at_multi_union_pw_aff(
6317 __isl_take isl_union_map *umap,
6318 __isl_take isl_multi_union_pw_aff *mupa);
6319 __isl_give isl_union_map *
6320 isl_union_map_lex_lt_at_multi_union_pw_aff(
6321 __isl_take isl_union_map *umap,
6322 __isl_take isl_multi_union_pw_aff *mupa);
6323 __isl_give isl_union_map *
6324 isl_union_map_lex_gt_at_multi_union_pw_aff(
6325 __isl_take isl_union_map *umap,
6326 __isl_take isl_multi_union_pw_aff *mupa);
6328 These functions select the subset of elements in the union map
6329 that have an equal or lexicographically smaller function value.
6331 =item * Cartesian Product
6333 #include <isl/space.h>
6334 __isl_give isl_space *isl_space_product(
6335 __isl_take isl_space *space1,
6336 __isl_take isl_space *space2);
6337 __isl_give isl_space *isl_space_domain_product(
6338 __isl_take isl_space *space1,
6339 __isl_take isl_space *space2);
6340 __isl_give isl_space *isl_space_range_product(
6341 __isl_take isl_space *space1,
6342 __isl_take isl_space *space2);
6345 C<isl_space_product>, C<isl_space_domain_product>
6346 and C<isl_space_range_product> take pairs or relation spaces and
6347 produce a single relations space, where either the domain, the range
6348 or both domain and range are wrapped spaces of relations between
6349 the domains and/or ranges of the input spaces.
6350 If the product is only constructed over the domain or the range
6351 then the ranges or the domains of the inputs should be the same.
6352 The function C<isl_space_product> also accepts a pair of set spaces,
6353 in which case it returns a wrapped space of a relation between the
6356 #include <isl/set.h>
6357 __isl_give isl_set *isl_set_product(
6358 __isl_take isl_set *set1,
6359 __isl_take isl_set *set2);
6361 #include <isl/map.h>
6362 __isl_give isl_basic_map *isl_basic_map_domain_product(
6363 __isl_take isl_basic_map *bmap1,
6364 __isl_take isl_basic_map *bmap2);
6365 __isl_give isl_basic_map *isl_basic_map_range_product(
6366 __isl_take isl_basic_map *bmap1,
6367 __isl_take isl_basic_map *bmap2);
6368 __isl_give isl_basic_map *isl_basic_map_product(
6369 __isl_take isl_basic_map *bmap1,
6370 __isl_take isl_basic_map *bmap2);
6371 __isl_give isl_map *isl_map_domain_product(
6372 __isl_take isl_map *map1,
6373 __isl_take isl_map *map2);
6374 __isl_give isl_map *isl_map_range_product(
6375 __isl_take isl_map *map1,
6376 __isl_take isl_map *map2);
6377 __isl_give isl_map *isl_map_product(
6378 __isl_take isl_map *map1,
6379 __isl_take isl_map *map2);
6381 #include <isl/union_set.h>
6382 __isl_give isl_union_set *isl_union_set_product(
6383 __isl_take isl_union_set *uset1,
6384 __isl_take isl_union_set *uset2);
6386 #include <isl/union_map.h>
6387 __isl_give isl_union_map *isl_union_map_domain_product(
6388 __isl_take isl_union_map *umap1,
6389 __isl_take isl_union_map *umap2);
6390 __isl_give isl_union_map *isl_union_map_range_product(
6391 __isl_take isl_union_map *umap1,
6392 __isl_take isl_union_map *umap2);
6393 __isl_give isl_union_map *isl_union_map_product(
6394 __isl_take isl_union_map *umap1,
6395 __isl_take isl_union_map *umap2);
6397 #include <isl/val.h>
6398 __isl_give isl_multi_val *isl_multi_val_range_product(
6399 __isl_take isl_multi_val *mv1,
6400 __isl_take isl_multi_val *mv2);
6401 __isl_give isl_multi_val *isl_multi_val_product(
6402 __isl_take isl_multi_val *mv1,
6403 __isl_take isl_multi_val *mv2);
6405 #include <isl/aff.h>
6406 __isl_give isl_multi_aff *isl_multi_aff_range_product(
6407 __isl_take isl_multi_aff *ma1,
6408 __isl_take isl_multi_aff *ma2);
6409 __isl_give isl_multi_aff *isl_multi_aff_product(
6410 __isl_take isl_multi_aff *ma1,
6411 __isl_take isl_multi_aff *ma2);
6412 __isl_give isl_multi_pw_aff *
6413 isl_multi_pw_aff_range_product(
6414 __isl_take isl_multi_pw_aff *mpa1,
6415 __isl_take isl_multi_pw_aff *mpa2);
6416 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6417 __isl_take isl_multi_pw_aff *mpa1,
6418 __isl_take isl_multi_pw_aff *mpa2);
6419 __isl_give isl_pw_multi_aff *
6420 isl_pw_multi_aff_range_product(
6421 __isl_take isl_pw_multi_aff *pma1,
6422 __isl_take isl_pw_multi_aff *pma2);
6423 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6424 __isl_take isl_pw_multi_aff *pma1,
6425 __isl_take isl_pw_multi_aff *pma2);
6426 __isl_give isl_multi_union_pw_aff *
6427 isl_multi_union_pw_aff_range_product(
6428 __isl_take isl_multi_union_pw_aff *mupa1,
6429 __isl_take isl_multi_union_pw_aff *mupa2);
6431 The above functions compute the cross product of the given
6432 sets, relations or functions. The domains and ranges of the results
6433 are wrapped maps between domains and ranges of the inputs.
6434 To obtain a ``flat'' product, use the following functions
6437 #include <isl/set.h>
6438 __isl_give isl_basic_set *isl_basic_set_flat_product(
6439 __isl_take isl_basic_set *bset1,
6440 __isl_take isl_basic_set *bset2);
6441 __isl_give isl_set *isl_set_flat_product(
6442 __isl_take isl_set *set1,
6443 __isl_take isl_set *set2);
6445 #include <isl/map.h>
6446 __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6447 __isl_take isl_basic_map *bmap1,
6448 __isl_take isl_basic_map *bmap2);
6449 __isl_give isl_map *isl_map_flat_domain_product(
6450 __isl_take isl_map *map1,
6451 __isl_take isl_map *map2);
6452 __isl_give isl_map *isl_map_flat_range_product(
6453 __isl_take isl_map *map1,
6454 __isl_take isl_map *map2);
6455 __isl_give isl_basic_map *isl_basic_map_flat_product(
6456 __isl_take isl_basic_map *bmap1,
6457 __isl_take isl_basic_map *bmap2);
6458 __isl_give isl_map *isl_map_flat_product(
6459 __isl_take isl_map *map1,
6460 __isl_take isl_map *map2);
6462 #include <isl/union_map.h>
6463 __isl_give isl_union_map *
6464 isl_union_map_flat_domain_product(
6465 __isl_take isl_union_map *umap1,
6466 __isl_take isl_union_map *umap2);
6467 __isl_give isl_union_map *
6468 isl_union_map_flat_range_product(
6469 __isl_take isl_union_map *umap1,
6470 __isl_take isl_union_map *umap2);
6472 #include <isl/val.h>
6473 __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6474 __isl_take isl_multi_val *mv1,
6475 __isl_take isl_multi_aff *mv2);
6477 #include <isl/aff.h>
6478 __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6479 __isl_take isl_multi_aff *ma1,
6480 __isl_take isl_multi_aff *ma2);
6481 __isl_give isl_pw_multi_aff *
6482 isl_pw_multi_aff_flat_range_product(
6483 __isl_take isl_pw_multi_aff *pma1,
6484 __isl_take isl_pw_multi_aff *pma2);
6485 __isl_give isl_multi_pw_aff *
6486 isl_multi_pw_aff_flat_range_product(
6487 __isl_take isl_multi_pw_aff *mpa1,
6488 __isl_take isl_multi_pw_aff *mpa2);
6489 __isl_give isl_union_pw_multi_aff *
6490 isl_union_pw_multi_aff_flat_range_product(
6491 __isl_take isl_union_pw_multi_aff *upma1,
6492 __isl_take isl_union_pw_multi_aff *upma2);
6493 __isl_give isl_multi_union_pw_aff *
6494 isl_multi_union_pw_aff_flat_range_product(
6495 __isl_take isl_multi_union_pw_aff *mupa1,
6496 __isl_take isl_multi_union_pw_aff *mupa2);
6498 #include <isl/space.h>
6499 __isl_give isl_space *isl_space_factor_domain(
6500 __isl_take isl_space *space);
6501 __isl_give isl_space *isl_space_factor_range(
6502 __isl_take isl_space *space);
6503 __isl_give isl_space *isl_space_domain_factor_domain(
6504 __isl_take isl_space *space);
6505 __isl_give isl_space *isl_space_domain_factor_range(
6506 __isl_take isl_space *space);
6507 __isl_give isl_space *isl_space_range_factor_domain(
6508 __isl_take isl_space *space);
6509 __isl_give isl_space *isl_space_range_factor_range(
6510 __isl_take isl_space *space);
6512 The functions C<isl_space_range_factor_domain> and
6513 C<isl_space_range_factor_range> extract the two arguments from
6514 the result of a call to C<isl_space_range_product>.
6516 The arguments of a call to a product can be extracted
6517 from the result using the following functions.
6519 #include <isl/map.h>
6520 __isl_give isl_map *isl_map_factor_domain(
6521 __isl_take isl_map *map);
6522 __isl_give isl_map *isl_map_factor_range(
6523 __isl_take isl_map *map);
6524 __isl_give isl_map *isl_map_domain_factor_domain(
6525 __isl_take isl_map *map);
6526 __isl_give isl_map *isl_map_domain_factor_range(
6527 __isl_take isl_map *map);
6528 __isl_give isl_map *isl_map_range_factor_domain(
6529 __isl_take isl_map *map);
6530 __isl_give isl_map *isl_map_range_factor_range(
6531 __isl_take isl_map *map);
6533 #include <isl/union_map.h>
6534 __isl_give isl_union_map *isl_union_map_factor_domain(
6535 __isl_take isl_union_map *umap);
6536 __isl_give isl_union_map *isl_union_map_factor_range(
6537 __isl_take isl_union_map *umap);
6538 __isl_give isl_union_map *
6539 isl_union_map_domain_factor_domain(
6540 __isl_take isl_union_map *umap);
6541 __isl_give isl_union_map *
6542 isl_union_map_domain_factor_range(
6543 __isl_take isl_union_map *umap);
6544 __isl_give isl_union_map *
6545 isl_union_map_range_factor_domain(
6546 __isl_take isl_union_map *umap);
6547 __isl_give isl_union_map *
6548 isl_union_map_range_factor_range(
6549 __isl_take isl_union_map *umap);
6551 #include <isl/val.h>
6552 __isl_give isl_multi_val *isl_multi_val_factor_range(
6553 __isl_take isl_multi_val *mv);
6554 __isl_give isl_multi_val *
6555 isl_multi_val_range_factor_domain(
6556 __isl_take isl_multi_val *mv);
6557 __isl_give isl_multi_val *
6558 isl_multi_val_range_factor_range(
6559 __isl_take isl_multi_val *mv);
6561 #include <isl/aff.h>
6562 __isl_give isl_multi_aff *isl_multi_aff_factor_range(
6563 __isl_take isl_multi_aff *ma);
6564 __isl_give isl_multi_aff *
6565 isl_multi_aff_range_factor_domain(
6566 __isl_take isl_multi_aff *ma);
6567 __isl_give isl_multi_aff *
6568 isl_multi_aff_range_factor_range(
6569 __isl_take isl_multi_aff *ma);
6570 __isl_give isl_multi_pw_aff *
6571 isl_multi_pw_aff_factor_range(
6572 __isl_take isl_multi_pw_aff *mpa);
6573 __isl_give isl_multi_pw_aff *
6574 isl_multi_pw_aff_range_factor_domain(
6575 __isl_take isl_multi_pw_aff *mpa);
6576 __isl_give isl_multi_pw_aff *
6577 isl_multi_pw_aff_range_factor_range(
6578 __isl_take isl_multi_pw_aff *mpa);
6579 __isl_give isl_multi_union_pw_aff *
6580 isl_multi_union_pw_aff_factor_range(
6581 __isl_take isl_multi_union_pw_aff *mupa);
6582 __isl_give isl_multi_union_pw_aff *
6583 isl_multi_union_pw_aff_range_factor_domain(
6584 __isl_take isl_multi_union_pw_aff *mupa);
6585 __isl_give isl_multi_union_pw_aff *
6586 isl_multi_union_pw_aff_range_factor_range(
6587 __isl_take isl_multi_union_pw_aff *mupa);
6589 The splice functions are a generalization of the flat product functions,
6590 where the second argument may be inserted at any position inside
6591 the first argument rather than being placed at the end.
6592 The functions C<isl_multi_val_factor_range>,
6593 C<isl_multi_aff_factor_range>,
6594 C<isl_multi_pw_aff_factor_range> and
6595 C<isl_multi_union_pw_aff_factor_range>
6596 take functions that live in a set space.
6598 #include <isl/val.h>
6599 __isl_give isl_multi_val *isl_multi_val_range_splice(
6600 __isl_take isl_multi_val *mv1, unsigned pos,
6601 __isl_take isl_multi_val *mv2);
6603 #include <isl/aff.h>
6604 __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6605 __isl_take isl_multi_aff *ma1, unsigned pos,
6606 __isl_take isl_multi_aff *ma2);
6607 __isl_give isl_multi_aff *isl_multi_aff_splice(
6608 __isl_take isl_multi_aff *ma1,
6609 unsigned in_pos, unsigned out_pos,
6610 __isl_take isl_multi_aff *ma2);
6611 __isl_give isl_multi_pw_aff *
6612 isl_multi_pw_aff_range_splice(
6613 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6614 __isl_take isl_multi_pw_aff *mpa2);
6615 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6616 __isl_take isl_multi_pw_aff *mpa1,
6617 unsigned in_pos, unsigned out_pos,
6618 __isl_take isl_multi_pw_aff *mpa2);
6619 __isl_give isl_multi_union_pw_aff *
6620 isl_multi_union_pw_aff_range_splice(
6621 __isl_take isl_multi_union_pw_aff *mupa1,
6623 __isl_take isl_multi_union_pw_aff *mupa2);
6625 =item * Simplification
6627 When applied to a set or relation,
6628 the gist operation returns a set or relation that has the
6629 same intersection with the context as the input set or relation.
6630 Any implicit equality in the intersection is made explicit in the result,
6631 while all inequalities that are redundant with respect to the intersection
6633 In case of union sets and relations, the gist operation is performed
6636 When applied to a function,
6637 the gist operation applies the set gist operation to each of
6638 the cells in the domain of the input piecewise expression.
6639 The context is also exploited
6640 to simplify the expression associated to each cell.
6642 #include <isl/set.h>
6643 __isl_give isl_basic_set *isl_basic_set_gist(
6644 __isl_take isl_basic_set *bset,
6645 __isl_take isl_basic_set *context);
6646 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6647 __isl_take isl_set *context);
6648 __isl_give isl_set *isl_set_gist_params(
6649 __isl_take isl_set *set,
6650 __isl_take isl_set *context);
6652 #include <isl/map.h>
6653 __isl_give isl_basic_map *isl_basic_map_gist(
6654 __isl_take isl_basic_map *bmap,
6655 __isl_take isl_basic_map *context);
6656 __isl_give isl_basic_map *isl_basic_map_gist_domain(
6657 __isl_take isl_basic_map *bmap,
6658 __isl_take isl_basic_set *context);
6659 __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6660 __isl_take isl_map *context);
6661 __isl_give isl_map *isl_map_gist_params(
6662 __isl_take isl_map *map,
6663 __isl_take isl_set *context);
6664 __isl_give isl_map *isl_map_gist_domain(
6665 __isl_take isl_map *map,
6666 __isl_take isl_set *context);
6667 __isl_give isl_map *isl_map_gist_range(
6668 __isl_take isl_map *map,
6669 __isl_take isl_set *context);
6671 #include <isl/union_set.h>
6672 __isl_give isl_union_set *isl_union_set_gist(
6673 __isl_take isl_union_set *uset,
6674 __isl_take isl_union_set *context);
6675 __isl_give isl_union_set *isl_union_set_gist_params(
6676 __isl_take isl_union_set *uset,
6677 __isl_take isl_set *set);
6679 #include <isl/union_map.h>
6680 __isl_give isl_union_map *isl_union_map_gist(
6681 __isl_take isl_union_map *umap,
6682 __isl_take isl_union_map *context);
6683 __isl_give isl_union_map *isl_union_map_gist_params(
6684 __isl_take isl_union_map *umap,
6685 __isl_take isl_set *set);
6686 __isl_give isl_union_map *isl_union_map_gist_domain(
6687 __isl_take isl_union_map *umap,
6688 __isl_take isl_union_set *uset);
6689 __isl_give isl_union_map *isl_union_map_gist_range(
6690 __isl_take isl_union_map *umap,
6691 __isl_take isl_union_set *uset);
6693 #include <isl/aff.h>
6694 __isl_give isl_aff *isl_aff_gist_params(
6695 __isl_take isl_aff *aff,
6696 __isl_take isl_set *context);
6697 __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6698 __isl_take isl_set *context);
6699 __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6700 __isl_take isl_multi_aff *maff,
6701 __isl_take isl_set *context);
6702 __isl_give isl_multi_aff *isl_multi_aff_gist(
6703 __isl_take isl_multi_aff *maff,
6704 __isl_take isl_set *context);
6705 __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6706 __isl_take isl_pw_aff *pwaff,
6707 __isl_take isl_set *context);
6708 __isl_give isl_pw_aff *isl_pw_aff_gist(
6709 __isl_take isl_pw_aff *pwaff,
6710 __isl_take isl_set *context);
6711 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6712 __isl_take isl_pw_multi_aff *pma,
6713 __isl_take isl_set *set);
6714 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6715 __isl_take isl_pw_multi_aff *pma,
6716 __isl_take isl_set *set);
6717 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6718 __isl_take isl_multi_pw_aff *mpa,
6719 __isl_take isl_set *set);
6720 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6721 __isl_take isl_multi_pw_aff *mpa,
6722 __isl_take isl_set *set);
6723 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6724 __isl_take isl_union_pw_aff *upa,
6725 __isl_take isl_union_set *context);
6726 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6727 __isl_take isl_union_pw_aff *upa,
6728 __isl_take isl_set *context);
6729 __isl_give isl_union_pw_multi_aff *
6730 isl_union_pw_multi_aff_gist_params(
6731 __isl_take isl_union_pw_multi_aff *upma,
6732 __isl_take isl_set *context);
6733 __isl_give isl_union_pw_multi_aff *
6734 isl_union_pw_multi_aff_gist(
6735 __isl_take isl_union_pw_multi_aff *upma,
6736 __isl_take isl_union_set *context);
6737 __isl_give isl_multi_union_pw_aff *
6738 isl_multi_union_pw_aff_gist_params(
6739 __isl_take isl_multi_union_pw_aff *aff,
6740 __isl_take isl_set *context);
6741 __isl_give isl_multi_union_pw_aff *
6742 isl_multi_union_pw_aff_gist(
6743 __isl_take isl_multi_union_pw_aff *aff,
6744 __isl_take isl_union_set *context);
6746 #include <isl/polynomial.h>
6747 __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6748 __isl_take isl_qpolynomial *qp,
6749 __isl_take isl_set *context);
6750 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6751 __isl_take isl_qpolynomial *qp,
6752 __isl_take isl_set *context);
6753 __isl_give isl_qpolynomial_fold *
6754 isl_qpolynomial_fold_gist_params(
6755 __isl_take isl_qpolynomial_fold *fold,
6756 __isl_take isl_set *context);
6757 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6758 __isl_take isl_qpolynomial_fold *fold,
6759 __isl_take isl_set *context);
6760 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6761 __isl_take isl_pw_qpolynomial *pwqp,
6762 __isl_take isl_set *context);
6763 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6764 __isl_take isl_pw_qpolynomial *pwqp,
6765 __isl_take isl_set *context);
6766 __isl_give isl_pw_qpolynomial_fold *
6767 isl_pw_qpolynomial_fold_gist(
6768 __isl_take isl_pw_qpolynomial_fold *pwf,
6769 __isl_take isl_set *context);
6770 __isl_give isl_pw_qpolynomial_fold *
6771 isl_pw_qpolynomial_fold_gist_params(
6772 __isl_take isl_pw_qpolynomial_fold *pwf,
6773 __isl_take isl_set *context);
6774 __isl_give isl_union_pw_qpolynomial *
6775 isl_union_pw_qpolynomial_gist_params(
6776 __isl_take isl_union_pw_qpolynomial *upwqp,
6777 __isl_take isl_set *context);
6778 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6779 __isl_take isl_union_pw_qpolynomial *upwqp,
6780 __isl_take isl_union_set *context);
6781 __isl_give isl_union_pw_qpolynomial_fold *
6782 isl_union_pw_qpolynomial_fold_gist(
6783 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6784 __isl_take isl_union_set *context);
6785 __isl_give isl_union_pw_qpolynomial_fold *
6786 isl_union_pw_qpolynomial_fold_gist_params(
6787 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6788 __isl_take isl_set *context);
6790 =item * Binary Arithmetic Operations
6792 #include <isl/set.h>
6793 __isl_give isl_set *isl_set_sum(
6794 __isl_take isl_set *set1,
6795 __isl_take isl_set *set2);
6796 #include <isl/map.h>
6797 __isl_give isl_map *isl_map_sum(
6798 __isl_take isl_map *map1,
6799 __isl_take isl_map *map2);
6801 C<isl_set_sum> computes the Minkowski sum of its two arguments,
6802 i.e., the set containing the sums of pairs of elements from
6803 C<set1> and C<set2>.
6804 The domain of the result of C<isl_map_sum> is the intersection
6805 of the domains of its two arguments. The corresponding range
6806 elements are the sums of the corresponding range elements
6807 in the two arguments.
6809 #include <isl/val.h>
6810 __isl_give isl_multi_val *isl_multi_val_add(
6811 __isl_take isl_multi_val *mv1,
6812 __isl_take isl_multi_val *mv2);
6813 __isl_give isl_multi_val *isl_multi_val_sub(
6814 __isl_take isl_multi_val *mv1,
6815 __isl_take isl_multi_val *mv2);
6817 #include <isl/aff.h>
6818 __isl_give isl_aff *isl_aff_add(
6819 __isl_take isl_aff *aff1,
6820 __isl_take isl_aff *aff2);
6821 __isl_give isl_multi_aff *isl_multi_aff_add(
6822 __isl_take isl_multi_aff *maff1,
6823 __isl_take isl_multi_aff *maff2);
6824 __isl_give isl_pw_aff *isl_pw_aff_add(
6825 __isl_take isl_pw_aff *pwaff1,
6826 __isl_take isl_pw_aff *pwaff2);
6827 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
6828 __isl_take isl_multi_pw_aff *mpa1,
6829 __isl_take isl_multi_pw_aff *mpa2);
6830 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6831 __isl_take isl_pw_multi_aff *pma1,
6832 __isl_take isl_pw_multi_aff *pma2);
6833 __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6834 __isl_take isl_union_pw_aff *upa1,
6835 __isl_take isl_union_pw_aff *upa2);
6836 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6837 __isl_take isl_union_pw_multi_aff *upma1,
6838 __isl_take isl_union_pw_multi_aff *upma2);
6839 __isl_give isl_multi_union_pw_aff *
6840 isl_multi_union_pw_aff_add(
6841 __isl_take isl_multi_union_pw_aff *mupa1,
6842 __isl_take isl_multi_union_pw_aff *mupa2);
6843 __isl_give isl_pw_aff *isl_pw_aff_min(
6844 __isl_take isl_pw_aff *pwaff1,
6845 __isl_take isl_pw_aff *pwaff2);
6846 __isl_give isl_pw_aff *isl_pw_aff_max(
6847 __isl_take isl_pw_aff *pwaff1,
6848 __isl_take isl_pw_aff *pwaff2);
6849 __isl_give isl_aff *isl_aff_sub(
6850 __isl_take isl_aff *aff1,
6851 __isl_take isl_aff *aff2);
6852 __isl_give isl_multi_aff *isl_multi_aff_sub(
6853 __isl_take isl_multi_aff *ma1,
6854 __isl_take isl_multi_aff *ma2);
6855 __isl_give isl_pw_aff *isl_pw_aff_sub(
6856 __isl_take isl_pw_aff *pwaff1,
6857 __isl_take isl_pw_aff *pwaff2);
6858 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6859 __isl_take isl_multi_pw_aff *mpa1,
6860 __isl_take isl_multi_pw_aff *mpa2);
6861 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6862 __isl_take isl_pw_multi_aff *pma1,
6863 __isl_take isl_pw_multi_aff *pma2);
6864 __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6865 __isl_take isl_union_pw_aff *upa1,
6866 __isl_take isl_union_pw_aff *upa2);
6867 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6868 __isl_take isl_union_pw_multi_aff *upma1,
6869 __isl_take isl_union_pw_multi_aff *upma2);
6870 __isl_give isl_multi_union_pw_aff *
6871 isl_multi_union_pw_aff_sub(
6872 __isl_take isl_multi_union_pw_aff *mupa1,
6873 __isl_take isl_multi_union_pw_aff *mupa2);
6875 C<isl_aff_sub> subtracts the second argument from the first.
6877 #include <isl/polynomial.h>
6878 __isl_give isl_qpolynomial *isl_qpolynomial_add(
6879 __isl_take isl_qpolynomial *qp1,
6880 __isl_take isl_qpolynomial *qp2);
6881 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6882 __isl_take isl_pw_qpolynomial *pwqp1,
6883 __isl_take isl_pw_qpolynomial *pwqp2);
6884 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6885 __isl_take isl_pw_qpolynomial *pwqp1,
6886 __isl_take isl_pw_qpolynomial *pwqp2);
6887 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6888 __isl_take isl_pw_qpolynomial_fold *pwf1,
6889 __isl_take isl_pw_qpolynomial_fold *pwf2);
6890 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6891 __isl_take isl_union_pw_qpolynomial *upwqp1,
6892 __isl_take isl_union_pw_qpolynomial *upwqp2);
6893 __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6894 __isl_take isl_qpolynomial *qp1,
6895 __isl_take isl_qpolynomial *qp2);
6896 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6897 __isl_take isl_pw_qpolynomial *pwqp1,
6898 __isl_take isl_pw_qpolynomial *pwqp2);
6899 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6900 __isl_take isl_union_pw_qpolynomial *upwqp1,
6901 __isl_take isl_union_pw_qpolynomial *upwqp2);
6902 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6903 __isl_take isl_pw_qpolynomial_fold *pwf1,
6904 __isl_take isl_pw_qpolynomial_fold *pwf2);
6905 __isl_give isl_union_pw_qpolynomial_fold *
6906 isl_union_pw_qpolynomial_fold_fold(
6907 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6908 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6910 #include <isl/aff.h>
6911 __isl_give isl_pw_aff *isl_pw_aff_union_add(
6912 __isl_take isl_pw_aff *pwaff1,
6913 __isl_take isl_pw_aff *pwaff2);
6914 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6915 __isl_take isl_pw_multi_aff *pma1,
6916 __isl_take isl_pw_multi_aff *pma2);
6917 __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6918 __isl_take isl_union_pw_aff *upa1,
6919 __isl_take isl_union_pw_aff *upa2);
6920 __isl_give isl_union_pw_multi_aff *
6921 isl_union_pw_multi_aff_union_add(
6922 __isl_take isl_union_pw_multi_aff *upma1,
6923 __isl_take isl_union_pw_multi_aff *upma2);
6924 __isl_give isl_multi_union_pw_aff *
6925 isl_multi_union_pw_aff_union_add(
6926 __isl_take isl_multi_union_pw_aff *mupa1,
6927 __isl_take isl_multi_union_pw_aff *mupa2);
6928 __isl_give isl_pw_aff *isl_pw_aff_union_min(
6929 __isl_take isl_pw_aff *pwaff1,
6930 __isl_take isl_pw_aff *pwaff2);
6931 __isl_give isl_pw_aff *isl_pw_aff_union_max(
6932 __isl_take isl_pw_aff *pwaff1,
6933 __isl_take isl_pw_aff *pwaff2);
6935 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6936 expression with a domain that is the union of those of C<pwaff1> and
6937 C<pwaff2> and such that on each cell, the quasi-affine expression is
6938 the maximum of those of C<pwaff1> and C<pwaff2>. If only one of
6939 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6940 associated expression is the defined one.
6941 This in contrast to the C<isl_pw_aff_max> function, which is
6942 only defined on the shared definition domain of the arguments.
6944 #include <isl/val.h>
6945 __isl_give isl_multi_val *isl_multi_val_add_val(
6946 __isl_take isl_multi_val *mv,
6947 __isl_take isl_val *v);
6948 __isl_give isl_multi_val *isl_multi_val_mod_val(
6949 __isl_take isl_multi_val *mv,
6950 __isl_take isl_val *v);
6951 __isl_give isl_multi_val *isl_multi_val_scale_val(
6952 __isl_take isl_multi_val *mv,
6953 __isl_take isl_val *v);
6954 __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6955 __isl_take isl_multi_val *mv,
6956 __isl_take isl_val *v);
6958 #include <isl/aff.h>
6959 __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6960 __isl_take isl_val *mod);
6961 __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6962 __isl_take isl_pw_aff *pa,
6963 __isl_take isl_val *mod);
6964 __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6965 __isl_take isl_union_pw_aff *upa,
6966 __isl_take isl_val *f);
6967 __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6968 __isl_take isl_val *v);
6969 __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6970 __isl_take isl_multi_aff *ma,
6971 __isl_take isl_val *v);
6972 __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6973 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6974 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6975 __isl_take isl_multi_pw_aff *mpa,
6976 __isl_take isl_val *v);
6977 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6978 __isl_take isl_pw_multi_aff *pma,
6979 __isl_take isl_val *v);
6980 __isl_give isl_union_pw_multi_aff *
6981 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6982 __isl_take isl_union_pw_aff *upa,
6983 __isl_take isl_val *f);
6984 isl_union_pw_multi_aff_scale_val(
6985 __isl_take isl_union_pw_multi_aff *upma,
6986 __isl_take isl_val *val);
6987 __isl_give isl_multi_union_pw_aff *
6988 isl_multi_union_pw_aff_scale_val(
6989 __isl_take isl_multi_union_pw_aff *mupa,
6990 __isl_take isl_val *v);
6991 __isl_give isl_aff *isl_aff_scale_down_ui(
6992 __isl_take isl_aff *aff, unsigned f);
6993 __isl_give isl_aff *isl_aff_scale_down_val(
6994 __isl_take isl_aff *aff, __isl_take isl_val *v);
6995 __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6996 __isl_take isl_multi_aff *ma,
6997 __isl_take isl_val *v);
6998 __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6999 __isl_take isl_pw_aff *pa,
7000 __isl_take isl_val *f);
7001 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
7002 __isl_take isl_multi_pw_aff *mpa,
7003 __isl_take isl_val *v);
7004 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
7005 __isl_take isl_pw_multi_aff *pma,
7006 __isl_take isl_val *v);
7007 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
7008 __isl_take isl_union_pw_aff *upa,
7009 __isl_take isl_val *v);
7010 __isl_give isl_union_pw_multi_aff *
7011 isl_union_pw_multi_aff_scale_down_val(
7012 __isl_take isl_union_pw_multi_aff *upma,
7013 __isl_take isl_val *val);
7014 __isl_give isl_multi_union_pw_aff *
7015 isl_multi_union_pw_aff_scale_down_val(
7016 __isl_take isl_multi_union_pw_aff *mupa,
7017 __isl_take isl_val *v);
7019 #include <isl/polynomial.h>
7020 __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
7021 __isl_take isl_qpolynomial *qp,
7022 __isl_take isl_val *v);
7023 __isl_give isl_qpolynomial_fold *
7024 isl_qpolynomial_fold_scale_val(
7025 __isl_take isl_qpolynomial_fold *fold,
7026 __isl_take isl_val *v);
7027 __isl_give isl_pw_qpolynomial *
7028 isl_pw_qpolynomial_scale_val(
7029 __isl_take isl_pw_qpolynomial *pwqp,
7030 __isl_take isl_val *v);
7031 __isl_give isl_pw_qpolynomial_fold *
7032 isl_pw_qpolynomial_fold_scale_val(
7033 __isl_take isl_pw_qpolynomial_fold *pwf,
7034 __isl_take isl_val *v);
7035 __isl_give isl_union_pw_qpolynomial *
7036 isl_union_pw_qpolynomial_scale_val(
7037 __isl_take isl_union_pw_qpolynomial *upwqp,
7038 __isl_take isl_val *v);
7039 __isl_give isl_union_pw_qpolynomial_fold *
7040 isl_union_pw_qpolynomial_fold_scale_val(
7041 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7042 __isl_take isl_val *v);
7043 __isl_give isl_qpolynomial *
7044 isl_qpolynomial_scale_down_val(
7045 __isl_take isl_qpolynomial *qp,
7046 __isl_take isl_val *v);
7047 __isl_give isl_qpolynomial_fold *
7048 isl_qpolynomial_fold_scale_down_val(
7049 __isl_take isl_qpolynomial_fold *fold,
7050 __isl_take isl_val *v);
7051 __isl_give isl_pw_qpolynomial *
7052 isl_pw_qpolynomial_scale_down_val(
7053 __isl_take isl_pw_qpolynomial *pwqp,
7054 __isl_take isl_val *v);
7055 __isl_give isl_pw_qpolynomial_fold *
7056 isl_pw_qpolynomial_fold_scale_down_val(
7057 __isl_take isl_pw_qpolynomial_fold *pwf,
7058 __isl_take isl_val *v);
7059 __isl_give isl_union_pw_qpolynomial *
7060 isl_union_pw_qpolynomial_scale_down_val(
7061 __isl_take isl_union_pw_qpolynomial *upwqp,
7062 __isl_take isl_val *v);
7063 __isl_give isl_union_pw_qpolynomial_fold *
7064 isl_union_pw_qpolynomial_fold_scale_down_val(
7065 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7066 __isl_take isl_val *v);
7068 #include <isl/val.h>
7069 __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
7070 __isl_take isl_multi_val *mv1,
7071 __isl_take isl_multi_val *mv2);
7072 __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
7073 __isl_take isl_multi_val *mv1,
7074 __isl_take isl_multi_val *mv2);
7075 __isl_give isl_multi_val *
7076 isl_multi_val_scale_down_multi_val(
7077 __isl_take isl_multi_val *mv1,
7078 __isl_take isl_multi_val *mv2);
7080 #include <isl/aff.h>
7081 __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
7082 __isl_take isl_multi_aff *ma,
7083 __isl_take isl_multi_val *mv);
7084 __isl_give isl_multi_union_pw_aff *
7085 isl_multi_union_pw_aff_mod_multi_val(
7086 __isl_take isl_multi_union_pw_aff *upma,
7087 __isl_take isl_multi_val *mv);
7088 __isl_give isl_multi_pw_aff *
7089 isl_multi_pw_aff_mod_multi_val(
7090 __isl_take isl_multi_pw_aff *mpa,
7091 __isl_take isl_multi_val *mv);
7092 __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
7093 __isl_take isl_multi_aff *ma,
7094 __isl_take isl_multi_val *mv);
7095 __isl_give isl_pw_multi_aff *
7096 isl_pw_multi_aff_scale_multi_val(
7097 __isl_take isl_pw_multi_aff *pma,
7098 __isl_take isl_multi_val *mv);
7099 __isl_give isl_multi_pw_aff *
7100 isl_multi_pw_aff_scale_multi_val(
7101 __isl_take isl_multi_pw_aff *mpa,
7102 __isl_take isl_multi_val *mv);
7103 __isl_give isl_multi_union_pw_aff *
7104 isl_multi_union_pw_aff_scale_multi_val(
7105 __isl_take isl_multi_union_pw_aff *mupa,
7106 __isl_take isl_multi_val *mv);
7107 __isl_give isl_union_pw_multi_aff *
7108 isl_union_pw_multi_aff_scale_multi_val(
7109 __isl_take isl_union_pw_multi_aff *upma,
7110 __isl_take isl_multi_val *mv);
7111 __isl_give isl_multi_aff *
7112 isl_multi_aff_scale_down_multi_val(
7113 __isl_take isl_multi_aff *ma,
7114 __isl_take isl_multi_val *mv);
7115 __isl_give isl_multi_pw_aff *
7116 isl_multi_pw_aff_scale_down_multi_val(
7117 __isl_take isl_multi_pw_aff *mpa,
7118 __isl_take isl_multi_val *mv);
7119 __isl_give isl_multi_union_pw_aff *
7120 isl_multi_union_pw_aff_scale_down_multi_val(
7121 __isl_take isl_multi_union_pw_aff *mupa,
7122 __isl_take isl_multi_val *mv);
7124 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
7125 by the corresponding elements of C<mv>.
7127 #include <isl/aff.h>
7128 __isl_give isl_aff *isl_aff_mul(
7129 __isl_take isl_aff *aff1,
7130 __isl_take isl_aff *aff2);
7131 __isl_give isl_aff *isl_aff_div(
7132 __isl_take isl_aff *aff1,
7133 __isl_take isl_aff *aff2);
7134 __isl_give isl_pw_aff *isl_pw_aff_mul(
7135 __isl_take isl_pw_aff *pwaff1,
7136 __isl_take isl_pw_aff *pwaff2);
7137 __isl_give isl_pw_aff *isl_pw_aff_div(
7138 __isl_take isl_pw_aff *pa1,
7139 __isl_take isl_pw_aff *pa2);
7140 __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
7141 __isl_take isl_pw_aff *pa1,
7142 __isl_take isl_pw_aff *pa2);
7143 __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
7144 __isl_take isl_pw_aff *pa1,
7145 __isl_take isl_pw_aff *pa2);
7147 When multiplying two affine expressions, at least one of the two needs
7148 to be a constant. Similarly, when dividing an affine expression by another,
7149 the second expression needs to be a constant.
7150 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
7151 rounding towards zero. C<isl_pw_aff_tdiv_r> computes the corresponding
7154 #include <isl/polynomial.h>
7155 __isl_give isl_qpolynomial *isl_qpolynomial_mul(
7156 __isl_take isl_qpolynomial *qp1,
7157 __isl_take isl_qpolynomial *qp2);
7158 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
7159 __isl_take isl_pw_qpolynomial *pwqp1,
7160 __isl_take isl_pw_qpolynomial *pwqp2);
7161 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
7162 __isl_take isl_union_pw_qpolynomial *upwqp1,
7163 __isl_take isl_union_pw_qpolynomial *upwqp2);
7167 =head3 Lexicographic Optimization
7169 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
7170 the following functions
7171 compute a set that contains the lexicographic minimum or maximum
7172 of the elements in C<set> (or C<bset>) for those values of the parameters
7173 that satisfy C<dom>.
7174 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7175 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
7177 In other words, the union of the parameter values
7178 for which the result is non-empty and of C<*empty>
7181 #include <isl/set.h>
7182 __isl_give isl_set *isl_basic_set_partial_lexmin(
7183 __isl_take isl_basic_set *bset,
7184 __isl_take isl_basic_set *dom,
7185 __isl_give isl_set **empty);
7186 __isl_give isl_set *isl_basic_set_partial_lexmax(
7187 __isl_take isl_basic_set *bset,
7188 __isl_take isl_basic_set *dom,
7189 __isl_give isl_set **empty);
7190 __isl_give isl_set *isl_set_partial_lexmin(
7191 __isl_take isl_set *set, __isl_take isl_set *dom,
7192 __isl_give isl_set **empty);
7193 __isl_give isl_set *isl_set_partial_lexmax(
7194 __isl_take isl_set *set, __isl_take isl_set *dom,
7195 __isl_give isl_set **empty);
7197 Given a (basic) set C<set> (or C<bset>), the following functions simply
7198 return a set containing the lexicographic minimum or maximum
7199 of the elements in C<set> (or C<bset>).
7200 In case of union sets, the optimum is computed per space.
7202 #include <isl/set.h>
7203 __isl_give isl_set *isl_basic_set_lexmin(
7204 __isl_take isl_basic_set *bset);
7205 __isl_give isl_set *isl_basic_set_lexmax(
7206 __isl_take isl_basic_set *bset);
7207 __isl_give isl_set *isl_set_lexmin(
7208 __isl_take isl_set *set);
7209 __isl_give isl_set *isl_set_lexmax(
7210 __isl_take isl_set *set);
7211 __isl_give isl_union_set *isl_union_set_lexmin(
7212 __isl_take isl_union_set *uset);
7213 __isl_give isl_union_set *isl_union_set_lexmax(
7214 __isl_take isl_union_set *uset);
7216 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
7217 the following functions
7218 compute a relation that maps each element of C<dom>
7219 to the single lexicographic minimum or maximum
7220 of the elements that are associated to that same
7221 element in C<map> (or C<bmap>).
7222 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7223 that contains the elements in C<dom> that do not map
7224 to any elements in C<map> (or C<bmap>).
7225 In other words, the union of the domain of the result and of C<*empty>
7228 #include <isl/map.h>
7229 __isl_give isl_map *isl_basic_map_partial_lexmax(
7230 __isl_take isl_basic_map *bmap,
7231 __isl_take isl_basic_set *dom,
7232 __isl_give isl_set **empty);
7233 __isl_give isl_map *isl_basic_map_partial_lexmin(
7234 __isl_take isl_basic_map *bmap,
7235 __isl_take isl_basic_set *dom,
7236 __isl_give isl_set **empty);
7237 __isl_give isl_map *isl_map_partial_lexmax(
7238 __isl_take isl_map *map, __isl_take isl_set *dom,
7239 __isl_give isl_set **empty);
7240 __isl_give isl_map *isl_map_partial_lexmin(
7241 __isl_take isl_map *map, __isl_take isl_set *dom,
7242 __isl_give isl_set **empty);
7244 Given a (basic) map C<map> (or C<bmap>), the following functions simply
7245 return a map mapping each element in the domain of
7246 C<map> (or C<bmap>) to the lexicographic minimum or maximum
7247 of all elements associated to that element.
7248 In case of union relations, the optimum is computed per space.
7250 #include <isl/map.h>
7251 __isl_give isl_map *isl_basic_map_lexmin(
7252 __isl_take isl_basic_map *bmap);
7253 __isl_give isl_map *isl_basic_map_lexmax(
7254 __isl_take isl_basic_map *bmap);
7255 __isl_give isl_map *isl_map_lexmin(
7256 __isl_take isl_map *map);
7257 __isl_give isl_map *isl_map_lexmax(
7258 __isl_take isl_map *map);
7259 __isl_give isl_union_map *isl_union_map_lexmin(
7260 __isl_take isl_union_map *umap);
7261 __isl_give isl_union_map *isl_union_map_lexmax(
7262 __isl_take isl_union_map *umap);
7264 The following functions return their result in the form of
7265 a piecewise multi-affine expression,
7266 but are otherwise equivalent to the corresponding functions
7267 returning a basic set or relation.
7269 #include <isl/set.h>
7270 __isl_give isl_pw_multi_aff *
7271 isl_basic_set_partial_lexmin_pw_multi_aff(
7272 __isl_take isl_basic_set *bset,
7273 __isl_take isl_basic_set *dom,
7274 __isl_give isl_set **empty);
7275 __isl_give isl_pw_multi_aff *
7276 isl_basic_set_partial_lexmax_pw_multi_aff(
7277 __isl_take isl_basic_set *bset,
7278 __isl_take isl_basic_set *dom,
7279 __isl_give isl_set **empty);
7280 __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
7281 __isl_take isl_set *set);
7282 __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
7283 __isl_take isl_set *set);
7285 #include <isl/map.h>
7286 __isl_give isl_pw_multi_aff *
7287 isl_basic_map_lexmin_pw_multi_aff(
7288 __isl_take isl_basic_map *bmap);
7289 __isl_give isl_pw_multi_aff *
7290 isl_basic_map_partial_lexmin_pw_multi_aff(
7291 __isl_take isl_basic_map *bmap,
7292 __isl_take isl_basic_set *dom,
7293 __isl_give isl_set **empty);
7294 __isl_give isl_pw_multi_aff *
7295 isl_basic_map_partial_lexmax_pw_multi_aff(
7296 __isl_take isl_basic_map *bmap,
7297 __isl_take isl_basic_set *dom,
7298 __isl_give isl_set **empty);
7299 __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
7300 __isl_take isl_map *map);
7301 __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
7302 __isl_take isl_map *map);
7304 The following functions return the lexicographic minimum or maximum
7305 on the shared domain of the inputs and the single defined function
7306 on those parts of the domain where only a single function is defined.
7308 #include <isl/aff.h>
7309 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
7310 __isl_take isl_pw_multi_aff *pma1,
7311 __isl_take isl_pw_multi_aff *pma2);
7312 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
7313 __isl_take isl_pw_multi_aff *pma1,
7314 __isl_take isl_pw_multi_aff *pma2);
7316 If the input to a lexicographic optimization problem has
7317 multiple constraints with the same coefficients for the optimized
7318 variables, then, by default, this symmetry is exploited by
7319 replacing those constraints by a single constraint with
7320 an abstract bound, which is in turn bounded by the corresponding terms
7321 in the original constraints.
7322 Without this optimization, the solver would typically consider
7323 all possible orderings of those original bounds, resulting in a needless
7324 decomposition of the domain.
7325 However, the optimization can also result in slowdowns since
7326 an extra parameter is introduced that may get used in additional
7328 The following option determines whether symmetry detection is applied
7329 during lexicographic optimization.
7331 #include <isl/options.h>
7332 isl_stat isl_options_set_pip_symmetry(isl_ctx *ctx,
7334 int isl_options_get_pip_symmetry(isl_ctx *ctx);
7338 See also \autoref{s:offline}.
7342 =head2 Ternary Operations
7344 #include <isl/aff.h>
7345 __isl_give isl_pw_aff *isl_pw_aff_cond(
7346 __isl_take isl_pw_aff *cond,
7347 __isl_take isl_pw_aff *pwaff_true,
7348 __isl_take isl_pw_aff *pwaff_false);
7350 The function C<isl_pw_aff_cond> performs a conditional operator
7351 and returns an expression that is equal to C<pwaff_true>
7352 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
7353 where C<cond> is zero.
7357 Lists are defined over several element types, including
7358 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
7359 C<isl_union_pw_multi_aff>, C<isl_constraint>,
7360 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
7361 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
7362 Here we take lists of C<isl_set>s as an example.
7363 Lists can be created, copied, modified and freed using the following functions.
7365 #include <isl/set.h>
7366 __isl_give isl_set_list *isl_set_list_from_set(
7367 __isl_take isl_set *el);
7368 __isl_give isl_set_list *isl_set_list_alloc(
7369 isl_ctx *ctx, int n);
7370 __isl_give isl_set_list *isl_set_list_copy(
7371 __isl_keep isl_set_list *list);
7372 __isl_give isl_set_list *isl_set_list_insert(
7373 __isl_take isl_set_list *list, unsigned pos,
7374 __isl_take isl_set *el);
7375 __isl_give isl_set_list *isl_set_list_add(
7376 __isl_take isl_set_list *list,
7377 __isl_take isl_set *el);
7378 __isl_give isl_set_list *isl_set_list_drop(
7379 __isl_take isl_set_list *list,
7380 unsigned first, unsigned n);
7381 __isl_give isl_set_list *isl_set_list_set_set(
7382 __isl_take isl_set_list *list, int index,
7383 __isl_take isl_set *set);
7384 __isl_give isl_set_list *isl_set_list_concat(
7385 __isl_take isl_set_list *list1,
7386 __isl_take isl_set_list *list2);
7387 __isl_give isl_set_list *isl_set_list_sort(
7388 __isl_take isl_set_list *list,
7389 int (*cmp)(__isl_keep isl_set *a,
7390 __isl_keep isl_set *b, void *user),
7392 __isl_null isl_set_list *isl_set_list_free(
7393 __isl_take isl_set_list *list);
7395 C<isl_set_list_alloc> creates an empty list with an initial capacity
7396 for C<n> elements. C<isl_set_list_insert> and C<isl_set_list_add>
7397 add elements to a list, increasing its capacity as needed.
7398 C<isl_set_list_from_set> creates a list with a single element.
7400 Lists can be inspected using the following functions.
7402 #include <isl/set.h>
7403 int isl_set_list_n_set(__isl_keep isl_set_list *list);
7404 __isl_give isl_set *isl_set_list_get_set(
7405 __isl_keep isl_set_list *list, int index);
7406 isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
7407 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7409 isl_stat isl_set_list_foreach_scc(
7410 __isl_keep isl_set_list *list,
7411 isl_bool (*follows)(__isl_keep isl_set *a,
7412 __isl_keep isl_set *b, void *user),
7414 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7417 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
7418 strongly connected components of the graph with as vertices the elements
7419 of C<list> and a directed edge from vertex C<b> to vertex C<a>
7420 iff C<follows(a, b)> returns C<isl_bool_true>. The callbacks C<follows> and
7421 C<fn> should return C<isl_bool_error> or C<isl_stat_error> on error.
7423 Lists can be printed using
7425 #include <isl/set.h>
7426 __isl_give isl_printer *isl_printer_print_set_list(
7427 __isl_take isl_printer *p,
7428 __isl_keep isl_set_list *list);
7430 =head2 Associative arrays
7432 Associative arrays map isl objects of a specific type to isl objects
7433 of some (other) specific type. They are defined for several pairs
7434 of types, including (C<isl_map>, C<isl_basic_set>),
7435 (C<isl_id>, C<isl_ast_expr>),
7436 (C<isl_id>, C<isl_id>) and
7437 (C<isl_id>, C<isl_pw_aff>).
7438 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7441 Associative arrays can be created, copied and freed using
7442 the following functions.
7444 #include <isl/id_to_ast_expr.h>
7445 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7446 isl_ctx *ctx, int min_size);
7447 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7448 __isl_keep isl_id_to_ast_expr *id2expr);
7449 __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7450 __isl_take isl_id_to_ast_expr *id2expr);
7452 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7453 to specify the expected size of the associative array.
7454 The associative array will be grown automatically as needed.
7456 Associative arrays can be inspected using the following functions.
7458 #include <isl/id_to_ast_expr.h>
7459 __isl_give isl_maybe_isl_ast_expr
7460 isl_id_to_ast_expr_try_get(
7461 __isl_keep isl_id_to_ast_expr *id2expr,
7462 __isl_keep isl_id *key);
7463 isl_bool isl_id_to_ast_expr_has(
7464 __isl_keep isl_id_to_ast_expr *id2expr,
7465 __isl_keep isl_id *key);
7466 __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7467 __isl_keep isl_id_to_ast_expr *id2expr,
7468 __isl_take isl_id *key);
7469 isl_stat isl_id_to_ast_expr_foreach(
7470 __isl_keep isl_id_to_ast_expr *id2expr,
7471 isl_stat (*fn)(__isl_take isl_id *key,
7472 __isl_take isl_ast_expr *val, void *user),
7475 The function C<isl_id_to_ast_expr_try_get> returns a structure
7476 containing two elements, C<valid> and C<value>.
7477 If there is a value associated to the key, then C<valid>
7478 is set to C<isl_bool_true> and C<value> contains a copy of
7479 the associated value. Otherwise C<value> is C<NULL> and
7480 C<valid> may be C<isl_bool_error> or C<isl_bool_false> depending
7481 on whether some error has occurred or there simply is no associated value.
7482 The function C<isl_id_to_ast_expr_has> returns the C<valid> field
7483 in the structure and
7484 the function C<isl_id_to_ast_expr_get> returns the C<value> field.
7486 Associative arrays can be modified using the following functions.
7488 #include <isl/id_to_ast_expr.h>
7489 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7490 __isl_take isl_id_to_ast_expr *id2expr,
7491 __isl_take isl_id *key,
7492 __isl_take isl_ast_expr *val);
7493 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7494 __isl_take isl_id_to_ast_expr *id2expr,
7495 __isl_take isl_id *key);
7497 Associative arrays can be printed using the following function.
7499 #include <isl/id_to_ast_expr.h>
7500 __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7501 __isl_take isl_printer *p,
7502 __isl_keep isl_id_to_ast_expr *id2expr);
7506 Vectors can be created, copied and freed using the following functions.
7508 #include <isl/vec.h>
7509 __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7511 __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7512 __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7514 Note that the elements of a newly created vector may have arbitrary values.
7515 The elements can be changed and inspected using the following functions.
7517 int isl_vec_size(__isl_keep isl_vec *vec);
7518 __isl_give isl_val *isl_vec_get_element_val(
7519 __isl_keep isl_vec *vec, int pos);
7520 __isl_give isl_vec *isl_vec_set_element_si(
7521 __isl_take isl_vec *vec, int pos, int v);
7522 __isl_give isl_vec *isl_vec_set_element_val(
7523 __isl_take isl_vec *vec, int pos,
7524 __isl_take isl_val *v);
7525 __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7527 __isl_give isl_vec *isl_vec_set_val(
7528 __isl_take isl_vec *vec, __isl_take isl_val *v);
7529 int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7530 __isl_keep isl_vec *vec2, int pos);
7532 C<isl_vec_get_element> will return a negative value if anything went wrong.
7533 In that case, the value of C<*v> is undefined.
7535 The following function can be used to concatenate two vectors.
7537 __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7538 __isl_take isl_vec *vec2);
7542 Matrices can be created, copied and freed using the following functions.
7544 #include <isl/mat.h>
7545 __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7546 unsigned n_row, unsigned n_col);
7547 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7548 __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7550 Note that the elements of a newly created matrix may have arbitrary values.
7551 The elements can be changed and inspected using the following functions.
7553 int isl_mat_rows(__isl_keep isl_mat *mat);
7554 int isl_mat_cols(__isl_keep isl_mat *mat);
7555 __isl_give isl_val *isl_mat_get_element_val(
7556 __isl_keep isl_mat *mat, int row, int col);
7557 __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7558 int row, int col, int v);
7559 __isl_give isl_mat *isl_mat_set_element_val(
7560 __isl_take isl_mat *mat, int row, int col,
7561 __isl_take isl_val *v);
7563 C<isl_mat_get_element> will return a negative value if anything went wrong.
7564 In that case, the value of C<*v> is undefined.
7566 The following function can be used to compute the (right) inverse
7567 of a matrix, i.e., a matrix such that the product of the original
7568 and the inverse (in that order) is a multiple of the identity matrix.
7569 The input matrix is assumed to be of full row-rank.
7571 __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7573 The following function can be used to compute the (right) kernel
7574 (or null space) of a matrix, i.e., a matrix such that the product of
7575 the original and the kernel (in that order) is the zero matrix.
7577 __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7579 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7581 The following functions determine
7582 an upper or lower bound on a quasipolynomial over its domain.
7584 __isl_give isl_pw_qpolynomial_fold *
7585 isl_pw_qpolynomial_bound(
7586 __isl_take isl_pw_qpolynomial *pwqp,
7587 enum isl_fold type, int *tight);
7589 __isl_give isl_union_pw_qpolynomial_fold *
7590 isl_union_pw_qpolynomial_bound(
7591 __isl_take isl_union_pw_qpolynomial *upwqp,
7592 enum isl_fold type, int *tight);
7594 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7595 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7596 is the returned bound is known be tight, i.e., for each value
7597 of the parameters there is at least
7598 one element in the domain that reaches the bound.
7599 If the domain of C<pwqp> is not wrapping, then the bound is computed
7600 over all elements in that domain and the result has a purely parametric
7601 domain. If the domain of C<pwqp> is wrapping, then the bound is
7602 computed over the range of the wrapped relation. The domain of the
7603 wrapped relation becomes the domain of the result.
7605 =head2 Parametric Vertex Enumeration
7607 The parametric vertex enumeration described in this section
7608 is mainly intended to be used internally and by the C<barvinok>
7611 #include <isl/vertices.h>
7612 __isl_give isl_vertices *isl_basic_set_compute_vertices(
7613 __isl_keep isl_basic_set *bset);
7615 The function C<isl_basic_set_compute_vertices> performs the
7616 actual computation of the parametric vertices and the chamber
7617 decomposition and store the result in an C<isl_vertices> object.
7618 This information can be queried by either iterating over all
7619 the vertices or iterating over all the chambers or cells
7620 and then iterating over all vertices that are active on the chamber.
7622 isl_stat isl_vertices_foreach_vertex(
7623 __isl_keep isl_vertices *vertices,
7624 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7625 void *user), void *user);
7627 isl_stat isl_vertices_foreach_cell(
7628 __isl_keep isl_vertices *vertices,
7629 isl_stat (*fn)(__isl_take isl_cell *cell,
7630 void *user), void *user);
7631 isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7632 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7633 void *user), void *user);
7635 Other operations that can be performed on an C<isl_vertices> object are
7638 int isl_vertices_get_n_vertices(
7639 __isl_keep isl_vertices *vertices);
7640 void isl_vertices_free(__isl_take isl_vertices *vertices);
7642 Vertices can be inspected and destroyed using the following functions.
7644 int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7645 __isl_give isl_basic_set *isl_vertex_get_domain(
7646 __isl_keep isl_vertex *vertex);
7647 __isl_give isl_multi_aff *isl_vertex_get_expr(
7648 __isl_keep isl_vertex *vertex);
7649 void isl_vertex_free(__isl_take isl_vertex *vertex);
7651 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7652 describing the vertex in terms of the parameters,
7653 while C<isl_vertex_get_domain> returns the activity domain
7656 Chambers can be inspected and destroyed using the following functions.
7658 __isl_give isl_basic_set *isl_cell_get_domain(
7659 __isl_keep isl_cell *cell);
7660 void isl_cell_free(__isl_take isl_cell *cell);
7662 =head1 Polyhedral Compilation Library
7664 This section collects functionality in C<isl> that has been specifically
7665 designed for use during polyhedral compilation.
7667 =head2 Schedule Trees
7669 A schedule tree is a structured representation of a schedule,
7670 assigning a relative order to a set of domain elements.
7671 The relative order expressed by the schedule tree is
7672 defined recursively. In particular, the order between
7673 two domain elements is determined by the node that is closest
7674 to the root that refers to both elements and that orders them apart.
7675 Each node in the tree is of one of several types.
7676 The root node is always of type C<isl_schedule_node_domain>
7677 (or C<isl_schedule_node_extension>)
7678 and it describes the (extra) domain elements to which the schedule applies.
7679 The other types of nodes are as follows.
7683 =item C<isl_schedule_node_band>
7685 A band of schedule dimensions. Each schedule dimension is represented
7686 by a union piecewise quasi-affine expression. If this expression
7687 assigns a different value to two domain elements, while all previous
7688 schedule dimensions in the same band assign them the same value,
7689 then the two domain elements are ordered according to these two
7691 Each expression is required to be total in the domain elements
7692 that reach the band node.
7694 =item C<isl_schedule_node_expansion>
7696 An expansion node maps each of the domain elements that reach the node
7697 to one or more domain elements. The image of this mapping forms
7698 the set of domain elements that reach the child of the expansion node.
7699 The function that maps each of the expanded domain elements
7700 to the original domain element from which it was expanded
7701 is called the contraction.
7703 =item C<isl_schedule_node_filter>
7705 A filter node does not impose any ordering, but rather intersects
7706 the set of domain elements that the current subtree refers to
7707 with a given union set. The subtree of the filter node only
7708 refers to domain elements in the intersection.
7709 A filter node is typically only used as a child of a sequence or
7712 =item C<isl_schedule_node_leaf>
7714 A leaf of the schedule tree. Leaf nodes do not impose any ordering.
7716 =item C<isl_schedule_node_mark>
7718 A mark node can be used to attach any kind of information to a subtree
7719 of the schedule tree.
7721 =item C<isl_schedule_node_sequence>
7723 A sequence node has one or more children, each of which is a filter node.
7724 The filters on these filter nodes form a partition of
7725 the domain elements that the current subtree refers to.
7726 If two domain elements appear in distinct filters then the sequence
7727 node orders them according to the child positions of the corresponding
7730 =item C<isl_schedule_node_set>
7732 A set node is similar to a sequence node, except that
7733 it expresses that domain elements appearing in distinct filters
7734 may have any order. The order of the children of a set node
7735 is therefore also immaterial.
7739 The following node types are only supported by the AST generator.
7743 =item C<isl_schedule_node_context>
7745 The context describes constraints on the parameters and
7746 the schedule dimensions of outer
7747 bands that the AST generator may assume to hold. It is also the only
7748 kind of node that may introduce additional parameters.
7749 The space of the context is that of the flat product of the outer
7750 band nodes. In particular, if there are no outer band nodes, then
7751 this space is the unnamed zero-dimensional space.
7752 Since a context node references the outer band nodes, any tree
7753 containing a context node is considered to be anchored.
7755 =item C<isl_schedule_node_extension>
7757 An extension node instructs the AST generator to add additional
7758 domain elements that need to be scheduled.
7759 The additional domain elements are described by the range of
7760 the extension map in terms of the outer schedule dimensions,
7761 i.e., the flat product of the outer band nodes.
7762 Note that domain elements are added whenever the AST generator
7763 reaches the extension node, meaning that there are still some
7764 active domain elements for which an AST needs to be generated.
7765 The conditions under which some domain elements are still active
7766 may however not be completely described by the outer AST nodes
7767 generated at that point.
7769 An extension node may also appear as the root of a schedule tree,
7770 when it is intended to be inserted into another tree
7771 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
7772 In this case, the domain of the extension node should
7773 correspond to the flat product of the outer band nodes
7774 in this other schedule tree at the point where the extension tree
7777 =item C<isl_schedule_node_guard>
7779 The guard describes constraints on the parameters and
7780 the schedule dimensions of outer
7781 bands that need to be enforced by the outer nodes
7782 in the generated AST.
7783 The space of the guard is that of the flat product of the outer
7784 band nodes. In particular, if there are no outer band nodes, then
7785 this space is the unnamed zero-dimensional space.
7786 Since a guard node references the outer band nodes, any tree
7787 containing a guard node is considered to be anchored.
7791 Except for the C<isl_schedule_node_context> nodes,
7792 none of the nodes may introduce any parameters that were not
7793 already present in the root domain node.
7795 A schedule tree is encapsulated in an C<isl_schedule> object.
7796 The simplest such objects, those with a tree consisting of single domain node,
7797 can be created using the following functions with either an empty
7798 domain or a given domain.
7800 #include <isl/schedule.h>
7801 __isl_give isl_schedule *isl_schedule_empty(
7802 __isl_take isl_space *space);
7803 __isl_give isl_schedule *isl_schedule_from_domain(
7804 __isl_take isl_union_set *domain);
7806 The function C<isl_schedule_constraints_compute_schedule> described
7807 in L</"Scheduling"> can also be used to construct schedules.
7809 C<isl_schedule> objects may be copied and freed using the following functions.
7811 #include <isl/schedule.h>
7812 __isl_give isl_schedule *isl_schedule_copy(
7813 __isl_keep isl_schedule *sched);
7814 __isl_null isl_schedule *isl_schedule_free(
7815 __isl_take isl_schedule *sched);
7817 The following functions checks whether two C<isl_schedule> objects
7818 are obviously the same.
7820 #include <isl/schedule.h>
7821 isl_bool isl_schedule_plain_is_equal(
7822 __isl_keep isl_schedule *schedule1,
7823 __isl_keep isl_schedule *schedule2);
7825 The domain of the schedule, i.e., the domain described by the root node,
7826 can be obtained using the following function.
7828 #include <isl/schedule.h>
7829 __isl_give isl_union_set *isl_schedule_get_domain(
7830 __isl_keep isl_schedule *schedule);
7832 An extra top-level band node (right underneath the domain node) can
7833 be introduced into the schedule using the following function.
7834 The schedule tree is assumed not to have any anchored nodes.
7836 #include <isl/schedule.h>
7837 __isl_give isl_schedule *
7838 isl_schedule_insert_partial_schedule(
7839 __isl_take isl_schedule *schedule,
7840 __isl_take isl_multi_union_pw_aff *partial);
7842 A top-level context node (right underneath the domain node) can
7843 be introduced into the schedule using the following function.
7845 #include <isl/schedule.h>
7846 __isl_give isl_schedule *isl_schedule_insert_context(
7847 __isl_take isl_schedule *schedule,
7848 __isl_take isl_set *context)
7850 A top-level guard node (right underneath the domain node) can
7851 be introduced into the schedule using the following function.
7853 #include <isl/schedule.h>
7854 __isl_give isl_schedule *isl_schedule_insert_guard(
7855 __isl_take isl_schedule *schedule,
7856 __isl_take isl_set *guard)
7858 A schedule that combines two schedules either in the given
7859 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
7860 or an C<isl_schedule_node_set> node,
7861 can be created using the following functions.
7863 #include <isl/schedule.h>
7864 __isl_give isl_schedule *isl_schedule_sequence(
7865 __isl_take isl_schedule *schedule1,
7866 __isl_take isl_schedule *schedule2);
7867 __isl_give isl_schedule *isl_schedule_set(
7868 __isl_take isl_schedule *schedule1,
7869 __isl_take isl_schedule *schedule2);
7871 The domains of the two input schedules need to be disjoint.
7873 The following function can be used to restrict the domain
7874 of a schedule with a domain node as root to be a subset of the given union set.
7875 This operation may remove nodes in the tree that have become
7878 #include <isl/schedule.h>
7879 __isl_give isl_schedule *isl_schedule_intersect_domain(
7880 __isl_take isl_schedule *schedule,
7881 __isl_take isl_union_set *domain);
7883 The following function can be used to simplify the domain
7884 of a schedule with a domain node as root with respect to the given
7887 #include <isl/schedule.h>
7888 __isl_give isl_schedule *isl_schedule_gist_domain_params(
7889 __isl_take isl_schedule *schedule,
7890 __isl_take isl_set *context);
7892 The following function resets the user pointers on all parameter
7893 and tuple identifiers referenced by the nodes of the given schedule.
7895 #include <isl/schedule.h>
7896 __isl_give isl_schedule *isl_schedule_reset_user(
7897 __isl_take isl_schedule *schedule);
7899 The following function aligns the parameters of all nodes
7900 in the given schedule to the given space.
7902 #include <isl/schedule.h>
7903 __isl_give isl_schedule *isl_schedule_align_params(
7904 __isl_take isl_schedule *schedule,
7905 __isl_take isl_space *space);
7907 The following function allows the user to plug in a given function
7908 in the iteration domains. The input schedule is not allowed to contain
7909 any expansion nodes.
7911 #include <isl/schedule.h>
7912 __isl_give isl_schedule *
7913 isl_schedule_pullback_union_pw_multi_aff(
7914 __isl_take isl_schedule *schedule,
7915 __isl_take isl_union_pw_multi_aff *upma);
7917 The following function can be used to plug in the schedule C<expansion>
7918 in the leaves of C<schedule>, where C<contraction> describes how
7919 the domain elements of C<expansion> map to the domain elements
7920 at the original leaves of C<schedule>.
7921 The resulting schedule will contain expansion nodes, unless
7922 C<contraction> is an identity function.
7924 #include <isl/schedule.h>
7925 __isl_give isl_schedule *isl_schedule_expand(
7926 __isl_take isl_schedule *schedule,
7927 __isl_take isl_union_pw_multi_aff *contraction,
7928 __isl_take isl_schedule *expansion);
7930 An C<isl_union_map> representation of the schedule can be obtained
7931 from an C<isl_schedule> using the following function.
7933 #include <isl/schedule.h>
7934 __isl_give isl_union_map *isl_schedule_get_map(
7935 __isl_keep isl_schedule *sched);
7937 The resulting relation encodes the same relative ordering as
7938 the schedule by mapping the domain elements to a common schedule space.
7939 If the schedule_separate_components option is set, then the order
7940 of the children of a set node is explicitly encoded in the result.
7941 If the tree contains any expansion nodes, then the relation
7942 is formulated in terms of the expanded domain elements.
7944 Schedules can be read from input using the following functions.
7946 #include <isl/schedule.h>
7947 __isl_give isl_schedule *isl_schedule_read_from_file(
7948 isl_ctx *ctx, FILE *input);
7949 __isl_give isl_schedule *isl_schedule_read_from_str(
7950 isl_ctx *ctx, const char *str);
7952 A representation of the schedule can be printed using
7954 #include <isl/schedule.h>
7955 __isl_give isl_printer *isl_printer_print_schedule(
7956 __isl_take isl_printer *p,
7957 __isl_keep isl_schedule *schedule);
7958 __isl_give char *isl_schedule_to_str(
7959 __isl_keep isl_schedule *schedule);
7961 C<isl_schedule_to_str> prints the schedule in flow format.
7963 The schedule tree can be traversed through the use of
7964 C<isl_schedule_node> objects that point to a particular
7965 position in the schedule tree. Whenever a C<isl_schedule_node>
7966 is use to modify a node in the schedule tree, the original schedule
7967 tree is left untouched and the modifications are performed to a copy
7968 of the tree. The returned C<isl_schedule_node> then points to
7969 this modified copy of the tree.
7971 The root of the schedule tree can be obtained using the following function.
7973 #include <isl/schedule.h>
7974 __isl_give isl_schedule_node *isl_schedule_get_root(
7975 __isl_keep isl_schedule *schedule);
7977 A pointer to a newly created schedule tree with a single domain
7978 node can be created using the following functions.
7980 #include <isl/schedule_node.h>
7981 __isl_give isl_schedule_node *
7982 isl_schedule_node_from_domain(
7983 __isl_take isl_union_set *domain);
7984 __isl_give isl_schedule_node *
7985 isl_schedule_node_from_extension(
7986 __isl_take isl_union_map *extension);
7988 C<isl_schedule_node_from_extension> creates a tree with an extension
7991 Schedule nodes can be copied and freed using the following functions.
7993 #include <isl/schedule_node.h>
7994 __isl_give isl_schedule_node *isl_schedule_node_copy(
7995 __isl_keep isl_schedule_node *node);
7996 __isl_null isl_schedule_node *isl_schedule_node_free(
7997 __isl_take isl_schedule_node *node);
7999 The following functions can be used to check if two schedule
8000 nodes point to the same position in the same schedule.
8002 #include <isl/schedule_node.h>
8003 isl_bool isl_schedule_node_is_equal(
8004 __isl_keep isl_schedule_node *node1,
8005 __isl_keep isl_schedule_node *node2);
8007 The following properties can be obtained from a schedule node.
8009 #include <isl/schedule_node.h>
8010 enum isl_schedule_node_type isl_schedule_node_get_type(
8011 __isl_keep isl_schedule_node *node);
8012 enum isl_schedule_node_type
8013 isl_schedule_node_get_parent_type(
8014 __isl_keep isl_schedule_node *node);
8015 __isl_give isl_schedule *isl_schedule_node_get_schedule(
8016 __isl_keep isl_schedule_node *node);
8018 The function C<isl_schedule_node_get_type> returns the type of
8019 the node, while C<isl_schedule_node_get_parent_type> returns
8020 type of the parent of the node, which is required to exist.
8021 The function C<isl_schedule_node_get_schedule> returns a copy
8022 to the schedule to which the node belongs.
8024 The following functions can be used to move the schedule node
8025 to a different position in the tree or to check if such a position
8028 #include <isl/schedule_node.h>
8029 isl_bool isl_schedule_node_has_parent(
8030 __isl_keep isl_schedule_node *node);
8031 __isl_give isl_schedule_node *isl_schedule_node_parent(
8032 __isl_take isl_schedule_node *node);
8033 __isl_give isl_schedule_node *isl_schedule_node_root(
8034 __isl_take isl_schedule_node *node);
8035 __isl_give isl_schedule_node *isl_schedule_node_ancestor(
8036 __isl_take isl_schedule_node *node,
8038 int isl_schedule_node_n_children(
8039 __isl_keep isl_schedule_node *node);
8040 __isl_give isl_schedule_node *isl_schedule_node_child(
8041 __isl_take isl_schedule_node *node, int pos);
8042 isl_bool isl_schedule_node_has_children(
8043 __isl_keep isl_schedule_node *node);
8044 __isl_give isl_schedule_node *isl_schedule_node_first_child(
8045 __isl_take isl_schedule_node *node);
8046 isl_bool isl_schedule_node_has_previous_sibling(
8047 __isl_keep isl_schedule_node *node);
8048 __isl_give isl_schedule_node *
8049 isl_schedule_node_previous_sibling(
8050 __isl_take isl_schedule_node *node);
8051 isl_bool isl_schedule_node_has_next_sibling(
8052 __isl_keep isl_schedule_node *node);
8053 __isl_give isl_schedule_node *
8054 isl_schedule_node_next_sibling(
8055 __isl_take isl_schedule_node *node);
8057 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
8058 is the node itself, the ancestor of generation 1 is its parent and so on.
8060 It is also possible to query the number of ancestors of a node,
8061 the position of the current node
8062 within the children of its parent, the position of the subtree
8063 containing a node within the children of an ancestor
8064 or to obtain a copy of a given
8065 child without destroying the current node.
8066 Given two nodes that point to the same schedule, their closest
8067 shared ancestor can be obtained using
8068 C<isl_schedule_node_get_shared_ancestor>.
8070 #include <isl/schedule_node.h>
8071 int isl_schedule_node_get_tree_depth(
8072 __isl_keep isl_schedule_node *node);
8073 int isl_schedule_node_get_child_position(
8074 __isl_keep isl_schedule_node *node);
8075 int isl_schedule_node_get_ancestor_child_position(
8076 __isl_keep isl_schedule_node *node,
8077 __isl_keep isl_schedule_node *ancestor);
8078 __isl_give isl_schedule_node *isl_schedule_node_get_child(
8079 __isl_keep isl_schedule_node *node, int pos);
8080 __isl_give isl_schedule_node *
8081 isl_schedule_node_get_shared_ancestor(
8082 __isl_keep isl_schedule_node *node1,
8083 __isl_keep isl_schedule_node *node2);
8085 All nodes in a schedule tree or
8086 all descendants of a specific node (including the node) can be visited
8087 in depth-first pre-order using the following functions.
8089 #include <isl/schedule.h>
8090 isl_stat isl_schedule_foreach_schedule_node_top_down(
8091 __isl_keep isl_schedule *sched,
8092 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8093 void *user), void *user);
8095 #include <isl/schedule_node.h>
8096 isl_stat isl_schedule_node_foreach_descendant_top_down(
8097 __isl_keep isl_schedule_node *node,
8098 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8099 void *user), void *user);
8101 The callback function is slightly different from the usual
8102 callbacks in that it not only indicates success (non-negative result)
8103 or failure (negative result), but also indicates whether the children
8104 of the given node should be visited. In particular, if the callback
8105 returns a positive value, then the children are visited, but if
8106 the callback returns zero, then the children are not visited.
8108 The ancestors of a node in a schedule tree can be visited from
8109 the root down to and including the parent of the node using
8110 the following function.
8112 #include <isl/schedule_node.h>
8113 isl_stat isl_schedule_node_foreach_ancestor_top_down(
8114 __isl_keep isl_schedule_node *node,
8115 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
8116 void *user), void *user);
8118 The following functions allows for a depth-first post-order
8119 traversal of the nodes in a schedule tree or
8120 of the descendants of a specific node (including the node
8121 itself), where the user callback is allowed to modify the
8124 #include <isl/schedule.h>
8125 __isl_give isl_schedule *
8126 isl_schedule_map_schedule_node_bottom_up(
8127 __isl_take isl_schedule *schedule,
8128 __isl_give isl_schedule_node *(*fn)(
8129 __isl_take isl_schedule_node *node,
8130 void *user), void *user);
8132 #include <isl/schedule_node.h>
8133 __isl_give isl_schedule_node *
8134 isl_schedule_node_map_descendant_bottom_up(
8135 __isl_take isl_schedule_node *node,
8136 __isl_give isl_schedule_node *(*fn)(
8137 __isl_take isl_schedule_node *node,
8138 void *user), void *user);
8140 The traversal continues from the node returned by the callback function.
8141 It is the responsibility of the user to ensure that this does not
8142 lead to an infinite loop. It is safest to always return a pointer
8143 to the same position (same ancestors and child positions) as the input node.
8145 The following function removes a node (along with its descendants)
8146 from a schedule tree and returns a pointer to the leaf at the
8147 same position in the updated tree.
8148 It is not allowed to remove the root of a schedule tree or
8149 a child of a set or sequence node.
8151 #include <isl/schedule_node.h>
8152 __isl_give isl_schedule_node *isl_schedule_node_cut(
8153 __isl_take isl_schedule_node *node);
8155 The following function removes a single node
8156 from a schedule tree and returns a pointer to the child
8157 of the node, now located at the position of the original node
8158 or to a leaf node at that position if there was no child.
8159 It is not allowed to remove the root of a schedule tree,
8160 a set or sequence node, a child of a set or sequence node or
8161 a band node with an anchored subtree.
8163 #include <isl/schedule_node.h>
8164 __isl_give isl_schedule_node *isl_schedule_node_delete(
8165 __isl_take isl_schedule_node *node);
8167 Most nodes in a schedule tree only contain local information.
8168 In some cases, however, a node may also refer to the schedule dimensions
8169 of its outer band nodes.
8170 This means that the position of the node within the tree should
8171 not be changed, or at least that no changes are performed to the
8172 outer band nodes. The following function can be used to test
8173 whether the subtree rooted at a given node contains any such nodes.
8175 #include <isl/schedule_node.h>
8176 isl_bool isl_schedule_node_is_subtree_anchored(
8177 __isl_keep isl_schedule_node *node);
8179 The following function resets the user pointers on all parameter
8180 and tuple identifiers referenced by the given schedule node.
8182 #include <isl/schedule_node.h>
8183 __isl_give isl_schedule_node *isl_schedule_node_reset_user(
8184 __isl_take isl_schedule_node *node);
8186 The following function aligns the parameters of the given schedule
8187 node to the given space.
8189 #include <isl/schedule_node.h>
8190 __isl_give isl_schedule_node *
8191 isl_schedule_node_align_params(
8192 __isl_take isl_schedule_node *node,
8193 __isl_take isl_space *space);
8195 Several node types have their own functions for querying
8196 (and in some cases setting) some node type specific properties.
8198 #include <isl/schedule_node.h>
8199 __isl_give isl_space *isl_schedule_node_band_get_space(
8200 __isl_keep isl_schedule_node *node);
8201 __isl_give isl_multi_union_pw_aff *
8202 isl_schedule_node_band_get_partial_schedule(
8203 __isl_keep isl_schedule_node *node);
8204 __isl_give isl_union_map *
8205 isl_schedule_node_band_get_partial_schedule_union_map(
8206 __isl_keep isl_schedule_node *node);
8207 unsigned isl_schedule_node_band_n_member(
8208 __isl_keep isl_schedule_node *node);
8209 isl_bool isl_schedule_node_band_member_get_coincident(
8210 __isl_keep isl_schedule_node *node, int pos);
8211 __isl_give isl_schedule_node *
8212 isl_schedule_node_band_member_set_coincident(
8213 __isl_take isl_schedule_node *node, int pos,
8215 isl_bool isl_schedule_node_band_get_permutable(
8216 __isl_keep isl_schedule_node *node);
8217 __isl_give isl_schedule_node *
8218 isl_schedule_node_band_set_permutable(
8219 __isl_take isl_schedule_node *node, int permutable);
8220 enum isl_ast_loop_type
8221 isl_schedule_node_band_member_get_ast_loop_type(
8222 __isl_keep isl_schedule_node *node, int pos);
8223 __isl_give isl_schedule_node *
8224 isl_schedule_node_band_member_set_ast_loop_type(
8225 __isl_take isl_schedule_node *node, int pos,
8226 enum isl_ast_loop_type type);
8227 __isl_give isl_union_set *
8228 enum isl_ast_loop_type
8229 isl_schedule_node_band_member_get_isolate_ast_loop_type(
8230 __isl_keep isl_schedule_node *node, int pos);
8231 __isl_give isl_schedule_node *
8232 isl_schedule_node_band_member_set_isolate_ast_loop_type(
8233 __isl_take isl_schedule_node *node, int pos,
8234 enum isl_ast_loop_type type);
8235 isl_schedule_node_band_get_ast_build_options(
8236 __isl_keep isl_schedule_node *node);
8237 __isl_give isl_schedule_node *
8238 isl_schedule_node_band_set_ast_build_options(
8239 __isl_take isl_schedule_node *node,
8240 __isl_take isl_union_set *options);
8241 __isl_give isl_set *
8242 isl_schedule_node_band_get_ast_isolate_option(
8243 __isl_keep isl_schedule_node *node);
8245 The function C<isl_schedule_node_band_get_space> returns the space
8246 of the partial schedule of the band.
8247 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
8248 returns a representation of the partial schedule of the band node
8249 in the form of an C<isl_union_map>.
8250 The coincident and permutable properties are set by
8251 C<isl_schedule_constraints_compute_schedule> on the schedule tree
8253 A scheduling dimension is considered to be ``coincident''
8254 if it satisfies the coincidence constraints within its band.
8255 That is, if the dependence distances of the coincidence
8256 constraints are all zero in that direction (for fixed
8257 iterations of outer bands).
8258 A band is marked permutable if it was produced using the Pluto-like scheduler.
8259 Note that the scheduler may have to resort to a Feautrier style scheduling
8260 step even if the default scheduler is used.
8261 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
8262 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
8263 For the meaning of these loop AST generation types and the difference
8264 between the regular loop AST generation type and the isolate
8265 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
8266 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
8267 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
8268 may return C<isl_ast_loop_error> if an error occurs.
8269 The AST build options govern how an AST is generated for
8270 the individual schedule dimensions during AST generation.
8271 See L</"AST Generation Options (Schedule Tree)">.
8272 The isolate option for the given node can be extracted from these
8273 AST build options using the function
8274 C<isl_schedule_node_band_get_ast_isolate_option>.
8276 #include <isl/schedule_node.h>
8277 __isl_give isl_set *
8278 isl_schedule_node_context_get_context(
8279 __isl_keep isl_schedule_node *node);
8281 #include <isl/schedule_node.h>
8282 __isl_give isl_union_set *
8283 isl_schedule_node_domain_get_domain(
8284 __isl_keep isl_schedule_node *node);
8286 #include <isl/schedule_node.h>
8287 __isl_give isl_union_map *
8288 isl_schedule_node_expansion_get_expansion(
8289 __isl_keep isl_schedule_node *node);
8290 __isl_give isl_union_pw_multi_aff *
8291 isl_schedule_node_expansion_get_contraction(
8292 __isl_keep isl_schedule_node *node);
8294 #include <isl/schedule_node.h>
8295 __isl_give isl_union_map *
8296 isl_schedule_node_extension_get_extension(
8297 __isl_keep isl_schedule_node *node);
8299 #include <isl/schedule_node.h>
8300 __isl_give isl_union_set *
8301 isl_schedule_node_filter_get_filter(
8302 __isl_keep isl_schedule_node *node);
8304 #include <isl/schedule_node.h>
8305 __isl_give isl_set *isl_schedule_node_guard_get_guard(
8306 __isl_keep isl_schedule_node *node);
8308 #include <isl/schedule_node.h>
8309 __isl_give isl_id *isl_schedule_node_mark_get_id(
8310 __isl_keep isl_schedule_node *node);
8312 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
8313 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
8314 partial schedules related to the node.
8316 #include <isl/schedule_node.h>
8317 __isl_give isl_multi_union_pw_aff *
8318 isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
8319 __isl_keep isl_schedule_node *node);
8320 __isl_give isl_union_pw_multi_aff *
8321 isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
8322 __isl_keep isl_schedule_node *node);
8323 __isl_give isl_union_map *
8324 isl_schedule_node_get_prefix_schedule_union_map(
8325 __isl_keep isl_schedule_node *node);
8326 __isl_give isl_union_map *
8327 isl_schedule_node_get_prefix_schedule_relation(
8328 __isl_keep isl_schedule_node *node);
8329 __isl_give isl_union_map *
8330 isl_schedule_node_get_subtree_schedule_union_map(
8331 __isl_keep isl_schedule_node *node);
8333 In particular, the functions
8334 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
8335 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
8336 and C<isl_schedule_node_get_prefix_schedule_union_map>
8337 return a relative ordering on the domain elements that reach the given
8338 node determined by its ancestors.
8339 The function C<isl_schedule_node_get_prefix_schedule_relation>
8340 additionally includes the domain constraints in the result.
8341 The function C<isl_schedule_node_get_subtree_schedule_union_map>
8342 returns a representation of the partial schedule defined by the
8343 subtree rooted at the given node.
8344 If the tree contains any expansion nodes, then the subtree schedule
8345 is formulated in terms of the expanded domain elements.
8346 The tree passed to functions returning a prefix schedule
8347 may only contain extension nodes if these would not affect
8348 the result of these functions. That is, if one of the ancestors
8349 is an extension node, then all of the domain elements that were
8350 added by the extension node need to have been filtered out
8351 by filter nodes between the extension node and the input node.
8352 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
8353 may not contain in extension nodes in the selected subtree.
8355 The expansion/contraction defined by an entire subtree, combining
8356 the expansions/contractions
8357 on the expansion nodes in the subtree, can be obtained using
8358 the following functions.
8360 #include <isl/schedule_node.h>
8361 __isl_give isl_union_map *
8362 isl_schedule_node_get_subtree_expansion(
8363 __isl_keep isl_schedule_node *node);
8364 __isl_give isl_union_pw_multi_aff *
8365 isl_schedule_node_get_subtree_contraction(
8366 __isl_keep isl_schedule_node *node);
8368 The total number of outer band members of given node, i.e.,
8369 the shared output dimension of the maps in the result
8370 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
8371 using the following function.
8373 #include <isl/schedule_node.h>
8374 int isl_schedule_node_get_schedule_depth(
8375 __isl_keep isl_schedule_node *node);
8377 The following functions return the elements that reach the given node
8378 or the union of universes in the spaces that contain these elements.
8380 #include <isl/schedule_node.h>
8381 __isl_give isl_union_set *
8382 isl_schedule_node_get_domain(
8383 __isl_keep isl_schedule_node *node);
8384 __isl_give isl_union_set *
8385 isl_schedule_node_get_universe_domain(
8386 __isl_keep isl_schedule_node *node);
8388 The input tree of C<isl_schedule_node_get_domain>
8389 may only contain extension nodes if these would not affect
8390 the result of this function. That is, if one of the ancestors
8391 is an extension node, then all of the domain elements that were
8392 added by the extension node need to have been filtered out
8393 by filter nodes between the extension node and the input node.
8395 The following functions can be used to introduce additional nodes
8396 in the schedule tree. The new node is introduced at the point
8397 in the tree where the C<isl_schedule_node> points to and
8398 the results points to the new node.
8400 #include <isl/schedule_node.h>
8401 __isl_give isl_schedule_node *
8402 isl_schedule_node_insert_partial_schedule(
8403 __isl_take isl_schedule_node *node,
8404 __isl_take isl_multi_union_pw_aff *schedule);
8406 This function inserts a new band node with (the greatest integer
8407 part of) the given partial schedule.
8408 The subtree rooted at the given node is assumed not to have
8411 #include <isl/schedule_node.h>
8412 __isl_give isl_schedule_node *
8413 isl_schedule_node_insert_context(
8414 __isl_take isl_schedule_node *node,
8415 __isl_take isl_set *context);
8417 This function inserts a new context node with the given context constraints.
8419 #include <isl/schedule_node.h>
8420 __isl_give isl_schedule_node *
8421 isl_schedule_node_insert_filter(
8422 __isl_take isl_schedule_node *node,
8423 __isl_take isl_union_set *filter);
8425 This function inserts a new filter node with the given filter.
8426 If the original node already pointed to a filter node, then the
8427 two filter nodes are merged into one.
8429 #include <isl/schedule_node.h>
8430 __isl_give isl_schedule_node *
8431 isl_schedule_node_insert_guard(
8432 __isl_take isl_schedule_node *node,
8433 __isl_take isl_set *guard);
8435 This function inserts a new guard node with the given guard constraints.
8437 #include <isl/schedule_node.h>
8438 __isl_give isl_schedule_node *
8439 isl_schedule_node_insert_mark(
8440 __isl_take isl_schedule_node *node,
8441 __isl_take isl_id *mark);
8443 This function inserts a new mark node with the give mark identifier.
8445 #include <isl/schedule_node.h>
8446 __isl_give isl_schedule_node *
8447 isl_schedule_node_insert_sequence(
8448 __isl_take isl_schedule_node *node,
8449 __isl_take isl_union_set_list *filters);
8450 __isl_give isl_schedule_node *
8451 isl_schedule_node_insert_set(
8452 __isl_take isl_schedule_node *node,
8453 __isl_take isl_union_set_list *filters);
8455 These functions insert a new sequence or set node with the given
8456 filters as children.
8458 #include <isl/schedule_node.h>
8459 __isl_give isl_schedule_node *isl_schedule_node_group(
8460 __isl_take isl_schedule_node *node,
8461 __isl_take isl_id *group_id);
8463 This function introduces an expansion node in between the current
8464 node and its parent that expands instances of a space with tuple
8465 identifier C<group_id> to the original domain elements that reach
8466 the node. The group instances are identified by the prefix schedule
8467 of those domain elements. The ancestors of the node are adjusted
8468 to refer to the group instances instead of the original domain
8469 elements. The return value points to the same node in the updated
8470 schedule tree as the input node, i.e., to the child of the newly
8471 introduced expansion node. Grouping instances of different statements
8472 ensures that they will be treated as a single statement by the
8473 AST generator up to the point of the expansion node.
8475 The following function can be used to flatten a nested
8478 #include <isl/schedule_node.h>
8479 __isl_give isl_schedule_node *
8480 isl_schedule_node_sequence_splice_child(
8481 __isl_take isl_schedule_node *node, int pos);
8483 That is, given a sequence node C<node> that has another sequence node
8484 in its child at position C<pos> (in particular, the child of that filter
8485 node is a sequence node), attach the children of that other sequence
8486 node as children of C<node>, replacing the original child at position
8489 The partial schedule of a band node can be scaled (down) or reduced using
8490 the following functions.
8492 #include <isl/schedule_node.h>
8493 __isl_give isl_schedule_node *
8494 isl_schedule_node_band_scale(
8495 __isl_take isl_schedule_node *node,
8496 __isl_take isl_multi_val *mv);
8497 __isl_give isl_schedule_node *
8498 isl_schedule_node_band_scale_down(
8499 __isl_take isl_schedule_node *node,
8500 __isl_take isl_multi_val *mv);
8501 __isl_give isl_schedule_node *
8502 isl_schedule_node_band_mod(
8503 __isl_take isl_schedule_node *node,
8504 __isl_take isl_multi_val *mv);
8506 The spaces of the two arguments need to match.
8507 After scaling, the partial schedule is replaced by its greatest
8508 integer part to ensure that the schedule remains integral.
8510 The partial schedule of a band node can be shifted by an
8511 C<isl_multi_union_pw_aff> with a domain that is a superset
8512 of the domain of the partial schedule using
8513 the following function.
8515 #include <isl/schedule_node.h>
8516 __isl_give isl_schedule_node *
8517 isl_schedule_node_band_shift(
8518 __isl_take isl_schedule_node *node,
8519 __isl_take isl_multi_union_pw_aff *shift);
8521 A band node can be tiled using the following function.
8523 #include <isl/schedule_node.h>
8524 __isl_give isl_schedule_node *isl_schedule_node_band_tile(
8525 __isl_take isl_schedule_node *node,
8526 __isl_take isl_multi_val *sizes);
8528 isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8530 int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8531 isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8533 int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8535 The C<isl_schedule_node_band_tile> function tiles
8536 the band using the given tile sizes inside its schedule.
8537 A new child band node is created to represent the point loops and it is
8538 inserted between the modified band and its children.
8539 The subtree rooted at the given node is assumed not to have
8541 The C<tile_scale_tile_loops> option specifies whether the tile
8542 loops iterators should be scaled by the tile sizes.
8543 If the C<tile_shift_point_loops> option is set, then the point loops
8544 are shifted to start at zero.
8546 A band node can be split into two nested band nodes
8547 using the following function.
8549 #include <isl/schedule_node.h>
8550 __isl_give isl_schedule_node *isl_schedule_node_band_split(
8551 __isl_take isl_schedule_node *node, int pos);
8553 The resulting outer band node contains the first C<pos> dimensions of
8554 the schedule of C<node> while the inner band contains the remaining dimensions.
8555 The schedules of the two band nodes live in anonymous spaces.
8556 The loop AST generation type options and the isolate option
8557 are split over the the two band nodes.
8559 A band node can be moved down to the leaves of the subtree rooted
8560 at the band node using the following function.
8562 #include <isl/schedule_node.h>
8563 __isl_give isl_schedule_node *isl_schedule_node_band_sink(
8564 __isl_take isl_schedule_node *node);
8566 The subtree rooted at the given node is assumed not to have
8568 The result points to the node in the resulting tree that is in the same
8569 position as the node pointed to by C<node> in the original tree.
8571 #include <isl/schedule_node.h>
8572 __isl_give isl_schedule_node *
8573 isl_schedule_node_order_before(
8574 __isl_take isl_schedule_node *node,
8575 __isl_take isl_union_set *filter);
8576 __isl_give isl_schedule_node *
8577 isl_schedule_node_order_after(
8578 __isl_take isl_schedule_node *node,
8579 __isl_take isl_union_set *filter);
8581 These functions split the domain elements that reach C<node>
8582 into those that satisfy C<filter> and those that do not and
8583 arranges for the elements that do satisfy the filter to be
8584 executed before (in case of C<isl_schedule_node_order_before>)
8585 or after (in case of C<isl_schedule_node_order_after>)
8586 those that do not. The order is imposed by
8587 a sequence node, possibly reusing the grandparent of C<node>
8588 on two copies of the subtree attached to the original C<node>.
8589 Both copies are simplified with respect to their filter.
8591 Return a pointer to the copy of the subtree that does not
8592 satisfy C<filter>. If there is no such copy (because all
8593 reaching domain elements satisfy the filter), then return
8594 the original pointer.
8596 #include <isl/schedule_node.h>
8597 __isl_give isl_schedule_node *
8598 isl_schedule_node_graft_before(
8599 __isl_take isl_schedule_node *node,
8600 __isl_take isl_schedule_node *graft);
8601 __isl_give isl_schedule_node *
8602 isl_schedule_node_graft_after(
8603 __isl_take isl_schedule_node *node,
8604 __isl_take isl_schedule_node *graft);
8606 This function inserts the C<graft> tree into the tree containing C<node>
8607 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
8608 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
8609 The root node of C<graft>
8610 should be an extension node where the domain of the extension
8611 is the flat product of all outer band nodes of C<node>.
8612 The root node may also be a domain node.
8613 The elements of the domain or the range of the extension may not
8614 intersect with the domain elements that reach "node".
8615 The schedule tree of C<graft> may not be anchored.
8617 The schedule tree of C<node> is modified to include an extension node
8618 corresponding to the root node of C<graft> as a child of the original
8619 parent of C<node>. The original node that C<node> points to and the
8620 child of the root node of C<graft> are attached to this extension node
8621 through a sequence, with appropriate filters and with the child
8622 of C<graft> appearing before or after the original C<node>.
8624 If C<node> already appears inside a sequence that is the child of
8625 an extension node and if the spaces of the new domain elements
8626 do not overlap with those of the original domain elements,
8627 then that extension node is extended with the new extension
8628 rather than introducing a new segment of extension and sequence nodes.
8630 Return a pointer to the same node in the modified tree that
8631 C<node> pointed to in the original tree.
8633 A representation of the schedule node can be printed using
8635 #include <isl/schedule_node.h>
8636 __isl_give isl_printer *isl_printer_print_schedule_node(
8637 __isl_take isl_printer *p,
8638 __isl_keep isl_schedule_node *node);
8639 __isl_give char *isl_schedule_node_to_str(
8640 __isl_keep isl_schedule_node *node);
8642 C<isl_schedule_node_to_str> prints the schedule node in block format.
8644 =head2 Dependence Analysis
8646 C<isl> contains specialized functionality for performing
8647 array dataflow analysis. That is, given a I<sink> access relation
8648 and a collection of possible I<source> access relations,
8649 C<isl> can compute relations that describe
8650 for each iteration of the sink access, which iteration
8651 of which of the source access relations was the last
8652 to access the same data element before the given iteration
8654 The resulting dependence relations map source iterations
8655 to either the corresponding sink iterations or
8656 pairs of corresponding sink iterations and accessed data elements.
8657 To compute standard flow dependences, the sink should be
8658 a read, while the sources should be writes.
8659 If any of the source accesses are marked as being I<may>
8660 accesses, then there will be a dependence from the last
8661 I<must> access B<and> from any I<may> access that follows
8662 this last I<must> access.
8663 In particular, if I<all> sources are I<may> accesses,
8664 then memory based dependence analysis is performed.
8665 If, on the other hand, all sources are I<must> accesses,
8666 then value based dependence analysis is performed.
8668 =head3 High-level Interface
8670 A high-level interface to dependence analysis is provided
8671 by the following function.
8673 #include <isl/flow.h>
8674 __isl_give isl_union_flow *
8675 isl_union_access_info_compute_flow(
8676 __isl_take isl_union_access_info *access);
8678 The input C<isl_union_access_info> object describes the sink
8679 access relations, the source access relations and a schedule,
8680 while the output C<isl_union_flow> object describes
8681 the resulting dependence relations and the subsets of the
8682 sink relations for which no source was found.
8684 An C<isl_union_access_info> is created, modified, copied and freed using
8685 the following functions.
8687 #include <isl/flow.h>
8688 __isl_give isl_union_access_info *
8689 isl_union_access_info_from_sink(
8690 __isl_take isl_union_map *sink);
8691 __isl_give isl_union_access_info *
8692 isl_union_access_info_set_must_source(
8693 __isl_take isl_union_access_info *access,
8694 __isl_take isl_union_map *must_source);
8695 __isl_give isl_union_access_info *
8696 isl_union_access_info_set_may_source(
8697 __isl_take isl_union_access_info *access,
8698 __isl_take isl_union_map *may_source);
8699 __isl_give isl_union_access_info *
8700 isl_union_access_info_set_schedule(
8701 __isl_take isl_union_access_info *access,
8702 __isl_take isl_schedule *schedule);
8703 __isl_give isl_union_access_info *
8704 isl_union_access_info_set_schedule_map(
8705 __isl_take isl_union_access_info *access,
8706 __isl_take isl_union_map *schedule_map);
8707 __isl_give isl_union_access_info *
8708 isl_union_access_info_copy(
8709 __isl_keep isl_union_access_info *access);
8710 __isl_null isl_union_access_info *
8711 isl_union_access_info_free(
8712 __isl_take isl_union_access_info *access);
8714 The may sources set by C<isl_union_access_info_set_may_source>
8715 do not need to include the must sources set by
8716 C<isl_union_access_info_set_must_source> as a subset.
8717 The user is free not to call one (or both) of these functions,
8718 in which case the corresponding set is kept to its empty default.
8719 Similarly, the default schedule initialized by
8720 C<isl_union_access_info_from_sink> is empty.
8721 The current schedule is determined by the last call to either
8722 C<isl_union_access_info_set_schedule> or
8723 C<isl_union_access_info_set_schedule_map>.
8724 The domain of the schedule corresponds to the domains of
8725 the access relations. In particular, the domains of the access
8726 relations are effectively intersected with the domain of the schedule
8727 and only the resulting accesses are considered by the dependence analysis.
8729 A representation of the information contained in an object
8730 of type C<isl_union_access_info> can be obtained using
8732 #include <isl/flow.h>
8733 __isl_give isl_printer *
8734 isl_printer_print_union_access_info(
8735 __isl_take isl_printer *p,
8736 __isl_keep isl_union_access_info *access);
8737 __isl_give char *isl_union_access_info_to_str(
8738 __isl_keep isl_union_access_info *access);
8740 C<isl_union_access_info_to_str> prints the information in flow format.
8742 The output of C<isl_union_access_info_compute_flow> can be examined
8743 and freed using the following functions.
8745 #include <isl/flow.h>
8746 __isl_give isl_union_map *isl_union_flow_get_must_dependence(
8747 __isl_keep isl_union_flow *flow);
8748 __isl_give isl_union_map *isl_union_flow_get_may_dependence(
8749 __isl_keep isl_union_flow *flow);
8750 __isl_give isl_union_map *
8751 isl_union_flow_get_full_must_dependence(
8752 __isl_keep isl_union_flow *flow);
8753 __isl_give isl_union_map *
8754 isl_union_flow_get_full_may_dependence(
8755 __isl_keep isl_union_flow *flow);
8756 __isl_give isl_union_map *isl_union_flow_get_must_no_source(
8757 __isl_keep isl_union_flow *flow);
8758 __isl_give isl_union_map *isl_union_flow_get_may_no_source(
8759 __isl_keep isl_union_flow *flow);
8760 __isl_null isl_union_flow *isl_union_flow_free(
8761 __isl_take isl_union_flow *flow);
8763 The relation returned by C<isl_union_flow_get_must_dependence>
8764 relates domain elements of must sources to domain elements of the sink.
8765 The relation returned by C<isl_union_flow_get_may_dependence>
8766 relates domain elements of must or may sources to domain elements of the sink
8767 and includes the previous relation as a subset.
8768 The relation returned by C<isl_union_flow_get_full_must_dependence>
8769 relates domain elements of must sources to pairs of domain elements of the sink
8770 and accessed data elements.
8771 The relation returned by C<isl_union_flow_get_full_may_dependence>
8772 relates domain elements of must or may sources to pairs of
8773 domain elements of the sink and accessed data elements.
8774 This relation includes the previous relation as a subset.
8775 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
8776 of the sink relation for which no dependences have been found.
8777 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
8778 of the sink relation for which no definite dependences have been found.
8779 That is, it contains those sink access that do not contribute to any
8780 of the elements in the relation returned
8781 by C<isl_union_flow_get_must_dependence>.
8783 A representation of the information contained in an object
8784 of type C<isl_union_flow> can be obtained using
8786 #include <isl/flow.h>
8787 __isl_give isl_printer *isl_printer_print_union_flow(
8788 __isl_take isl_printer *p,
8789 __isl_keep isl_union_flow *flow);
8790 __isl_give char *isl_union_flow_to_str(
8791 __isl_keep isl_union_flow *flow);
8793 C<isl_union_flow_to_str> prints the information in flow format.
8795 =head3 Low-level Interface
8797 A lower-level interface is provided by the following functions.
8799 #include <isl/flow.h>
8801 typedef int (*isl_access_level_before)(void *first, void *second);
8803 __isl_give isl_access_info *isl_access_info_alloc(
8804 __isl_take isl_map *sink,
8805 void *sink_user, isl_access_level_before fn,
8807 __isl_give isl_access_info *isl_access_info_add_source(
8808 __isl_take isl_access_info *acc,
8809 __isl_take isl_map *source, int must,
8811 __isl_null isl_access_info *isl_access_info_free(
8812 __isl_take isl_access_info *acc);
8814 __isl_give isl_flow *isl_access_info_compute_flow(
8815 __isl_take isl_access_info *acc);
8817 isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
8818 isl_stat (*fn)(__isl_take isl_map *dep, int must,
8819 void *dep_user, void *user),
8821 __isl_give isl_map *isl_flow_get_no_source(
8822 __isl_keep isl_flow *deps, int must);
8823 void isl_flow_free(__isl_take isl_flow *deps);
8825 The function C<isl_access_info_compute_flow> performs the actual
8826 dependence analysis. The other functions are used to construct
8827 the input for this function or to read off the output.
8829 The input is collected in an C<isl_access_info>, which can
8830 be created through a call to C<isl_access_info_alloc>.
8831 The arguments to this functions are the sink access relation
8832 C<sink>, a token C<sink_user> used to identify the sink
8833 access to the user, a callback function for specifying the
8834 relative order of source and sink accesses, and the number
8835 of source access relations that will be added.
8836 The callback function has type C<int (*)(void *first, void *second)>.
8837 The function is called with two user supplied tokens identifying
8838 either a source or the sink and it should return the shared nesting
8839 level and the relative order of the two accesses.
8840 In particular, let I<n> be the number of loops shared by
8841 the two accesses. If C<first> precedes C<second> textually,
8842 then the function should return I<2 * n + 1>; otherwise,
8843 it should return I<2 * n>.
8844 The sources can be added to the C<isl_access_info> by performing
8845 (at most) C<max_source> calls to C<isl_access_info_add_source>.
8846 C<must> indicates whether the source is a I<must> access
8847 or a I<may> access. Note that a multi-valued access relation
8848 should only be marked I<must> if every iteration in the domain
8849 of the relation accesses I<all> elements in its image.
8850 The C<source_user> token is again used to identify
8851 the source access. The range of the source access relation
8852 C<source> should have the same dimension as the range
8853 of the sink access relation.
8854 The C<isl_access_info_free> function should usually not be
8855 called explicitly, because it is called implicitly by
8856 C<isl_access_info_compute_flow>.
8858 The result of the dependence analysis is collected in an
8859 C<isl_flow>. There may be elements of
8860 the sink access for which no preceding source access could be
8861 found or for which all preceding sources are I<may> accesses.
8862 The relations containing these elements can be obtained through
8863 calls to C<isl_flow_get_no_source>, the first with C<must> set
8864 and the second with C<must> unset.
8865 In the case of standard flow dependence analysis,
8866 with the sink a read and the sources I<must> writes,
8867 the first relation corresponds to the reads from uninitialized
8868 array elements and the second relation is empty.
8869 The actual flow dependences can be extracted using
8870 C<isl_flow_foreach>. This function will call the user-specified
8871 callback function C<fn> for each B<non-empty> dependence between
8872 a source and the sink. The callback function is called
8873 with four arguments, the actual flow dependence relation
8874 mapping source iterations to sink iterations, a boolean that
8875 indicates whether it is a I<must> or I<may> dependence, a token
8876 identifying the source and an additional C<void *> with value
8877 equal to the third argument of the C<isl_flow_foreach> call.
8878 A dependence is marked I<must> if it originates from a I<must>
8879 source and if it is not followed by any I<may> sources.
8881 After finishing with an C<isl_flow>, the user should call
8882 C<isl_flow_free> to free all associated memory.
8884 =head3 Interaction with the Low-level Interface
8886 During the dependence analysis, we frequently need to perform
8887 the following operation. Given a relation between sink iterations
8888 and potential source iterations from a particular source domain,
8889 what is the last potential source iteration corresponding to each
8890 sink iteration. It can sometimes be convenient to adjust
8891 the set of potential source iterations before or after each such operation.
8892 The prototypical example is fuzzy array dataflow analysis,
8893 where we need to analyze if, based on data-dependent constraints,
8894 the sink iteration can ever be executed without one or more of
8895 the corresponding potential source iterations being executed.
8896 If so, we can introduce extra parameters and select an unknown
8897 but fixed source iteration from the potential source iterations.
8898 To be able to perform such manipulations, C<isl> provides the following
8901 #include <isl/flow.h>
8903 typedef __isl_give isl_restriction *(*isl_access_restrict)(
8904 __isl_keep isl_map *source_map,
8905 __isl_keep isl_set *sink, void *source_user,
8907 __isl_give isl_access_info *isl_access_info_set_restrict(
8908 __isl_take isl_access_info *acc,
8909 isl_access_restrict fn, void *user);
8911 The function C<isl_access_info_set_restrict> should be called
8912 before calling C<isl_access_info_compute_flow> and registers a callback function
8913 that will be called any time C<isl> is about to compute the last
8914 potential source. The first argument is the (reverse) proto-dependence,
8915 mapping sink iterations to potential source iterations.
8916 The second argument represents the sink iterations for which
8917 we want to compute the last source iteration.
8918 The third argument is the token corresponding to the source
8919 and the final argument is the token passed to C<isl_access_info_set_restrict>.
8920 The callback is expected to return a restriction on either the input or
8921 the output of the operation computing the last potential source.
8922 If the input needs to be restricted then restrictions are needed
8923 for both the source and the sink iterations. The sink iterations
8924 and the potential source iterations will be intersected with these sets.
8925 If the output needs to be restricted then only a restriction on the source
8926 iterations is required.
8927 If any error occurs, the callback should return C<NULL>.
8928 An C<isl_restriction> object can be created, freed and inspected
8929 using the following functions.
8931 #include <isl/flow.h>
8933 __isl_give isl_restriction *isl_restriction_input(
8934 __isl_take isl_set *source_restr,
8935 __isl_take isl_set *sink_restr);
8936 __isl_give isl_restriction *isl_restriction_output(
8937 __isl_take isl_set *source_restr);
8938 __isl_give isl_restriction *isl_restriction_none(
8939 __isl_take isl_map *source_map);
8940 __isl_give isl_restriction *isl_restriction_empty(
8941 __isl_take isl_map *source_map);
8942 __isl_null isl_restriction *isl_restriction_free(
8943 __isl_take isl_restriction *restr);
8945 C<isl_restriction_none> and C<isl_restriction_empty> are special
8946 cases of C<isl_restriction_input>. C<isl_restriction_none>
8947 is essentially equivalent to
8949 isl_restriction_input(isl_set_universe(
8950 isl_space_range(isl_map_get_space(source_map))),
8952 isl_space_domain(isl_map_get_space(source_map))));
8954 whereas C<isl_restriction_empty> is essentially equivalent to
8956 isl_restriction_input(isl_set_empty(
8957 isl_space_range(isl_map_get_space(source_map))),
8959 isl_space_domain(isl_map_get_space(source_map))));
8963 #include <isl/schedule.h>
8964 __isl_give isl_schedule *
8965 isl_schedule_constraints_compute_schedule(
8966 __isl_take isl_schedule_constraints *sc);
8968 The function C<isl_schedule_constraints_compute_schedule> can be
8969 used to compute a schedule that satisfies the given schedule constraints.
8970 These schedule constraints include the iteration domain for which
8971 a schedule should be computed and dependences between pairs of
8972 iterations. In particular, these dependences include
8973 I<validity> dependences and I<proximity> dependences.
8974 By default, the algorithm used to construct the schedule is similar
8975 to that of C<Pluto>.
8976 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
8978 The generated schedule respects all validity dependences.
8979 That is, all dependence distances over these dependences in the
8980 scheduled space are lexicographically positive.
8982 The default algorithm tries to ensure that the dependence distances
8983 over coincidence constraints are zero and to minimize the
8984 dependence distances over proximity dependences.
8985 Moreover, it tries to obtain sequences (bands) of schedule dimensions
8986 for groups of domains where the dependence distances over validity
8987 dependences have only non-negative values.
8988 Note that when minimizing the maximal dependence distance
8989 over proximity dependences, a single affine expression in the parameters
8990 is constructed that bounds all dependence distances. If no such expression
8991 exists, then the algorithm will fail and resort to an alternative
8992 scheduling algorithm. In particular, this means that adding proximity
8993 dependences may eliminate valid solutions. A typical example where this
8994 phenomenon may occur is when some subset of the proximity dependences
8995 has no restriction on some parameter, forcing the coefficient of that
8996 parameter to be zero, while some other subset forces the dependence
8997 distance to depend on that parameter, requiring the same coefficient
8999 When using Feautrier's algorithm, the coincidence and proximity constraints
9000 are only taken into account during the extension to a
9001 full-dimensional schedule.
9003 An C<isl_schedule_constraints> object can be constructed
9004 and manipulated using the following functions.
9006 #include <isl/schedule.h>
9007 __isl_give isl_schedule_constraints *
9008 isl_schedule_constraints_copy(
9009 __isl_keep isl_schedule_constraints *sc);
9010 __isl_give isl_schedule_constraints *
9011 isl_schedule_constraints_on_domain(
9012 __isl_take isl_union_set *domain);
9013 __isl_give isl_schedule_constraints *
9014 isl_schedule_constraints_set_context(
9015 __isl_take isl_schedule_constraints *sc,
9016 __isl_take isl_set *context);
9017 __isl_give isl_schedule_constraints *
9018 isl_schedule_constraints_set_validity(
9019 __isl_take isl_schedule_constraints *sc,
9020 __isl_take isl_union_map *validity);
9021 __isl_give isl_schedule_constraints *
9022 isl_schedule_constraints_set_coincidence(
9023 __isl_take isl_schedule_constraints *sc,
9024 __isl_take isl_union_map *coincidence);
9025 __isl_give isl_schedule_constraints *
9026 isl_schedule_constraints_set_proximity(
9027 __isl_take isl_schedule_constraints *sc,
9028 __isl_take isl_union_map *proximity);
9029 __isl_give isl_schedule_constraints *
9030 isl_schedule_constraints_set_conditional_validity(
9031 __isl_take isl_schedule_constraints *sc,
9032 __isl_take isl_union_map *condition,
9033 __isl_take isl_union_map *validity);
9034 __isl_give isl_schedule_constraints *
9035 isl_schedule_constraints_apply(
9036 __isl_take isl_schedule_constraints *sc,
9037 __isl_take isl_union_map *umap);
9038 __isl_null isl_schedule_constraints *
9039 isl_schedule_constraints_free(
9040 __isl_take isl_schedule_constraints *sc);
9042 The initial C<isl_schedule_constraints> object created by
9043 C<isl_schedule_constraints_on_domain> does not impose any constraints.
9044 That is, it has an empty set of dependences.
9045 The function C<isl_schedule_constraints_set_context> allows the user
9046 to specify additional constraints on the parameters that may
9047 be assumed to hold during the construction of the schedule.
9048 The function C<isl_schedule_constraints_set_validity> replaces the
9049 validity dependences, mapping domain elements I<i> to domain
9050 elements that should be scheduled after I<i>.
9051 The function C<isl_schedule_constraints_set_coincidence> replaces the
9052 coincidence dependences, mapping domain elements I<i> to domain
9053 elements that should be scheduled together with I<I>, if possible.
9054 The function C<isl_schedule_constraints_set_proximity> replaces the
9055 proximity dependences, mapping domain elements I<i> to domain
9056 elements that should be scheduled either before I<I>
9057 or as early as possible after I<i>.
9059 The function C<isl_schedule_constraints_set_conditional_validity>
9060 replaces the conditional validity constraints.
9061 A conditional validity constraint is only imposed when any of the corresponding
9062 conditions is satisfied, i.e., when any of them is non-zero.
9063 That is, the scheduler ensures that within each band if the dependence
9064 distances over the condition constraints are not all zero
9065 then all corresponding conditional validity constraints are respected.
9066 A conditional validity constraint corresponds to a condition
9067 if the two are adjacent, i.e., if the domain of one relation intersect
9068 the range of the other relation.
9069 The typical use case of conditional validity constraints is
9070 to allow order constraints between live ranges to be violated
9071 as long as the live ranges themselves are local to the band.
9072 To allow more fine-grained control over which conditions correspond
9073 to which conditional validity constraints, the domains and ranges
9074 of these relations may include I<tags>. That is, the domains and
9075 ranges of those relation may themselves be wrapped relations
9076 where the iteration domain appears in the domain of those wrapped relations
9077 and the range of the wrapped relations can be arbitrarily chosen
9078 by the user. Conditions and conditional validity constraints are only
9079 considered adjacent to each other if the entire wrapped relation matches.
9080 In particular, a relation with a tag will never be considered adjacent
9081 to a relation without a tag.
9083 The function C<isl_schedule_constraints_compute_schedule> takes
9084 schedule constraints that are defined on some set of domain elements
9085 and transforms them to schedule constraints on the elements
9086 to which these domain elements are mapped by the given transformation.
9088 An C<isl_schedule_constraints> object can be inspected
9089 using the following functions.
9091 #include <isl/schedule.h>
9092 __isl_give isl_union_set *
9093 isl_schedule_constraints_get_domain(
9094 __isl_keep isl_schedule_constraints *sc);
9095 __isl_give isl_union_map *
9096 isl_schedule_constraints_get_validity(
9097 __isl_keep isl_schedule_constraints *sc);
9098 __isl_give isl_union_map *
9099 isl_schedule_constraints_get_coincidence(
9100 __isl_keep isl_schedule_constraints *sc);
9101 __isl_give isl_union_map *
9102 isl_schedule_constraints_get_proximity(
9103 __isl_keep isl_schedule_constraints *sc);
9104 __isl_give isl_union_map *
9105 isl_schedule_constraints_get_conditional_validity(
9106 __isl_keep isl_schedule_constraints *sc);
9107 __isl_give isl_union_map *
9108 isl_schedule_constraints_get_conditional_validity_condition(
9109 __isl_keep isl_schedule_constraints *sc);
9111 The following function computes a schedule directly from
9112 an iteration domain and validity and proximity dependences
9113 and is implemented in terms of the functions described above.
9114 The use of C<isl_union_set_compute_schedule> is discouraged.
9116 #include <isl/schedule.h>
9117 __isl_give isl_schedule *isl_union_set_compute_schedule(
9118 __isl_take isl_union_set *domain,
9119 __isl_take isl_union_map *validity,
9120 __isl_take isl_union_map *proximity);
9122 The generated schedule represents a schedule tree.
9123 For more information on schedule trees, see
9124 L</"Schedule Trees">.
9128 #include <isl/schedule.h>
9129 isl_stat isl_options_set_schedule_max_coefficient(
9130 isl_ctx *ctx, int val);
9131 int isl_options_get_schedule_max_coefficient(
9133 isl_stat isl_options_set_schedule_max_constant_term(
9134 isl_ctx *ctx, int val);
9135 int isl_options_get_schedule_max_constant_term(
9137 isl_stat isl_options_set_schedule_serialize_sccs(
9138 isl_ctx *ctx, int val);
9139 int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
9140 isl_stat isl_options_set_schedule_whole_component(
9141 isl_ctx *ctx, int val);
9142 int isl_options_get_schedule_whole_component(
9144 isl_stat isl_options_set_schedule_maximize_band_depth(
9145 isl_ctx *ctx, int val);
9146 int isl_options_get_schedule_maximize_band_depth(
9148 isl_stat isl_options_set_schedule_maximize_coincidence(
9149 isl_ctx *ctx, int val);
9150 int isl_options_get_schedule_maximize_coincidence(
9152 isl_stat isl_options_set_schedule_outer_coincidence(
9153 isl_ctx *ctx, int val);
9154 int isl_options_get_schedule_outer_coincidence(
9156 isl_stat isl_options_set_schedule_split_scaled(
9157 isl_ctx *ctx, int val);
9158 int isl_options_get_schedule_split_scaled(
9160 isl_stat isl_options_set_schedule_treat_coalescing(
9161 isl_ctx *ctx, int val);
9162 int isl_options_get_schedule_treat_coalescing(
9164 isl_stat isl_options_set_schedule_algorithm(
9165 isl_ctx *ctx, int val);
9166 int isl_options_get_schedule_algorithm(
9168 isl_stat isl_options_set_schedule_separate_components(
9169 isl_ctx *ctx, int val);
9170 int isl_options_get_schedule_separate_components(
9175 =item * schedule_max_coefficient
9177 This option enforces that the coefficients for variable and parameter
9178 dimensions in the calculated schedule are not larger than the specified value.
9179 This option can significantly increase the speed of the scheduling calculation
9180 and may also prevent fusing of unrelated dimensions. A value of -1 means that
9181 this option does not introduce bounds on the variable or parameter
9184 =item * schedule_max_constant_term
9186 This option enforces that the constant coefficients in the calculated schedule
9187 are not larger than the maximal constant term. This option can significantly
9188 increase the speed of the scheduling calculation and may also prevent fusing of
9189 unrelated dimensions. A value of -1 means that this option does not introduce
9190 bounds on the constant coefficients.
9192 =item * schedule_serialize_sccs
9194 If this option is set, then all strongly connected components
9195 in the dependence graph are serialized as soon as they are detected.
9196 This means in particular that instances of statements will only
9197 appear in the same band node if these statements belong
9198 to the same strongly connected component at the point where
9199 the band node is constructed.
9201 =item * schedule_whole_component
9203 If this option is set, then entire (weakly) connected
9204 components in the dependence graph are scheduled together
9206 Otherwise, each strongly connected component within
9207 such a weakly connected component is first scheduled separately
9208 and then combined with other strongly connected components.
9209 This option has no effect if C<schedule_serialize_sccs> is set.
9211 =item * schedule_maximize_band_depth
9213 If this option is set, then the scheduler tries to maximize
9214 the width of the bands. Wider bands give more possibilities for tiling.
9215 In particular, if the C<schedule_whole_component> option is set,
9216 then bands are split if this might result in wider bands.
9217 Otherwise, the effect of this option is to only allow
9218 strongly connected components to be combined if this does
9219 not reduce the width of the bands.
9220 Note that if the C<schedule_serialize_sccs> options is set, then
9221 the C<schedule_maximize_band_depth> option therefore has no effect.
9223 =item * schedule_maximize_coincidence
9225 This option is only effective if the C<schedule_whole_component>
9226 option is turned off.
9227 If the C<schedule_maximize_coincidence> option is set, then (clusters of)
9228 strongly connected components are only combined with each other
9229 if this does not reduce the number of coincident band members.
9231 =item * schedule_outer_coincidence
9233 If this option is set, then we try to construct schedules
9234 where the outermost scheduling dimension in each band
9235 satisfies the coincidence constraints.
9237 =item * schedule_algorithm
9239 Selects the scheduling algorithm to be used.
9240 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
9241 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
9243 =item * schedule_split_scaled
9245 If this option is set, then we try to construct schedules in which the
9246 constant term is split off from the linear part if the linear parts of
9247 the scheduling rows for all nodes in the graphs have a common non-trivial
9249 The constant term is then placed in a separate band and the linear
9251 This option is only effective when the Feautrier style scheduler is
9252 being used, either as the main scheduler or as a fallback for the
9253 Pluto-like scheduler.
9255 =item * schedule_treat_coalescing
9257 If this option is set, then the scheduler will try and avoid
9258 producing schedules that perform loop coalescing.
9259 In particular, for the Pluto-like scheduler, this option places
9260 bounds on the schedule coefficients based on the sizes of the instance sets.
9261 For the Feautrier style scheduler, this option detects potentially
9262 coalescing schedules and then tries to adjust the schedule to avoid
9265 =item * schedule_separate_components
9267 If this option is set then the function C<isl_schedule_get_map>
9268 will treat set nodes in the same way as sequence nodes.
9272 =head2 AST Generation
9274 This section describes the C<isl> functionality for generating
9275 ASTs that visit all the elements
9276 in a domain in an order specified by a schedule tree or
9278 In case the schedule given as a C<isl_union_map>, an AST is generated
9279 that visits all the elements in the domain of the C<isl_union_map>
9280 according to the lexicographic order of the corresponding image
9281 element(s). If the range of the C<isl_union_map> consists of
9282 elements in more than one space, then each of these spaces is handled
9283 separately in an arbitrary order.
9284 It should be noted that the schedule tree or the image elements
9285 in a schedule map only specify the I<order>
9286 in which the corresponding domain elements should be visited.
9287 No direct relation between the partial schedule values
9288 or the image elements on the one hand and the loop iterators
9289 in the generated AST on the other hand should be assumed.
9291 Each AST is generated within a build. The initial build
9292 simply specifies the constraints on the parameters (if any)
9293 and can be created, inspected, copied and freed using the following functions.
9295 #include <isl/ast_build.h>
9296 __isl_give isl_ast_build *isl_ast_build_alloc(
9298 __isl_give isl_ast_build *isl_ast_build_from_context(
9299 __isl_take isl_set *set);
9300 __isl_give isl_ast_build *isl_ast_build_copy(
9301 __isl_keep isl_ast_build *build);
9302 __isl_null isl_ast_build *isl_ast_build_free(
9303 __isl_take isl_ast_build *build);
9305 The C<set> argument is usually a parameter set with zero or more parameters.
9306 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
9307 this set is required to be a parameter set.
9308 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
9309 specify any parameter constraints.
9310 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
9311 and L</"Fine-grained Control over AST Generation">.
9312 Finally, the AST itself can be constructed using one of the following
9315 #include <isl/ast_build.h>
9316 __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
9317 __isl_keep isl_ast_build *build,
9318 __isl_take isl_schedule *schedule);
9319 __isl_give isl_ast_node *
9320 isl_ast_build_node_from_schedule_map(
9321 __isl_keep isl_ast_build *build,
9322 __isl_take isl_union_map *schedule);
9324 =head3 Inspecting the AST
9326 The basic properties of an AST node can be obtained as follows.
9328 #include <isl/ast.h>
9329 enum isl_ast_node_type isl_ast_node_get_type(
9330 __isl_keep isl_ast_node *node);
9332 The type of an AST node is one of
9333 C<isl_ast_node_for>,
9335 C<isl_ast_node_block>,
9336 C<isl_ast_node_mark> or
9337 C<isl_ast_node_user>.
9338 An C<isl_ast_node_for> represents a for node.
9339 An C<isl_ast_node_if> represents an if node.
9340 An C<isl_ast_node_block> represents a compound node.
9341 An C<isl_ast_node_mark> introduces a mark in the AST.
9342 An C<isl_ast_node_user> represents an expression statement.
9343 An expression statement typically corresponds to a domain element, i.e.,
9344 one of the elements that is visited by the AST.
9346 Each type of node has its own additional properties.
9348 #include <isl/ast.h>
9349 __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
9350 __isl_keep isl_ast_node *node);
9351 __isl_give isl_ast_expr *isl_ast_node_for_get_init(
9352 __isl_keep isl_ast_node *node);
9353 __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
9354 __isl_keep isl_ast_node *node);
9355 __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
9356 __isl_keep isl_ast_node *node);
9357 __isl_give isl_ast_node *isl_ast_node_for_get_body(
9358 __isl_keep isl_ast_node *node);
9359 isl_bool isl_ast_node_for_is_degenerate(
9360 __isl_keep isl_ast_node *node);
9362 An C<isl_ast_for> is considered degenerate if it is known to execute
9365 #include <isl/ast.h>
9366 __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
9367 __isl_keep isl_ast_node *node);
9368 __isl_give isl_ast_node *isl_ast_node_if_get_then(
9369 __isl_keep isl_ast_node *node);
9370 isl_bool isl_ast_node_if_has_else(
9371 __isl_keep isl_ast_node *node);
9372 __isl_give isl_ast_node *isl_ast_node_if_get_else(
9373 __isl_keep isl_ast_node *node);
9375 __isl_give isl_ast_node_list *
9376 isl_ast_node_block_get_children(
9377 __isl_keep isl_ast_node *node);
9379 __isl_give isl_id *isl_ast_node_mark_get_id(
9380 __isl_keep isl_ast_node *node);
9381 __isl_give isl_ast_node *isl_ast_node_mark_get_node(
9382 __isl_keep isl_ast_node *node);
9384 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
9385 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
9387 #include <isl/ast.h>
9388 __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
9389 __isl_keep isl_ast_node *node);
9391 All descendants of a specific node in the AST (including the node itself)
9393 in depth-first pre-order using the following function.
9395 #include <isl/ast.h>
9396 isl_stat isl_ast_node_foreach_descendant_top_down(
9397 __isl_keep isl_ast_node *node,
9398 isl_bool (*fn)(__isl_keep isl_ast_node *node,
9399 void *user), void *user);
9401 The callback function should return C<isl_bool_true> if the children
9402 of the given node should be visited and C<isl_bool_false> if they should not.
9403 It should return C<isl_bool_error> in case of failure, in which case
9404 the entire traversal is aborted.
9406 Each of the returned C<isl_ast_expr>s can in turn be inspected using
9407 the following functions.
9409 #include <isl/ast.h>
9410 enum isl_ast_expr_type isl_ast_expr_get_type(
9411 __isl_keep isl_ast_expr *expr);
9413 The type of an AST expression is one of
9415 C<isl_ast_expr_id> or
9416 C<isl_ast_expr_int>.
9417 An C<isl_ast_expr_op> represents the result of an operation.
9418 An C<isl_ast_expr_id> represents an identifier.
9419 An C<isl_ast_expr_int> represents an integer value.
9421 Each type of expression has its own additional properties.
9423 #include <isl/ast.h>
9424 enum isl_ast_op_type isl_ast_expr_get_op_type(
9425 __isl_keep isl_ast_expr *expr);
9426 int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
9427 __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
9428 __isl_keep isl_ast_expr *expr, int pos);
9429 isl_stat isl_ast_expr_foreach_ast_op_type(
9430 __isl_keep isl_ast_expr *expr,
9431 isl_stat (*fn)(enum isl_ast_op_type type,
9432 void *user), void *user);
9433 isl_stat isl_ast_node_foreach_ast_op_type(
9434 __isl_keep isl_ast_node *node,
9435 isl_stat (*fn)(enum isl_ast_op_type type,
9436 void *user), void *user);
9438 C<isl_ast_expr_get_op_type> returns the type of the operation
9439 performed. C<isl_ast_expr_get_op_n_arg> returns the number of
9440 arguments. C<isl_ast_expr_get_op_arg> returns the specified
9442 C<isl_ast_expr_foreach_ast_op_type> calls C<fn> for each distinct
9443 C<isl_ast_op_type> that appears in C<expr>.
9444 C<isl_ast_node_foreach_ast_op_type> does the same for each distinct
9445 C<isl_ast_op_type> that appears in C<node>.
9446 The operation type is one of the following.
9450 =item C<isl_ast_op_and>
9452 Logical I<and> of two arguments.
9453 Both arguments can be evaluated.
9455 =item C<isl_ast_op_and_then>
9457 Logical I<and> of two arguments.
9458 The second argument can only be evaluated if the first evaluates to true.
9460 =item C<isl_ast_op_or>
9462 Logical I<or> of two arguments.
9463 Both arguments can be evaluated.
9465 =item C<isl_ast_op_or_else>
9467 Logical I<or> of two arguments.
9468 The second argument can only be evaluated if the first evaluates to false.
9470 =item C<isl_ast_op_max>
9472 Maximum of two or more arguments.
9474 =item C<isl_ast_op_min>
9476 Minimum of two or more arguments.
9478 =item C<isl_ast_op_minus>
9482 =item C<isl_ast_op_add>
9484 Sum of two arguments.
9486 =item C<isl_ast_op_sub>
9488 Difference of two arguments.
9490 =item C<isl_ast_op_mul>
9492 Product of two arguments.
9494 =item C<isl_ast_op_div>
9496 Exact division. That is, the result is known to be an integer.
9498 =item C<isl_ast_op_fdiv_q>
9500 Result of integer division, rounded towards negative
9503 =item C<isl_ast_op_pdiv_q>
9505 Result of integer division, where dividend is known to be non-negative.
9507 =item C<isl_ast_op_pdiv_r>
9509 Remainder of integer division, where dividend is known to be non-negative.
9511 =item C<isl_ast_op_zdiv_r>
9513 Equal to zero iff the remainder on integer division is zero.
9515 =item C<isl_ast_op_cond>
9517 Conditional operator defined on three arguments.
9518 If the first argument evaluates to true, then the result
9519 is equal to the second argument. Otherwise, the result
9520 is equal to the third argument.
9521 The second and third argument may only be evaluated if
9522 the first argument evaluates to true and false, respectively.
9523 Corresponds to C<a ? b : c> in C.
9525 =item C<isl_ast_op_select>
9527 Conditional operator defined on three arguments.
9528 If the first argument evaluates to true, then the result
9529 is equal to the second argument. Otherwise, the result
9530 is equal to the third argument.
9531 The second and third argument may be evaluated independently
9532 of the value of the first argument.
9533 Corresponds to C<a * b + (1 - a) * c> in C.
9535 =item C<isl_ast_op_eq>
9539 =item C<isl_ast_op_le>
9541 Less than or equal relation.
9543 =item C<isl_ast_op_lt>
9547 =item C<isl_ast_op_ge>
9549 Greater than or equal relation.
9551 =item C<isl_ast_op_gt>
9553 Greater than relation.
9555 =item C<isl_ast_op_call>
9558 The number of arguments of the C<isl_ast_expr> is one more than
9559 the number of arguments in the function call, the first argument
9560 representing the function being called.
9562 =item C<isl_ast_op_access>
9565 The number of arguments of the C<isl_ast_expr> is one more than
9566 the number of index expressions in the array access, the first argument
9567 representing the array being accessed.
9569 =item C<isl_ast_op_member>
9572 This operation has two arguments, a structure and the name of
9573 the member of the structure being accessed.
9577 #include <isl/ast.h>
9578 __isl_give isl_id *isl_ast_expr_get_id(
9579 __isl_keep isl_ast_expr *expr);
9581 Return the identifier represented by the AST expression.
9583 #include <isl/ast.h>
9584 __isl_give isl_val *isl_ast_expr_get_val(
9585 __isl_keep isl_ast_expr *expr);
9587 Return the integer represented by the AST expression.
9589 =head3 Properties of ASTs
9591 #include <isl/ast.h>
9592 isl_bool isl_ast_expr_is_equal(
9593 __isl_keep isl_ast_expr *expr1,
9594 __isl_keep isl_ast_expr *expr2);
9596 Check if two C<isl_ast_expr>s are equal to each other.
9598 =head3 Manipulating and printing the AST
9600 AST nodes can be copied and freed using the following functions.
9602 #include <isl/ast.h>
9603 __isl_give isl_ast_node *isl_ast_node_copy(
9604 __isl_keep isl_ast_node *node);
9605 __isl_null isl_ast_node *isl_ast_node_free(
9606 __isl_take isl_ast_node *node);
9608 AST expressions can be copied and freed using the following functions.
9610 #include <isl/ast.h>
9611 __isl_give isl_ast_expr *isl_ast_expr_copy(
9612 __isl_keep isl_ast_expr *expr);
9613 __isl_null isl_ast_expr *isl_ast_expr_free(
9614 __isl_take isl_ast_expr *expr);
9616 New AST expressions can be created either directly or within
9617 the context of an C<isl_ast_build>.
9619 #include <isl/ast.h>
9620 __isl_give isl_ast_expr *isl_ast_expr_from_val(
9621 __isl_take isl_val *v);
9622 __isl_give isl_ast_expr *isl_ast_expr_from_id(
9623 __isl_take isl_id *id);
9624 __isl_give isl_ast_expr *isl_ast_expr_neg(
9625 __isl_take isl_ast_expr *expr);
9626 __isl_give isl_ast_expr *isl_ast_expr_address_of(
9627 __isl_take isl_ast_expr *expr);
9628 __isl_give isl_ast_expr *isl_ast_expr_add(
9629 __isl_take isl_ast_expr *expr1,
9630 __isl_take isl_ast_expr *expr2);
9631 __isl_give isl_ast_expr *isl_ast_expr_sub(
9632 __isl_take isl_ast_expr *expr1,
9633 __isl_take isl_ast_expr *expr2);
9634 __isl_give isl_ast_expr *isl_ast_expr_mul(
9635 __isl_take isl_ast_expr *expr1,
9636 __isl_take isl_ast_expr *expr2);
9637 __isl_give isl_ast_expr *isl_ast_expr_div(
9638 __isl_take isl_ast_expr *expr1,
9639 __isl_take isl_ast_expr *expr2);
9640 __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
9641 __isl_take isl_ast_expr *expr1,
9642 __isl_take isl_ast_expr *expr2);
9643 __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
9644 __isl_take isl_ast_expr *expr1,
9645 __isl_take isl_ast_expr *expr2);
9646 __isl_give isl_ast_expr *isl_ast_expr_and(
9647 __isl_take isl_ast_expr *expr1,
9648 __isl_take isl_ast_expr *expr2)
9649 __isl_give isl_ast_expr *isl_ast_expr_and_then(
9650 __isl_take isl_ast_expr *expr1,
9651 __isl_take isl_ast_expr *expr2)
9652 __isl_give isl_ast_expr *isl_ast_expr_or(
9653 __isl_take isl_ast_expr *expr1,
9654 __isl_take isl_ast_expr *expr2)
9655 __isl_give isl_ast_expr *isl_ast_expr_or_else(
9656 __isl_take isl_ast_expr *expr1,
9657 __isl_take isl_ast_expr *expr2)
9658 __isl_give isl_ast_expr *isl_ast_expr_eq(
9659 __isl_take isl_ast_expr *expr1,
9660 __isl_take isl_ast_expr *expr2);
9661 __isl_give isl_ast_expr *isl_ast_expr_le(
9662 __isl_take isl_ast_expr *expr1,
9663 __isl_take isl_ast_expr *expr2);
9664 __isl_give isl_ast_expr *isl_ast_expr_lt(
9665 __isl_take isl_ast_expr *expr1,
9666 __isl_take isl_ast_expr *expr2);
9667 __isl_give isl_ast_expr *isl_ast_expr_ge(
9668 __isl_take isl_ast_expr *expr1,
9669 __isl_take isl_ast_expr *expr2);
9670 __isl_give isl_ast_expr *isl_ast_expr_gt(
9671 __isl_take isl_ast_expr *expr1,
9672 __isl_take isl_ast_expr *expr2);
9673 __isl_give isl_ast_expr *isl_ast_expr_access(
9674 __isl_take isl_ast_expr *array,
9675 __isl_take isl_ast_expr_list *indices);
9676 __isl_give isl_ast_expr *isl_ast_expr_call(
9677 __isl_take isl_ast_expr *function,
9678 __isl_take isl_ast_expr_list *arguments);
9680 The function C<isl_ast_expr_address_of> can be applied to an
9681 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
9682 to represent the address of the C<isl_ast_expr_access>. The function
9683 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
9684 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
9686 #include <isl/ast_build.h>
9687 __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
9688 __isl_keep isl_ast_build *build,
9689 __isl_take isl_set *set);
9690 __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
9691 __isl_keep isl_ast_build *build,
9692 __isl_take isl_pw_aff *pa);
9693 __isl_give isl_ast_expr *
9694 isl_ast_build_access_from_pw_multi_aff(
9695 __isl_keep isl_ast_build *build,
9696 __isl_take isl_pw_multi_aff *pma);
9697 __isl_give isl_ast_expr *
9698 isl_ast_build_access_from_multi_pw_aff(
9699 __isl_keep isl_ast_build *build,
9700 __isl_take isl_multi_pw_aff *mpa);
9701 __isl_give isl_ast_expr *
9702 isl_ast_build_call_from_pw_multi_aff(
9703 __isl_keep isl_ast_build *build,
9704 __isl_take isl_pw_multi_aff *pma);
9705 __isl_give isl_ast_expr *
9706 isl_ast_build_call_from_multi_pw_aff(
9707 __isl_keep isl_ast_build *build,
9708 __isl_take isl_multi_pw_aff *mpa);
9711 the domains of C<pa>, C<mpa> and C<pma> should correspond
9712 to the schedule space of C<build>.
9713 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
9714 the function being called.
9715 If the accessed space is a nested relation, then it is taken
9716 to represent an access of the member specified by the range
9717 of this nested relation of the structure specified by the domain
9718 of the nested relation.
9720 The following functions can be used to modify an C<isl_ast_expr>.
9722 #include <isl/ast.h>
9723 __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
9724 __isl_take isl_ast_expr *expr, int pos,
9725 __isl_take isl_ast_expr *arg);
9727 Replace the argument of C<expr> at position C<pos> by C<arg>.
9729 #include <isl/ast.h>
9730 __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
9731 __isl_take isl_ast_expr *expr,
9732 __isl_take isl_id_to_ast_expr *id2expr);
9734 The function C<isl_ast_expr_substitute_ids> replaces the
9735 subexpressions of C<expr> of type C<isl_ast_expr_id>
9736 by the corresponding expression in C<id2expr>, if there is any.
9739 User specified data can be attached to an C<isl_ast_node> and obtained
9740 from the same C<isl_ast_node> using the following functions.
9742 #include <isl/ast.h>
9743 __isl_give isl_ast_node *isl_ast_node_set_annotation(
9744 __isl_take isl_ast_node *node,
9745 __isl_take isl_id *annotation);
9746 __isl_give isl_id *isl_ast_node_get_annotation(
9747 __isl_keep isl_ast_node *node);
9749 Basic printing can be performed using the following functions.
9751 #include <isl/ast.h>
9752 __isl_give isl_printer *isl_printer_print_ast_expr(
9753 __isl_take isl_printer *p,
9754 __isl_keep isl_ast_expr *expr);
9755 __isl_give isl_printer *isl_printer_print_ast_node(
9756 __isl_take isl_printer *p,
9757 __isl_keep isl_ast_node *node);
9758 __isl_give char *isl_ast_expr_to_str(
9759 __isl_keep isl_ast_expr *expr);
9760 __isl_give char *isl_ast_node_to_str(
9761 __isl_keep isl_ast_node *node);
9762 __isl_give char *isl_ast_expr_to_C_str(
9763 __isl_keep isl_ast_expr *expr);
9764 __isl_give char *isl_ast_node_to_C_str(
9765 __isl_keep isl_ast_node *node);
9767 The functions C<isl_ast_expr_to_C_str> and
9768 C<isl_ast_node_to_C_str> are convenience functions
9769 that return a string representation of the input in C format.
9771 More advanced printing can be performed using the following functions.
9773 #include <isl/ast.h>
9774 __isl_give isl_printer *isl_ast_op_type_set_print_name(
9775 __isl_take isl_printer *p,
9776 enum isl_ast_op_type type,
9777 __isl_keep const char *name);
9778 isl_stat isl_options_set_ast_print_macro_once(
9779 isl_ctx *ctx, int val);
9780 int isl_options_get_ast_print_macro_once(isl_ctx *ctx);
9781 __isl_give isl_printer *isl_ast_op_type_print_macro(
9782 enum isl_ast_op_type type,
9783 __isl_take isl_printer *p);
9784 __isl_give isl_printer *isl_ast_expr_print_macros(
9785 __isl_keep isl_ast_expr *expr,
9786 __isl_take isl_printer *p);
9787 __isl_give isl_printer *isl_ast_node_print_macros(
9788 __isl_keep isl_ast_node *node,
9789 __isl_take isl_printer *p);
9790 __isl_give isl_printer *isl_ast_node_print(
9791 __isl_keep isl_ast_node *node,
9792 __isl_take isl_printer *p,
9793 __isl_take isl_ast_print_options *options);
9794 __isl_give isl_printer *isl_ast_node_for_print(
9795 __isl_keep isl_ast_node *node,
9796 __isl_take isl_printer *p,
9797 __isl_take isl_ast_print_options *options);
9798 __isl_give isl_printer *isl_ast_node_if_print(
9799 __isl_keep isl_ast_node *node,
9800 __isl_take isl_printer *p,
9801 __isl_take isl_ast_print_options *options);
9803 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
9804 C<isl> may print out an AST that makes use of macros such
9805 as C<floord>, C<min> and C<max>.
9806 The names of these macros may be modified by a call
9807 to C<isl_ast_op_type_set_print_name>. The user-specified
9808 names are associated to the printer object.
9809 C<isl_ast_op_type_print_macro> prints out the macro
9810 corresponding to a specific C<isl_ast_op_type>.
9811 If the print-macro-once option is set, then a given macro definition
9812 is only printed once to any given printer object.
9813 C<isl_ast_expr_print_macros> scans the C<isl_ast_expr>
9814 for subexpressions where these macros would be used and prints
9815 out the required macro definitions.
9816 Essentially, C<isl_ast_expr_print_macros> calls
9817 C<isl_ast_expr_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
9818 as function argument.
9819 C<isl_ast_node_print_macros> does the same
9820 for expressions in its C<isl_ast_node> argument.
9821 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
9822 C<isl_ast_node_if_print> print an C<isl_ast_node>
9823 in C<ISL_FORMAT_C>, but allow for some extra control
9824 through an C<isl_ast_print_options> object.
9825 This object can be created using the following functions.
9827 #include <isl/ast.h>
9828 __isl_give isl_ast_print_options *
9829 isl_ast_print_options_alloc(isl_ctx *ctx);
9830 __isl_give isl_ast_print_options *
9831 isl_ast_print_options_copy(
9832 __isl_keep isl_ast_print_options *options);
9833 __isl_null isl_ast_print_options *
9834 isl_ast_print_options_free(
9835 __isl_take isl_ast_print_options *options);
9837 __isl_give isl_ast_print_options *
9838 isl_ast_print_options_set_print_user(
9839 __isl_take isl_ast_print_options *options,
9840 __isl_give isl_printer *(*print_user)(
9841 __isl_take isl_printer *p,
9842 __isl_take isl_ast_print_options *options,
9843 __isl_keep isl_ast_node *node, void *user),
9845 __isl_give isl_ast_print_options *
9846 isl_ast_print_options_set_print_for(
9847 __isl_take isl_ast_print_options *options,
9848 __isl_give isl_printer *(*print_for)(
9849 __isl_take isl_printer *p,
9850 __isl_take isl_ast_print_options *options,
9851 __isl_keep isl_ast_node *node, void *user),
9854 The callback set by C<isl_ast_print_options_set_print_user>
9855 is called whenever a node of type C<isl_ast_node_user> needs to
9857 The callback set by C<isl_ast_print_options_set_print_for>
9858 is called whenever a node of type C<isl_ast_node_for> needs to
9860 Note that C<isl_ast_node_for_print> will I<not> call the
9861 callback set by C<isl_ast_print_options_set_print_for> on the node
9862 on which C<isl_ast_node_for_print> is called, but only on nested
9863 nodes of type C<isl_ast_node_for>. It is therefore safe to
9864 call C<isl_ast_node_for_print> from within the callback set by
9865 C<isl_ast_print_options_set_print_for>.
9867 The following option determines the type to be used for iterators
9868 while printing the AST.
9870 isl_stat isl_options_set_ast_iterator_type(
9871 isl_ctx *ctx, const char *val);
9872 const char *isl_options_get_ast_iterator_type(
9875 The AST printer only prints body nodes as blocks if these
9876 blocks cannot be safely omitted.
9877 For example, a C<for> node with one body node will not be
9878 surrounded with braces in C<ISL_FORMAT_C>.
9879 A block will always be printed by setting the following option.
9881 isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
9883 int isl_options_get_ast_always_print_block(isl_ctx *ctx);
9887 #include <isl/ast_build.h>
9888 isl_stat isl_options_set_ast_build_atomic_upper_bound(
9889 isl_ctx *ctx, int val);
9890 int isl_options_get_ast_build_atomic_upper_bound(
9892 isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
9894 int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
9895 isl_stat isl_options_set_ast_build_detect_min_max(
9896 isl_ctx *ctx, int val);
9897 int isl_options_get_ast_build_detect_min_max(
9899 isl_stat isl_options_set_ast_build_exploit_nested_bounds(
9900 isl_ctx *ctx, int val);
9901 int isl_options_get_ast_build_exploit_nested_bounds(
9903 isl_stat isl_options_set_ast_build_group_coscheduled(
9904 isl_ctx *ctx, int val);
9905 int isl_options_get_ast_build_group_coscheduled(
9907 isl_stat isl_options_set_ast_build_scale_strides(
9908 isl_ctx *ctx, int val);
9909 int isl_options_get_ast_build_scale_strides(
9911 isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
9913 int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
9914 isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
9916 int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
9920 =item * ast_build_atomic_upper_bound
9922 Generate loop upper bounds that consist of the current loop iterator,
9923 an operator and an expression not involving the iterator.
9924 If this option is not set, then the current loop iterator may appear
9925 several times in the upper bound.
9926 For example, when this option is turned off, AST generation
9929 [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
9933 for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
9936 When the option is turned on, the following AST is generated
9938 for (int c0 = 0; c0 <= min(100, n); c0 += 1)
9941 =item * ast_build_prefer_pdiv
9943 If this option is turned off, then the AST generation will
9944 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
9945 operators, but no C<isl_ast_op_pdiv_q> or
9946 C<isl_ast_op_pdiv_r> operators.
9947 If this option is turned on, then C<isl> will try to convert
9948 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
9949 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
9951 =item * ast_build_detect_min_max
9953 If this option is turned on, then C<isl> will try and detect
9954 min or max-expressions when building AST expressions from
9955 piecewise affine expressions.
9957 =item * ast_build_exploit_nested_bounds
9959 Simplify conditions based on bounds of nested for loops.
9960 In particular, remove conditions that are implied by the fact
9961 that one or more nested loops have at least one iteration,
9962 meaning that the upper bound is at least as large as the lower bound.
9963 For example, when this option is turned off, AST generation
9966 [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
9972 for (int c0 = 0; c0 <= N; c0 += 1)
9973 for (int c1 = 0; c1 <= M; c1 += 1)
9976 When the option is turned on, the following AST is generated
9978 for (int c0 = 0; c0 <= N; c0 += 1)
9979 for (int c1 = 0; c1 <= M; c1 += 1)
9982 =item * ast_build_group_coscheduled
9984 If two domain elements are assigned the same schedule point, then
9985 they may be executed in any order and they may even appear in different
9986 loops. If this options is set, then the AST generator will make
9987 sure that coscheduled domain elements do not appear in separate parts
9988 of the AST. This is useful in case of nested AST generation
9989 if the outer AST generation is given only part of a schedule
9990 and the inner AST generation should handle the domains that are
9991 coscheduled by this initial part of the schedule together.
9992 For example if an AST is generated for a schedule
9994 { A[i] -> [0]; B[i] -> [0] }
9996 then the C<isl_ast_build_set_create_leaf> callback described
9997 below may get called twice, once for each domain.
9998 Setting this option ensures that the callback is only called once
9999 on both domains together.
10001 =item * ast_build_separation_bounds
10003 This option specifies which bounds to use during separation.
10004 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
10005 then all (possibly implicit) bounds on the current dimension will
10006 be used during separation.
10007 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
10008 then only those bounds that are explicitly available will
10009 be used during separation.
10011 =item * ast_build_scale_strides
10013 This option specifies whether the AST generator is allowed
10014 to scale down iterators of strided loops.
10016 =item * ast_build_allow_else
10018 This option specifies whether the AST generator is allowed
10019 to construct if statements with else branches.
10021 =item * ast_build_allow_or
10023 This option specifies whether the AST generator is allowed
10024 to construct if conditions with disjunctions.
10028 =head3 AST Generation Options (Schedule Tree)
10030 In case of AST construction from a schedule tree, the options
10031 that control how an AST is created from the individual schedule
10032 dimensions are stored in the band nodes of the tree
10033 (see L</"Schedule Trees">).
10035 In particular, a schedule dimension can be handled in four
10036 different ways, atomic, separate, unroll or the default.
10037 This loop AST generation type can be set using
10038 C<isl_schedule_node_band_member_set_ast_loop_type>.
10040 the first three can be selected by including a one-dimensional
10041 element with as value the position of the schedule dimension
10042 within the band and as name one of C<atomic>, C<separate>
10043 or C<unroll> in the options
10044 set by C<isl_schedule_node_band_set_ast_build_options>.
10045 Only one of these three may be specified for
10046 any given schedule dimension within a band node.
10047 If none of these is specified, then the default
10048 is used. The meaning of the options is as follows.
10054 When this option is specified, the AST generator will make
10055 sure that a given domains space only appears in a single
10056 loop at the specified level.
10058 For example, for the schedule tree
10060 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10062 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10063 options: "{ atomic[x] }"
10065 the following AST will be generated
10067 for (int c0 = 0; c0 <= 10; c0 += 1) {
10074 On the other hand, for the schedule tree
10076 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10078 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10079 options: "{ separate[x] }"
10081 the following AST will be generated
10085 for (int c0 = 1; c0 <= 9; c0 += 1) {
10092 If neither C<atomic> nor C<separate> is specified, then the AST generator
10093 may produce either of these two results or some intermediate form.
10097 When this option is specified, the AST generator will
10098 split the domain of the specified schedule dimension
10099 into pieces with a fixed set of statements for which
10100 instances need to be executed by the iterations in
10101 the schedule domain part. This option tends to avoid
10102 the generation of guards inside the corresponding loops.
10103 See also the C<atomic> option.
10107 When this option is specified, the AST generator will
10108 I<completely> unroll the corresponding schedule dimension.
10109 It is the responsibility of the user to ensure that such
10110 unrolling is possible.
10111 To obtain a partial unrolling, the user should apply an additional
10112 strip-mining to the schedule and fully unroll the inner schedule
10117 The C<isolate> option is a bit more involved. It allows the user
10118 to isolate a range of schedule dimension values from smaller and
10119 greater values. Additionally, the user may specify a different
10120 atomic/separate/unroll choice for the isolated part and the remaining
10121 parts. The typical use case of the C<isolate> option is to isolate
10122 full tiles from partial tiles.
10123 The part that needs to be isolated may depend on outer schedule dimensions.
10124 The option therefore needs to be able to reference those outer schedule
10125 dimensions. In particular, the space of the C<isolate> option is that
10126 of a wrapped map with as domain the flat product of all outer band nodes
10127 and as range the space of the current band node.
10128 The atomic/separate/unroll choice for the isolated part is determined
10129 by an option that lives in an unnamed wrapped space with as domain
10130 a zero-dimensional C<isolate> space and as range the regular
10131 C<atomic>, C<separate> or C<unroll> space.
10132 This option may also be set directly using
10133 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
10134 The atomic/separate/unroll choice for the remaining part is determined
10135 by the regular C<atomic>, C<separate> or C<unroll> option.
10136 Since the C<isolate> option references outer schedule dimensions,
10137 its use in a band node causes any tree containing the node
10138 to be considered anchored.
10140 As an example, consider the isolation of full tiles from partial tiles
10141 in a tiling of a triangular domain. The original schedule is as follows.
10143 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10145 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10146 { A[i,j] -> [floor(j/10)] }, \
10147 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10151 for (int c0 = 0; c0 <= 10; c0 += 1)
10152 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10153 for (int c2 = 10 * c0;
10154 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10155 for (int c3 = 10 * c1;
10156 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10159 Isolating the full tiles, we have the following input
10161 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10163 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10164 { A[i,j] -> [floor(j/10)] }, \
10165 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10166 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10167 10a+9+10b+9 <= 100 }"
10172 for (int c0 = 0; c0 <= 8; c0 += 1) {
10173 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10174 for (int c2 = 10 * c0;
10175 c2 <= 10 * c0 + 9; c2 += 1)
10176 for (int c3 = 10 * c1;
10177 c3 <= 10 * c1 + 9; c3 += 1)
10179 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10180 for (int c2 = 10 * c0;
10181 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10182 for (int c3 = 10 * c1;
10183 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10186 for (int c0 = 9; c0 <= 10; c0 += 1)
10187 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10188 for (int c2 = 10 * c0;
10189 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10190 for (int c3 = 10 * c1;
10191 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10195 We may then additionally unroll the innermost loop of the isolated part
10197 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10199 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10200 { A[i,j] -> [floor(j/10)] }, \
10201 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10202 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10203 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
10208 for (int c0 = 0; c0 <= 8; c0 += 1) {
10209 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10210 for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
10212 A(c2, 10 * c1 + 1);
10213 A(c2, 10 * c1 + 2);
10214 A(c2, 10 * c1 + 3);
10215 A(c2, 10 * c1 + 4);
10216 A(c2, 10 * c1 + 5);
10217 A(c2, 10 * c1 + 6);
10218 A(c2, 10 * c1 + 7);
10219 A(c2, 10 * c1 + 8);
10220 A(c2, 10 * c1 + 9);
10222 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10223 for (int c2 = 10 * c0;
10224 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10225 for (int c3 = 10 * c1;
10226 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10229 for (int c0 = 9; c0 <= 10; c0 += 1)
10230 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10231 for (int c2 = 10 * c0;
10232 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10233 for (int c3 = 10 * c1;
10234 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10239 =head3 AST Generation Options (Schedule Map)
10241 In case of AST construction using
10242 C<isl_ast_build_node_from_schedule_map>, the options
10243 that control how an AST is created from the individual schedule
10244 dimensions are stored in the C<isl_ast_build>.
10245 They can be set using the following function.
10247 #include <isl/ast_build.h>
10248 __isl_give isl_ast_build *
10249 isl_ast_build_set_options(
10250 __isl_take isl_ast_build *control,
10251 __isl_take isl_union_map *options);
10253 The options are encoded in an C<isl_union_map>.
10254 The domain of this union relation refers to the schedule domain,
10255 i.e., the range of the schedule passed
10256 to C<isl_ast_build_node_from_schedule_map>.
10257 In the case of nested AST generation (see L</"Nested AST Generation">),
10258 the domain of C<options> should refer to the extra piece of the schedule.
10259 That is, it should be equal to the range of the wrapped relation in the
10260 range of the schedule.
10261 The range of the options can consist of elements in one or more spaces,
10262 the names of which determine the effect of the option.
10263 The values of the range typically also refer to the schedule dimension
10264 to which the option applies. In case of nested AST generation
10265 (see L</"Nested AST Generation">), these values refer to the position
10266 of the schedule dimension within the innermost AST generation.
10267 The constraints on the domain elements of
10268 the option should only refer to this dimension and earlier dimensions.
10269 We consider the following spaces.
10273 =item C<separation_class>
10275 B<This option has been deprecated. Use the isolate option on
10276 schedule trees instead.>
10278 This space is a wrapped relation between two one dimensional spaces.
10279 The input space represents the schedule dimension to which the option
10280 applies and the output space represents the separation class.
10281 While constructing a loop corresponding to the specified schedule
10282 dimension(s), the AST generator will try to generate separate loops
10283 for domain elements that are assigned different classes.
10284 If only some of the elements are assigned a class, then those elements
10285 that are not assigned any class will be treated as belonging to a class
10286 that is separate from the explicitly assigned classes.
10287 The typical use case for this option is to separate full tiles from
10289 The other options, described below, are applied after the separation
10292 As an example, consider the separation into full and partial tiles
10293 of a tiling of a triangular domain.
10294 Take, for example, the domain
10296 { A[i,j] : 0 <= i,j and i + j <= 100 }
10298 and a tiling into tiles of 10 by 10. The input to the AST generator
10299 is then the schedule
10301 { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
10304 Without any options, the following AST is generated
10306 for (int c0 = 0; c0 <= 10; c0 += 1)
10307 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10308 for (int c2 = 10 * c0;
10309 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10311 for (int c3 = 10 * c1;
10312 c3 <= min(10 * c1 + 9, -c2 + 100);
10316 Separation into full and partial tiles can be obtained by assigning
10317 a class, say C<0>, to the full tiles. The full tiles are represented by those
10318 values of the first and second schedule dimensions for which there are
10319 values of the third and fourth dimensions to cover an entire tile.
10320 That is, we need to specify the following option
10322 { [a,b,c,d] -> separation_class[[0]->[0]] :
10323 exists b': 0 <= 10a,10b' and
10324 10a+9+10b'+9 <= 100;
10325 [a,b,c,d] -> separation_class[[1]->[0]] :
10326 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
10328 which simplifies to
10330 { [a, b, c, d] -> separation_class[[1] -> [0]] :
10331 a >= 0 and b >= 0 and b <= 8 - a;
10332 [a, b, c, d] -> separation_class[[0] -> [0]] :
10333 a >= 0 and a <= 8 }
10335 With this option, the generated AST is as follows
10338 for (int c0 = 0; c0 <= 8; c0 += 1) {
10339 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10340 for (int c2 = 10 * c0;
10341 c2 <= 10 * c0 + 9; c2 += 1)
10342 for (int c3 = 10 * c1;
10343 c3 <= 10 * c1 + 9; c3 += 1)
10345 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10346 for (int c2 = 10 * c0;
10347 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10349 for (int c3 = 10 * c1;
10350 c3 <= min(-c2 + 100, 10 * c1 + 9);
10354 for (int c0 = 9; c0 <= 10; c0 += 1)
10355 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10356 for (int c2 = 10 * c0;
10357 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10359 for (int c3 = 10 * c1;
10360 c3 <= min(10 * c1 + 9, -c2 + 100);
10367 This is a single-dimensional space representing the schedule dimension(s)
10368 to which ``separation'' should be applied. Separation tries to split
10369 a loop into several pieces if this can avoid the generation of guards
10371 See also the C<atomic> option.
10375 This is a single-dimensional space representing the schedule dimension(s)
10376 for which the domains should be considered ``atomic''. That is, the
10377 AST generator will make sure that any given domain space will only appear
10378 in a single loop at the specified level.
10380 Consider the following schedule
10382 { a[i] -> [i] : 0 <= i < 10;
10383 b[i] -> [i+1] : 0 <= i < 10 }
10385 If the following option is specified
10387 { [i] -> separate[x] }
10389 then the following AST will be generated
10393 for (int c0 = 1; c0 <= 9; c0 += 1) {
10400 If, on the other hand, the following option is specified
10402 { [i] -> atomic[x] }
10404 then the following AST will be generated
10406 for (int c0 = 0; c0 <= 10; c0 += 1) {
10413 If neither C<atomic> nor C<separate> is specified, then the AST generator
10414 may produce either of these two results or some intermediate form.
10418 This is a single-dimensional space representing the schedule dimension(s)
10419 that should be I<completely> unrolled.
10420 To obtain a partial unrolling, the user should apply an additional
10421 strip-mining to the schedule and fully unroll the inner loop.
10425 =head3 Fine-grained Control over AST Generation
10427 Besides specifying the constraints on the parameters,
10428 an C<isl_ast_build> object can be used to control
10429 various aspects of the AST generation process.
10430 In case of AST construction using
10431 C<isl_ast_build_node_from_schedule_map>,
10432 the most prominent way of control is through ``options'',
10433 as explained above.
10435 Additional control is available through the following functions.
10437 #include <isl/ast_build.h>
10438 __isl_give isl_ast_build *
10439 isl_ast_build_set_iterators(
10440 __isl_take isl_ast_build *control,
10441 __isl_take isl_id_list *iterators);
10443 The function C<isl_ast_build_set_iterators> allows the user to
10444 specify a list of iterator C<isl_id>s to be used as iterators.
10445 If the input schedule is injective, then
10446 the number of elements in this list should be as large as the dimension
10447 of the schedule space, but no direct correspondence should be assumed
10448 between dimensions and elements.
10449 If the input schedule is not injective, then an additional number
10450 of C<isl_id>s equal to the largest dimension of the input domains
10452 If the number of provided C<isl_id>s is insufficient, then additional
10453 names are automatically generated.
10455 #include <isl/ast_build.h>
10456 __isl_give isl_ast_build *
10457 isl_ast_build_set_create_leaf(
10458 __isl_take isl_ast_build *control,
10459 __isl_give isl_ast_node *(*fn)(
10460 __isl_take isl_ast_build *build,
10461 void *user), void *user);
10464 C<isl_ast_build_set_create_leaf> function allows for the
10465 specification of a callback that should be called whenever the AST
10466 generator arrives at an element of the schedule domain.
10467 The callback should return an AST node that should be inserted
10468 at the corresponding position of the AST. The default action (when
10469 the callback is not set) is to continue generating parts of the AST to scan
10470 all the domain elements associated to the schedule domain element
10471 and to insert user nodes, ``calling'' the domain element, for each of them.
10472 The C<build> argument contains the current state of the C<isl_ast_build>.
10473 To ease nested AST generation (see L</"Nested AST Generation">),
10474 all control information that is
10475 specific to the current AST generation such as the options and
10476 the callbacks has been removed from this C<isl_ast_build>.
10477 The callback would typically return the result of a nested
10478 AST generation or a
10479 user defined node created using the following function.
10481 #include <isl/ast.h>
10482 __isl_give isl_ast_node *isl_ast_node_alloc_user(
10483 __isl_take isl_ast_expr *expr);
10485 #include <isl/ast_build.h>
10486 __isl_give isl_ast_build *
10487 isl_ast_build_set_at_each_domain(
10488 __isl_take isl_ast_build *build,
10489 __isl_give isl_ast_node *(*fn)(
10490 __isl_take isl_ast_node *node,
10491 __isl_keep isl_ast_build *build,
10492 void *user), void *user);
10493 __isl_give isl_ast_build *
10494 isl_ast_build_set_before_each_for(
10495 __isl_take isl_ast_build *build,
10496 __isl_give isl_id *(*fn)(
10497 __isl_keep isl_ast_build *build,
10498 void *user), void *user);
10499 __isl_give isl_ast_build *
10500 isl_ast_build_set_after_each_for(
10501 __isl_take isl_ast_build *build,
10502 __isl_give isl_ast_node *(*fn)(
10503 __isl_take isl_ast_node *node,
10504 __isl_keep isl_ast_build *build,
10505 void *user), void *user);
10506 __isl_give isl_ast_build *
10507 isl_ast_build_set_before_each_mark(
10508 __isl_take isl_ast_build *build,
10509 isl_stat (*fn)(__isl_keep isl_id *mark,
10510 __isl_keep isl_ast_build *build,
10511 void *user), void *user);
10512 __isl_give isl_ast_build *
10513 isl_ast_build_set_after_each_mark(
10514 __isl_take isl_ast_build *build,
10515 __isl_give isl_ast_node *(*fn)(
10516 __isl_take isl_ast_node *node,
10517 __isl_keep isl_ast_build *build,
10518 void *user), void *user);
10520 The callback set by C<isl_ast_build_set_at_each_domain> will
10521 be called for each domain AST node.
10522 The callbacks set by C<isl_ast_build_set_before_each_for>
10523 and C<isl_ast_build_set_after_each_for> will be called
10524 for each for AST node. The first will be called in depth-first
10525 pre-order, while the second will be called in depth-first post-order.
10526 Since C<isl_ast_build_set_before_each_for> is called before the for
10527 node is actually constructed, it is only passed an C<isl_ast_build>.
10528 The returned C<isl_id> will be added as an annotation (using
10529 C<isl_ast_node_set_annotation>) to the constructed for node.
10530 In particular, if the user has also specified an C<after_each_for>
10531 callback, then the annotation can be retrieved from the node passed to
10532 that callback using C<isl_ast_node_get_annotation>.
10533 The callbacks set by C<isl_ast_build_set_before_each_mark>
10534 and C<isl_ast_build_set_after_each_mark> will be called for each
10535 mark AST node that is created, i.e., for each mark schedule node
10536 in the input schedule tree. The first will be called in depth-first
10537 pre-order, while the second will be called in depth-first post-order.
10538 Since the callback set by C<isl_ast_build_set_before_each_mark>
10539 is called before the mark AST node is actually constructed, it is passed
10540 the identifier of the mark node.
10541 All callbacks should C<NULL> (or -1) on failure.
10542 The given C<isl_ast_build> can be used to create new
10543 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
10544 or C<isl_ast_build_call_from_pw_multi_aff>.
10546 =head3 Nested AST Generation
10548 C<isl> allows the user to create an AST within the context
10549 of another AST. These nested ASTs are created using the
10550 same C<isl_ast_build_node_from_schedule_map> function that is used to create
10551 the outer AST. The C<build> argument should be an C<isl_ast_build>
10552 passed to a callback set by
10553 C<isl_ast_build_set_create_leaf>.
10554 The space of the range of the C<schedule> argument should refer
10555 to this build. In particular, the space should be a wrapped
10556 relation and the domain of this wrapped relation should be the
10557 same as that of the range of the schedule returned by
10558 C<isl_ast_build_get_schedule> below.
10559 In practice, the new schedule is typically
10560 created by calling C<isl_union_map_range_product> on the old schedule
10561 and some extra piece of the schedule.
10562 The space of the schedule domain is also available from
10563 the C<isl_ast_build>.
10565 #include <isl/ast_build.h>
10566 __isl_give isl_union_map *isl_ast_build_get_schedule(
10567 __isl_keep isl_ast_build *build);
10568 __isl_give isl_space *isl_ast_build_get_schedule_space(
10569 __isl_keep isl_ast_build *build);
10570 __isl_give isl_ast_build *isl_ast_build_restrict(
10571 __isl_take isl_ast_build *build,
10572 __isl_take isl_set *set);
10574 The C<isl_ast_build_get_schedule> function returns a (partial)
10575 schedule for the domains elements for which part of the AST still needs to
10576 be generated in the current build.
10577 In particular, the domain elements are mapped to those iterations of the loops
10578 enclosing the current point of the AST generation inside which
10579 the domain elements are executed.
10580 No direct correspondence between
10581 the input schedule and this schedule should be assumed.
10582 The space obtained from C<isl_ast_build_get_schedule_space> can be used
10583 to create a set for C<isl_ast_build_restrict> to intersect
10584 with the current build. In particular, the set passed to
10585 C<isl_ast_build_restrict> can have additional parameters.
10586 The ids of the set dimensions in the space returned by
10587 C<isl_ast_build_get_schedule_space> correspond to the
10588 iterators of the already generated loops.
10589 The user should not rely on the ids of the output dimensions
10590 of the relations in the union relation returned by
10591 C<isl_ast_build_get_schedule> having any particular value.
10593 =head1 Applications
10595 Although C<isl> is mainly meant to be used as a library,
10596 it also contains some basic applications that use some
10597 of the functionality of C<isl>.
10598 The input may be specified in either the L<isl format>
10599 or the L<PolyLib format>.
10601 =head2 C<isl_polyhedron_sample>
10603 C<isl_polyhedron_sample> takes a polyhedron as input and prints
10604 an integer element of the polyhedron, if there is any.
10605 The first column in the output is the denominator and is always
10606 equal to 1. If the polyhedron contains no integer points,
10607 then a vector of length zero is printed.
10611 C<isl_pip> takes the same input as the C<example> program
10612 from the C<piplib> distribution, i.e., a set of constraints
10613 on the parameters, a line containing only -1 and finally a set
10614 of constraints on a parametric polyhedron.
10615 The coefficients of the parameters appear in the last columns
10616 (but before the final constant column).
10617 The output is the lexicographic minimum of the parametric polyhedron.
10618 As C<isl> currently does not have its own output format, the output
10619 is just a dump of the internal state.
10621 =head2 C<isl_polyhedron_minimize>
10623 C<isl_polyhedron_minimize> computes the minimum of some linear
10624 or affine objective function over the integer points in a polyhedron.
10625 If an affine objective function
10626 is given, then the constant should appear in the last column.
10628 =head2 C<isl_polytope_scan>
10630 Given a polytope, C<isl_polytope_scan> prints
10631 all integer points in the polytope.
10633 =head2 C<isl_codegen>
10635 Given a schedule, a context set and an options relation,
10636 C<isl_codegen> prints out an AST that scans the domain elements
10637 of the schedule in the order of their image(s) taking into account
10638 the constraints in the context set.