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_is_domain(__isl_keep isl_space *space1,
956 __isl_keep isl_space *space2);
957 isl_bool isl_space_is_range(__isl_keep isl_space *space1,
958 __isl_keep isl_space *space2);
959 isl_bool isl_space_tuple_is_equal(
960 __isl_keep isl_space *space1,
961 enum isl_dim_type type1,
962 __isl_keep isl_space *space2,
963 enum isl_dim_type type2);
965 C<isl_space_is_domain> checks whether the first argument is equal
966 to the domain of the second argument. This requires in particular that
967 the first argument is a set space and that the second argument
968 is a map space. C<isl_space_tuple_is_equal> checks whether the given
969 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
970 spaces are the same. That is, it checks if they have the same
971 identifier (if any), the same dimension and the same internal structure
974 It is often useful to create objects that live in the
975 same space as some other object. This can be accomplished
976 by creating the new objects
977 (see L</"Creating New Sets and Relations"> or
978 L</"Functions">) based on the space
979 of the original object.
982 __isl_give isl_space *isl_basic_set_get_space(
983 __isl_keep isl_basic_set *bset);
984 __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
986 #include <isl/union_set.h>
987 __isl_give isl_space *isl_union_set_get_space(
988 __isl_keep isl_union_set *uset);
991 __isl_give isl_space *isl_basic_map_get_space(
992 __isl_keep isl_basic_map *bmap);
993 __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
995 #include <isl/union_map.h>
996 __isl_give isl_space *isl_union_map_get_space(
997 __isl_keep isl_union_map *umap);
999 #include <isl/constraint.h>
1000 __isl_give isl_space *isl_constraint_get_space(
1001 __isl_keep isl_constraint *constraint);
1003 #include <isl/polynomial.h>
1004 __isl_give isl_space *isl_qpolynomial_get_domain_space(
1005 __isl_keep isl_qpolynomial *qp);
1006 __isl_give isl_space *isl_qpolynomial_get_space(
1007 __isl_keep isl_qpolynomial *qp);
1008 __isl_give isl_space *
1009 isl_qpolynomial_fold_get_domain_space(
1010 __isl_keep isl_qpolynomial_fold *fold);
1011 __isl_give isl_space *isl_qpolynomial_fold_get_space(
1012 __isl_keep isl_qpolynomial_fold *fold);
1013 __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
1014 __isl_keep isl_pw_qpolynomial *pwqp);
1015 __isl_give isl_space *isl_pw_qpolynomial_get_space(
1016 __isl_keep isl_pw_qpolynomial *pwqp);
1017 __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
1018 __isl_keep isl_pw_qpolynomial_fold *pwf);
1019 __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1020 __isl_keep isl_pw_qpolynomial_fold *pwf);
1021 __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1022 __isl_keep isl_union_pw_qpolynomial *upwqp);
1023 __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1024 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1026 #include <isl/val.h>
1027 __isl_give isl_space *isl_multi_val_get_space(
1028 __isl_keep isl_multi_val *mv);
1030 #include <isl/aff.h>
1031 __isl_give isl_space *isl_aff_get_domain_space(
1032 __isl_keep isl_aff *aff);
1033 __isl_give isl_space *isl_aff_get_space(
1034 __isl_keep isl_aff *aff);
1035 __isl_give isl_space *isl_pw_aff_get_domain_space(
1036 __isl_keep isl_pw_aff *pwaff);
1037 __isl_give isl_space *isl_pw_aff_get_space(
1038 __isl_keep isl_pw_aff *pwaff);
1039 __isl_give isl_space *isl_multi_aff_get_domain_space(
1040 __isl_keep isl_multi_aff *maff);
1041 __isl_give isl_space *isl_multi_aff_get_space(
1042 __isl_keep isl_multi_aff *maff);
1043 __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1044 __isl_keep isl_pw_multi_aff *pma);
1045 __isl_give isl_space *isl_pw_multi_aff_get_space(
1046 __isl_keep isl_pw_multi_aff *pma);
1047 __isl_give isl_space *isl_union_pw_aff_get_space(
1048 __isl_keep isl_union_pw_aff *upa);
1049 __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1050 __isl_keep isl_union_pw_multi_aff *upma);
1051 __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1052 __isl_keep isl_multi_pw_aff *mpa);
1053 __isl_give isl_space *isl_multi_pw_aff_get_space(
1054 __isl_keep isl_multi_pw_aff *mpa);
1055 __isl_give isl_space *
1056 isl_multi_union_pw_aff_get_domain_space(
1057 __isl_keep isl_multi_union_pw_aff *mupa);
1058 __isl_give isl_space *
1059 isl_multi_union_pw_aff_get_space(
1060 __isl_keep isl_multi_union_pw_aff *mupa);
1062 #include <isl/point.h>
1063 __isl_give isl_space *isl_point_get_space(
1064 __isl_keep isl_point *pnt);
1066 The number of dimensions of a given type of space
1067 may be read off from a space or an object that lives
1068 in a space using the following functions.
1069 In case of C<isl_space_dim>, type may be
1070 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1071 C<isl_dim_out> (only for relations), C<isl_dim_set>
1072 (only for sets) or C<isl_dim_all>.
1074 #include <isl/space.h>
1075 unsigned isl_space_dim(__isl_keep isl_space *space,
1076 enum isl_dim_type type);
1078 #include <isl/local_space.h>
1079 int isl_local_space_dim(__isl_keep isl_local_space *ls,
1080 enum isl_dim_type type);
1082 #include <isl/set.h>
1083 unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1084 enum isl_dim_type type);
1085 unsigned isl_set_dim(__isl_keep isl_set *set,
1086 enum isl_dim_type type);
1088 #include <isl/union_set.h>
1089 unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1090 enum isl_dim_type type);
1092 #include <isl/map.h>
1093 unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1094 enum isl_dim_type type);
1095 unsigned isl_map_dim(__isl_keep isl_map *map,
1096 enum isl_dim_type type);
1098 #include <isl/union_map.h>
1099 unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1100 enum isl_dim_type type);
1102 #include <isl/val.h>
1103 unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1104 enum isl_dim_type type);
1106 #include <isl/aff.h>
1107 int isl_aff_dim(__isl_keep isl_aff *aff,
1108 enum isl_dim_type type);
1109 unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1110 enum isl_dim_type type);
1111 unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1112 enum isl_dim_type type);
1113 unsigned isl_pw_multi_aff_dim(
1114 __isl_keep isl_pw_multi_aff *pma,
1115 enum isl_dim_type type);
1116 unsigned isl_multi_pw_aff_dim(
1117 __isl_keep isl_multi_pw_aff *mpa,
1118 enum isl_dim_type type);
1119 unsigned isl_union_pw_aff_dim(
1120 __isl_keep isl_union_pw_aff *upa,
1121 enum isl_dim_type type);
1122 unsigned isl_union_pw_multi_aff_dim(
1123 __isl_keep isl_union_pw_multi_aff *upma,
1124 enum isl_dim_type type);
1125 unsigned isl_multi_union_pw_aff_dim(
1126 __isl_keep isl_multi_union_pw_aff *mupa,
1127 enum isl_dim_type type);
1129 #include <isl/polynomial.h>
1130 unsigned isl_union_pw_qpolynomial_dim(
1131 __isl_keep isl_union_pw_qpolynomial *upwqp,
1132 enum isl_dim_type type);
1133 unsigned isl_union_pw_qpolynomial_fold_dim(
1134 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1135 enum isl_dim_type type);
1137 Note that an C<isl_union_set>, an C<isl_union_map>,
1138 an C<isl_union_pw_multi_aff>,
1139 an C<isl_union_pw_qpolynomial> and
1140 an C<isl_union_pw_qpolynomial_fold>
1141 only have parameters.
1143 The identifiers or names of the individual dimensions of spaces
1144 may be set or read off using the following functions on spaces
1145 or objects that live in spaces.
1146 These functions are mostly useful to obtain the identifiers, positions
1147 or names of the parameters. Identifiers of individual dimensions are
1148 essentially only useful for printing. They are ignored by all other
1149 operations and may not be preserved across those operations.
1151 #include <isl/space.h>
1152 __isl_give isl_space *isl_space_set_dim_id(
1153 __isl_take isl_space *space,
1154 enum isl_dim_type type, unsigned pos,
1155 __isl_take isl_id *id);
1156 isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1157 enum isl_dim_type type, unsigned pos);
1158 __isl_give isl_id *isl_space_get_dim_id(
1159 __isl_keep isl_space *space,
1160 enum isl_dim_type type, unsigned pos);
1161 __isl_give isl_space *isl_space_set_dim_name(
1162 __isl_take isl_space *space,
1163 enum isl_dim_type type, unsigned pos,
1164 __isl_keep const char *name);
1165 isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1166 enum isl_dim_type type, unsigned pos);
1167 __isl_keep const char *isl_space_get_dim_name(
1168 __isl_keep isl_space *space,
1169 enum isl_dim_type type, unsigned pos);
1171 #include <isl/local_space.h>
1172 __isl_give isl_local_space *isl_local_space_set_dim_id(
1173 __isl_take isl_local_space *ls,
1174 enum isl_dim_type type, unsigned pos,
1175 __isl_take isl_id *id);
1176 isl_bool isl_local_space_has_dim_id(
1177 __isl_keep isl_local_space *ls,
1178 enum isl_dim_type type, unsigned pos);
1179 __isl_give isl_id *isl_local_space_get_dim_id(
1180 __isl_keep isl_local_space *ls,
1181 enum isl_dim_type type, unsigned pos);
1182 __isl_give isl_local_space *isl_local_space_set_dim_name(
1183 __isl_take isl_local_space *ls,
1184 enum isl_dim_type type, unsigned pos, const char *s);
1185 isl_bool isl_local_space_has_dim_name(
1186 __isl_keep isl_local_space *ls,
1187 enum isl_dim_type type, unsigned pos)
1188 const char *isl_local_space_get_dim_name(
1189 __isl_keep isl_local_space *ls,
1190 enum isl_dim_type type, unsigned pos);
1192 #include <isl/constraint.h>
1193 const char *isl_constraint_get_dim_name(
1194 __isl_keep isl_constraint *constraint,
1195 enum isl_dim_type type, unsigned pos);
1197 #include <isl/set.h>
1198 __isl_give isl_id *isl_basic_set_get_dim_id(
1199 __isl_keep isl_basic_set *bset,
1200 enum isl_dim_type type, unsigned pos);
1201 __isl_give isl_set *isl_set_set_dim_id(
1202 __isl_take isl_set *set, enum isl_dim_type type,
1203 unsigned pos, __isl_take isl_id *id);
1204 isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1205 enum isl_dim_type type, unsigned pos);
1206 __isl_give isl_id *isl_set_get_dim_id(
1207 __isl_keep isl_set *set, enum isl_dim_type type,
1209 const char *isl_basic_set_get_dim_name(
1210 __isl_keep isl_basic_set *bset,
1211 enum isl_dim_type type, unsigned pos);
1212 isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1213 enum isl_dim_type type, unsigned pos);
1214 const char *isl_set_get_dim_name(
1215 __isl_keep isl_set *set,
1216 enum isl_dim_type type, unsigned pos);
1218 #include <isl/map.h>
1219 __isl_give isl_map *isl_map_set_dim_id(
1220 __isl_take isl_map *map, enum isl_dim_type type,
1221 unsigned pos, __isl_take isl_id *id);
1222 isl_bool isl_basic_map_has_dim_id(
1223 __isl_keep isl_basic_map *bmap,
1224 enum isl_dim_type type, unsigned pos);
1225 isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1226 enum isl_dim_type type, unsigned pos);
1227 __isl_give isl_id *isl_map_get_dim_id(
1228 __isl_keep isl_map *map, enum isl_dim_type type,
1230 __isl_give isl_id *isl_union_map_get_dim_id(
1231 __isl_keep isl_union_map *umap,
1232 enum isl_dim_type type, unsigned pos);
1233 const char *isl_basic_map_get_dim_name(
1234 __isl_keep isl_basic_map *bmap,
1235 enum isl_dim_type type, unsigned pos);
1236 isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1237 enum isl_dim_type type, unsigned pos);
1238 const char *isl_map_get_dim_name(
1239 __isl_keep isl_map *map,
1240 enum isl_dim_type type, unsigned pos);
1242 #include <isl/val.h>
1243 __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1244 __isl_take isl_multi_val *mv,
1245 enum isl_dim_type type, unsigned pos,
1246 __isl_take isl_id *id);
1247 __isl_give isl_id *isl_multi_val_get_dim_id(
1248 __isl_keep isl_multi_val *mv,
1249 enum isl_dim_type type, unsigned pos);
1250 __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1251 __isl_take isl_multi_val *mv,
1252 enum isl_dim_type type, unsigned pos, const char *s);
1254 #include <isl/aff.h>
1255 __isl_give isl_aff *isl_aff_set_dim_id(
1256 __isl_take isl_aff *aff, enum isl_dim_type type,
1257 unsigned pos, __isl_take isl_id *id);
1258 __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1259 __isl_take isl_multi_aff *maff,
1260 enum isl_dim_type type, unsigned pos,
1261 __isl_take isl_id *id);
1262 __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1263 __isl_take isl_pw_aff *pma,
1264 enum isl_dim_type type, unsigned pos,
1265 __isl_take isl_id *id);
1266 __isl_give isl_multi_pw_aff *
1267 isl_multi_pw_aff_set_dim_id(
1268 __isl_take isl_multi_pw_aff *mpa,
1269 enum isl_dim_type type, unsigned pos,
1270 __isl_take isl_id *id);
1271 __isl_give isl_multi_union_pw_aff *
1272 isl_multi_union_pw_aff_set_dim_id(
1273 __isl_take isl_multi_union_pw_aff *mupa,
1274 enum isl_dim_type type, unsigned pos,
1275 __isl_take isl_id *id);
1276 __isl_give isl_id *isl_multi_aff_get_dim_id(
1277 __isl_keep isl_multi_aff *ma,
1278 enum isl_dim_type type, unsigned pos);
1279 isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1280 enum isl_dim_type type, unsigned pos);
1281 __isl_give isl_id *isl_pw_aff_get_dim_id(
1282 __isl_keep isl_pw_aff *pa,
1283 enum isl_dim_type type, unsigned pos);
1284 __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1285 __isl_keep isl_pw_multi_aff *pma,
1286 enum isl_dim_type type, unsigned pos);
1287 __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1288 __isl_keep isl_multi_pw_aff *mpa,
1289 enum isl_dim_type type, unsigned pos);
1290 __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1291 __isl_keep isl_multi_union_pw_aff *mupa,
1292 enum isl_dim_type type, unsigned pos);
1293 __isl_give isl_aff *isl_aff_set_dim_name(
1294 __isl_take isl_aff *aff, enum isl_dim_type type,
1295 unsigned pos, const char *s);
1296 __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1297 __isl_take isl_multi_aff *maff,
1298 enum isl_dim_type type, unsigned pos, const char *s);
1299 __isl_give isl_multi_pw_aff *
1300 isl_multi_pw_aff_set_dim_name(
1301 __isl_take isl_multi_pw_aff *mpa,
1302 enum isl_dim_type type, unsigned pos, const char *s);
1303 __isl_give isl_union_pw_aff *
1304 isl_union_pw_aff_set_dim_name(
1305 __isl_take isl_union_pw_aff *upa,
1306 enum isl_dim_type type, unsigned pos,
1308 __isl_give isl_union_pw_multi_aff *
1309 isl_union_pw_multi_aff_set_dim_name(
1310 __isl_take isl_union_pw_multi_aff *upma,
1311 enum isl_dim_type type, unsigned pos,
1313 __isl_give isl_multi_union_pw_aff *
1314 isl_multi_union_pw_aff_set_dim_name(
1315 __isl_take isl_multi_union_pw_aff *mupa,
1316 enum isl_dim_type type, unsigned pos,
1317 const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1318 enum isl_dim_type type, unsigned pos);
1319 const char *isl_pw_aff_get_dim_name(
1320 __isl_keep isl_pw_aff *pa,
1321 enum isl_dim_type type, unsigned pos);
1322 const char *isl_pw_multi_aff_get_dim_name(
1323 __isl_keep isl_pw_multi_aff *pma,
1324 enum isl_dim_type type, unsigned pos);
1326 #include <isl/polynomial.h>
1327 __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1328 __isl_take isl_qpolynomial *qp,
1329 enum isl_dim_type type, unsigned pos,
1331 __isl_give isl_pw_qpolynomial *
1332 isl_pw_qpolynomial_set_dim_name(
1333 __isl_take isl_pw_qpolynomial *pwqp,
1334 enum isl_dim_type type, unsigned pos,
1336 __isl_give isl_pw_qpolynomial_fold *
1337 isl_pw_qpolynomial_fold_set_dim_name(
1338 __isl_take isl_pw_qpolynomial_fold *pwf,
1339 enum isl_dim_type type, unsigned pos,
1341 __isl_give isl_union_pw_qpolynomial *
1342 isl_union_pw_qpolynomial_set_dim_name(
1343 __isl_take isl_union_pw_qpolynomial *upwqp,
1344 enum isl_dim_type type, unsigned pos,
1346 __isl_give isl_union_pw_qpolynomial_fold *
1347 isl_union_pw_qpolynomial_fold_set_dim_name(
1348 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1349 enum isl_dim_type type, unsigned pos,
1352 Note that C<isl_space_get_name> returns a pointer to some internal
1353 data structure, so the result can only be used while the
1354 corresponding C<isl_space> is alive.
1355 Also note that every function that operates on two sets or relations
1356 requires that both arguments have the same parameters. This also
1357 means that if one of the arguments has named parameters, then the
1358 other needs to have named parameters too and the names need to match.
1359 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1360 arguments may have different parameters (as long as they are named),
1361 in which case the result will have as parameters the union of the parameters of
1364 Given the identifier or name of a dimension (typically a parameter),
1365 its position can be obtained from the following functions.
1367 #include <isl/space.h>
1368 int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1369 enum isl_dim_type type, __isl_keep isl_id *id);
1370 int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1371 enum isl_dim_type type, const char *name);
1373 #include <isl/local_space.h>
1374 int isl_local_space_find_dim_by_name(
1375 __isl_keep isl_local_space *ls,
1376 enum isl_dim_type type, const char *name);
1378 #include <isl/val.h>
1379 int isl_multi_val_find_dim_by_id(
1380 __isl_keep isl_multi_val *mv,
1381 enum isl_dim_type type, __isl_keep isl_id *id);
1382 int isl_multi_val_find_dim_by_name(
1383 __isl_keep isl_multi_val *mv,
1384 enum isl_dim_type type, const char *name);
1386 #include <isl/set.h>
1387 int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1388 enum isl_dim_type type, __isl_keep isl_id *id);
1389 int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1390 enum isl_dim_type type, const char *name);
1392 #include <isl/map.h>
1393 int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1394 enum isl_dim_type type, __isl_keep isl_id *id);
1395 int isl_basic_map_find_dim_by_name(
1396 __isl_keep isl_basic_map *bmap,
1397 enum isl_dim_type type, const char *name);
1398 int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1399 enum isl_dim_type type, const char *name);
1400 int isl_union_map_find_dim_by_name(
1401 __isl_keep isl_union_map *umap,
1402 enum isl_dim_type type, const char *name);
1404 #include <isl/aff.h>
1405 int isl_multi_aff_find_dim_by_id(
1406 __isl_keep isl_multi_aff *ma,
1407 enum isl_dim_type type, __isl_keep isl_id *id);
1408 int isl_multi_pw_aff_find_dim_by_id(
1409 __isl_keep isl_multi_pw_aff *mpa,
1410 enum isl_dim_type type, __isl_keep isl_id *id);
1411 int isl_multi_union_pw_aff_find_dim_by_id(
1412 __isl_keep isl_union_multi_pw_aff *mupa,
1413 enum isl_dim_type type, __isl_keep isl_id *id);
1414 int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1415 enum isl_dim_type type, const char *name);
1416 int isl_multi_aff_find_dim_by_name(
1417 __isl_keep isl_multi_aff *ma,
1418 enum isl_dim_type type, const char *name);
1419 int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1420 enum isl_dim_type type, const char *name);
1421 int isl_multi_pw_aff_find_dim_by_name(
1422 __isl_keep isl_multi_pw_aff *mpa,
1423 enum isl_dim_type type, const char *name);
1424 int isl_pw_multi_aff_find_dim_by_name(
1425 __isl_keep isl_pw_multi_aff *pma,
1426 enum isl_dim_type type, const char *name);
1427 int isl_union_pw_aff_find_dim_by_name(
1428 __isl_keep isl_union_pw_aff *upa,
1429 enum isl_dim_type type, const char *name);
1430 int isl_union_pw_multi_aff_find_dim_by_name(
1431 __isl_keep isl_union_pw_multi_aff *upma,
1432 enum isl_dim_type type, const char *name);
1433 int isl_multi_union_pw_aff_find_dim_by_name(
1434 __isl_keep isl_multi_union_pw_aff *mupa,
1435 enum isl_dim_type type, const char *name);
1437 #include <isl/polynomial.h>
1438 int isl_pw_qpolynomial_find_dim_by_name(
1439 __isl_keep isl_pw_qpolynomial *pwqp,
1440 enum isl_dim_type type, const char *name);
1441 int isl_pw_qpolynomial_fold_find_dim_by_name(
1442 __isl_keep isl_pw_qpolynomial_fold *pwf,
1443 enum isl_dim_type type, const char *name);
1444 int isl_union_pw_qpolynomial_find_dim_by_name(
1445 __isl_keep isl_union_pw_qpolynomial *upwqp,
1446 enum isl_dim_type type, const char *name);
1447 int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1448 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1449 enum isl_dim_type type, const char *name);
1451 The identifiers or names of entire spaces may be set or read off
1452 using the following functions.
1454 #include <isl/space.h>
1455 __isl_give isl_space *isl_space_set_tuple_id(
1456 __isl_take isl_space *space,
1457 enum isl_dim_type type, __isl_take isl_id *id);
1458 __isl_give isl_space *isl_space_reset_tuple_id(
1459 __isl_take isl_space *space, enum isl_dim_type type);
1460 isl_bool isl_space_has_tuple_id(
1461 __isl_keep isl_space *space,
1462 enum isl_dim_type type);
1463 __isl_give isl_id *isl_space_get_tuple_id(
1464 __isl_keep isl_space *space, enum isl_dim_type type);
1465 __isl_give isl_space *isl_space_set_tuple_name(
1466 __isl_take isl_space *space,
1467 enum isl_dim_type type, const char *s);
1468 isl_bool isl_space_has_tuple_name(
1469 __isl_keep isl_space *space,
1470 enum isl_dim_type type);
1471 const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1472 enum isl_dim_type type);
1474 #include <isl/local_space.h>
1475 __isl_give isl_local_space *isl_local_space_set_tuple_id(
1476 __isl_take isl_local_space *ls,
1477 enum isl_dim_type type, __isl_take isl_id *id);
1479 #include <isl/set.h>
1480 __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1481 __isl_take isl_basic_set *bset,
1482 __isl_take isl_id *id);
1483 __isl_give isl_set *isl_set_set_tuple_id(
1484 __isl_take isl_set *set, __isl_take isl_id *id);
1485 __isl_give isl_set *isl_set_reset_tuple_id(
1486 __isl_take isl_set *set);
1487 isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1488 __isl_give isl_id *isl_set_get_tuple_id(
1489 __isl_keep isl_set *set);
1490 __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1491 __isl_take isl_basic_set *set, const char *s);
1492 __isl_give isl_set *isl_set_set_tuple_name(
1493 __isl_take isl_set *set, const char *s);
1494 const char *isl_basic_set_get_tuple_name(
1495 __isl_keep isl_basic_set *bset);
1496 isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1497 const char *isl_set_get_tuple_name(
1498 __isl_keep isl_set *set);
1500 #include <isl/map.h>
1501 __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1502 __isl_take isl_basic_map *bmap,
1503 enum isl_dim_type type, __isl_take isl_id *id);
1504 __isl_give isl_map *isl_map_set_tuple_id(
1505 __isl_take isl_map *map, enum isl_dim_type type,
1506 __isl_take isl_id *id);
1507 __isl_give isl_map *isl_map_reset_tuple_id(
1508 __isl_take isl_map *map, enum isl_dim_type type);
1509 isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1510 enum isl_dim_type type);
1511 __isl_give isl_id *isl_map_get_tuple_id(
1512 __isl_keep isl_map *map, enum isl_dim_type type);
1513 __isl_give isl_map *isl_map_set_tuple_name(
1514 __isl_take isl_map *map,
1515 enum isl_dim_type type, const char *s);
1516 const char *isl_basic_map_get_tuple_name(
1517 __isl_keep isl_basic_map *bmap,
1518 enum isl_dim_type type);
1519 __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1520 __isl_take isl_basic_map *bmap,
1521 enum isl_dim_type type, const char *s);
1522 isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1523 enum isl_dim_type type);
1524 const char *isl_map_get_tuple_name(
1525 __isl_keep isl_map *map,
1526 enum isl_dim_type type);
1528 #include <isl/val.h>
1529 __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1530 __isl_take isl_multi_val *mv,
1531 enum isl_dim_type type, __isl_take isl_id *id);
1532 __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1533 __isl_take isl_multi_val *mv,
1534 enum isl_dim_type type);
1535 isl_bool isl_multi_val_has_tuple_id(
1536 __isl_keep isl_multi_val *mv,
1537 enum isl_dim_type type);
1538 __isl_give isl_id *isl_multi_val_get_tuple_id(
1539 __isl_keep isl_multi_val *mv,
1540 enum isl_dim_type type);
1541 __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1542 __isl_take isl_multi_val *mv,
1543 enum isl_dim_type type, const char *s);
1544 const char *isl_multi_val_get_tuple_name(
1545 __isl_keep isl_multi_val *mv,
1546 enum isl_dim_type type);
1548 #include <isl/aff.h>
1549 __isl_give isl_aff *isl_aff_set_tuple_id(
1550 __isl_take isl_aff *aff,
1551 enum isl_dim_type type, __isl_take isl_id *id);
1552 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1553 __isl_take isl_multi_aff *maff,
1554 enum isl_dim_type type, __isl_take isl_id *id);
1555 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1556 __isl_take isl_pw_aff *pwaff,
1557 enum isl_dim_type type, __isl_take isl_id *id);
1558 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1559 __isl_take isl_pw_multi_aff *pma,
1560 enum isl_dim_type type, __isl_take isl_id *id);
1561 __isl_give isl_multi_union_pw_aff *
1562 isl_multi_union_pw_aff_set_tuple_id(
1563 __isl_take isl_multi_union_pw_aff *mupa,
1564 enum isl_dim_type type, __isl_take isl_id *id);
1565 __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1566 __isl_take isl_multi_aff *ma,
1567 enum isl_dim_type type);
1568 __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1569 __isl_take isl_pw_aff *pa,
1570 enum isl_dim_type type);
1571 __isl_give isl_multi_pw_aff *
1572 isl_multi_pw_aff_reset_tuple_id(
1573 __isl_take isl_multi_pw_aff *mpa,
1574 enum isl_dim_type type);
1575 __isl_give isl_pw_multi_aff *
1576 isl_pw_multi_aff_reset_tuple_id(
1577 __isl_take isl_pw_multi_aff *pma,
1578 enum isl_dim_type type);
1579 __isl_give isl_multi_union_pw_aff *
1580 isl_multi_union_pw_aff_reset_tuple_id(
1581 __isl_take isl_multi_union_pw_aff *mupa,
1582 enum isl_dim_type type);
1583 isl_bool isl_multi_aff_has_tuple_id(
1584 __isl_keep isl_multi_aff *ma,
1585 enum isl_dim_type type);
1586 __isl_give isl_id *isl_multi_aff_get_tuple_id(
1587 __isl_keep isl_multi_aff *ma,
1588 enum isl_dim_type type);
1589 isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1590 enum isl_dim_type type);
1591 __isl_give isl_id *isl_pw_aff_get_tuple_id(
1592 __isl_keep isl_pw_aff *pa,
1593 enum isl_dim_type type);
1594 isl_bool isl_pw_multi_aff_has_tuple_id(
1595 __isl_keep isl_pw_multi_aff *pma,
1596 enum isl_dim_type type);
1597 __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1598 __isl_keep isl_pw_multi_aff *pma,
1599 enum isl_dim_type type);
1600 isl_bool isl_multi_pw_aff_has_tuple_id(
1601 __isl_keep isl_multi_pw_aff *mpa,
1602 enum isl_dim_type type);
1603 __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1604 __isl_keep isl_multi_pw_aff *mpa,
1605 enum isl_dim_type type);
1606 isl_bool isl_multi_union_pw_aff_has_tuple_id(
1607 __isl_keep isl_multi_union_pw_aff *mupa,
1608 enum isl_dim_type type);
1609 __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1610 __isl_keep isl_multi_union_pw_aff *mupa,
1611 enum isl_dim_type type);
1612 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1613 __isl_take isl_multi_aff *maff,
1614 enum isl_dim_type type, const char *s);
1615 __isl_give isl_multi_pw_aff *
1616 isl_multi_pw_aff_set_tuple_name(
1617 __isl_take isl_multi_pw_aff *mpa,
1618 enum isl_dim_type type, const char *s);
1619 __isl_give isl_multi_union_pw_aff *
1620 isl_multi_union_pw_aff_set_tuple_name(
1621 __isl_take isl_multi_union_pw_aff *mupa,
1622 enum isl_dim_type type, const char *s);
1623 const char *isl_multi_aff_get_tuple_name(
1624 __isl_keep isl_multi_aff *multi,
1625 enum isl_dim_type type);
1626 isl_bool isl_pw_multi_aff_has_tuple_name(
1627 __isl_keep isl_pw_multi_aff *pma,
1628 enum isl_dim_type type);
1629 const char *isl_pw_multi_aff_get_tuple_name(
1630 __isl_keep isl_pw_multi_aff *pma,
1631 enum isl_dim_type type);
1632 const char *isl_multi_union_pw_aff_get_tuple_name(
1633 __isl_keep isl_multi_union_pw_aff *mupa,
1634 enum isl_dim_type type);
1636 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1637 or C<isl_dim_set>. As with C<isl_space_get_name>,
1638 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1640 Binary operations require the corresponding spaces of their arguments
1641 to have the same name.
1643 To keep the names of all parameters and tuples, but reset the user pointers
1644 of all the corresponding identifiers, use the following function.
1646 #include <isl/space.h>
1647 __isl_give isl_space *isl_space_reset_user(
1648 __isl_take isl_space *space);
1650 #include <isl/set.h>
1651 __isl_give isl_set *isl_set_reset_user(
1652 __isl_take isl_set *set);
1654 #include <isl/map.h>
1655 __isl_give isl_map *isl_map_reset_user(
1656 __isl_take isl_map *map);
1658 #include <isl/union_set.h>
1659 __isl_give isl_union_set *isl_union_set_reset_user(
1660 __isl_take isl_union_set *uset);
1662 #include <isl/union_map.h>
1663 __isl_give isl_union_map *isl_union_map_reset_user(
1664 __isl_take isl_union_map *umap);
1666 #include <isl/val.h>
1667 __isl_give isl_multi_val *isl_multi_val_reset_user(
1668 __isl_take isl_multi_val *mv);
1670 #include <isl/aff.h>
1671 __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1672 __isl_take isl_multi_aff *ma);
1673 __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1674 __isl_take isl_pw_aff *pa);
1675 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1676 __isl_take isl_multi_pw_aff *mpa);
1677 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1678 __isl_take isl_pw_multi_aff *pma);
1679 __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1680 __isl_take isl_union_pw_aff *upa);
1681 __isl_give isl_multi_union_pw_aff *
1682 isl_multi_union_pw_aff_reset_user(
1683 __isl_take isl_multi_union_pw_aff *mupa);
1684 __isl_give isl_union_pw_multi_aff *
1685 isl_union_pw_multi_aff_reset_user(
1686 __isl_take isl_union_pw_multi_aff *upma);
1688 #include <isl/polynomial.h>
1689 __isl_give isl_pw_qpolynomial *
1690 isl_pw_qpolynomial_reset_user(
1691 __isl_take isl_pw_qpolynomial *pwqp);
1692 __isl_give isl_union_pw_qpolynomial *
1693 isl_union_pw_qpolynomial_reset_user(
1694 __isl_take isl_union_pw_qpolynomial *upwqp);
1695 __isl_give isl_pw_qpolynomial_fold *
1696 isl_pw_qpolynomial_fold_reset_user(
1697 __isl_take isl_pw_qpolynomial_fold *pwf);
1698 __isl_give isl_union_pw_qpolynomial_fold *
1699 isl_union_pw_qpolynomial_fold_reset_user(
1700 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1702 Spaces can be nested. In particular, the domain of a set or
1703 the domain or range of a relation can be a nested relation.
1704 This process is also called I<wrapping>.
1705 The functions for detecting, constructing and deconstructing
1706 such nested spaces can be found in the wrapping properties
1707 of L</"Unary Properties">, the wrapping operations
1708 of L</"Unary Operations"> and the Cartesian product operations
1709 of L</"Basic Operations">.
1711 Spaces can be created from other spaces
1712 using the functions described in L</"Unary Operations">
1713 and L</"Binary Operations">.
1717 A local space is essentially a space with
1718 zero or more existentially quantified variables.
1719 The local space of various objects can be obtained
1720 using the following functions.
1722 #include <isl/constraint.h>
1723 __isl_give isl_local_space *isl_constraint_get_local_space(
1724 __isl_keep isl_constraint *constraint);
1726 #include <isl/set.h>
1727 __isl_give isl_local_space *isl_basic_set_get_local_space(
1728 __isl_keep isl_basic_set *bset);
1730 #include <isl/map.h>
1731 __isl_give isl_local_space *isl_basic_map_get_local_space(
1732 __isl_keep isl_basic_map *bmap);
1734 #include <isl/aff.h>
1735 __isl_give isl_local_space *isl_aff_get_domain_local_space(
1736 __isl_keep isl_aff *aff);
1737 __isl_give isl_local_space *isl_aff_get_local_space(
1738 __isl_keep isl_aff *aff);
1740 A new local space can be created from a space using
1742 #include <isl/local_space.h>
1743 __isl_give isl_local_space *isl_local_space_from_space(
1744 __isl_take isl_space *space);
1746 They can be inspected, modified, copied and freed using the following functions.
1748 #include <isl/local_space.h>
1749 isl_bool isl_local_space_is_params(
1750 __isl_keep isl_local_space *ls);
1751 isl_bool isl_local_space_is_set(
1752 __isl_keep isl_local_space *ls);
1753 __isl_give isl_space *isl_local_space_get_space(
1754 __isl_keep isl_local_space *ls);
1755 __isl_give isl_aff *isl_local_space_get_div(
1756 __isl_keep isl_local_space *ls, int pos);
1757 __isl_give isl_local_space *isl_local_space_copy(
1758 __isl_keep isl_local_space *ls);
1759 __isl_null isl_local_space *isl_local_space_free(
1760 __isl_take isl_local_space *ls);
1762 Note that C<isl_local_space_get_div> can only be used on local spaces
1765 Two local spaces can be compared using
1767 isl_bool isl_local_space_is_equal(
1768 __isl_keep isl_local_space *ls1,
1769 __isl_keep isl_local_space *ls2);
1771 Local spaces can be created from other local spaces
1772 using the functions described in L</"Unary Operations">
1773 and L</"Binary Operations">.
1775 =head2 Creating New Sets and Relations
1777 C<isl> has functions for creating some standard sets and relations.
1781 =item * Empty sets and relations
1783 __isl_give isl_basic_set *isl_basic_set_empty(
1784 __isl_take isl_space *space);
1785 __isl_give isl_basic_map *isl_basic_map_empty(
1786 __isl_take isl_space *space);
1787 __isl_give isl_set *isl_set_empty(
1788 __isl_take isl_space *space);
1789 __isl_give isl_map *isl_map_empty(
1790 __isl_take isl_space *space);
1791 __isl_give isl_union_set *isl_union_set_empty(
1792 __isl_take isl_space *space);
1793 __isl_give isl_union_map *isl_union_map_empty(
1794 __isl_take isl_space *space);
1796 For C<isl_union_set>s and C<isl_union_map>s, the space
1797 is only used to specify the parameters.
1799 =item * Universe sets and relations
1801 __isl_give isl_basic_set *isl_basic_set_universe(
1802 __isl_take isl_space *space);
1803 __isl_give isl_basic_map *isl_basic_map_universe(
1804 __isl_take isl_space *space);
1805 __isl_give isl_set *isl_set_universe(
1806 __isl_take isl_space *space);
1807 __isl_give isl_map *isl_map_universe(
1808 __isl_take isl_space *space);
1809 __isl_give isl_union_set *isl_union_set_universe(
1810 __isl_take isl_union_set *uset);
1811 __isl_give isl_union_map *isl_union_map_universe(
1812 __isl_take isl_union_map *umap);
1814 The sets and relations constructed by the functions above
1815 contain all integer values, while those constructed by the
1816 functions below only contain non-negative values.
1818 __isl_give isl_basic_set *isl_basic_set_nat_universe(
1819 __isl_take isl_space *space);
1820 __isl_give isl_basic_map *isl_basic_map_nat_universe(
1821 __isl_take isl_space *space);
1822 __isl_give isl_set *isl_set_nat_universe(
1823 __isl_take isl_space *space);
1824 __isl_give isl_map *isl_map_nat_universe(
1825 __isl_take isl_space *space);
1827 =item * Identity relations
1829 __isl_give isl_basic_map *isl_basic_map_identity(
1830 __isl_take isl_space *space);
1831 __isl_give isl_map *isl_map_identity(
1832 __isl_take isl_space *space);
1834 The number of input and output dimensions in C<space> needs
1837 =item * Lexicographic order
1839 __isl_give isl_map *isl_map_lex_lt(
1840 __isl_take isl_space *set_space);
1841 __isl_give isl_map *isl_map_lex_le(
1842 __isl_take isl_space *set_space);
1843 __isl_give isl_map *isl_map_lex_gt(
1844 __isl_take isl_space *set_space);
1845 __isl_give isl_map *isl_map_lex_ge(
1846 __isl_take isl_space *set_space);
1847 __isl_give isl_map *isl_map_lex_lt_first(
1848 __isl_take isl_space *space, unsigned n);
1849 __isl_give isl_map *isl_map_lex_le_first(
1850 __isl_take isl_space *space, unsigned n);
1851 __isl_give isl_map *isl_map_lex_gt_first(
1852 __isl_take isl_space *space, unsigned n);
1853 __isl_give isl_map *isl_map_lex_ge_first(
1854 __isl_take isl_space *space, unsigned n);
1856 The first four functions take a space for a B<set>
1857 and return relations that express that the elements in the domain
1858 are lexicographically less
1859 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1860 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1861 than the elements in the range.
1862 The last four functions take a space for a map
1863 and return relations that express that the first C<n> dimensions
1864 in the domain are lexicographically less
1865 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1866 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1867 than the first C<n> dimensions in the range.
1871 A basic set or relation can be converted to a set or relation
1872 using the following functions.
1874 __isl_give isl_set *isl_set_from_basic_set(
1875 __isl_take isl_basic_set *bset);
1876 __isl_give isl_map *isl_map_from_basic_map(
1877 __isl_take isl_basic_map *bmap);
1879 Sets and relations can be converted to union sets and relations
1880 using the following functions.
1882 __isl_give isl_union_set *isl_union_set_from_basic_set(
1883 __isl_take isl_basic_set *bset);
1884 __isl_give isl_union_map *isl_union_map_from_basic_map(
1885 __isl_take isl_basic_map *bmap);
1886 __isl_give isl_union_set *isl_union_set_from_set(
1887 __isl_take isl_set *set);
1888 __isl_give isl_union_map *isl_union_map_from_map(
1889 __isl_take isl_map *map);
1891 The inverse conversions below can only be used if the input
1892 union set or relation is known to contain elements in exactly one
1895 __isl_give isl_set *isl_set_from_union_set(
1896 __isl_take isl_union_set *uset);
1897 __isl_give isl_map *isl_map_from_union_map(
1898 __isl_take isl_union_map *umap);
1900 Sets and relations can be copied and freed again using the following
1903 __isl_give isl_basic_set *isl_basic_set_copy(
1904 __isl_keep isl_basic_set *bset);
1905 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1906 __isl_give isl_union_set *isl_union_set_copy(
1907 __isl_keep isl_union_set *uset);
1908 __isl_give isl_basic_map *isl_basic_map_copy(
1909 __isl_keep isl_basic_map *bmap);
1910 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1911 __isl_give isl_union_map *isl_union_map_copy(
1912 __isl_keep isl_union_map *umap);
1913 __isl_null isl_basic_set *isl_basic_set_free(
1914 __isl_take isl_basic_set *bset);
1915 __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1916 __isl_null isl_union_set *isl_union_set_free(
1917 __isl_take isl_union_set *uset);
1918 __isl_null isl_basic_map *isl_basic_map_free(
1919 __isl_take isl_basic_map *bmap);
1920 __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1921 __isl_null isl_union_map *isl_union_map_free(
1922 __isl_take isl_union_map *umap);
1924 Other sets and relations can be constructed by starting
1925 from a universe set or relation, adding equality and/or
1926 inequality constraints and then projecting out the
1927 existentially quantified variables, if any.
1928 Constraints can be constructed, manipulated and
1929 added to (or removed from) (basic) sets and relations
1930 using the following functions.
1932 #include <isl/constraint.h>
1933 __isl_give isl_constraint *isl_constraint_alloc_equality(
1934 __isl_take isl_local_space *ls);
1935 __isl_give isl_constraint *isl_constraint_alloc_inequality(
1936 __isl_take isl_local_space *ls);
1937 __isl_give isl_constraint *isl_constraint_set_constant_si(
1938 __isl_take isl_constraint *constraint, int v);
1939 __isl_give isl_constraint *isl_constraint_set_constant_val(
1940 __isl_take isl_constraint *constraint,
1941 __isl_take isl_val *v);
1942 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1943 __isl_take isl_constraint *constraint,
1944 enum isl_dim_type type, int pos, int v);
1945 __isl_give isl_constraint *
1946 isl_constraint_set_coefficient_val(
1947 __isl_take isl_constraint *constraint,
1948 enum isl_dim_type type, int pos,
1949 __isl_take isl_val *v);
1950 __isl_give isl_basic_map *isl_basic_map_add_constraint(
1951 __isl_take isl_basic_map *bmap,
1952 __isl_take isl_constraint *constraint);
1953 __isl_give isl_basic_set *isl_basic_set_add_constraint(
1954 __isl_take isl_basic_set *bset,
1955 __isl_take isl_constraint *constraint);
1956 __isl_give isl_map *isl_map_add_constraint(
1957 __isl_take isl_map *map,
1958 __isl_take isl_constraint *constraint);
1959 __isl_give isl_set *isl_set_add_constraint(
1960 __isl_take isl_set *set,
1961 __isl_take isl_constraint *constraint);
1963 For example, to create a set containing the even integers
1964 between 10 and 42, you would use the following code.
1967 isl_local_space *ls;
1969 isl_basic_set *bset;
1971 space = isl_space_set_alloc(ctx, 0, 2);
1972 bset = isl_basic_set_universe(isl_space_copy(space));
1973 ls = isl_local_space_from_space(space);
1975 c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
1976 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1977 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1978 bset = isl_basic_set_add_constraint(bset, c);
1980 c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
1981 c = isl_constraint_set_constant_si(c, -10);
1982 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1983 bset = isl_basic_set_add_constraint(bset, c);
1985 c = isl_constraint_alloc_inequality(ls);
1986 c = isl_constraint_set_constant_si(c, 42);
1987 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1988 bset = isl_basic_set_add_constraint(bset, c);
1990 bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1994 isl_basic_set *bset;
1995 bset = isl_basic_set_read_from_str(ctx,
1996 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1998 A basic set or relation can also be constructed from two matrices
1999 describing the equalities and the inequalities.
2001 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
2002 __isl_take isl_space *space,
2003 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2004 enum isl_dim_type c1,
2005 enum isl_dim_type c2, enum isl_dim_type c3,
2006 enum isl_dim_type c4);
2007 __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
2008 __isl_take isl_space *space,
2009 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2010 enum isl_dim_type c1,
2011 enum isl_dim_type c2, enum isl_dim_type c3,
2012 enum isl_dim_type c4, enum isl_dim_type c5);
2014 The C<isl_dim_type> arguments indicate the order in which
2015 different kinds of variables appear in the input matrices
2016 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
2017 C<isl_dim_set> and C<isl_dim_div> for sets and
2018 of C<isl_dim_cst>, C<isl_dim_param>,
2019 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2021 A (basic or union) set or relation can also be constructed from a
2022 (union) (piecewise) (multiple) affine expression
2023 or a list of affine expressions
2024 (See L</"Functions">), provided these affine expressions do not
2027 __isl_give isl_basic_map *isl_basic_map_from_aff(
2028 __isl_take isl_aff *aff);
2029 __isl_give isl_map *isl_map_from_aff(
2030 __isl_take isl_aff *aff);
2031 __isl_give isl_set *isl_set_from_pw_aff(
2032 __isl_take isl_pw_aff *pwaff);
2033 __isl_give isl_map *isl_map_from_pw_aff(
2034 __isl_take isl_pw_aff *pwaff);
2035 __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2036 __isl_take isl_space *domain_space,
2037 __isl_take isl_aff_list *list);
2038 __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2039 __isl_take isl_multi_aff *maff)
2040 __isl_give isl_map *isl_map_from_multi_aff(
2041 __isl_take isl_multi_aff *maff)
2042 __isl_give isl_set *isl_set_from_pw_multi_aff(
2043 __isl_take isl_pw_multi_aff *pma);
2044 __isl_give isl_map *isl_map_from_pw_multi_aff(
2045 __isl_take isl_pw_multi_aff *pma);
2046 __isl_give isl_set *isl_set_from_multi_pw_aff(
2047 __isl_take isl_multi_pw_aff *mpa);
2048 __isl_give isl_map *isl_map_from_multi_pw_aff(
2049 __isl_take isl_multi_pw_aff *mpa);
2050 __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2051 __isl_take isl_union_pw_aff *upa);
2052 __isl_give isl_union_map *
2053 isl_union_map_from_union_pw_multi_aff(
2054 __isl_take isl_union_pw_multi_aff *upma);
2055 __isl_give isl_union_map *
2056 isl_union_map_from_multi_union_pw_aff(
2057 __isl_take isl_multi_union_pw_aff *mupa);
2059 The C<domain_space> argument describes the domain of the resulting
2060 basic relation. It is required because the C<list> may consist
2061 of zero affine expressions.
2062 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2063 is not allowed to be zero-dimensional. The domain of the result
2064 is the shared domain of the union piecewise affine elements.
2066 =head2 Inspecting Sets and Relations
2068 Usually, the user should not have to care about the actual constraints
2069 of the sets and maps, but should instead apply the abstract operations
2070 explained in the following sections.
2071 Occasionally, however, it may be required to inspect the individual
2072 coefficients of the constraints. This section explains how to do so.
2073 In these cases, it may also be useful to have C<isl> compute
2074 an explicit representation of the existentially quantified variables.
2076 __isl_give isl_set *isl_set_compute_divs(
2077 __isl_take isl_set *set);
2078 __isl_give isl_map *isl_map_compute_divs(
2079 __isl_take isl_map *map);
2080 __isl_give isl_union_set *isl_union_set_compute_divs(
2081 __isl_take isl_union_set *uset);
2082 __isl_give isl_union_map *isl_union_map_compute_divs(
2083 __isl_take isl_union_map *umap);
2085 This explicit representation defines the existentially quantified
2086 variables as integer divisions of the other variables, possibly
2087 including earlier existentially quantified variables.
2088 An explicitly represented existentially quantified variable therefore
2089 has a unique value when the values of the other variables are known.
2090 If, furthermore, the same existentials, i.e., existentials
2091 with the same explicit representations, should appear in the
2092 same order in each of the disjuncts of a set or map, then the user should call
2093 either of the following functions.
2095 __isl_give isl_set *isl_set_align_divs(
2096 __isl_take isl_set *set);
2097 __isl_give isl_map *isl_map_align_divs(
2098 __isl_take isl_map *map);
2100 Alternatively, the existentially quantified variables can be removed
2101 using the following functions, which compute an overapproximation.
2103 __isl_give isl_basic_set *isl_basic_set_remove_divs(
2104 __isl_take isl_basic_set *bset);
2105 __isl_give isl_basic_map *isl_basic_map_remove_divs(
2106 __isl_take isl_basic_map *bmap);
2107 __isl_give isl_set *isl_set_remove_divs(
2108 __isl_take isl_set *set);
2109 __isl_give isl_map *isl_map_remove_divs(
2110 __isl_take isl_map *map);
2112 It is also possible to only remove those divs that are defined
2113 in terms of a given range of dimensions or only those for which
2114 no explicit representation is known.
2116 __isl_give isl_basic_set *
2117 isl_basic_set_remove_divs_involving_dims(
2118 __isl_take isl_basic_set *bset,
2119 enum isl_dim_type type,
2120 unsigned first, unsigned n);
2121 __isl_give isl_basic_map *
2122 isl_basic_map_remove_divs_involving_dims(
2123 __isl_take isl_basic_map *bmap,
2124 enum isl_dim_type type,
2125 unsigned first, unsigned n);
2126 __isl_give isl_set *isl_set_remove_divs_involving_dims(
2127 __isl_take isl_set *set, enum isl_dim_type type,
2128 unsigned first, unsigned n);
2129 __isl_give isl_map *isl_map_remove_divs_involving_dims(
2130 __isl_take isl_map *map, enum isl_dim_type type,
2131 unsigned first, unsigned n);
2133 __isl_give isl_basic_set *
2134 isl_basic_set_remove_unknown_divs(
2135 __isl_take isl_basic_set *bset);
2136 __isl_give isl_set *isl_set_remove_unknown_divs(
2137 __isl_take isl_set *set);
2138 __isl_give isl_map *isl_map_remove_unknown_divs(
2139 __isl_take isl_map *map);
2141 To iterate over all the sets or maps in a union set or map, use
2143 isl_stat isl_union_set_foreach_set(
2144 __isl_keep isl_union_set *uset,
2145 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2147 isl_stat isl_union_map_foreach_map(
2148 __isl_keep isl_union_map *umap,
2149 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2152 These functions call the callback function once for each
2153 (pair of) space(s) for which there are elements in the input.
2154 The argument to the callback contains all elements in the input
2155 with that (pair of) space(s).
2157 The number of sets or maps in a union set or map can be obtained
2160 int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2161 int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2163 To extract the set or map in a given space from a union, use
2165 __isl_give isl_set *isl_union_set_extract_set(
2166 __isl_keep isl_union_set *uset,
2167 __isl_take isl_space *space);
2168 __isl_give isl_map *isl_union_map_extract_map(
2169 __isl_keep isl_union_map *umap,
2170 __isl_take isl_space *space);
2172 To iterate over all the basic sets or maps in a set or map, use
2174 isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2175 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2178 isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2179 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2183 The callback function C<fn> should return 0 if successful and
2184 -1 if an error occurs. In the latter case, or if any other error
2185 occurs, the above functions will return -1.
2187 It should be noted that C<isl> does not guarantee that
2188 the basic sets or maps passed to C<fn> are disjoint.
2189 If this is required, then the user should call one of
2190 the following functions first.
2192 __isl_give isl_set *isl_set_make_disjoint(
2193 __isl_take isl_set *set);
2194 __isl_give isl_map *isl_map_make_disjoint(
2195 __isl_take isl_map *map);
2197 The number of basic sets in a set can be obtained
2198 or the number of basic maps in a map can be obtained
2201 #include <isl/set.h>
2202 int isl_set_n_basic_set(__isl_keep isl_set *set);
2204 #include <isl/map.h>
2205 int isl_map_n_basic_map(__isl_keep isl_map *map);
2207 It is also possible to obtain a list of basic sets from a set
2209 #include <isl/set.h>
2210 __isl_give isl_basic_set_list *isl_set_get_basic_set_list(
2211 __isl_keep isl_set *set);
2213 The returned list can be manipulated using the functions in L<"Lists">.
2215 To iterate over the constraints of a basic set or map, use
2217 #include <isl/constraint.h>
2219 int isl_basic_set_n_constraint(
2220 __isl_keep isl_basic_set *bset);
2221 isl_stat isl_basic_set_foreach_constraint(
2222 __isl_keep isl_basic_set *bset,
2223 isl_stat (*fn)(__isl_take isl_constraint *c,
2226 int isl_basic_map_n_constraint(
2227 __isl_keep isl_basic_map *bmap);
2228 isl_stat isl_basic_map_foreach_constraint(
2229 __isl_keep isl_basic_map *bmap,
2230 isl_stat (*fn)(__isl_take isl_constraint *c,
2233 __isl_null isl_constraint *isl_constraint_free(
2234 __isl_take isl_constraint *c);
2236 Again, the callback function C<fn> should return 0 if successful and
2237 -1 if an error occurs. In the latter case, or if any other error
2238 occurs, the above functions will return -1.
2239 The constraint C<c> represents either an equality or an inequality.
2240 Use the following function to find out whether a constraint
2241 represents an equality. If not, it represents an inequality.
2243 isl_bool isl_constraint_is_equality(
2244 __isl_keep isl_constraint *constraint);
2246 It is also possible to obtain a list of constraints from a basic
2249 #include <isl/constraint.h>
2250 __isl_give isl_constraint_list *
2251 isl_basic_map_get_constraint_list(
2252 __isl_keep isl_basic_map *bmap);
2253 __isl_give isl_constraint_list *
2254 isl_basic_set_get_constraint_list(
2255 __isl_keep isl_basic_set *bset);
2257 These functions require that all existentially quantified variables
2258 have an explicit representation.
2259 The returned list can be manipulated using the functions in L<"Lists">.
2261 The coefficients of the constraints can be inspected using
2262 the following functions.
2264 isl_bool isl_constraint_is_lower_bound(
2265 __isl_keep isl_constraint *constraint,
2266 enum isl_dim_type type, unsigned pos);
2267 isl_bool isl_constraint_is_upper_bound(
2268 __isl_keep isl_constraint *constraint,
2269 enum isl_dim_type type, unsigned pos);
2270 __isl_give isl_val *isl_constraint_get_constant_val(
2271 __isl_keep isl_constraint *constraint);
2272 __isl_give isl_val *isl_constraint_get_coefficient_val(
2273 __isl_keep isl_constraint *constraint,
2274 enum isl_dim_type type, int pos);
2276 The explicit representations of the existentially quantified
2277 variables can be inspected using the following function.
2278 Note that the user is only allowed to use this function
2279 if the inspected set or map is the result of a call
2280 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2281 The existentially quantified variable is equal to the floor
2282 of the returned affine expression. The affine expression
2283 itself can be inspected using the functions in
2286 __isl_give isl_aff *isl_constraint_get_div(
2287 __isl_keep isl_constraint *constraint, int pos);
2289 To obtain the constraints of a basic set or map in matrix
2290 form, use the following functions.
2292 __isl_give isl_mat *isl_basic_set_equalities_matrix(
2293 __isl_keep isl_basic_set *bset,
2294 enum isl_dim_type c1, enum isl_dim_type c2,
2295 enum isl_dim_type c3, enum isl_dim_type c4);
2296 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2297 __isl_keep isl_basic_set *bset,
2298 enum isl_dim_type c1, enum isl_dim_type c2,
2299 enum isl_dim_type c3, enum isl_dim_type c4);
2300 __isl_give isl_mat *isl_basic_map_equalities_matrix(
2301 __isl_keep isl_basic_map *bmap,
2302 enum isl_dim_type c1,
2303 enum isl_dim_type c2, enum isl_dim_type c3,
2304 enum isl_dim_type c4, enum isl_dim_type c5);
2305 __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2306 __isl_keep isl_basic_map *bmap,
2307 enum isl_dim_type c1,
2308 enum isl_dim_type c2, enum isl_dim_type c3,
2309 enum isl_dim_type c4, enum isl_dim_type c5);
2311 The C<isl_dim_type> arguments dictate the order in which
2312 different kinds of variables appear in the resulting matrix.
2313 For set inputs, they should be a permutation of
2314 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2315 For map inputs, they should be a permutation of
2316 C<isl_dim_cst>, C<isl_dim_param>,
2317 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2321 Points are elements of a set. They can be used to construct
2322 simple sets (boxes) or they can be used to represent the
2323 individual elements of a set.
2324 The zero point (the origin) can be created using
2326 __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2328 The coordinates of a point can be inspected, set and changed
2331 __isl_give isl_val *isl_point_get_coordinate_val(
2332 __isl_keep isl_point *pnt,
2333 enum isl_dim_type type, int pos);
2334 __isl_give isl_point *isl_point_set_coordinate_val(
2335 __isl_take isl_point *pnt,
2336 enum isl_dim_type type, int pos,
2337 __isl_take isl_val *v);
2339 __isl_give isl_point *isl_point_add_ui(
2340 __isl_take isl_point *pnt,
2341 enum isl_dim_type type, int pos, unsigned val);
2342 __isl_give isl_point *isl_point_sub_ui(
2343 __isl_take isl_point *pnt,
2344 enum isl_dim_type type, int pos, unsigned val);
2346 Points can be copied or freed using
2348 __isl_give isl_point *isl_point_copy(
2349 __isl_keep isl_point *pnt);
2350 void isl_point_free(__isl_take isl_point *pnt);
2352 A singleton set can be created from a point using
2354 __isl_give isl_basic_set *isl_basic_set_from_point(
2355 __isl_take isl_point *pnt);
2356 __isl_give isl_set *isl_set_from_point(
2357 __isl_take isl_point *pnt);
2358 __isl_give isl_union_set *isl_union_set_from_point(
2359 __isl_take isl_point *pnt);
2361 and a box can be created from two opposite extremal points using
2363 __isl_give isl_basic_set *isl_basic_set_box_from_points(
2364 __isl_take isl_point *pnt1,
2365 __isl_take isl_point *pnt2);
2366 __isl_give isl_set *isl_set_box_from_points(
2367 __isl_take isl_point *pnt1,
2368 __isl_take isl_point *pnt2);
2370 All elements of a B<bounded> (union) set can be enumerated using
2371 the following functions.
2373 isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2374 isl_stat (*fn)(__isl_take isl_point *pnt,
2377 isl_stat isl_union_set_foreach_point(
2378 __isl_keep isl_union_set *uset,
2379 isl_stat (*fn)(__isl_take isl_point *pnt,
2383 The function C<fn> is called for each integer point in
2384 C<set> with as second argument the last argument of
2385 the C<isl_set_foreach_point> call. The function C<fn>
2386 should return C<0> on success and C<-1> on failure.
2387 In the latter case, C<isl_set_foreach_point> will stop
2388 enumerating and return C<-1> as well.
2389 If the enumeration is performed successfully and to completion,
2390 then C<isl_set_foreach_point> returns C<0>.
2392 To obtain a single point of a (basic or union) set, use
2394 __isl_give isl_point *isl_basic_set_sample_point(
2395 __isl_take isl_basic_set *bset);
2396 __isl_give isl_point *isl_set_sample_point(
2397 __isl_take isl_set *set);
2398 __isl_give isl_point *isl_union_set_sample_point(
2399 __isl_take isl_union_set *uset);
2401 If C<set> does not contain any (integer) points, then the
2402 resulting point will be ``void'', a property that can be
2405 isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2409 Besides sets and relation, C<isl> also supports various types of functions.
2410 Each of these types is derived from the value type (see L</"Values">)
2411 or from one of two primitive function types
2412 through the application of zero or more type constructors.
2413 We first describe the primitive type and then we describe
2414 the types derived from these primitive types.
2416 =head3 Primitive Functions
2418 C<isl> support two primitive function types, quasi-affine
2419 expressions and quasipolynomials.
2420 A quasi-affine expression is defined either over a parameter
2421 space or over a set and is composed of integer constants,
2422 parameters and set variables, addition, subtraction and
2423 integer division by an integer constant.
2424 For example, the quasi-affine expression
2426 [n] -> { [x] -> [2*floor((4 n + x)/9] }
2428 maps C<x> to C<2*floor((4 n + x)/9>.
2429 A quasipolynomial is a polynomial expression in quasi-affine
2430 expression. That is, it additionally allows for multiplication.
2431 Note, though, that it is not allowed to construct an integer
2432 division of an expression involving multiplications.
2433 Here is an example of a quasipolynomial that is not
2434 quasi-affine expression
2436 [n] -> { [x] -> (n*floor((4 n + x)/9) }
2438 Note that the external representations of quasi-affine expressions
2439 and quasipolynomials are different. Quasi-affine expressions
2440 use a notation with square brackets just like binary relations,
2441 while quasipolynomials do not. This might change at some point.
2443 If a primitive function is defined over a parameter space,
2444 then the space of the function itself is that of a set.
2445 If it is defined over a set, then the space of the function
2446 is that of a relation. In both cases, the set space (or
2447 the output space) is single-dimensional, anonymous and unstructured.
2448 To create functions with multiple dimensions or with other kinds
2449 of set or output spaces, use multiple expressions
2450 (see L</"Multiple Expressions">).
2454 =item * Quasi-affine Expressions
2456 Besides the expressions described above, a quasi-affine
2457 expression can also be set to NaN. Such expressions
2458 typically represent a failure to represent a result
2459 as a quasi-affine expression.
2461 The zero quasi affine expression or the quasi affine expression
2462 that is equal to a given value or
2463 a specified dimension on a given domain can be created using
2465 #include <isl/aff.h>
2466 __isl_give isl_aff *isl_aff_zero_on_domain(
2467 __isl_take isl_local_space *ls);
2468 __isl_give isl_aff *isl_aff_val_on_domain(
2469 __isl_take isl_local_space *ls,
2470 __isl_take isl_val *val);
2471 __isl_give isl_aff *isl_aff_var_on_domain(
2472 __isl_take isl_local_space *ls,
2473 enum isl_dim_type type, unsigned pos);
2474 __isl_give isl_aff *isl_aff_nan_on_domain(
2475 __isl_take isl_local_space *ls);
2477 Quasi affine expressions can be copied and freed using
2479 #include <isl/aff.h>
2480 __isl_give isl_aff *isl_aff_copy(
2481 __isl_keep isl_aff *aff);
2482 __isl_null isl_aff *isl_aff_free(
2483 __isl_take isl_aff *aff);
2485 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2486 using the following function. The constraint is required to have
2487 a non-zero coefficient for the specified dimension.
2489 #include <isl/constraint.h>
2490 __isl_give isl_aff *isl_constraint_get_bound(
2491 __isl_keep isl_constraint *constraint,
2492 enum isl_dim_type type, int pos);
2494 The entire affine expression of the constraint can also be extracted
2495 using the following function.
2497 #include <isl/constraint.h>
2498 __isl_give isl_aff *isl_constraint_get_aff(
2499 __isl_keep isl_constraint *constraint);
2501 Conversely, an equality constraint equating
2502 the affine expression to zero or an inequality constraint enforcing
2503 the affine expression to be non-negative, can be constructed using
2505 __isl_give isl_constraint *isl_equality_from_aff(
2506 __isl_take isl_aff *aff);
2507 __isl_give isl_constraint *isl_inequality_from_aff(
2508 __isl_take isl_aff *aff);
2510 The coefficients and the integer divisions of an affine expression
2511 can be inspected using the following functions.
2513 #include <isl/aff.h>
2514 __isl_give isl_val *isl_aff_get_constant_val(
2515 __isl_keep isl_aff *aff);
2516 __isl_give isl_val *isl_aff_get_coefficient_val(
2517 __isl_keep isl_aff *aff,
2518 enum isl_dim_type type, int pos);
2519 int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2520 enum isl_dim_type type, int pos);
2521 __isl_give isl_val *isl_aff_get_denominator_val(
2522 __isl_keep isl_aff *aff);
2523 __isl_give isl_aff *isl_aff_get_div(
2524 __isl_keep isl_aff *aff, int pos);
2526 They can be modified using the following functions.
2528 #include <isl/aff.h>
2529 __isl_give isl_aff *isl_aff_set_constant_si(
2530 __isl_take isl_aff *aff, int v);
2531 __isl_give isl_aff *isl_aff_set_constant_val(
2532 __isl_take isl_aff *aff, __isl_take isl_val *v);
2533 __isl_give isl_aff *isl_aff_set_coefficient_si(
2534 __isl_take isl_aff *aff,
2535 enum isl_dim_type type, int pos, int v);
2536 __isl_give isl_aff *isl_aff_set_coefficient_val(
2537 __isl_take isl_aff *aff,
2538 enum isl_dim_type type, int pos,
2539 __isl_take isl_val *v);
2541 __isl_give isl_aff *isl_aff_add_constant_si(
2542 __isl_take isl_aff *aff, int v);
2543 __isl_give isl_aff *isl_aff_add_constant_val(
2544 __isl_take isl_aff *aff, __isl_take isl_val *v);
2545 __isl_give isl_aff *isl_aff_add_constant_num_si(
2546 __isl_take isl_aff *aff, int v);
2547 __isl_give isl_aff *isl_aff_add_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_add_coefficient_val(
2551 __isl_take isl_aff *aff,
2552 enum isl_dim_type type, int pos,
2553 __isl_take isl_val *v);
2555 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2556 set the I<numerator> of the constant or coefficient, while
2557 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2558 the constant or coefficient as a whole.
2559 The C<add_constant> and C<add_coefficient> functions add an integer
2560 or rational value to
2561 the possibly rational constant or coefficient.
2562 The C<add_constant_num> functions add an integer value to
2565 =item * Quasipolynomials
2567 Some simple quasipolynomials can be created using the following functions.
2569 #include <isl/polynomial.h>
2570 __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2571 __isl_take isl_space *domain);
2572 __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2573 __isl_take isl_space *domain);
2574 __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2575 __isl_take isl_space *domain);
2576 __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2577 __isl_take isl_space *domain);
2578 __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2579 __isl_take isl_space *domain);
2580 __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2581 __isl_take isl_space *domain,
2582 __isl_take isl_val *val);
2583 __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2584 __isl_take isl_space *domain,
2585 enum isl_dim_type type, unsigned pos);
2586 __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2587 __isl_take isl_aff *aff);
2589 Recall that the space in which a quasipolynomial lives is a map space
2590 with a one-dimensional range. The C<domain> argument in some of
2591 the functions above corresponds to the domain of this map space.
2593 Quasipolynomials can be copied and freed again using the following
2596 #include <isl/polynomial.h>
2597 __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2598 __isl_keep isl_qpolynomial *qp);
2599 __isl_null isl_qpolynomial *isl_qpolynomial_free(
2600 __isl_take isl_qpolynomial *qp);
2602 The constant term of a quasipolynomial can be extracted using
2604 __isl_give isl_val *isl_qpolynomial_get_constant_val(
2605 __isl_keep isl_qpolynomial *qp);
2607 To iterate over all terms in a quasipolynomial,
2610 isl_stat isl_qpolynomial_foreach_term(
2611 __isl_keep isl_qpolynomial *qp,
2612 isl_stat (*fn)(__isl_take isl_term *term,
2613 void *user), void *user);
2615 The terms themselves can be inspected and freed using
2618 unsigned isl_term_dim(__isl_keep isl_term *term,
2619 enum isl_dim_type type);
2620 __isl_give isl_val *isl_term_get_coefficient_val(
2621 __isl_keep isl_term *term);
2622 int isl_term_get_exp(__isl_keep isl_term *term,
2623 enum isl_dim_type type, unsigned pos);
2624 __isl_give isl_aff *isl_term_get_div(
2625 __isl_keep isl_term *term, unsigned pos);
2626 void isl_term_free(__isl_take isl_term *term);
2628 Each term is a product of parameters, set variables and
2629 integer divisions. The function C<isl_term_get_exp>
2630 returns the exponent of a given dimensions in the given term.
2636 A reduction represents a maximum or a minimum of its
2638 The only reduction type defined by C<isl> is
2639 C<isl_qpolynomial_fold>.
2641 There are currently no functions to directly create such
2642 objects, but they do appear in the piecewise quasipolynomial
2643 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2645 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2647 Reductions can be copied and freed using
2648 the following functions.
2650 #include <isl/polynomial.h>
2651 __isl_give isl_qpolynomial_fold *
2652 isl_qpolynomial_fold_copy(
2653 __isl_keep isl_qpolynomial_fold *fold);
2654 void isl_qpolynomial_fold_free(
2655 __isl_take isl_qpolynomial_fold *fold);
2657 To iterate over all quasipolynomials in a reduction, use
2659 isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2660 __isl_keep isl_qpolynomial_fold *fold,
2661 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2662 void *user), void *user);
2664 =head3 Multiple Expressions
2666 A multiple expression represents a sequence of zero or
2667 more base expressions, all defined on the same domain space.
2668 The domain space of the multiple expression is the same
2669 as that of the base expressions, but the range space
2670 can be any space. In case the base expressions have
2671 a set space, the corresponding multiple expression
2672 also has a set space.
2673 Objects of the value type do not have an associated space.
2674 The space of a multiple value is therefore always a set space.
2675 Similarly, the space of a multiple union piecewise
2676 affine expression is always a set space.
2678 The multiple expression types defined by C<isl>
2679 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2680 C<isl_multi_union_pw_aff>.
2682 A multiple expression with the value zero for
2683 each output (or set) dimension can be created
2684 using the following functions.
2686 #include <isl/val.h>
2687 __isl_give isl_multi_val *isl_multi_val_zero(
2688 __isl_take isl_space *space);
2690 #include <isl/aff.h>
2691 __isl_give isl_multi_aff *isl_multi_aff_zero(
2692 __isl_take isl_space *space);
2693 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2694 __isl_take isl_space *space);
2695 __isl_give isl_multi_union_pw_aff *
2696 isl_multi_union_pw_aff_zero(
2697 __isl_take isl_space *space);
2699 Since there is no canonical way of representing a zero
2700 value of type C<isl_union_pw_aff>, the space passed
2701 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2703 An identity function can be created using the following
2704 functions. The space needs to be that of a relation
2705 with the same number of input and output dimensions.
2707 #include <isl/aff.h>
2708 __isl_give isl_multi_aff *isl_multi_aff_identity(
2709 __isl_take isl_space *space);
2710 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2711 __isl_take isl_space *space);
2713 A function that performs a projection on a universe
2714 relation or set can be created using the following functions.
2715 See also the corresponding
2716 projection operations in L</"Unary Operations">.
2718 #include <isl/aff.h>
2719 __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2720 __isl_take isl_space *space);
2721 __isl_give isl_multi_aff *isl_multi_aff_range_map(
2722 __isl_take isl_space *space);
2723 __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2724 __isl_take isl_space *space,
2725 enum isl_dim_type type,
2726 unsigned first, unsigned n);
2728 A multiple expression can be created from a single
2729 base expression using the following functions.
2730 The space of the created multiple expression is the same
2731 as that of the base expression, except for
2732 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2733 lives in a parameter space and the output lives
2734 in a single-dimensional set space.
2736 #include <isl/aff.h>
2737 __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2738 __isl_take isl_aff *aff);
2739 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2740 __isl_take isl_pw_aff *pa);
2741 __isl_give isl_multi_union_pw_aff *
2742 isl_multi_union_pw_aff_from_union_pw_aff(
2743 __isl_take isl_union_pw_aff *upa);
2745 A multiple expression can be created from a list
2746 of base expression in a specified space.
2747 The domain of this space needs to be the same
2748 as the domains of the base expressions in the list.
2749 If the base expressions have a set space (or no associated space),
2750 then this space also needs to be a set space.
2752 #include <isl/val.h>
2753 __isl_give isl_multi_val *isl_multi_val_from_val_list(
2754 __isl_take isl_space *space,
2755 __isl_take isl_val_list *list);
2757 #include <isl/aff.h>
2758 __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2759 __isl_take isl_space *space,
2760 __isl_take isl_aff_list *list);
2761 __isl_give isl_multi_pw_aff *
2762 isl_multi_pw_aff_from_pw_aff_list(
2763 __isl_take isl_space *space,
2764 __isl_take isl_pw_aff_list *list);
2765 __isl_give isl_multi_union_pw_aff *
2766 isl_multi_union_pw_aff_from_union_pw_aff_list(
2767 __isl_take isl_space *space,
2768 __isl_take isl_union_pw_aff_list *list);
2770 As a convenience, a multiple piecewise expression can
2771 also be created from a multiple expression.
2772 Each piecewise expression in the result has a single
2775 #include <isl/aff.h>
2776 __isl_give isl_multi_pw_aff *
2777 isl_multi_pw_aff_from_multi_aff(
2778 __isl_take isl_multi_aff *ma);
2780 Similarly, a multiple union expression can be
2781 created from a multiple expression.
2783 #include <isl/aff.h>
2784 __isl_give isl_multi_union_pw_aff *
2785 isl_multi_union_pw_aff_from_multi_aff(
2786 __isl_take isl_multi_aff *ma);
2787 __isl_give isl_multi_union_pw_aff *
2788 isl_multi_union_pw_aff_from_multi_pw_aff(
2789 __isl_take isl_multi_pw_aff *mpa);
2791 A multiple quasi-affine expression can be created from
2792 a multiple value with a given domain space using the following
2795 #include <isl/aff.h>
2796 __isl_give isl_multi_aff *
2797 isl_multi_aff_multi_val_on_space(
2798 __isl_take isl_space *space,
2799 __isl_take isl_multi_val *mv);
2802 a multiple union piecewise affine expression can be created from
2803 a multiple value with a given domain or
2804 a multiple affine expression with a given domain
2805 using the following functions.
2807 #include <isl/aff.h>
2808 __isl_give isl_multi_union_pw_aff *
2809 isl_multi_union_pw_aff_multi_val_on_domain(
2810 __isl_take isl_union_set *domain,
2811 __isl_take isl_multi_val *mv);
2812 __isl_give isl_multi_union_pw_aff *
2813 isl_multi_union_pw_aff_multi_aff_on_domain(
2814 __isl_take isl_union_set *domain,
2815 __isl_take isl_multi_aff *ma);
2817 Multiple expressions can be copied and freed using
2818 the following functions.
2820 #include <isl/val.h>
2821 __isl_give isl_multi_val *isl_multi_val_copy(
2822 __isl_keep isl_multi_val *mv);
2823 __isl_null isl_multi_val *isl_multi_val_free(
2824 __isl_take isl_multi_val *mv);
2826 #include <isl/aff.h>
2827 __isl_give isl_multi_aff *isl_multi_aff_copy(
2828 __isl_keep isl_multi_aff *maff);
2829 __isl_null isl_multi_aff *isl_multi_aff_free(
2830 __isl_take isl_multi_aff *maff);
2831 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2832 __isl_keep isl_multi_pw_aff *mpa);
2833 __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2834 __isl_take isl_multi_pw_aff *mpa);
2835 __isl_give isl_multi_union_pw_aff *
2836 isl_multi_union_pw_aff_copy(
2837 __isl_keep isl_multi_union_pw_aff *mupa);
2838 __isl_null isl_multi_union_pw_aff *
2839 isl_multi_union_pw_aff_free(
2840 __isl_take isl_multi_union_pw_aff *mupa);
2842 The base expression at a given position of a multiple
2843 expression can be extracted using the following functions.
2845 #include <isl/val.h>
2846 __isl_give isl_val *isl_multi_val_get_val(
2847 __isl_keep isl_multi_val *mv, int pos);
2849 #include <isl/aff.h>
2850 __isl_give isl_aff *isl_multi_aff_get_aff(
2851 __isl_keep isl_multi_aff *multi, int pos);
2852 __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2853 __isl_keep isl_multi_pw_aff *mpa, int pos);
2854 __isl_give isl_union_pw_aff *
2855 isl_multi_union_pw_aff_get_union_pw_aff(
2856 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2858 It can be replaced using the following functions.
2860 #include <isl/val.h>
2861 __isl_give isl_multi_val *isl_multi_val_set_val(
2862 __isl_take isl_multi_val *mv, int pos,
2863 __isl_take isl_val *val);
2865 #include <isl/aff.h>
2866 __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2867 __isl_take isl_multi_aff *multi, int pos,
2868 __isl_take isl_aff *aff);
2869 __isl_give isl_multi_union_pw_aff *
2870 isl_multi_union_pw_aff_set_union_pw_aff(
2871 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2872 __isl_take isl_union_pw_aff *upa);
2874 As a convenience, a sequence of base expressions that have
2875 their domains in a given space can be extracted from a sequence
2876 of union expressions using the following function.
2878 #include <isl/aff.h>
2879 __isl_give isl_multi_pw_aff *
2880 isl_multi_union_pw_aff_extract_multi_pw_aff(
2881 __isl_keep isl_multi_union_pw_aff *mupa,
2882 __isl_take isl_space *space);
2884 Note that there is a difference between C<isl_multi_union_pw_aff>
2885 and C<isl_union_pw_multi_aff> objects. The first is a sequence
2886 of unions of piecewise expressions, while the second is a union
2887 of piecewise sequences. In particular, multiple affine expressions
2888 in an C<isl_union_pw_multi_aff> may live in different spaces,
2889 while there is only a single multiple expression in
2890 an C<isl_multi_union_pw_aff>, which can therefore only live
2891 in a single space. This means that not every
2892 C<isl_union_pw_multi_aff> can be converted to
2893 an C<isl_multi_union_pw_aff>. Conversely, a zero-dimensional
2894 C<isl_multi_union_pw_aff> carries no information
2895 about any possible domain and therefore cannot be converted
2896 to an C<isl_union_pw_multi_aff>. Moreover, the elements
2897 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2898 while each multiple expression inside an C<isl_union_pw_multi_aff>
2899 has a single domain. The conversion of an C<isl_union_pw_multi_aff>
2900 of dimension greater than one may therefore not be exact.
2901 The following functions can
2902 be used to perform these conversions when they are possible.
2904 #include <isl/aff.h>
2905 __isl_give isl_multi_union_pw_aff *
2906 isl_multi_union_pw_aff_from_union_pw_multi_aff(
2907 __isl_take isl_union_pw_multi_aff *upma);
2908 __isl_give isl_union_pw_multi_aff *
2909 isl_union_pw_multi_aff_from_multi_union_pw_aff(
2910 __isl_take isl_multi_union_pw_aff *mupa);
2912 =head3 Piecewise Expressions
2914 A piecewise expression is an expression that is described
2915 using zero or more base expression defined over the same
2916 number of cells in the domain space of the base expressions.
2917 All base expressions are defined over the same
2918 domain space and the cells are disjoint.
2919 The space of a piecewise expression is the same as
2920 that of the base expressions.
2921 If the union of the cells is a strict subset of the domain
2922 space, then the value of the piecewise expression outside
2923 this union is different for types derived from quasi-affine
2924 expressions and those derived from quasipolynomials.
2925 Piecewise expressions derived from quasi-affine expressions
2926 are considered to be undefined outside the union of their cells.
2927 Piecewise expressions derived from quasipolynomials
2928 are considered to be zero outside the union of their cells.
2930 Piecewise quasipolynomials are mainly used by the C<barvinok>
2931 library for representing the number of elements in a parametric set or map.
2932 For example, the piecewise quasipolynomial
2934 [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2936 represents the number of points in the map
2938 [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2940 The piecewise expression types defined by C<isl>
2941 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2942 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2944 A piecewise expression with no cells can be created using
2945 the following functions.
2947 #include <isl/aff.h>
2948 __isl_give isl_pw_aff *isl_pw_aff_empty(
2949 __isl_take isl_space *space);
2950 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2951 __isl_take isl_space *space);
2953 A piecewise expression with a single universe cell can be
2954 created using the following functions.
2956 #include <isl/aff.h>
2957 __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2958 __isl_take isl_aff *aff);
2959 __isl_give isl_pw_multi_aff *
2960 isl_pw_multi_aff_from_multi_aff(
2961 __isl_take isl_multi_aff *ma);
2963 #include <isl/polynomial.h>
2964 __isl_give isl_pw_qpolynomial *
2965 isl_pw_qpolynomial_from_qpolynomial(
2966 __isl_take isl_qpolynomial *qp);
2968 A piecewise expression with a single specified cell can be
2969 created using the following functions.
2971 #include <isl/aff.h>
2972 __isl_give isl_pw_aff *isl_pw_aff_alloc(
2973 __isl_take isl_set *set, __isl_take isl_aff *aff);
2974 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2975 __isl_take isl_set *set,
2976 __isl_take isl_multi_aff *maff);
2978 #include <isl/polynomial.h>
2979 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2980 __isl_take isl_set *set,
2981 __isl_take isl_qpolynomial *qp);
2983 The following convenience functions first create a base expression and
2984 then create a piecewise expression over a universe domain.
2986 #include <isl/aff.h>
2987 __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2988 __isl_take isl_local_space *ls);
2989 __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2990 __isl_take isl_local_space *ls,
2991 enum isl_dim_type type, unsigned pos);
2992 __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2993 __isl_take isl_local_space *ls);
2994 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2995 __isl_take isl_space *space);
2996 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2997 __isl_take isl_space *space);
2998 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2999 __isl_take isl_space *space);
3000 __isl_give isl_pw_multi_aff *
3001 isl_pw_multi_aff_project_out_map(
3002 __isl_take isl_space *space,
3003 enum isl_dim_type type,
3004 unsigned first, unsigned n);
3006 #include <isl/polynomial.h>
3007 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
3008 __isl_take isl_space *space);
3010 The following convenience functions first create a base expression and
3011 then create a piecewise expression over a given domain.
3013 #include <isl/aff.h>
3014 __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
3015 __isl_take isl_set *domain,
3016 __isl_take isl_val *v);
3017 __isl_give isl_pw_multi_aff *
3018 isl_pw_multi_aff_multi_val_on_domain(
3019 __isl_take isl_set *domain,
3020 __isl_take isl_multi_val *mv);
3022 As a convenience, a piecewise multiple expression can
3023 also be created from a piecewise expression.
3024 Each multiple expression in the result is derived
3025 from the corresponding base expression.
3027 #include <isl/aff.h>
3028 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
3029 __isl_take isl_pw_aff *pa);
3031 Similarly, a piecewise quasipolynomial can be
3032 created from a piecewise quasi-affine expression using
3033 the following function.
3035 #include <isl/polynomial.h>
3036 __isl_give isl_pw_qpolynomial *
3037 isl_pw_qpolynomial_from_pw_aff(
3038 __isl_take isl_pw_aff *pwaff);
3040 Piecewise expressions can be copied and freed using the following functions.
3042 #include <isl/aff.h>
3043 __isl_give isl_pw_aff *isl_pw_aff_copy(
3044 __isl_keep isl_pw_aff *pwaff);
3045 __isl_null isl_pw_aff *isl_pw_aff_free(
3046 __isl_take isl_pw_aff *pwaff);
3047 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3048 __isl_keep isl_pw_multi_aff *pma);
3049 __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3050 __isl_take isl_pw_multi_aff *pma);
3052 #include <isl/polynomial.h>
3053 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3054 __isl_keep isl_pw_qpolynomial *pwqp);
3055 __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3056 __isl_take isl_pw_qpolynomial *pwqp);
3057 __isl_give isl_pw_qpolynomial_fold *
3058 isl_pw_qpolynomial_fold_copy(
3059 __isl_keep isl_pw_qpolynomial_fold *pwf);
3060 __isl_null isl_pw_qpolynomial_fold *
3061 isl_pw_qpolynomial_fold_free(
3062 __isl_take isl_pw_qpolynomial_fold *pwf);
3064 To iterate over the different cells of a piecewise expression,
3065 use the following functions.
3067 #include <isl/aff.h>
3068 isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3069 int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3070 isl_stat isl_pw_aff_foreach_piece(
3071 __isl_keep isl_pw_aff *pwaff,
3072 isl_stat (*fn)(__isl_take isl_set *set,
3073 __isl_take isl_aff *aff,
3074 void *user), void *user);
3075 isl_stat isl_pw_multi_aff_foreach_piece(
3076 __isl_keep isl_pw_multi_aff *pma,
3077 isl_stat (*fn)(__isl_take isl_set *set,
3078 __isl_take isl_multi_aff *maff,
3079 void *user), void *user);
3081 #include <isl/polynomial.h>
3082 isl_stat isl_pw_qpolynomial_foreach_piece(
3083 __isl_keep isl_pw_qpolynomial *pwqp,
3084 isl_stat (*fn)(__isl_take isl_set *set,
3085 __isl_take isl_qpolynomial *qp,
3086 void *user), void *user);
3087 isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3088 __isl_keep isl_pw_qpolynomial *pwqp,
3089 isl_stat (*fn)(__isl_take isl_set *set,
3090 __isl_take isl_qpolynomial *qp,
3091 void *user), void *user);
3092 isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3093 __isl_keep isl_pw_qpolynomial_fold *pwf,
3094 isl_stat (*fn)(__isl_take isl_set *set,
3095 __isl_take isl_qpolynomial_fold *fold,
3096 void *user), void *user);
3097 isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3098 __isl_keep isl_pw_qpolynomial_fold *pwf,
3099 isl_stat (*fn)(__isl_take isl_set *set,
3100 __isl_take isl_qpolynomial_fold *fold,
3101 void *user), void *user);
3103 As usual, the function C<fn> should return C<0> on success
3104 and C<-1> on failure. The difference between
3105 C<isl_pw_qpolynomial_foreach_piece> and
3106 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3107 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3108 compute unique representations for all existentially quantified
3109 variables and then turn these existentially quantified variables
3110 into extra set variables, adapting the associated quasipolynomial
3111 accordingly. This means that the C<set> passed to C<fn>
3112 will not have any existentially quantified variables, but that
3113 the dimensions of the sets may be different for different
3114 invocations of C<fn>.
3115 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3116 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3118 A piecewise expression consisting of the expressions at a given
3119 position of a piecewise multiple expression can be extracted
3120 using the following function.
3122 #include <isl/aff.h>
3123 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3124 __isl_keep isl_pw_multi_aff *pma, int pos);
3126 These expressions can be replaced using the following function.
3128 #include <isl/aff.h>
3129 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3130 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3131 __isl_take isl_pw_aff *pa);
3133 Note that there is a difference between C<isl_multi_pw_aff> and
3134 C<isl_pw_multi_aff> objects. The first is a sequence of piecewise
3135 affine expressions, while the second is a piecewise sequence
3136 of affine expressions. In particular, each of the piecewise
3137 affine expressions in an C<isl_multi_pw_aff> may have a different
3138 domain, while all multiple expressions associated to a cell
3139 in an C<isl_pw_multi_aff> have the same domain.
3140 It is possible to convert between the two, but when converting
3141 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3142 of the result is the intersection of the domains of the input.
3143 The reverse conversion is exact.
3145 #include <isl/aff.h>
3146 __isl_give isl_pw_multi_aff *
3147 isl_pw_multi_aff_from_multi_pw_aff(
3148 __isl_take isl_multi_pw_aff *mpa);
3149 __isl_give isl_multi_pw_aff *
3150 isl_multi_pw_aff_from_pw_multi_aff(
3151 __isl_take isl_pw_multi_aff *pma);
3153 =head3 Union Expressions
3155 A union expression collects base expressions defined
3156 over different domains. The space of a union expression
3157 is that of the shared parameter space.
3159 The union expression types defined by C<isl>
3160 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3161 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3163 C<isl_union_pw_aff>,
3164 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>,
3165 there can be at most one base expression for a given domain space.
3167 C<isl_union_pw_multi_aff>,
3168 there can be multiple such expressions for a given domain space,
3169 but the domains of these expressions need to be disjoint.
3171 An empty union expression can be created using the following functions.
3173 #include <isl/aff.h>
3174 __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3175 __isl_take isl_space *space);
3176 __isl_give isl_union_pw_multi_aff *
3177 isl_union_pw_multi_aff_empty(
3178 __isl_take isl_space *space);
3180 #include <isl/polynomial.h>
3181 __isl_give isl_union_pw_qpolynomial *
3182 isl_union_pw_qpolynomial_zero(
3183 __isl_take isl_space *space);
3185 A union expression containing a single base expression
3186 can be created using the following functions.
3188 #include <isl/aff.h>
3189 __isl_give isl_union_pw_aff *
3190 isl_union_pw_aff_from_pw_aff(
3191 __isl_take isl_pw_aff *pa);
3192 __isl_give isl_union_pw_multi_aff *
3193 isl_union_pw_multi_aff_from_aff(
3194 __isl_take isl_aff *aff);
3195 __isl_give isl_union_pw_multi_aff *
3196 isl_union_pw_multi_aff_from_pw_multi_aff(
3197 __isl_take isl_pw_multi_aff *pma);
3199 #include <isl/polynomial.h>
3200 __isl_give isl_union_pw_qpolynomial *
3201 isl_union_pw_qpolynomial_from_pw_qpolynomial(
3202 __isl_take isl_pw_qpolynomial *pwqp);
3204 The following functions create a base expression on each
3205 of the sets in the union set and collect the results.
3207 #include <isl/aff.h>
3208 __isl_give isl_union_pw_multi_aff *
3209 isl_union_pw_multi_aff_from_union_pw_aff(
3210 __isl_take isl_union_pw_aff *upa);
3211 __isl_give isl_union_pw_aff *
3212 isl_union_pw_multi_aff_get_union_pw_aff(
3213 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3214 __isl_give isl_union_pw_aff *
3215 isl_union_pw_aff_val_on_domain(
3216 __isl_take isl_union_set *domain,
3217 __isl_take isl_val *v);
3218 __isl_give isl_union_pw_multi_aff *
3219 isl_union_pw_multi_aff_multi_val_on_domain(
3220 __isl_take isl_union_set *domain,
3221 __isl_take isl_multi_val *mv);
3223 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3224 expression on a given domain can be created using the following
3227 #include <isl/aff.h>
3228 __isl_give isl_union_pw_aff *
3229 isl_union_pw_aff_aff_on_domain(
3230 __isl_take isl_union_set *domain,
3231 __isl_take isl_aff *aff);
3233 A base expression can be added to a union expression using
3234 the following functions.
3236 #include <isl/aff.h>
3237 __isl_give isl_union_pw_aff *
3238 isl_union_pw_aff_add_pw_aff(
3239 __isl_take isl_union_pw_aff *upa,
3240 __isl_take isl_pw_aff *pa);
3241 __isl_give isl_union_pw_multi_aff *
3242 isl_union_pw_multi_aff_add_pw_multi_aff(
3243 __isl_take isl_union_pw_multi_aff *upma,
3244 __isl_take isl_pw_multi_aff *pma);
3246 #include <isl/polynomial.h>
3247 __isl_give isl_union_pw_qpolynomial *
3248 isl_union_pw_qpolynomial_add_pw_qpolynomial(
3249 __isl_take isl_union_pw_qpolynomial *upwqp,
3250 __isl_take isl_pw_qpolynomial *pwqp);
3252 Union expressions can be copied and freed using
3253 the following functions.
3255 #include <isl/aff.h>
3256 __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3257 __isl_keep isl_union_pw_aff *upa);
3258 __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3259 __isl_take isl_union_pw_aff *upa);
3260 __isl_give isl_union_pw_multi_aff *
3261 isl_union_pw_multi_aff_copy(
3262 __isl_keep isl_union_pw_multi_aff *upma);
3263 __isl_null isl_union_pw_multi_aff *
3264 isl_union_pw_multi_aff_free(
3265 __isl_take isl_union_pw_multi_aff *upma);
3267 #include <isl/polynomial.h>
3268 __isl_give isl_union_pw_qpolynomial *
3269 isl_union_pw_qpolynomial_copy(
3270 __isl_keep isl_union_pw_qpolynomial *upwqp);
3271 __isl_null isl_union_pw_qpolynomial *
3272 isl_union_pw_qpolynomial_free(
3273 __isl_take isl_union_pw_qpolynomial *upwqp);
3274 __isl_give isl_union_pw_qpolynomial_fold *
3275 isl_union_pw_qpolynomial_fold_copy(
3276 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3277 __isl_null isl_union_pw_qpolynomial_fold *
3278 isl_union_pw_qpolynomial_fold_free(
3279 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3281 To iterate over the base expressions in a union expression,
3282 use the following functions.
3284 #include <isl/aff.h>
3285 int isl_union_pw_aff_n_pw_aff(
3286 __isl_keep isl_union_pw_aff *upa);
3287 isl_stat isl_union_pw_aff_foreach_pw_aff(
3288 __isl_keep isl_union_pw_aff *upa,
3289 isl_stat (*fn)(__isl_take isl_pw_aff *pa,
3290 void *user), void *user);
3291 int isl_union_pw_multi_aff_n_pw_multi_aff(
3292 __isl_keep isl_union_pw_multi_aff *upma);
3293 isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3294 __isl_keep isl_union_pw_multi_aff *upma,
3295 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3296 void *user), void *user);
3298 #include <isl/polynomial.h>
3299 int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3300 __isl_keep isl_union_pw_qpolynomial *upwqp);
3301 isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3302 __isl_keep isl_union_pw_qpolynomial *upwqp,
3303 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3304 void *user), void *user);
3305 int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3306 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3307 isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3308 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3309 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3310 void *user), void *user);
3312 To extract the base expression in a given space from a union, use
3313 the following functions.
3315 #include <isl/aff.h>
3316 __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3317 __isl_keep isl_union_pw_aff *upa,
3318 __isl_take isl_space *space);
3319 __isl_give isl_pw_multi_aff *
3320 isl_union_pw_multi_aff_extract_pw_multi_aff(
3321 __isl_keep isl_union_pw_multi_aff *upma,
3322 __isl_take isl_space *space);
3324 #include <isl/polynomial.h>
3325 __isl_give isl_pw_qpolynomial *
3326 isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3327 __isl_keep isl_union_pw_qpolynomial *upwqp,
3328 __isl_take isl_space *space);
3330 =head2 Input and Output
3332 For set and relation,
3333 C<isl> supports its own input/output format, which is similar
3334 to the C<Omega> format, but also supports the C<PolyLib> format
3336 For other object types, typically only an C<isl> format is supported.
3338 =head3 C<isl> format
3340 The C<isl> format is similar to that of C<Omega>, but has a different
3341 syntax for describing the parameters and allows for the definition
3342 of an existentially quantified variable as the integer division
3343 of an affine expression.
3344 For example, the set of integers C<i> between C<0> and C<n>
3345 such that C<i % 10 <= 6> can be described as
3347 [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3350 A set or relation can have several disjuncts, separated
3351 by the keyword C<or>. Each disjunct is either a conjunction
3352 of constraints or a projection (C<exists>) of a conjunction
3353 of constraints. The constraints are separated by the keyword
3356 =head3 C<PolyLib> format
3358 If the represented set is a union, then the first line
3359 contains a single number representing the number of disjuncts.
3360 Otherwise, a line containing the number C<1> is optional.
3362 Each disjunct is represented by a matrix of constraints.
3363 The first line contains two numbers representing
3364 the number of rows and columns,
3365 where the number of rows is equal to the number of constraints
3366 and the number of columns is equal to two plus the number of variables.
3367 The following lines contain the actual rows of the constraint matrix.
3368 In each row, the first column indicates whether the constraint
3369 is an equality (C<0>) or inequality (C<1>). The final column
3370 corresponds to the constant term.
3372 If the set is parametric, then the coefficients of the parameters
3373 appear in the last columns before the constant column.
3374 The coefficients of any existentially quantified variables appear
3375 between those of the set variables and those of the parameters.
3377 =head3 Extended C<PolyLib> format
3379 The extended C<PolyLib> format is nearly identical to the
3380 C<PolyLib> format. The only difference is that the line
3381 containing the number of rows and columns of a constraint matrix
3382 also contains four additional numbers:
3383 the number of output dimensions, the number of input dimensions,
3384 the number of local dimensions (i.e., the number of existentially
3385 quantified variables) and the number of parameters.
3386 For sets, the number of ``output'' dimensions is equal
3387 to the number of set dimensions, while the number of ``input''
3392 Objects can be read from input using the following functions.
3394 #include <isl/val.h>
3395 __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3397 __isl_give isl_multi_val *isl_multi_val_read_from_str(
3398 isl_ctx *ctx, const char *str);
3400 #include <isl/set.h>
3401 __isl_give isl_basic_set *isl_basic_set_read_from_file(
3402 isl_ctx *ctx, FILE *input);
3403 __isl_give isl_basic_set *isl_basic_set_read_from_str(
3404 isl_ctx *ctx, const char *str);
3405 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3407 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3410 #include <isl/map.h>
3411 __isl_give isl_basic_map *isl_basic_map_read_from_file(
3412 isl_ctx *ctx, FILE *input);
3413 __isl_give isl_basic_map *isl_basic_map_read_from_str(
3414 isl_ctx *ctx, const char *str);
3415 __isl_give isl_map *isl_map_read_from_file(
3416 isl_ctx *ctx, FILE *input);
3417 __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3420 #include <isl/union_set.h>
3421 __isl_give isl_union_set *isl_union_set_read_from_file(
3422 isl_ctx *ctx, FILE *input);
3423 __isl_give isl_union_set *isl_union_set_read_from_str(
3424 isl_ctx *ctx, const char *str);
3426 #include <isl/union_map.h>
3427 __isl_give isl_union_map *isl_union_map_read_from_file(
3428 isl_ctx *ctx, FILE *input);
3429 __isl_give isl_union_map *isl_union_map_read_from_str(
3430 isl_ctx *ctx, const char *str);
3432 #include <isl/aff.h>
3433 __isl_give isl_aff *isl_aff_read_from_str(
3434 isl_ctx *ctx, const char *str);
3435 __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3436 isl_ctx *ctx, const char *str);
3437 __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3438 isl_ctx *ctx, const char *str);
3439 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3440 isl_ctx *ctx, const char *str);
3441 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3442 isl_ctx *ctx, const char *str);
3443 __isl_give isl_union_pw_aff *
3444 isl_union_pw_aff_read_from_str(
3445 isl_ctx *ctx, const char *str);
3446 __isl_give isl_union_pw_multi_aff *
3447 isl_union_pw_multi_aff_read_from_str(
3448 isl_ctx *ctx, const char *str);
3449 __isl_give isl_multi_union_pw_aff *
3450 isl_multi_union_pw_aff_read_from_str(
3451 isl_ctx *ctx, const char *str);
3453 #include <isl/polynomial.h>
3454 __isl_give isl_union_pw_qpolynomial *
3455 isl_union_pw_qpolynomial_read_from_str(
3456 isl_ctx *ctx, const char *str);
3458 For sets and relations,
3459 the input format is autodetected and may be either the C<PolyLib> format
3460 or the C<isl> format.
3464 Before anything can be printed, an C<isl_printer> needs to
3467 __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3469 __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3470 __isl_null isl_printer *isl_printer_free(
3471 __isl_take isl_printer *printer);
3473 C<isl_printer_to_file> prints to the given file, while
3474 C<isl_printer_to_str> prints to a string that can be extracted
3475 using the following function.
3477 #include <isl/printer.h>
3478 __isl_give char *isl_printer_get_str(
3479 __isl_keep isl_printer *printer);
3481 The printer can be inspected using the following functions.
3483 FILE *isl_printer_get_file(
3484 __isl_keep isl_printer *printer);
3485 int isl_printer_get_output_format(
3486 __isl_keep isl_printer *p);
3487 int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3489 The behavior of the printer can be modified in various ways
3491 __isl_give isl_printer *isl_printer_set_output_format(
3492 __isl_take isl_printer *p, int output_format);
3493 __isl_give isl_printer *isl_printer_set_indent(
3494 __isl_take isl_printer *p, int indent);
3495 __isl_give isl_printer *isl_printer_set_indent_prefix(
3496 __isl_take isl_printer *p, const char *prefix);
3497 __isl_give isl_printer *isl_printer_indent(
3498 __isl_take isl_printer *p, int indent);
3499 __isl_give isl_printer *isl_printer_set_prefix(
3500 __isl_take isl_printer *p, const char *prefix);
3501 __isl_give isl_printer *isl_printer_set_suffix(
3502 __isl_take isl_printer *p, const char *suffix);
3503 __isl_give isl_printer *isl_printer_set_yaml_style(
3504 __isl_take isl_printer *p, int yaml_style);
3506 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3507 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3508 and defaults to C<ISL_FORMAT_ISL>.
3509 Each line in the output is prefixed by C<indent_prefix>,
3510 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3511 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3512 In the C<PolyLib> format output,
3513 the coefficients of the existentially quantified variables
3514 appear between those of the set variables and those
3516 The function C<isl_printer_indent> increases the indentation
3517 by the specified amount (which may be negative).
3518 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3519 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3522 To actually print something, use
3524 #include <isl/printer.h>
3525 __isl_give isl_printer *isl_printer_print_double(
3526 __isl_take isl_printer *p, double d);
3528 #include <isl/val.h>
3529 __isl_give isl_printer *isl_printer_print_val(
3530 __isl_take isl_printer *p, __isl_keep isl_val *v);
3532 #include <isl/set.h>
3533 __isl_give isl_printer *isl_printer_print_basic_set(
3534 __isl_take isl_printer *printer,
3535 __isl_keep isl_basic_set *bset);
3536 __isl_give isl_printer *isl_printer_print_set(
3537 __isl_take isl_printer *printer,
3538 __isl_keep isl_set *set);
3540 #include <isl/map.h>
3541 __isl_give isl_printer *isl_printer_print_basic_map(
3542 __isl_take isl_printer *printer,
3543 __isl_keep isl_basic_map *bmap);
3544 __isl_give isl_printer *isl_printer_print_map(
3545 __isl_take isl_printer *printer,
3546 __isl_keep isl_map *map);
3548 #include <isl/union_set.h>
3549 __isl_give isl_printer *isl_printer_print_union_set(
3550 __isl_take isl_printer *p,
3551 __isl_keep isl_union_set *uset);
3553 #include <isl/union_map.h>
3554 __isl_give isl_printer *isl_printer_print_union_map(
3555 __isl_take isl_printer *p,
3556 __isl_keep isl_union_map *umap);
3558 #include <isl/val.h>
3559 __isl_give isl_printer *isl_printer_print_multi_val(
3560 __isl_take isl_printer *p,
3561 __isl_keep isl_multi_val *mv);
3563 #include <isl/aff.h>
3564 __isl_give isl_printer *isl_printer_print_aff(
3565 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3566 __isl_give isl_printer *isl_printer_print_multi_aff(
3567 __isl_take isl_printer *p,
3568 __isl_keep isl_multi_aff *maff);
3569 __isl_give isl_printer *isl_printer_print_pw_aff(
3570 __isl_take isl_printer *p,
3571 __isl_keep isl_pw_aff *pwaff);
3572 __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3573 __isl_take isl_printer *p,
3574 __isl_keep isl_pw_multi_aff *pma);
3575 __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3576 __isl_take isl_printer *p,
3577 __isl_keep isl_multi_pw_aff *mpa);
3578 __isl_give isl_printer *isl_printer_print_union_pw_aff(
3579 __isl_take isl_printer *p,
3580 __isl_keep isl_union_pw_aff *upa);
3581 __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3582 __isl_take isl_printer *p,
3583 __isl_keep isl_union_pw_multi_aff *upma);
3584 __isl_give isl_printer *
3585 isl_printer_print_multi_union_pw_aff(
3586 __isl_take isl_printer *p,
3587 __isl_keep isl_multi_union_pw_aff *mupa);
3589 #include <isl/polynomial.h>
3590 __isl_give isl_printer *isl_printer_print_qpolynomial(
3591 __isl_take isl_printer *p,
3592 __isl_keep isl_qpolynomial *qp);
3593 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3594 __isl_take isl_printer *p,
3595 __isl_keep isl_pw_qpolynomial *pwqp);
3596 __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3597 __isl_take isl_printer *p,
3598 __isl_keep isl_union_pw_qpolynomial *upwqp);
3600 __isl_give isl_printer *
3601 isl_printer_print_pw_qpolynomial_fold(
3602 __isl_take isl_printer *p,
3603 __isl_keep isl_pw_qpolynomial_fold *pwf);
3604 __isl_give isl_printer *
3605 isl_printer_print_union_pw_qpolynomial_fold(
3606 __isl_take isl_printer *p,
3607 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3609 For C<isl_printer_print_qpolynomial>,
3610 C<isl_printer_print_pw_qpolynomial> and
3611 C<isl_printer_print_pw_qpolynomial_fold>,
3612 the output format of the printer
3613 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3614 For C<isl_printer_print_union_pw_qpolynomial> and
3615 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3617 In case of printing in C<ISL_FORMAT_C>, the user may want
3618 to set the names of all dimensions first.
3620 C<isl> also provides limited support for printing YAML documents,
3621 just enough for the internal use for printing such documents.
3623 #include <isl/printer.h>
3624 __isl_give isl_printer *isl_printer_yaml_start_mapping(
3625 __isl_take isl_printer *p);
3626 __isl_give isl_printer *isl_printer_yaml_end_mapping(
3627 __isl_take isl_printer *p);
3628 __isl_give isl_printer *isl_printer_yaml_start_sequence(
3629 __isl_take isl_printer *p);
3630 __isl_give isl_printer *isl_printer_yaml_end_sequence(
3631 __isl_take isl_printer *p);
3632 __isl_give isl_printer *isl_printer_yaml_next(
3633 __isl_take isl_printer *p);
3635 A document is started by a call to either
3636 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3637 Anything printed to the printer after such a call belong to the
3638 first key of the mapping or the first element in the sequence.
3639 The function C<isl_printer_yaml_next> moves to the value if
3640 we are currently printing a mapping key, the next key if we
3641 are printing a value or the next element if we are printing
3642 an element in a sequence.
3643 Nested mappings and sequences are initiated by the same
3644 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3645 Each call to these functions needs to have a corresponding call to
3646 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3648 When called on a file printer, the following function flushes
3649 the file. When called on a string printer, the buffer is cleared.
3651 __isl_give isl_printer *isl_printer_flush(
3652 __isl_take isl_printer *p);
3654 The following functions allow the user to attach
3655 notes to a printer in order to keep track of additional state.
3657 #include <isl/printer.h>
3658 isl_bool isl_printer_has_note(__isl_keep isl_printer *p,
3659 __isl_keep isl_id *id);
3660 __isl_give isl_id *isl_printer_get_note(
3661 __isl_keep isl_printer *p, __isl_take isl_id *id);
3662 __isl_give isl_printer *isl_printer_set_note(
3663 __isl_take isl_printer *p,
3664 __isl_take isl_id *id, __isl_take isl_id *note);
3666 C<isl_printer_set_note> associates the given note to the given
3667 identifier in the printer.
3668 C<isl_printer_get_note> retrieves a note associated to an
3670 C<isl_printer_has_note> checks if there is such a note.
3671 C<isl_printer_get_note> fails if the requested note does not exist.
3673 Alternatively, a string representation can be obtained
3674 directly using the following functions, which always print
3677 #include <isl/space.h>
3678 __isl_give char *isl_space_to_str(
3679 __isl_keep isl_space *space);
3681 #include <isl/val.h>
3682 __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3683 __isl_give char *isl_multi_val_to_str(
3684 __isl_keep isl_multi_val *mv);
3686 #include <isl/set.h>
3687 __isl_give char *isl_basic_set_to_str(
3688 __isl_keep isl_basic_set *bset);
3689 __isl_give char *isl_set_to_str(
3690 __isl_keep isl_set *set);
3692 #include <isl/union_set.h>
3693 __isl_give char *isl_union_set_to_str(
3694 __isl_keep isl_union_set *uset);
3696 #include <isl/map.h>
3697 __isl_give char *isl_basic_map_to_str(
3698 __isl_keep isl_basic_map *bmap);
3699 __isl_give char *isl_map_to_str(
3700 __isl_keep isl_map *map);
3702 #include <isl/union_map.h>
3703 __isl_give char *isl_union_map_to_str(
3704 __isl_keep isl_union_map *umap);
3706 #include <isl/aff.h>
3707 __isl_give char *isl_aff_to_str(__isl_keep isl_aff *aff);
3708 __isl_give char *isl_pw_aff_to_str(
3709 __isl_keep isl_pw_aff *pa);
3710 __isl_give char *isl_multi_aff_to_str(
3711 __isl_keep isl_multi_aff *ma);
3712 __isl_give char *isl_pw_multi_aff_to_str(
3713 __isl_keep isl_pw_multi_aff *pma);
3714 __isl_give char *isl_multi_pw_aff_to_str(
3715 __isl_keep isl_multi_pw_aff *mpa);
3716 __isl_give char *isl_union_pw_aff_to_str(
3717 __isl_keep isl_union_pw_aff *upa);
3718 __isl_give char *isl_union_pw_multi_aff_to_str(
3719 __isl_keep isl_union_pw_multi_aff *upma);
3720 __isl_give char *isl_multi_union_pw_aff_to_str(
3721 __isl_keep isl_multi_union_pw_aff *mupa);
3723 #include <isl/point.h>
3724 __isl_give char *isl_point_to_str(
3725 __isl_keep isl_point *pnt);
3727 #include <isl/polynomial.h>
3728 __isl_give char *isl_pw_qpolynomial_to_str(
3729 __isl_keep isl_pw_qpolynomial *pwqp);
3730 __isl_give char *isl_union_pw_qpolynomial_to_str(
3731 __isl_keep isl_union_pw_qpolynomial *upwqp);
3735 =head3 Unary Properties
3741 The following functions test whether the given set or relation
3742 contains any integer points. The ``plain'' variants do not perform
3743 any computations, but simply check if the given set or relation
3744 is already known to be empty.
3746 isl_bool isl_basic_set_plain_is_empty(
3747 __isl_keep isl_basic_set *bset);
3748 isl_bool isl_basic_set_is_empty(
3749 __isl_keep isl_basic_set *bset);
3750 isl_bool isl_set_plain_is_empty(
3751 __isl_keep isl_set *set);
3752 isl_bool isl_set_is_empty(__isl_keep isl_set *set);
3753 isl_bool isl_union_set_is_empty(
3754 __isl_keep isl_union_set *uset);
3755 isl_bool isl_basic_map_plain_is_empty(
3756 __isl_keep isl_basic_map *bmap);
3757 isl_bool isl_basic_map_is_empty(
3758 __isl_keep isl_basic_map *bmap);
3759 isl_bool isl_map_plain_is_empty(
3760 __isl_keep isl_map *map);
3761 isl_bool isl_map_is_empty(__isl_keep isl_map *map);
3762 isl_bool isl_union_map_is_empty(
3763 __isl_keep isl_union_map *umap);
3765 =item * Universality
3767 isl_bool isl_basic_set_plain_is_universe(
3768 __isl_keep isl_basic_set *bset);
3769 isl_bool isl_basic_set_is_universe(
3770 __isl_keep isl_basic_set *bset);
3771 isl_bool isl_basic_map_plain_is_universe(
3772 __isl_keep isl_basic_map *bmap);
3773 isl_bool isl_basic_map_is_universe(
3774 __isl_keep isl_basic_map *bmap);
3775 isl_bool isl_set_plain_is_universe(
3776 __isl_keep isl_set *set);
3777 isl_bool isl_map_plain_is_universe(
3778 __isl_keep isl_map *map);
3780 =item * Single-valuedness
3782 #include <isl/set.h>
3783 isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
3785 #include <isl/map.h>
3786 isl_bool isl_basic_map_is_single_valued(
3787 __isl_keep isl_basic_map *bmap);
3788 isl_bool isl_map_plain_is_single_valued(
3789 __isl_keep isl_map *map);
3790 isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
3792 #include <isl/union_map.h>
3793 isl_bool isl_union_map_is_single_valued(
3794 __isl_keep isl_union_map *umap);
3798 isl_bool isl_map_plain_is_injective(
3799 __isl_keep isl_map *map);
3800 isl_bool isl_map_is_injective(
3801 __isl_keep isl_map *map);
3802 isl_bool isl_union_map_plain_is_injective(
3803 __isl_keep isl_union_map *umap);
3804 isl_bool isl_union_map_is_injective(
3805 __isl_keep isl_union_map *umap);
3809 isl_bool isl_map_is_bijective(
3810 __isl_keep isl_map *map);
3811 isl_bool isl_union_map_is_bijective(
3812 __isl_keep isl_union_map *umap);
3816 The following functions test whether the given relation
3817 only maps elements to themselves.
3819 #include <isl/map.h>
3820 isl_bool isl_map_is_identity(
3821 __isl_keep isl_map *map);
3823 #include <isl/union_map.h>
3824 isl_bool isl_union_map_is_identity(
3825 __isl_keep isl_union_map *umap);
3829 __isl_give isl_val *
3830 isl_basic_map_plain_get_val_if_fixed(
3831 __isl_keep isl_basic_map *bmap,
3832 enum isl_dim_type type, unsigned pos);
3833 __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3834 __isl_keep isl_set *set,
3835 enum isl_dim_type type, unsigned pos);
3836 __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3837 __isl_keep isl_map *map,
3838 enum isl_dim_type type, unsigned pos);
3840 If the set or relation obviously lies on a hyperplane where the given dimension
3841 has a fixed value, then return that value.
3842 Otherwise return NaN.
3846 isl_stat isl_set_dim_residue_class_val(
3847 __isl_keep isl_set *set,
3848 int pos, __isl_give isl_val **modulo,
3849 __isl_give isl_val **residue);
3851 Check if the values of the given set dimension are equal to a fixed
3852 value modulo some integer value. If so, assign the modulo to C<*modulo>
3853 and the fixed value to C<*residue>. If the given dimension attains only
3854 a single value, then assign C<0> to C<*modulo> and the fixed value to
3856 If the dimension does not attain only a single value and if no modulo
3857 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3861 To check whether the description of a set, relation or function depends
3862 on one or more given dimensions,
3863 the following functions can be used.
3865 #include <isl/constraint.h>
3866 isl_bool isl_constraint_involves_dims(
3867 __isl_keep isl_constraint *constraint,
3868 enum isl_dim_type type, unsigned first, unsigned n);
3870 #include <isl/set.h>
3871 isl_bool isl_basic_set_involves_dims(
3872 __isl_keep isl_basic_set *bset,
3873 enum isl_dim_type type, unsigned first, unsigned n);
3874 isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
3875 enum isl_dim_type type, unsigned first, unsigned n);
3877 #include <isl/map.h>
3878 isl_bool isl_basic_map_involves_dims(
3879 __isl_keep isl_basic_map *bmap,
3880 enum isl_dim_type type, unsigned first, unsigned n);
3881 isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
3882 enum isl_dim_type type, unsigned first, unsigned n);
3884 #include <isl/union_map.h>
3885 isl_bool isl_union_map_involves_dims(
3886 __isl_keep isl_union_map *umap,
3887 enum isl_dim_type type, unsigned first, unsigned n);
3889 #include <isl/aff.h>
3890 isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
3891 enum isl_dim_type type, unsigned first, unsigned n);
3892 isl_bool isl_pw_aff_involves_dims(
3893 __isl_keep isl_pw_aff *pwaff,
3894 enum isl_dim_type type, unsigned first, unsigned n);
3895 isl_bool isl_multi_aff_involves_dims(
3896 __isl_keep isl_multi_aff *ma,
3897 enum isl_dim_type type, unsigned first, unsigned n);
3898 isl_bool isl_multi_pw_aff_involves_dims(
3899 __isl_keep isl_multi_pw_aff *mpa,
3900 enum isl_dim_type type, unsigned first, unsigned n);
3902 #include <isl/polynomial.h>
3903 isl_bool isl_qpolynomial_involves_dims(
3904 __isl_keep isl_qpolynomial *qp,
3905 enum isl_dim_type type, unsigned first, unsigned n);
3907 Similarly, the following functions can be used to check whether
3908 a given dimension is involved in any lower or upper bound.
3910 #include <isl/set.h>
3911 isl_bool isl_set_dim_has_any_lower_bound(
3912 __isl_keep isl_set *set,
3913 enum isl_dim_type type, unsigned pos);
3914 isl_bool isl_set_dim_has_any_upper_bound(
3915 __isl_keep isl_set *set,
3916 enum isl_dim_type type, unsigned pos);
3918 Note that these functions return true even if there is a bound on
3919 the dimension on only some of the basic sets of C<set>.
3920 To check if they have a bound for all of the basic sets in C<set>,
3921 use the following functions instead.
3923 #include <isl/set.h>
3924 isl_bool isl_set_dim_has_lower_bound(
3925 __isl_keep isl_set *set,
3926 enum isl_dim_type type, unsigned pos);
3927 isl_bool isl_set_dim_has_upper_bound(
3928 __isl_keep isl_set *set,
3929 enum isl_dim_type type, unsigned pos);
3933 To check whether a set is a parameter domain, use this function:
3935 isl_bool isl_set_is_params(__isl_keep isl_set *set);
3936 isl_bool isl_union_set_is_params(
3937 __isl_keep isl_union_set *uset);
3941 The following functions check whether the space of the given
3942 (basic) set or relation range is a wrapped relation.
3944 #include <isl/space.h>
3945 isl_bool isl_space_is_wrapping(
3946 __isl_keep isl_space *space);
3947 isl_bool isl_space_domain_is_wrapping(
3948 __isl_keep isl_space *space);
3949 isl_bool isl_space_range_is_wrapping(
3950 __isl_keep isl_space *space);
3952 #include <isl/set.h>
3953 isl_bool isl_basic_set_is_wrapping(
3954 __isl_keep isl_basic_set *bset);
3955 isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
3957 #include <isl/map.h>
3958 isl_bool isl_map_domain_is_wrapping(
3959 __isl_keep isl_map *map);
3960 isl_bool isl_map_range_is_wrapping(
3961 __isl_keep isl_map *map);
3963 #include <isl/val.h>
3964 isl_bool isl_multi_val_range_is_wrapping(
3965 __isl_keep isl_multi_val *mv);
3967 #include <isl/aff.h>
3968 isl_bool isl_multi_aff_range_is_wrapping(
3969 __isl_keep isl_multi_aff *ma);
3970 isl_bool isl_multi_pw_aff_range_is_wrapping(
3971 __isl_keep isl_multi_pw_aff *mpa);
3972 isl_bool isl_multi_union_pw_aff_range_is_wrapping(
3973 __isl_keep isl_multi_union_pw_aff *mupa);
3975 The input to C<isl_space_is_wrapping> should
3976 be the space of a set, while that of
3977 C<isl_space_domain_is_wrapping> and
3978 C<isl_space_range_is_wrapping> should be the space of a relation.
3980 =item * Internal Product
3982 isl_bool isl_basic_map_can_zip(
3983 __isl_keep isl_basic_map *bmap);
3984 isl_bool isl_map_can_zip(__isl_keep isl_map *map);
3986 Check whether the product of domain and range of the given relation
3988 i.e., whether both domain and range are nested relations.
3992 #include <isl/space.h>
3993 isl_bool isl_space_can_curry(
3994 __isl_keep isl_space *space);
3996 #include <isl/map.h>
3997 isl_bool isl_basic_map_can_curry(
3998 __isl_keep isl_basic_map *bmap);
3999 isl_bool isl_map_can_curry(__isl_keep isl_map *map);
4001 Check whether the domain of the (basic) relation is a wrapped relation.
4003 #include <isl/space.h>
4004 __isl_give isl_space *isl_space_uncurry(
4005 __isl_take isl_space *space);
4007 #include <isl/map.h>
4008 isl_bool isl_basic_map_can_uncurry(
4009 __isl_keep isl_basic_map *bmap);
4010 isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
4012 Check whether the range of the (basic) relation is a wrapped relation.
4014 #include <isl/space.h>
4015 isl_bool isl_space_can_range_curry(
4016 __isl_keep isl_space *space);
4018 #include <isl/map.h>
4019 isl_bool isl_map_can_range_curry(
4020 __isl_keep isl_map *map);
4022 Check whether the domain of the relation wrapped in the range of
4023 the input is itself a wrapped relation.
4025 =item * Special Values
4027 #include <isl/aff.h>
4028 isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
4029 isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
4030 isl_bool isl_multi_pw_aff_is_cst(
4031 __isl_keep isl_multi_pw_aff *mpa);
4033 Check whether the given expression is a constant.
4035 #include <isl/aff.h>
4036 isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
4037 isl_bool isl_pw_aff_involves_nan(
4038 __isl_keep isl_pw_aff *pa);
4040 #include <isl/polynomial.h>
4041 isl_bool isl_qpolynomial_fold_is_nan(
4042 __isl_keep isl_qpolynomial_fold *fold);
4044 Check whether the given expression is equal to or involves NaN.
4046 #include <isl/aff.h>
4047 isl_bool isl_aff_plain_is_zero(
4048 __isl_keep isl_aff *aff);
4050 Check whether the affine expression is obviously zero.
4054 =head3 Binary Properties
4060 The following functions check whether two objects
4061 represent the same set, relation or function.
4062 The C<plain> variants only return true if the objects
4063 are obviously the same. That is, they may return false
4064 even if the objects are the same, but they will never
4065 return true if the objects are not the same.
4067 #include <isl/set.h>
4068 isl_bool isl_basic_set_plain_is_equal(
4069 __isl_keep isl_basic_set *bset1,
4070 __isl_keep isl_basic_set *bset2);
4071 isl_bool isl_basic_set_is_equal(
4072 __isl_keep isl_basic_set *bset1,
4073 __isl_keep isl_basic_set *bset2);
4074 isl_bool isl_set_plain_is_equal(
4075 __isl_keep isl_set *set1,
4076 __isl_keep isl_set *set2);
4077 isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
4078 __isl_keep isl_set *set2);
4080 #include <isl/map.h>
4081 isl_bool isl_basic_map_is_equal(
4082 __isl_keep isl_basic_map *bmap1,
4083 __isl_keep isl_basic_map *bmap2);
4084 isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
4085 __isl_keep isl_map *map2);
4086 isl_bool isl_map_plain_is_equal(
4087 __isl_keep isl_map *map1,
4088 __isl_keep isl_map *map2);
4090 #include <isl/union_set.h>
4091 isl_bool isl_union_set_is_equal(
4092 __isl_keep isl_union_set *uset1,
4093 __isl_keep isl_union_set *uset2);
4095 #include <isl/union_map.h>
4096 isl_bool isl_union_map_is_equal(
4097 __isl_keep isl_union_map *umap1,
4098 __isl_keep isl_union_map *umap2);
4100 #include <isl/aff.h>
4101 isl_bool isl_aff_plain_is_equal(
4102 __isl_keep isl_aff *aff1,
4103 __isl_keep isl_aff *aff2);
4104 isl_bool isl_multi_aff_plain_is_equal(
4105 __isl_keep isl_multi_aff *maff1,
4106 __isl_keep isl_multi_aff *maff2);
4107 isl_bool isl_pw_aff_plain_is_equal(
4108 __isl_keep isl_pw_aff *pwaff1,
4109 __isl_keep isl_pw_aff *pwaff2);
4110 isl_bool isl_pw_multi_aff_plain_is_equal(
4111 __isl_keep isl_pw_multi_aff *pma1,
4112 __isl_keep isl_pw_multi_aff *pma2);
4113 isl_bool isl_multi_pw_aff_plain_is_equal(
4114 __isl_keep isl_multi_pw_aff *mpa1,
4115 __isl_keep isl_multi_pw_aff *mpa2);
4116 isl_bool isl_multi_pw_aff_is_equal(
4117 __isl_keep isl_multi_pw_aff *mpa1,
4118 __isl_keep isl_multi_pw_aff *mpa2);
4119 isl_bool isl_union_pw_aff_plain_is_equal(
4120 __isl_keep isl_union_pw_aff *upa1,
4121 __isl_keep isl_union_pw_aff *upa2);
4122 isl_bool isl_union_pw_multi_aff_plain_is_equal(
4123 __isl_keep isl_union_pw_multi_aff *upma1,
4124 __isl_keep isl_union_pw_multi_aff *upma2);
4125 isl_bool isl_multi_union_pw_aff_plain_is_equal(
4126 __isl_keep isl_multi_union_pw_aff *mupa1,
4127 __isl_keep isl_multi_union_pw_aff *mupa2);
4129 #include <isl/polynomial.h>
4130 isl_bool isl_union_pw_qpolynomial_plain_is_equal(
4131 __isl_keep isl_union_pw_qpolynomial *upwqp1,
4132 __isl_keep isl_union_pw_qpolynomial *upwqp2);
4133 isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
4134 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
4135 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
4137 =item * Disjointness
4139 #include <isl/set.h>
4140 isl_bool isl_basic_set_is_disjoint(
4141 __isl_keep isl_basic_set *bset1,
4142 __isl_keep isl_basic_set *bset2);
4143 isl_bool isl_set_plain_is_disjoint(
4144 __isl_keep isl_set *set1,
4145 __isl_keep isl_set *set2);
4146 isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
4147 __isl_keep isl_set *set2);
4149 #include <isl/map.h>
4150 isl_bool isl_basic_map_is_disjoint(
4151 __isl_keep isl_basic_map *bmap1,
4152 __isl_keep isl_basic_map *bmap2);
4153 isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
4154 __isl_keep isl_map *map2);
4156 #include <isl/union_set.h>
4157 isl_bool isl_union_set_is_disjoint(
4158 __isl_keep isl_union_set *uset1,
4159 __isl_keep isl_union_set *uset2);
4161 #include <isl/union_map.h>
4162 isl_bool isl_union_map_is_disjoint(
4163 __isl_keep isl_union_map *umap1,
4164 __isl_keep isl_union_map *umap2);
4168 isl_bool isl_basic_set_is_subset(
4169 __isl_keep isl_basic_set *bset1,
4170 __isl_keep isl_basic_set *bset2);
4171 isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4172 __isl_keep isl_set *set2);
4173 isl_bool isl_set_is_strict_subset(
4174 __isl_keep isl_set *set1,
4175 __isl_keep isl_set *set2);
4176 isl_bool isl_union_set_is_subset(
4177 __isl_keep isl_union_set *uset1,
4178 __isl_keep isl_union_set *uset2);
4179 isl_bool isl_union_set_is_strict_subset(
4180 __isl_keep isl_union_set *uset1,
4181 __isl_keep isl_union_set *uset2);
4182 isl_bool isl_basic_map_is_subset(
4183 __isl_keep isl_basic_map *bmap1,
4184 __isl_keep isl_basic_map *bmap2);
4185 isl_bool isl_basic_map_is_strict_subset(
4186 __isl_keep isl_basic_map *bmap1,
4187 __isl_keep isl_basic_map *bmap2);
4188 isl_bool isl_map_is_subset(
4189 __isl_keep isl_map *map1,
4190 __isl_keep isl_map *map2);
4191 isl_bool isl_map_is_strict_subset(
4192 __isl_keep isl_map *map1,
4193 __isl_keep isl_map *map2);
4194 isl_bool isl_union_map_is_subset(
4195 __isl_keep isl_union_map *umap1,
4196 __isl_keep isl_union_map *umap2);
4197 isl_bool isl_union_map_is_strict_subset(
4198 __isl_keep isl_union_map *umap1,
4199 __isl_keep isl_union_map *umap2);
4201 Check whether the first argument is a (strict) subset of the
4206 Every comparison function returns a negative value if the first
4207 argument is considered smaller than the second, a positive value
4208 if the first argument is considered greater and zero if the two
4209 constraints are considered the same by the comparison criterion.
4211 #include <isl/constraint.h>
4212 int isl_constraint_plain_cmp(
4213 __isl_keep isl_constraint *c1,
4214 __isl_keep isl_constraint *c2);
4216 This function is useful for sorting C<isl_constraint>s.
4217 The order depends on the internal representation of the inputs.
4218 The order is fixed over different calls to the function (assuming
4219 the internal representation of the inputs has not changed), but may
4220 change over different versions of C<isl>.
4222 #include <isl/constraint.h>
4223 int isl_constraint_cmp_last_non_zero(
4224 __isl_keep isl_constraint *c1,
4225 __isl_keep isl_constraint *c2);
4227 This function can be used to sort constraints that live in the same
4228 local space. Constraints that involve ``earlier'' dimensions or
4229 that have a smaller coefficient for the shared latest dimension
4230 are considered smaller than other constraints.
4231 This function only defines a B<partial> order.
4233 #include <isl/set.h>
4234 int isl_set_plain_cmp(__isl_keep isl_set *set1,
4235 __isl_keep isl_set *set2);
4237 This function is useful for sorting C<isl_set>s.
4238 The order depends on the internal representation of the inputs.
4239 The order is fixed over different calls to the function (assuming
4240 the internal representation of the inputs has not changed), but may
4241 change over different versions of C<isl>.
4243 #include <isl/aff.h>
4244 int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4245 __isl_keep isl_pw_aff *pa2);
4247 The function C<isl_pw_aff_plain_cmp> can be used to sort
4248 C<isl_pw_aff>s. The order is not strictly defined.
4249 The current order sorts expressions that only involve
4250 earlier dimensions before those that involve later dimensions.
4254 =head2 Unary Operations
4260 __isl_give isl_set *isl_set_complement(
4261 __isl_take isl_set *set);
4262 __isl_give isl_map *isl_map_complement(
4263 __isl_take isl_map *map);
4267 #include <isl/space.h>
4268 __isl_give isl_space *isl_space_reverse(
4269 __isl_take isl_space *space);
4271 #include <isl/map.h>
4272 __isl_give isl_basic_map *isl_basic_map_reverse(
4273 __isl_take isl_basic_map *bmap);
4274 __isl_give isl_map *isl_map_reverse(
4275 __isl_take isl_map *map);
4277 #include <isl/union_map.h>
4278 __isl_give isl_union_map *isl_union_map_reverse(
4279 __isl_take isl_union_map *umap);
4283 #include <isl/space.h>
4284 __isl_give isl_space *isl_space_domain(
4285 __isl_take isl_space *space);
4286 __isl_give isl_space *isl_space_range(
4287 __isl_take isl_space *space);
4288 __isl_give isl_space *isl_space_params(
4289 __isl_take isl_space *space);
4291 #include <isl/local_space.h>
4292 __isl_give isl_local_space *isl_local_space_domain(
4293 __isl_take isl_local_space *ls);
4294 __isl_give isl_local_space *isl_local_space_range(
4295 __isl_take isl_local_space *ls);
4297 #include <isl/set.h>
4298 __isl_give isl_basic_set *isl_basic_set_project_out(
4299 __isl_take isl_basic_set *bset,
4300 enum isl_dim_type type, unsigned first, unsigned n);
4301 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4302 enum isl_dim_type type, unsigned first, unsigned n);
4303 __isl_give isl_map *isl_set_project_onto_map(
4304 __isl_take isl_set *set,
4305 enum isl_dim_type type, unsigned first,
4307 __isl_give isl_basic_set *isl_basic_set_params(
4308 __isl_take isl_basic_set *bset);
4309 __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4311 The function C<isl_set_project_onto_map> returns a relation
4312 that projects the input set onto the given set dimensions.
4314 #include <isl/map.h>
4315 __isl_give isl_basic_map *isl_basic_map_project_out(
4316 __isl_take isl_basic_map *bmap,
4317 enum isl_dim_type type, unsigned first, unsigned n);
4318 __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4319 enum isl_dim_type type, unsigned first, unsigned n);
4320 __isl_give isl_basic_set *isl_basic_map_domain(
4321 __isl_take isl_basic_map *bmap);
4322 __isl_give isl_basic_set *isl_basic_map_range(
4323 __isl_take isl_basic_map *bmap);
4324 __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4325 __isl_give isl_set *isl_map_domain(
4326 __isl_take isl_map *bmap);
4327 __isl_give isl_set *isl_map_range(
4328 __isl_take isl_map *map);
4330 #include <isl/union_set.h>
4331 __isl_give isl_union_set *isl_union_set_project_out(
4332 __isl_take isl_union_set *uset,
4333 enum isl_dim_type type,
4334 unsigned first, unsigned n);
4335 __isl_give isl_set *isl_union_set_params(
4336 __isl_take isl_union_set *uset);
4338 The function C<isl_union_set_project_out> can only project out
4341 #include <isl/union_map.h>
4342 __isl_give isl_union_map *isl_union_map_project_out(
4343 __isl_take isl_union_map *umap,
4344 enum isl_dim_type type, unsigned first, unsigned n);
4345 __isl_give isl_set *isl_union_map_params(
4346 __isl_take isl_union_map *umap);
4347 __isl_give isl_union_set *isl_union_map_domain(
4348 __isl_take isl_union_map *umap);
4349 __isl_give isl_union_set *isl_union_map_range(
4350 __isl_take isl_union_map *umap);
4352 The function C<isl_union_map_project_out> can only project out
4355 #include <isl/aff.h>
4356 __isl_give isl_aff *isl_aff_project_domain_on_params(
4357 __isl_take isl_aff *aff);
4358 __isl_give isl_pw_multi_aff *
4359 isl_pw_multi_aff_project_domain_on_params(
4360 __isl_take isl_pw_multi_aff *pma);
4361 __isl_give isl_set *isl_pw_aff_domain(
4362 __isl_take isl_pw_aff *pwaff);
4363 __isl_give isl_set *isl_pw_multi_aff_domain(
4364 __isl_take isl_pw_multi_aff *pma);
4365 __isl_give isl_set *isl_multi_pw_aff_domain(
4366 __isl_take isl_multi_pw_aff *mpa);
4367 __isl_give isl_union_set *isl_union_pw_aff_domain(
4368 __isl_take isl_union_pw_aff *upa);
4369 __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4370 __isl_take isl_union_pw_multi_aff *upma);
4371 __isl_give isl_union_set *
4372 isl_multi_union_pw_aff_domain(
4373 __isl_take isl_multi_union_pw_aff *mupa);
4374 __isl_give isl_set *isl_pw_aff_params(
4375 __isl_take isl_pw_aff *pwa);
4377 The function C<isl_multi_union_pw_aff_domain> requires its
4378 input to have at least one set dimension.
4380 #include <isl/polynomial.h>
4381 __isl_give isl_qpolynomial *
4382 isl_qpolynomial_project_domain_on_params(
4383 __isl_take isl_qpolynomial *qp);
4384 __isl_give isl_pw_qpolynomial *
4385 isl_pw_qpolynomial_project_domain_on_params(
4386 __isl_take isl_pw_qpolynomial *pwqp);
4387 __isl_give isl_pw_qpolynomial_fold *
4388 isl_pw_qpolynomial_fold_project_domain_on_params(
4389 __isl_take isl_pw_qpolynomial_fold *pwf);
4390 __isl_give isl_set *isl_pw_qpolynomial_domain(
4391 __isl_take isl_pw_qpolynomial *pwqp);
4392 __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4393 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4394 __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4395 __isl_take isl_union_pw_qpolynomial *upwqp);
4397 #include <isl/space.h>
4398 __isl_give isl_space *isl_space_domain_map(
4399 __isl_take isl_space *space);
4400 __isl_give isl_space *isl_space_range_map(
4401 __isl_take isl_space *space);
4403 #include <isl/map.h>
4404 __isl_give isl_map *isl_set_wrapped_domain_map(
4405 __isl_take isl_set *set);
4406 __isl_give isl_basic_map *isl_basic_map_domain_map(
4407 __isl_take isl_basic_map *bmap);
4408 __isl_give isl_basic_map *isl_basic_map_range_map(
4409 __isl_take isl_basic_map *bmap);
4410 __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4411 __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4413 #include <isl/union_map.h>
4414 __isl_give isl_union_map *isl_union_map_domain_map(
4415 __isl_take isl_union_map *umap);
4416 __isl_give isl_union_pw_multi_aff *
4417 isl_union_map_domain_map_union_pw_multi_aff(
4418 __isl_take isl_union_map *umap);
4419 __isl_give isl_union_map *isl_union_map_range_map(
4420 __isl_take isl_union_map *umap);
4421 __isl_give isl_union_map *
4422 isl_union_set_wrapped_domain_map(
4423 __isl_take isl_union_set *uset);
4425 The functions above construct a (basic, regular or union) relation
4426 that maps (a wrapped version of) the input relation to its domain or range.
4427 C<isl_set_wrapped_domain_map> maps the input set to the domain
4428 of its wrapped relation.
4432 __isl_give isl_basic_set *isl_basic_set_eliminate(
4433 __isl_take isl_basic_set *bset,
4434 enum isl_dim_type type,
4435 unsigned first, unsigned n);
4436 __isl_give isl_set *isl_set_eliminate(
4437 __isl_take isl_set *set, enum isl_dim_type type,
4438 unsigned first, unsigned n);
4439 __isl_give isl_basic_map *isl_basic_map_eliminate(
4440 __isl_take isl_basic_map *bmap,
4441 enum isl_dim_type type,
4442 unsigned first, unsigned n);
4443 __isl_give isl_map *isl_map_eliminate(
4444 __isl_take isl_map *map, enum isl_dim_type type,
4445 unsigned first, unsigned n);
4447 Eliminate the coefficients for the given dimensions from the constraints,
4448 without removing the dimensions.
4450 =item * Constructing a set from a parameter domain
4452 A zero-dimensional space or (basic) set can be constructed
4453 on a given parameter domain using the following functions.
4455 #include <isl/space.h>
4456 __isl_give isl_space *isl_space_set_from_params(
4457 __isl_take isl_space *space);
4459 #include <isl/set.h>
4460 __isl_give isl_basic_set *isl_basic_set_from_params(
4461 __isl_take isl_basic_set *bset);
4462 __isl_give isl_set *isl_set_from_params(
4463 __isl_take isl_set *set);
4465 =item * Constructing a relation from one or two sets
4467 Create a relation with the given set(s) as domain and/or range.
4468 If only the domain or the range is specified, then
4469 the range or domain of the created relation is a zero-dimensional
4470 flat anonymous space.
4472 #include <isl/space.h>
4473 __isl_give isl_space *isl_space_from_domain(
4474 __isl_take isl_space *space);
4475 __isl_give isl_space *isl_space_from_range(
4476 __isl_take isl_space *space);
4477 __isl_give isl_space *isl_space_map_from_set(
4478 __isl_take isl_space *space);
4479 __isl_give isl_space *isl_space_map_from_domain_and_range(
4480 __isl_take isl_space *domain,
4481 __isl_take isl_space *range);
4483 #include <isl/local_space.h>
4484 __isl_give isl_local_space *isl_local_space_from_domain(
4485 __isl_take isl_local_space *ls);
4487 #include <isl/map.h>
4488 __isl_give isl_map *isl_map_from_domain(
4489 __isl_take isl_set *set);
4490 __isl_give isl_map *isl_map_from_range(
4491 __isl_take isl_set *set);
4493 #include <isl/union_map.h>
4494 __isl_give isl_union_map *
4495 isl_union_map_from_domain_and_range(
4496 __isl_take isl_union_set *domain,
4497 __isl_take isl_union_set *range);
4499 #include <isl/val.h>
4500 __isl_give isl_multi_val *isl_multi_val_from_range(
4501 __isl_take isl_multi_val *mv);
4503 #include <isl/aff.h>
4504 __isl_give isl_multi_aff *isl_multi_aff_from_range(
4505 __isl_take isl_multi_aff *ma);
4506 __isl_give isl_pw_aff *isl_pw_aff_from_range(
4507 __isl_take isl_pw_aff *pwa);
4508 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4509 __isl_take isl_multi_pw_aff *mpa);
4510 __isl_give isl_multi_union_pw_aff *
4511 isl_multi_union_pw_aff_from_range(
4512 __isl_take isl_multi_union_pw_aff *mupa);
4513 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4514 __isl_take isl_set *set);
4515 __isl_give isl_union_pw_multi_aff *
4516 isl_union_pw_multi_aff_from_domain(
4517 __isl_take isl_union_set *uset);
4521 #include <isl/set.h>
4522 __isl_give isl_basic_set *isl_basic_set_fix_si(
4523 __isl_take isl_basic_set *bset,
4524 enum isl_dim_type type, unsigned pos, int value);
4525 __isl_give isl_basic_set *isl_basic_set_fix_val(
4526 __isl_take isl_basic_set *bset,
4527 enum isl_dim_type type, unsigned pos,
4528 __isl_take isl_val *v);
4529 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4530 enum isl_dim_type type, unsigned pos, int value);
4531 __isl_give isl_set *isl_set_fix_val(
4532 __isl_take isl_set *set,
4533 enum isl_dim_type type, unsigned pos,
4534 __isl_take isl_val *v);
4536 #include <isl/map.h>
4537 __isl_give isl_basic_map *isl_basic_map_fix_si(
4538 __isl_take isl_basic_map *bmap,
4539 enum isl_dim_type type, unsigned pos, int value);
4540 __isl_give isl_basic_map *isl_basic_map_fix_val(
4541 __isl_take isl_basic_map *bmap,
4542 enum isl_dim_type type, unsigned pos,
4543 __isl_take isl_val *v);
4544 __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4545 enum isl_dim_type type, unsigned pos, int value);
4546 __isl_give isl_map *isl_map_fix_val(
4547 __isl_take isl_map *map,
4548 enum isl_dim_type type, unsigned pos,
4549 __isl_take isl_val *v);
4551 #include <isl/aff.h>
4552 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4553 __isl_take isl_pw_multi_aff *pma,
4554 enum isl_dim_type type, unsigned pos, int value);
4556 #include <isl/polynomial.h>
4557 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4558 __isl_take isl_pw_qpolynomial *pwqp,
4559 enum isl_dim_type type, unsigned n,
4560 __isl_take isl_val *v);
4562 Intersect the set, relation or function domain
4563 with the hyperplane where the given
4564 dimension has the fixed given value.
4566 __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4567 __isl_take isl_basic_map *bmap,
4568 enum isl_dim_type type, unsigned pos, int value);
4569 __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4570 __isl_take isl_basic_map *bmap,
4571 enum isl_dim_type type, unsigned pos, int value);
4572 __isl_give isl_set *isl_set_lower_bound_si(
4573 __isl_take isl_set *set,
4574 enum isl_dim_type type, unsigned pos, int value);
4575 __isl_give isl_set *isl_set_lower_bound_val(
4576 __isl_take isl_set *set,
4577 enum isl_dim_type type, unsigned pos,
4578 __isl_take isl_val *value);
4579 __isl_give isl_map *isl_map_lower_bound_si(
4580 __isl_take isl_map *map,
4581 enum isl_dim_type type, unsigned pos, int value);
4582 __isl_give isl_set *isl_set_upper_bound_si(
4583 __isl_take isl_set *set,
4584 enum isl_dim_type type, unsigned pos, int value);
4585 __isl_give isl_set *isl_set_upper_bound_val(
4586 __isl_take isl_set *set,
4587 enum isl_dim_type type, unsigned pos,
4588 __isl_take isl_val *value);
4589 __isl_give isl_map *isl_map_upper_bound_si(
4590 __isl_take isl_map *map,
4591 enum isl_dim_type type, unsigned pos, int value);
4593 Intersect the set or relation with the half-space where the given
4594 dimension has a value bounded by the fixed given integer value.
4596 __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4597 enum isl_dim_type type1, int pos1,
4598 enum isl_dim_type type2, int pos2);
4599 __isl_give isl_basic_map *isl_basic_map_equate(
4600 __isl_take isl_basic_map *bmap,
4601 enum isl_dim_type type1, int pos1,
4602 enum isl_dim_type type2, int pos2);
4603 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4604 enum isl_dim_type type1, int pos1,
4605 enum isl_dim_type type2, int pos2);
4607 Intersect the set or relation with the hyperplane where the given
4608 dimensions are equal to each other.
4610 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4611 enum isl_dim_type type1, int pos1,
4612 enum isl_dim_type type2, int pos2);
4614 Intersect the relation with the hyperplane where the given
4615 dimensions have opposite values.
4617 __isl_give isl_map *isl_map_order_le(
4618 __isl_take isl_map *map,
4619 enum isl_dim_type type1, int pos1,
4620 enum isl_dim_type type2, int pos2);
4621 __isl_give isl_basic_map *isl_basic_map_order_ge(
4622 __isl_take isl_basic_map *bmap,
4623 enum isl_dim_type type1, int pos1,
4624 enum isl_dim_type type2, int pos2);
4625 __isl_give isl_map *isl_map_order_ge(
4626 __isl_take isl_map *map,
4627 enum isl_dim_type type1, int pos1,
4628 enum isl_dim_type type2, int pos2);
4629 __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4630 enum isl_dim_type type1, int pos1,
4631 enum isl_dim_type type2, int pos2);
4632 __isl_give isl_basic_map *isl_basic_map_order_gt(
4633 __isl_take isl_basic_map *bmap,
4634 enum isl_dim_type type1, int pos1,
4635 enum isl_dim_type type2, int pos2);
4636 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4637 enum isl_dim_type type1, int pos1,
4638 enum isl_dim_type type2, int pos2);
4640 Intersect the relation with the half-space where the given
4641 dimensions satisfy the given ordering.
4645 #include <isl/aff.h>
4646 __isl_give isl_basic_set *isl_aff_zero_basic_set(
4647 __isl_take isl_aff *aff);
4648 __isl_give isl_basic_set *isl_aff_neg_basic_set(
4649 __isl_take isl_aff *aff);
4650 __isl_give isl_set *isl_pw_aff_pos_set(
4651 __isl_take isl_pw_aff *pa);
4652 __isl_give isl_set *isl_pw_aff_nonneg_set(
4653 __isl_take isl_pw_aff *pwaff);
4654 __isl_give isl_set *isl_pw_aff_zero_set(
4655 __isl_take isl_pw_aff *pwaff);
4656 __isl_give isl_set *isl_pw_aff_non_zero_set(
4657 __isl_take isl_pw_aff *pwaff);
4658 __isl_give isl_union_set *
4659 isl_union_pw_aff_zero_union_set(
4660 __isl_take isl_union_pw_aff *upa);
4661 __isl_give isl_union_set *
4662 isl_multi_union_pw_aff_zero_union_set(
4663 __isl_take isl_multi_union_pw_aff *mupa);
4665 The function C<isl_aff_neg_basic_set> returns a basic set
4666 containing those elements in the domain space
4667 of C<aff> where C<aff> is negative.
4668 The function C<isl_pw_aff_nonneg_set> returns a set
4669 containing those elements in the domain
4670 of C<pwaff> where C<pwaff> is non-negative.
4671 The function C<isl_multi_union_pw_aff_zero_union_set>
4672 returns a union set containing those elements
4673 in the domains of its elements where they are all zero.
4677 __isl_give isl_map *isl_set_identity(
4678 __isl_take isl_set *set);
4679 __isl_give isl_union_map *isl_union_set_identity(
4680 __isl_take isl_union_set *uset);
4681 __isl_give isl_union_pw_multi_aff *
4682 isl_union_set_identity_union_pw_multi_aff(
4683 __isl_take isl_union_set *uset);
4685 Construct an identity relation on the given (union) set.
4687 =item * Function Extraction
4689 A piecewise quasi affine expression that is equal to 1 on a set
4690 and 0 outside the set can be created using the following function.
4692 #include <isl/aff.h>
4693 __isl_give isl_pw_aff *isl_set_indicator_function(
4694 __isl_take isl_set *set);
4696 A piecewise multiple quasi affine expression can be extracted
4697 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4698 and the C<isl_map> is single-valued.
4699 In case of a conversion from an C<isl_union_map>
4700 to an C<isl_union_pw_multi_aff>, these properties need to hold
4701 in each domain space.
4702 A conversion to a C<isl_multi_union_pw_aff> additionally
4703 requires that the input is non-empty and involves only a single
4706 #include <isl/aff.h>
4707 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4708 __isl_take isl_set *set);
4709 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4710 __isl_take isl_map *map);
4712 __isl_give isl_union_pw_multi_aff *
4713 isl_union_pw_multi_aff_from_union_set(
4714 __isl_take isl_union_set *uset);
4715 __isl_give isl_union_pw_multi_aff *
4716 isl_union_pw_multi_aff_from_union_map(
4717 __isl_take isl_union_map *umap);
4719 __isl_give isl_multi_union_pw_aff *
4720 isl_multi_union_pw_aff_from_union_map(
4721 __isl_take isl_union_map *umap);
4725 __isl_give isl_basic_set *isl_basic_map_deltas(
4726 __isl_take isl_basic_map *bmap);
4727 __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4728 __isl_give isl_union_set *isl_union_map_deltas(
4729 __isl_take isl_union_map *umap);
4731 These functions return a (basic) set containing the differences
4732 between image elements and corresponding domain elements in the input.
4734 __isl_give isl_basic_map *isl_basic_map_deltas_map(
4735 __isl_take isl_basic_map *bmap);
4736 __isl_give isl_map *isl_map_deltas_map(
4737 __isl_take isl_map *map);
4738 __isl_give isl_union_map *isl_union_map_deltas_map(
4739 __isl_take isl_union_map *umap);
4741 The functions above construct a (basic, regular or union) relation
4742 that maps (a wrapped version of) the input relation to its delta set.
4746 Simplify the representation of a set, relation or functions by trying
4747 to combine pairs of basic sets or relations into a single
4748 basic set or relation.
4750 #include <isl/set.h>
4751 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4753 #include <isl/map.h>
4754 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4756 #include <isl/union_set.h>
4757 __isl_give isl_union_set *isl_union_set_coalesce(
4758 __isl_take isl_union_set *uset);
4760 #include <isl/union_map.h>
4761 __isl_give isl_union_map *isl_union_map_coalesce(
4762 __isl_take isl_union_map *umap);
4764 #include <isl/aff.h>
4765 __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4766 __isl_take isl_pw_aff *pwqp);
4767 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4768 __isl_take isl_pw_multi_aff *pma);
4769 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4770 __isl_take isl_multi_pw_aff *mpa);
4771 __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4772 __isl_take isl_union_pw_aff *upa);
4773 __isl_give isl_union_pw_multi_aff *
4774 isl_union_pw_multi_aff_coalesce(
4775 __isl_take isl_union_pw_multi_aff *upma);
4776 __isl_give isl_multi_union_pw_aff *
4777 isl_multi_union_pw_aff_coalesce(
4778 __isl_take isl_multi_union_pw_aff *aff);
4780 #include <isl/polynomial.h>
4781 __isl_give isl_pw_qpolynomial_fold *
4782 isl_pw_qpolynomial_fold_coalesce(
4783 __isl_take isl_pw_qpolynomial_fold *pwf);
4784 __isl_give isl_union_pw_qpolynomial *
4785 isl_union_pw_qpolynomial_coalesce(
4786 __isl_take isl_union_pw_qpolynomial *upwqp);
4787 __isl_give isl_union_pw_qpolynomial_fold *
4788 isl_union_pw_qpolynomial_fold_coalesce(
4789 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4791 One of the methods for combining pairs of basic sets or relations
4792 can result in coefficients that are much larger than those that appear
4793 in the constraints of the input. By default, the coefficients are
4794 not allowed to grow larger, but this can be changed by unsetting
4795 the following option.
4797 isl_stat isl_options_set_coalesce_bounded_wrapping(
4798 isl_ctx *ctx, int val);
4799 int isl_options_get_coalesce_bounded_wrapping(
4802 =item * Detecting equalities
4804 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4805 __isl_take isl_basic_set *bset);
4806 __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4807 __isl_take isl_basic_map *bmap);
4808 __isl_give isl_set *isl_set_detect_equalities(
4809 __isl_take isl_set *set);
4810 __isl_give isl_map *isl_map_detect_equalities(
4811 __isl_take isl_map *map);
4812 __isl_give isl_union_set *isl_union_set_detect_equalities(
4813 __isl_take isl_union_set *uset);
4814 __isl_give isl_union_map *isl_union_map_detect_equalities(
4815 __isl_take isl_union_map *umap);
4817 Simplify the representation of a set or relation by detecting implicit
4820 =item * Removing redundant constraints
4822 #include <isl/set.h>
4823 __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4824 __isl_take isl_basic_set *bset);
4825 __isl_give isl_set *isl_set_remove_redundancies(
4826 __isl_take isl_set *set);
4828 #include <isl/union_set.h>
4829 __isl_give isl_union_set *
4830 isl_union_set_remove_redundancies(
4831 __isl_take isl_union_set *uset);
4833 #include <isl/map.h>
4834 __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4835 __isl_take isl_basic_map *bmap);
4836 __isl_give isl_map *isl_map_remove_redundancies(
4837 __isl_take isl_map *map);
4839 #include <isl/union_map.h>
4840 __isl_give isl_union_map *
4841 isl_union_map_remove_redundancies(
4842 __isl_take isl_union_map *umap);
4846 __isl_give isl_basic_set *isl_set_convex_hull(
4847 __isl_take isl_set *set);
4848 __isl_give isl_basic_map *isl_map_convex_hull(
4849 __isl_take isl_map *map);
4851 If the input set or relation has any existentially quantified
4852 variables, then the result of these operations is currently undefined.
4856 #include <isl/set.h>
4857 __isl_give isl_basic_set *
4858 isl_set_unshifted_simple_hull(
4859 __isl_take isl_set *set);
4860 __isl_give isl_basic_set *isl_set_simple_hull(
4861 __isl_take isl_set *set);
4862 __isl_give isl_basic_set *
4863 isl_set_plain_unshifted_simple_hull(
4864 __isl_take isl_set *set);
4865 __isl_give isl_basic_set *
4866 isl_set_unshifted_simple_hull_from_set_list(
4867 __isl_take isl_set *set,
4868 __isl_take isl_set_list *list);
4870 #include <isl/map.h>
4871 __isl_give isl_basic_map *
4872 isl_map_unshifted_simple_hull(
4873 __isl_take isl_map *map);
4874 __isl_give isl_basic_map *isl_map_simple_hull(
4875 __isl_take isl_map *map);
4876 __isl_give isl_basic_map *
4877 isl_map_plain_unshifted_simple_hull(
4878 __isl_take isl_map *map);
4879 __isl_give isl_basic_map *
4880 isl_map_unshifted_simple_hull_from_map_list(
4881 __isl_take isl_map *map,
4882 __isl_take isl_map_list *list);
4884 #include <isl/union_map.h>
4885 __isl_give isl_union_map *isl_union_map_simple_hull(
4886 __isl_take isl_union_map *umap);
4888 These functions compute a single basic set or relation
4889 that contains the whole input set or relation.
4890 In particular, the output is described by translates
4891 of the constraints describing the basic sets or relations in the input.
4892 In case of C<isl_set_unshifted_simple_hull>, only the original
4893 constraints are used, without any translation.
4894 In case of C<isl_set_plain_unshifted_simple_hull> and
4895 C<isl_map_plain_unshifted_simple_hull>, the result is described
4896 by original constraints that are obviously satisfied
4897 by the entire input set or relation.
4898 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4899 C<isl_map_unshifted_simple_hull_from_map_list>, the
4900 constraints are taken from the elements of the second argument.
4904 (See \autoref{s:simple hull}.)
4910 __isl_give isl_basic_set *isl_basic_set_affine_hull(
4911 __isl_take isl_basic_set *bset);
4912 __isl_give isl_basic_set *isl_set_affine_hull(
4913 __isl_take isl_set *set);
4914 __isl_give isl_union_set *isl_union_set_affine_hull(
4915 __isl_take isl_union_set *uset);
4916 __isl_give isl_basic_map *isl_basic_map_affine_hull(
4917 __isl_take isl_basic_map *bmap);
4918 __isl_give isl_basic_map *isl_map_affine_hull(
4919 __isl_take isl_map *map);
4920 __isl_give isl_union_map *isl_union_map_affine_hull(
4921 __isl_take isl_union_map *umap);
4923 In case of union sets and relations, the affine hull is computed
4926 =item * Polyhedral hull
4928 __isl_give isl_basic_set *isl_set_polyhedral_hull(
4929 __isl_take isl_set *set);
4930 __isl_give isl_basic_map *isl_map_polyhedral_hull(
4931 __isl_take isl_map *map);
4932 __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4933 __isl_take isl_union_set *uset);
4934 __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4935 __isl_take isl_union_map *umap);
4937 These functions compute a single basic set or relation
4938 not involving any existentially quantified variables
4939 that contains the whole input set or relation.
4940 In case of union sets and relations, the polyhedral hull is computed
4943 =item * Other approximations
4945 #include <isl/set.h>
4946 __isl_give isl_basic_set *
4947 isl_basic_set_drop_constraints_involving_dims(
4948 __isl_take isl_basic_set *bset,
4949 enum isl_dim_type type,
4950 unsigned first, unsigned n);
4951 __isl_give isl_basic_set *
4952 isl_basic_set_drop_constraints_not_involving_dims(
4953 __isl_take isl_basic_set *bset,
4954 enum isl_dim_type type,
4955 unsigned first, unsigned n);
4956 __isl_give isl_set *
4957 isl_set_drop_constraints_involving_dims(
4958 __isl_take isl_set *set,
4959 enum isl_dim_type type,
4960 unsigned first, unsigned n);
4961 __isl_give isl_set *
4962 isl_set_drop_constraints_not_involving_dims(
4963 __isl_take isl_set *set,
4964 enum isl_dim_type type,
4965 unsigned first, unsigned n);
4967 #include <isl/map.h>
4968 __isl_give isl_basic_map *
4969 isl_basic_map_drop_constraints_involving_dims(
4970 __isl_take isl_basic_map *bmap,
4971 enum isl_dim_type type,
4972 unsigned first, unsigned n);
4973 __isl_give isl_basic_map *
4974 isl_basic_map_drop_constraints_not_involving_dims(
4975 __isl_take isl_basic_map *bmap,
4976 enum isl_dim_type type,
4977 unsigned first, unsigned n);
4978 __isl_give isl_map *
4979 isl_map_drop_constraints_involving_dims(
4980 __isl_take isl_map *map,
4981 enum isl_dim_type type,
4982 unsigned first, unsigned n);
4983 __isl_give isl_map *
4984 isl_map_drop_constraints_not_involving_dims(
4985 __isl_take isl_map *map,
4986 enum isl_dim_type type,
4987 unsigned first, unsigned n);
4989 These functions drop any constraints (not) involving the specified dimensions.
4990 Note that the result depends on the representation of the input.
4992 #include <isl/polynomial.h>
4993 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4994 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4995 __isl_give isl_union_pw_qpolynomial *
4996 isl_union_pw_qpolynomial_to_polynomial(
4997 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4999 Approximate each quasipolynomial by a polynomial. If C<sign> is positive,
5000 the polynomial will be an overapproximation. If C<sign> is negative,
5001 it will be an underapproximation. If C<sign> is zero, the approximation
5002 will lie somewhere in between.
5006 __isl_give isl_basic_set *isl_basic_set_sample(
5007 __isl_take isl_basic_set *bset);
5008 __isl_give isl_basic_set *isl_set_sample(
5009 __isl_take isl_set *set);
5010 __isl_give isl_basic_map *isl_basic_map_sample(
5011 __isl_take isl_basic_map *bmap);
5012 __isl_give isl_basic_map *isl_map_sample(
5013 __isl_take isl_map *map);
5015 If the input (basic) set or relation is non-empty, then return
5016 a singleton subset of the input. Otherwise, return an empty set.
5018 =item * Optimization
5020 #include <isl/ilp.h>
5021 __isl_give isl_val *isl_basic_set_max_val(
5022 __isl_keep isl_basic_set *bset,
5023 __isl_keep isl_aff *obj);
5024 __isl_give isl_val *isl_set_min_val(
5025 __isl_keep isl_set *set,
5026 __isl_keep isl_aff *obj);
5027 __isl_give isl_val *isl_set_max_val(
5028 __isl_keep isl_set *set,
5029 __isl_keep isl_aff *obj);
5030 __isl_give isl_multi_val *
5031 isl_union_set_min_multi_union_pw_aff(
5032 __isl_keep isl_union_set *set,
5033 __isl_keep isl_multi_union_pw_aff *obj);
5035 Compute the minimum or maximum of the integer affine expression C<obj>
5036 over the points in C<set>, returning the result in C<opt>.
5037 The result is C<NULL> in case of an error, the optimal value in case
5038 there is one, negative infinity or infinity if the problem is unbounded and
5039 NaN if the problem is empty.
5041 =item * Parametric optimization
5043 __isl_give isl_pw_aff *isl_set_dim_min(
5044 __isl_take isl_set *set, int pos);
5045 __isl_give isl_pw_aff *isl_set_dim_max(
5046 __isl_take isl_set *set, int pos);
5047 __isl_give isl_pw_aff *isl_map_dim_min(
5048 __isl_take isl_map *map, int pos);
5049 __isl_give isl_pw_aff *isl_map_dim_max(
5050 __isl_take isl_map *map, int pos);
5052 Compute the minimum or maximum of the given set or output dimension
5053 as a function of the parameters (and input dimensions), but independently
5054 of the other set or output dimensions.
5055 For lexicographic optimization, see L<"Lexicographic Optimization">.
5059 The following functions compute either the set of (rational) coefficient
5060 values of valid constraints for the given set or the set of (rational)
5061 values satisfying the constraints with coefficients from the given set.
5062 Internally, these two sets of functions perform essentially the
5063 same operations, except that the set of coefficients is assumed to
5064 be a cone, while the set of values may be any polyhedron.
5065 The current implementation is based on the Farkas lemma and
5066 Fourier-Motzkin elimination, but this may change or be made optional
5067 in future. In particular, future implementations may use different
5068 dualization algorithms or skip the elimination step.
5070 __isl_give isl_basic_set *isl_basic_set_coefficients(
5071 __isl_take isl_basic_set *bset);
5072 __isl_give isl_basic_set *isl_set_coefficients(
5073 __isl_take isl_set *set);
5074 __isl_give isl_union_set *isl_union_set_coefficients(
5075 __isl_take isl_union_set *bset);
5076 __isl_give isl_basic_set *isl_basic_set_solutions(
5077 __isl_take isl_basic_set *bset);
5078 __isl_give isl_basic_set *isl_set_solutions(
5079 __isl_take isl_set *set);
5080 __isl_give isl_union_set *isl_union_set_solutions(
5081 __isl_take isl_union_set *bset);
5085 __isl_give isl_map *isl_map_fixed_power_val(
5086 __isl_take isl_map *map,
5087 __isl_take isl_val *exp);
5088 __isl_give isl_union_map *
5089 isl_union_map_fixed_power_val(
5090 __isl_take isl_union_map *umap,
5091 __isl_take isl_val *exp);
5093 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
5094 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
5095 of C<map> is computed.
5097 __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
5099 __isl_give isl_union_map *isl_union_map_power(
5100 __isl_take isl_union_map *umap, int *exact);
5102 Compute a parametric representation for all positive powers I<k> of C<map>.
5103 The result maps I<k> to a nested relation corresponding to the
5104 I<k>th power of C<map>.
5105 The result may be an overapproximation. If the result is known to be exact,
5106 then C<*exact> is set to C<1>.
5108 =item * Transitive closure
5110 __isl_give isl_map *isl_map_transitive_closure(
5111 __isl_take isl_map *map, int *exact);
5112 __isl_give isl_union_map *isl_union_map_transitive_closure(
5113 __isl_take isl_union_map *umap, int *exact);
5115 Compute the transitive closure of C<map>.
5116 The result may be an overapproximation. If the result is known to be exact,
5117 then C<*exact> is set to C<1>.
5119 =item * Reaching path lengths
5121 __isl_give isl_map *isl_map_reaching_path_lengths(
5122 __isl_take isl_map *map, int *exact);
5124 Compute a relation that maps each element in the range of C<map>
5125 to the lengths of all paths composed of edges in C<map> that
5126 end up in the given element.
5127 The result may be an overapproximation. If the result is known to be exact,
5128 then C<*exact> is set to C<1>.
5129 To compute the I<maximal> path length, the resulting relation
5130 should be postprocessed by C<isl_map_lexmax>.
5131 In particular, if the input relation is a dependence relation
5132 (mapping sources to sinks), then the maximal path length corresponds
5133 to the free schedule.
5134 Note, however, that C<isl_map_lexmax> expects the maximum to be
5135 finite, so if the path lengths are unbounded (possibly due to
5136 the overapproximation), then you will get an error message.
5140 #include <isl/space.h>
5141 __isl_give isl_space *isl_space_wrap(
5142 __isl_take isl_space *space);
5143 __isl_give isl_space *isl_space_unwrap(
5144 __isl_take isl_space *space);
5146 #include <isl/local_space.h>
5147 __isl_give isl_local_space *isl_local_space_wrap(
5148 __isl_take isl_local_space *ls);
5150 #include <isl/set.h>
5151 __isl_give isl_basic_map *isl_basic_set_unwrap(
5152 __isl_take isl_basic_set *bset);
5153 __isl_give isl_map *isl_set_unwrap(
5154 __isl_take isl_set *set);
5156 #include <isl/map.h>
5157 __isl_give isl_basic_set *isl_basic_map_wrap(
5158 __isl_take isl_basic_map *bmap);
5159 __isl_give isl_set *isl_map_wrap(
5160 __isl_take isl_map *map);
5162 #include <isl/union_set.h>
5163 __isl_give isl_union_map *isl_union_set_unwrap(
5164 __isl_take isl_union_set *uset);
5166 #include <isl/union_map.h>
5167 __isl_give isl_union_set *isl_union_map_wrap(
5168 __isl_take isl_union_map *umap);
5170 The input to C<isl_space_unwrap> should
5171 be the space of a set, while that of
5172 C<isl_space_wrap> should be the space of a relation.
5173 Conversely, the output of C<isl_space_unwrap> is the space
5174 of a relation, while that of C<isl_space_wrap> is the space of a set.
5178 Remove any internal structure of domain (and range) of the given
5179 set or relation. If there is any such internal structure in the input,
5180 then the name of the space is also removed.
5182 #include <isl/local_space.h>
5183 __isl_give isl_local_space *
5184 isl_local_space_flatten_domain(
5185 __isl_take isl_local_space *ls);
5186 __isl_give isl_local_space *
5187 isl_local_space_flatten_range(
5188 __isl_take isl_local_space *ls);
5190 #include <isl/set.h>
5191 __isl_give isl_basic_set *isl_basic_set_flatten(
5192 __isl_take isl_basic_set *bset);
5193 __isl_give isl_set *isl_set_flatten(
5194 __isl_take isl_set *set);
5196 #include <isl/map.h>
5197 __isl_give isl_basic_map *isl_basic_map_flatten_domain(
5198 __isl_take isl_basic_map *bmap);
5199 __isl_give isl_basic_map *isl_basic_map_flatten_range(
5200 __isl_take isl_basic_map *bmap);
5201 __isl_give isl_map *isl_map_flatten_range(
5202 __isl_take isl_map *map);
5203 __isl_give isl_map *isl_map_flatten_domain(
5204 __isl_take isl_map *map);
5205 __isl_give isl_basic_map *isl_basic_map_flatten(
5206 __isl_take isl_basic_map *bmap);
5207 __isl_give isl_map *isl_map_flatten(
5208 __isl_take isl_map *map);
5210 #include <isl/val.h>
5211 __isl_give isl_multi_val *isl_multi_val_flatten_range(
5212 __isl_take isl_multi_val *mv);
5214 #include <isl/aff.h>
5215 __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5216 __isl_take isl_multi_aff *ma);
5217 __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5218 __isl_take isl_multi_aff *ma);
5219 __isl_give isl_multi_pw_aff *
5220 isl_multi_pw_aff_flatten_range(
5221 __isl_take isl_multi_pw_aff *mpa);
5222 __isl_give isl_multi_union_pw_aff *
5223 isl_multi_union_pw_aff_flatten_range(
5224 __isl_take isl_multi_union_pw_aff *mupa);
5226 #include <isl/map.h>
5227 __isl_give isl_map *isl_set_flatten_map(
5228 __isl_take isl_set *set);
5230 The function above constructs a relation
5231 that maps the input set to a flattened version of the set.
5235 Lift the input set to a space with extra dimensions corresponding
5236 to the existentially quantified variables in the input.
5237 In particular, the result lives in a wrapped map where the domain
5238 is the original space and the range corresponds to the original
5239 existentially quantified variables.
5241 #include <isl/set.h>
5242 __isl_give isl_basic_set *isl_basic_set_lift(
5243 __isl_take isl_basic_set *bset);
5244 __isl_give isl_set *isl_set_lift(
5245 __isl_take isl_set *set);
5246 __isl_give isl_union_set *isl_union_set_lift(
5247 __isl_take isl_union_set *uset);
5249 Given a local space that contains the existentially quantified
5250 variables of a set, a basic relation that, when applied to
5251 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
5252 can be constructed using the following function.
5254 #include <isl/local_space.h>
5255 __isl_give isl_basic_map *isl_local_space_lifting(
5256 __isl_take isl_local_space *ls);
5258 #include <isl/aff.h>
5259 __isl_give isl_multi_aff *isl_multi_aff_lift(
5260 __isl_take isl_multi_aff *maff,
5261 __isl_give isl_local_space **ls);
5263 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
5264 then it is assigned the local space that lies at the basis of
5265 the lifting applied.
5267 =item * Internal Product
5269 #include <isl/space.h>
5270 __isl_give isl_space *isl_space_zip(
5271 __isl_take isl_space *space);
5273 #include <isl/map.h>
5274 __isl_give isl_basic_map *isl_basic_map_zip(
5275 __isl_take isl_basic_map *bmap);
5276 __isl_give isl_map *isl_map_zip(
5277 __isl_take isl_map *map);
5279 #include <isl/union_map.h>
5280 __isl_give isl_union_map *isl_union_map_zip(
5281 __isl_take isl_union_map *umap);
5283 Given a relation with nested relations for domain and range,
5284 interchange the range of the domain with the domain of the range.
5288 #include <isl/space.h>
5289 __isl_give isl_space *isl_space_curry(
5290 __isl_take isl_space *space);
5291 __isl_give isl_space *isl_space_uncurry(
5292 __isl_take isl_space *space);
5294 #include <isl/map.h>
5295 __isl_give isl_basic_map *isl_basic_map_curry(
5296 __isl_take isl_basic_map *bmap);
5297 __isl_give isl_basic_map *isl_basic_map_uncurry(
5298 __isl_take isl_basic_map *bmap);
5299 __isl_give isl_map *isl_map_curry(
5300 __isl_take isl_map *map);
5301 __isl_give isl_map *isl_map_uncurry(
5302 __isl_take isl_map *map);
5304 #include <isl/union_map.h>
5305 __isl_give isl_union_map *isl_union_map_curry(
5306 __isl_take isl_union_map *umap);
5307 __isl_give isl_union_map *isl_union_map_uncurry(
5308 __isl_take isl_union_map *umap);
5310 Given a relation with a nested relation for domain,
5311 the C<curry> functions
5312 move the range of the nested relation out of the domain
5313 and use it as the domain of a nested relation in the range,
5314 with the original range as range of this nested relation.
5315 The C<uncurry> functions perform the inverse operation.
5317 #include <isl/space.h>
5318 __isl_give isl_space *isl_space_range_curry(
5319 __isl_take isl_space *space);
5321 #include <isl/map.h>
5322 __isl_give isl_map *isl_map_range_curry(
5323 __isl_take isl_map *map);
5325 #include <isl/union_map.h>
5326 __isl_give isl_union_map *isl_union_map_range_curry(
5327 __isl_take isl_union_map *umap);
5329 These functions apply the currying to the relation that
5330 is nested inside the range of the input.
5332 =item * Aligning parameters
5334 Change the order of the parameters of the given set, relation
5336 such that the first parameters match those of C<model>.
5337 This may involve the introduction of extra parameters.
5338 All parameters need to be named.
5340 #include <isl/space.h>
5341 __isl_give isl_space *isl_space_align_params(
5342 __isl_take isl_space *space1,
5343 __isl_take isl_space *space2)
5345 #include <isl/set.h>
5346 __isl_give isl_basic_set *isl_basic_set_align_params(
5347 __isl_take isl_basic_set *bset,
5348 __isl_take isl_space *model);
5349 __isl_give isl_set *isl_set_align_params(
5350 __isl_take isl_set *set,
5351 __isl_take isl_space *model);
5353 #include <isl/map.h>
5354 __isl_give isl_basic_map *isl_basic_map_align_params(
5355 __isl_take isl_basic_map *bmap,
5356 __isl_take isl_space *model);
5357 __isl_give isl_map *isl_map_align_params(
5358 __isl_take isl_map *map,
5359 __isl_take isl_space *model);
5361 #include <isl/val.h>
5362 __isl_give isl_multi_val *isl_multi_val_align_params(
5363 __isl_take isl_multi_val *mv,
5364 __isl_take isl_space *model);
5366 #include <isl/aff.h>
5367 __isl_give isl_aff *isl_aff_align_params(
5368 __isl_take isl_aff *aff,
5369 __isl_take isl_space *model);
5370 __isl_give isl_multi_aff *isl_multi_aff_align_params(
5371 __isl_take isl_multi_aff *multi,
5372 __isl_take isl_space *model);
5373 __isl_give isl_pw_aff *isl_pw_aff_align_params(
5374 __isl_take isl_pw_aff *pwaff,
5375 __isl_take isl_space *model);
5376 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5377 __isl_take isl_pw_multi_aff *pma,
5378 __isl_take isl_space *model);
5379 __isl_give isl_union_pw_aff *
5380 isl_union_pw_aff_align_params(
5381 __isl_take isl_union_pw_aff *upa,
5382 __isl_take isl_space *model);
5383 __isl_give isl_union_pw_multi_aff *
5384 isl_union_pw_multi_aff_align_params(
5385 __isl_take isl_union_pw_multi_aff *upma,
5386 __isl_take isl_space *model);
5387 __isl_give isl_multi_union_pw_aff *
5388 isl_multi_union_pw_aff_align_params(
5389 __isl_take isl_multi_union_pw_aff *mupa,
5390 __isl_take isl_space *model);
5392 #include <isl/polynomial.h>
5393 __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5394 __isl_take isl_qpolynomial *qp,
5395 __isl_take isl_space *model);
5397 =item * Unary Arithmetic Operations
5399 #include <isl/set.h>
5400 __isl_give isl_set *isl_set_neg(
5401 __isl_take isl_set *set);
5402 #include <isl/map.h>
5403 __isl_give isl_map *isl_map_neg(
5404 __isl_take isl_map *map);
5406 C<isl_set_neg> constructs a set containing the opposites of
5407 the elements in its argument.
5408 The domain of the result of C<isl_map_neg> is the same
5409 as the domain of its argument. The corresponding range
5410 elements are the opposites of the corresponding range
5411 elements in the argument.
5413 #include <isl/val.h>
5414 __isl_give isl_multi_val *isl_multi_val_neg(
5415 __isl_take isl_multi_val *mv);
5417 #include <isl/aff.h>
5418 __isl_give isl_aff *isl_aff_neg(
5419 __isl_take isl_aff *aff);
5420 __isl_give isl_multi_aff *isl_multi_aff_neg(
5421 __isl_take isl_multi_aff *ma);
5422 __isl_give isl_pw_aff *isl_pw_aff_neg(
5423 __isl_take isl_pw_aff *pwaff);
5424 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5425 __isl_take isl_pw_multi_aff *pma);
5426 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5427 __isl_take isl_multi_pw_aff *mpa);
5428 __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5429 __isl_take isl_union_pw_aff *upa);
5430 __isl_give isl_union_pw_multi_aff *
5431 isl_union_pw_multi_aff_neg(
5432 __isl_take isl_union_pw_multi_aff *upma);
5433 __isl_give isl_multi_union_pw_aff *
5434 isl_multi_union_pw_aff_neg(
5435 __isl_take isl_multi_union_pw_aff *mupa);
5436 __isl_give isl_aff *isl_aff_ceil(
5437 __isl_take isl_aff *aff);
5438 __isl_give isl_pw_aff *isl_pw_aff_ceil(
5439 __isl_take isl_pw_aff *pwaff);
5440 __isl_give isl_aff *isl_aff_floor(
5441 __isl_take isl_aff *aff);
5442 __isl_give isl_multi_aff *isl_multi_aff_floor(
5443 __isl_take isl_multi_aff *ma);
5444 __isl_give isl_pw_aff *isl_pw_aff_floor(
5445 __isl_take isl_pw_aff *pwaff);
5446 __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5447 __isl_take isl_union_pw_aff *upa);
5448 __isl_give isl_multi_union_pw_aff *
5449 isl_multi_union_pw_aff_floor(
5450 __isl_take isl_multi_union_pw_aff *mupa);
5452 #include <isl/aff.h>
5453 __isl_give isl_pw_aff *isl_pw_aff_list_min(
5454 __isl_take isl_pw_aff_list *list);
5455 __isl_give isl_pw_aff *isl_pw_aff_list_max(
5456 __isl_take isl_pw_aff_list *list);
5458 #include <isl/polynomial.h>
5459 __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5460 __isl_take isl_qpolynomial *qp);
5461 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5462 __isl_take isl_pw_qpolynomial *pwqp);
5463 __isl_give isl_union_pw_qpolynomial *
5464 isl_union_pw_qpolynomial_neg(
5465 __isl_take isl_union_pw_qpolynomial *upwqp);
5466 __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5467 __isl_take isl_qpolynomial *qp,
5469 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5470 __isl_take isl_pw_qpolynomial *pwqp,
5475 The following functions evaluate a function in a point.
5477 #include <isl/polynomial.h>
5478 __isl_give isl_val *isl_pw_qpolynomial_eval(
5479 __isl_take isl_pw_qpolynomial *pwqp,
5480 __isl_take isl_point *pnt);
5481 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5482 __isl_take isl_pw_qpolynomial_fold *pwf,
5483 __isl_take isl_point *pnt);
5484 __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5485 __isl_take isl_union_pw_qpolynomial *upwqp,
5486 __isl_take isl_point *pnt);
5487 __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5488 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5489 __isl_take isl_point *pnt);
5491 =item * Dimension manipulation
5493 It is usually not advisable to directly change the (input or output)
5494 space of a set or a relation as this removes the name and the internal
5495 structure of the space. However, the functions below can be useful
5496 to add new parameters, assuming
5497 C<isl_set_align_params> and C<isl_map_align_params>
5500 #include <isl/space.h>
5501 __isl_give isl_space *isl_space_add_dims(
5502 __isl_take isl_space *space,
5503 enum isl_dim_type type, unsigned n);
5504 __isl_give isl_space *isl_space_insert_dims(
5505 __isl_take isl_space *space,
5506 enum isl_dim_type type, unsigned pos, unsigned n);
5507 __isl_give isl_space *isl_space_drop_dims(
5508 __isl_take isl_space *space,
5509 enum isl_dim_type type, unsigned first, unsigned n);
5510 __isl_give isl_space *isl_space_move_dims(
5511 __isl_take isl_space *space,
5512 enum isl_dim_type dst_type, unsigned dst_pos,
5513 enum isl_dim_type src_type, unsigned src_pos,
5516 #include <isl/local_space.h>
5517 __isl_give isl_local_space *isl_local_space_add_dims(
5518 __isl_take isl_local_space *ls,
5519 enum isl_dim_type type, unsigned n);
5520 __isl_give isl_local_space *isl_local_space_insert_dims(
5521 __isl_take isl_local_space *ls,
5522 enum isl_dim_type type, unsigned first, unsigned n);
5523 __isl_give isl_local_space *isl_local_space_drop_dims(
5524 __isl_take isl_local_space *ls,
5525 enum isl_dim_type type, unsigned first, unsigned n);
5527 #include <isl/set.h>
5528 __isl_give isl_basic_set *isl_basic_set_add_dims(
5529 __isl_take isl_basic_set *bset,
5530 enum isl_dim_type type, unsigned n);
5531 __isl_give isl_set *isl_set_add_dims(
5532 __isl_take isl_set *set,
5533 enum isl_dim_type type, unsigned n);
5534 __isl_give isl_basic_set *isl_basic_set_insert_dims(
5535 __isl_take isl_basic_set *bset,
5536 enum isl_dim_type type, unsigned pos,
5538 __isl_give isl_set *isl_set_insert_dims(
5539 __isl_take isl_set *set,
5540 enum isl_dim_type type, unsigned pos, unsigned n);
5541 __isl_give isl_basic_set *isl_basic_set_move_dims(
5542 __isl_take isl_basic_set *bset,
5543 enum isl_dim_type dst_type, unsigned dst_pos,
5544 enum isl_dim_type src_type, unsigned src_pos,
5546 __isl_give isl_set *isl_set_move_dims(
5547 __isl_take isl_set *set,
5548 enum isl_dim_type dst_type, unsigned dst_pos,
5549 enum isl_dim_type src_type, unsigned src_pos,
5552 #include <isl/map.h>
5553 __isl_give isl_basic_map *isl_basic_map_add_dims(
5554 __isl_take isl_basic_map *bmap,
5555 enum isl_dim_type type, unsigned n);
5556 __isl_give isl_map *isl_map_add_dims(
5557 __isl_take isl_map *map,
5558 enum isl_dim_type type, unsigned n);
5559 __isl_give isl_basic_map *isl_basic_map_insert_dims(
5560 __isl_take isl_basic_map *bmap,
5561 enum isl_dim_type type, unsigned pos,
5563 __isl_give isl_map *isl_map_insert_dims(
5564 __isl_take isl_map *map,
5565 enum isl_dim_type type, unsigned pos, unsigned n);
5566 __isl_give isl_basic_map *isl_basic_map_move_dims(
5567 __isl_take isl_basic_map *bmap,
5568 enum isl_dim_type dst_type, unsigned dst_pos,
5569 enum isl_dim_type src_type, unsigned src_pos,
5571 __isl_give isl_map *isl_map_move_dims(
5572 __isl_take isl_map *map,
5573 enum isl_dim_type dst_type, unsigned dst_pos,
5574 enum isl_dim_type src_type, unsigned src_pos,
5577 #include <isl/val.h>
5578 __isl_give isl_multi_val *isl_multi_val_insert_dims(
5579 __isl_take isl_multi_val *mv,
5580 enum isl_dim_type type, unsigned first, unsigned n);
5581 __isl_give isl_multi_val *isl_multi_val_add_dims(
5582 __isl_take isl_multi_val *mv,
5583 enum isl_dim_type type, unsigned n);
5584 __isl_give isl_multi_val *isl_multi_val_drop_dims(
5585 __isl_take isl_multi_val *mv,
5586 enum isl_dim_type type, unsigned first, unsigned n);
5588 #include <isl/aff.h>
5589 __isl_give isl_aff *isl_aff_insert_dims(
5590 __isl_take isl_aff *aff,
5591 enum isl_dim_type type, unsigned first, unsigned n);
5592 __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5593 __isl_take isl_multi_aff *ma,
5594 enum isl_dim_type type, unsigned first, unsigned n);
5595 __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5596 __isl_take isl_pw_aff *pwaff,
5597 enum isl_dim_type type, unsigned first, unsigned n);
5598 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5599 __isl_take isl_multi_pw_aff *mpa,
5600 enum isl_dim_type type, unsigned first, unsigned n);
5601 __isl_give isl_aff *isl_aff_add_dims(
5602 __isl_take isl_aff *aff,
5603 enum isl_dim_type type, unsigned n);
5604 __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5605 __isl_take isl_multi_aff *ma,
5606 enum isl_dim_type type, unsigned n);
5607 __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5608 __isl_take isl_pw_aff *pwaff,
5609 enum isl_dim_type type, unsigned n);
5610 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5611 __isl_take isl_multi_pw_aff *mpa,
5612 enum isl_dim_type type, unsigned n);
5613 __isl_give isl_aff *isl_aff_drop_dims(
5614 __isl_take isl_aff *aff,
5615 enum isl_dim_type type, unsigned first, unsigned n);
5616 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5617 __isl_take isl_multi_aff *maff,
5618 enum isl_dim_type type, unsigned first, unsigned n);
5619 __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5620 __isl_take isl_pw_aff *pwaff,
5621 enum isl_dim_type type, unsigned first, unsigned n);
5622 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5623 __isl_take isl_pw_multi_aff *pma,
5624 enum isl_dim_type type, unsigned first, unsigned n);
5625 __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5626 __isl_take isl_union_pw_aff *upa,
5627 enum isl_dim_type type, unsigned first, unsigned n);
5628 __isl_give isl_union_pw_multi_aff *
5629 isl_union_pw_multi_aff_drop_dims(
5630 __isl_take isl_union_pw_multi_aff *upma,
5631 enum isl_dim_type type,
5632 unsigned first, unsigned n);
5633 __isl_give isl_multi_union_pw_aff *
5634 isl_multi_union_pw_aff_drop_dims(
5635 __isl_take isl_multi_union_pw_aff *mupa,
5636 enum isl_dim_type type, unsigned first,
5638 __isl_give isl_aff *isl_aff_move_dims(
5639 __isl_take isl_aff *aff,
5640 enum isl_dim_type dst_type, unsigned dst_pos,
5641 enum isl_dim_type src_type, unsigned src_pos,
5643 __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5644 __isl_take isl_multi_aff *ma,
5645 enum isl_dim_type dst_type, unsigned dst_pos,
5646 enum isl_dim_type src_type, unsigned src_pos,
5648 __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5649 __isl_take isl_pw_aff *pa,
5650 enum isl_dim_type dst_type, unsigned dst_pos,
5651 enum isl_dim_type src_type, unsigned src_pos,
5653 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5654 __isl_take isl_multi_pw_aff *pma,
5655 enum isl_dim_type dst_type, unsigned dst_pos,
5656 enum isl_dim_type src_type, unsigned src_pos,
5659 #include <isl/polynomial.h>
5660 __isl_give isl_union_pw_qpolynomial *
5661 isl_union_pw_qpolynomial_drop_dims(
5662 __isl_take isl_union_pw_qpolynomial *upwqp,
5663 enum isl_dim_type type,
5664 unsigned first, unsigned n);
5665 __isl_give isl_union_pw_qpolynomial_fold *
5666 isl_union_pw_qpolynomial_fold_drop_dims(
5667 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5668 enum isl_dim_type type,
5669 unsigned first, unsigned n);
5671 The operations on union expressions can only manipulate parameters.
5675 =head2 Binary Operations
5677 The two arguments of a binary operation not only need to live
5678 in the same C<isl_ctx>, they currently also need to have
5679 the same (number of) parameters.
5681 =head3 Basic Operations
5685 =item * Intersection
5687 #include <isl/local_space.h>
5688 __isl_give isl_local_space *isl_local_space_intersect(
5689 __isl_take isl_local_space *ls1,
5690 __isl_take isl_local_space *ls2);
5692 #include <isl/set.h>
5693 __isl_give isl_basic_set *isl_basic_set_intersect_params(
5694 __isl_take isl_basic_set *bset1,
5695 __isl_take isl_basic_set *bset2);
5696 __isl_give isl_basic_set *isl_basic_set_intersect(
5697 __isl_take isl_basic_set *bset1,
5698 __isl_take isl_basic_set *bset2);
5699 __isl_give isl_basic_set *isl_basic_set_list_intersect(
5700 __isl_take struct isl_basic_set_list *list);
5701 __isl_give isl_set *isl_set_intersect_params(
5702 __isl_take isl_set *set,
5703 __isl_take isl_set *params);
5704 __isl_give isl_set *isl_set_intersect(
5705 __isl_take isl_set *set1,
5706 __isl_take isl_set *set2);
5708 #include <isl/map.h>
5709 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5710 __isl_take isl_basic_map *bmap,
5711 __isl_take isl_basic_set *bset);
5712 __isl_give isl_basic_map *isl_basic_map_intersect_range(
5713 __isl_take isl_basic_map *bmap,
5714 __isl_take isl_basic_set *bset);
5715 __isl_give isl_basic_map *isl_basic_map_intersect(
5716 __isl_take isl_basic_map *bmap1,
5717 __isl_take isl_basic_map *bmap2);
5718 __isl_give isl_basic_map *isl_basic_map_list_intersect(
5719 __isl_take isl_basic_map_list *list);
5720 __isl_give isl_map *isl_map_intersect_params(
5721 __isl_take isl_map *map,
5722 __isl_take isl_set *params);
5723 __isl_give isl_map *isl_map_intersect_domain(
5724 __isl_take isl_map *map,
5725 __isl_take isl_set *set);
5726 __isl_give isl_map *isl_map_intersect_range(
5727 __isl_take isl_map *map,
5728 __isl_take isl_set *set);
5729 __isl_give isl_map *isl_map_intersect(
5730 __isl_take isl_map *map1,
5731 __isl_take isl_map *map2);
5733 #include <isl/union_set.h>
5734 __isl_give isl_union_set *isl_union_set_intersect_params(
5735 __isl_take isl_union_set *uset,
5736 __isl_take isl_set *set);
5737 __isl_give isl_union_set *isl_union_set_intersect(
5738 __isl_take isl_union_set *uset1,
5739 __isl_take isl_union_set *uset2);
5741 #include <isl/union_map.h>
5742 __isl_give isl_union_map *isl_union_map_intersect_params(
5743 __isl_take isl_union_map *umap,
5744 __isl_take isl_set *set);
5745 __isl_give isl_union_map *isl_union_map_intersect_domain(
5746 __isl_take isl_union_map *umap,
5747 __isl_take isl_union_set *uset);
5748 __isl_give isl_union_map *isl_union_map_intersect_range(
5749 __isl_take isl_union_map *umap,
5750 __isl_take isl_union_set *uset);
5751 __isl_give isl_union_map *isl_union_map_intersect(
5752 __isl_take isl_union_map *umap1,
5753 __isl_take isl_union_map *umap2);
5755 #include <isl/aff.h>
5756 __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5757 __isl_take isl_pw_aff *pa,
5758 __isl_take isl_set *set);
5759 __isl_give isl_multi_pw_aff *
5760 isl_multi_pw_aff_intersect_domain(
5761 __isl_take isl_multi_pw_aff *mpa,
5762 __isl_take isl_set *domain);
5763 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5764 __isl_take isl_pw_multi_aff *pma,
5765 __isl_take isl_set *set);
5766 __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5767 __isl_take isl_union_pw_aff *upa,
5768 __isl_take isl_union_set *uset);
5769 __isl_give isl_union_pw_multi_aff *
5770 isl_union_pw_multi_aff_intersect_domain(
5771 __isl_take isl_union_pw_multi_aff *upma,
5772 __isl_take isl_union_set *uset);
5773 __isl_give isl_multi_union_pw_aff *
5774 isl_multi_union_pw_aff_intersect_domain(
5775 __isl_take isl_multi_union_pw_aff *mupa,
5776 __isl_take isl_union_set *uset);
5777 __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5778 __isl_take isl_pw_aff *pa,
5779 __isl_take isl_set *set);
5780 __isl_give isl_multi_pw_aff *
5781 isl_multi_pw_aff_intersect_params(
5782 __isl_take isl_multi_pw_aff *mpa,
5783 __isl_take isl_set *set);
5784 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5785 __isl_take isl_pw_multi_aff *pma,
5786 __isl_take isl_set *set);
5787 __isl_give isl_union_pw_aff *
5788 isl_union_pw_aff_intersect_params(
5789 __isl_take isl_union_pw_aff *upa,
5790 __isl_give isl_union_pw_multi_aff *
5791 isl_union_pw_multi_aff_intersect_params(
5792 __isl_take isl_union_pw_multi_aff *upma,
5793 __isl_take isl_set *set);
5794 __isl_give isl_multi_union_pw_aff *
5795 isl_multi_union_pw_aff_intersect_params(
5796 __isl_take isl_multi_union_pw_aff *mupa,
5797 __isl_take isl_set *params);
5798 isl_multi_union_pw_aff_intersect_range(
5799 __isl_take isl_multi_union_pw_aff *mupa,
5800 __isl_take isl_set *set);
5802 #include <isl/polynomial.h>
5803 __isl_give isl_pw_qpolynomial *
5804 isl_pw_qpolynomial_intersect_domain(
5805 __isl_take isl_pw_qpolynomial *pwpq,
5806 __isl_take isl_set *set);
5807 __isl_give isl_union_pw_qpolynomial *
5808 isl_union_pw_qpolynomial_intersect_domain(
5809 __isl_take isl_union_pw_qpolynomial *upwpq,
5810 __isl_take isl_union_set *uset);
5811 __isl_give isl_union_pw_qpolynomial_fold *
5812 isl_union_pw_qpolynomial_fold_intersect_domain(
5813 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5814 __isl_take isl_union_set *uset);
5815 __isl_give isl_pw_qpolynomial *
5816 isl_pw_qpolynomial_intersect_params(
5817 __isl_take isl_pw_qpolynomial *pwpq,
5818 __isl_take isl_set *set);
5819 __isl_give isl_pw_qpolynomial_fold *
5820 isl_pw_qpolynomial_fold_intersect_params(
5821 __isl_take isl_pw_qpolynomial_fold *pwf,
5822 __isl_take isl_set *set);
5823 __isl_give isl_union_pw_qpolynomial *
5824 isl_union_pw_qpolynomial_intersect_params(
5825 __isl_take isl_union_pw_qpolynomial *upwpq,
5826 __isl_take isl_set *set);
5827 __isl_give isl_union_pw_qpolynomial_fold *
5828 isl_union_pw_qpolynomial_fold_intersect_params(
5829 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5830 __isl_take isl_set *set);
5832 The second argument to the C<_params> functions needs to be
5833 a parametric (basic) set. For the other functions, a parametric set
5834 for either argument is only allowed if the other argument is
5835 a parametric set as well.
5836 The list passed to C<isl_basic_set_list_intersect> needs to have
5837 at least one element and all elements need to live in the same space.
5838 The function C<isl_multi_union_pw_aff_intersect_range>
5839 restricts the input function to those shared domain elements
5840 that map to the specified range.
5844 #include <isl/set.h>
5845 __isl_give isl_set *isl_basic_set_union(
5846 __isl_take isl_basic_set *bset1,
5847 __isl_take isl_basic_set *bset2);
5848 __isl_give isl_set *isl_set_union(
5849 __isl_take isl_set *set1,
5850 __isl_take isl_set *set2);
5851 __isl_give isl_set *isl_set_list_union(
5852 __isl_take isl_set_list *list);
5854 #include <isl/map.h>
5855 __isl_give isl_map *isl_basic_map_union(
5856 __isl_take isl_basic_map *bmap1,
5857 __isl_take isl_basic_map *bmap2);
5858 __isl_give isl_map *isl_map_union(
5859 __isl_take isl_map *map1,
5860 __isl_take isl_map *map2);
5862 #include <isl/union_set.h>
5863 __isl_give isl_union_set *isl_union_set_union(
5864 __isl_take isl_union_set *uset1,
5865 __isl_take isl_union_set *uset2);
5866 __isl_give isl_union_set *isl_union_set_list_union(
5867 __isl_take isl_union_set_list *list);
5869 #include <isl/union_map.h>
5870 __isl_give isl_union_map *isl_union_map_union(
5871 __isl_take isl_union_map *umap1,
5872 __isl_take isl_union_map *umap2);
5874 The list passed to C<isl_set_list_union> needs to have
5875 at least one element and all elements need to live in the same space.
5877 =item * Set difference
5879 #include <isl/set.h>
5880 __isl_give isl_set *isl_set_subtract(
5881 __isl_take isl_set *set1,
5882 __isl_take isl_set *set2);
5884 #include <isl/map.h>
5885 __isl_give isl_map *isl_map_subtract(
5886 __isl_take isl_map *map1,
5887 __isl_take isl_map *map2);
5888 __isl_give isl_map *isl_map_subtract_domain(
5889 __isl_take isl_map *map,
5890 __isl_take isl_set *dom);
5891 __isl_give isl_map *isl_map_subtract_range(
5892 __isl_take isl_map *map,
5893 __isl_take isl_set *dom);
5895 #include <isl/union_set.h>
5896 __isl_give isl_union_set *isl_union_set_subtract(
5897 __isl_take isl_union_set *uset1,
5898 __isl_take isl_union_set *uset2);
5900 #include <isl/union_map.h>
5901 __isl_give isl_union_map *isl_union_map_subtract(
5902 __isl_take isl_union_map *umap1,
5903 __isl_take isl_union_map *umap2);
5904 __isl_give isl_union_map *isl_union_map_subtract_domain(
5905 __isl_take isl_union_map *umap,
5906 __isl_take isl_union_set *dom);
5907 __isl_give isl_union_map *isl_union_map_subtract_range(
5908 __isl_take isl_union_map *umap,
5909 __isl_take isl_union_set *dom);
5911 #include <isl/aff.h>
5912 __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5913 __isl_take isl_pw_aff *pa,
5914 __isl_take isl_set *set);
5915 __isl_give isl_pw_multi_aff *
5916 isl_pw_multi_aff_subtract_domain(
5917 __isl_take isl_pw_multi_aff *pma,
5918 __isl_take isl_set *set);
5919 __isl_give isl_union_pw_aff *
5920 isl_union_pw_aff_subtract_domain(
5921 __isl_take isl_union_pw_aff *upa,
5922 __isl_take isl_union_set *uset);
5923 __isl_give isl_union_pw_multi_aff *
5924 isl_union_pw_multi_aff_subtract_domain(
5925 __isl_take isl_union_pw_multi_aff *upma,
5926 __isl_take isl_set *set);
5928 #include <isl/polynomial.h>
5929 __isl_give isl_pw_qpolynomial *
5930 isl_pw_qpolynomial_subtract_domain(
5931 __isl_take isl_pw_qpolynomial *pwpq,
5932 __isl_take isl_set *set);
5933 __isl_give isl_pw_qpolynomial_fold *
5934 isl_pw_qpolynomial_fold_subtract_domain(
5935 __isl_take isl_pw_qpolynomial_fold *pwf,
5936 __isl_take isl_set *set);
5937 __isl_give isl_union_pw_qpolynomial *
5938 isl_union_pw_qpolynomial_subtract_domain(
5939 __isl_take isl_union_pw_qpolynomial *upwpq,
5940 __isl_take isl_union_set *uset);
5941 __isl_give isl_union_pw_qpolynomial_fold *
5942 isl_union_pw_qpolynomial_fold_subtract_domain(
5943 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5944 __isl_take isl_union_set *uset);
5948 #include <isl/space.h>
5949 __isl_give isl_space *isl_space_join(
5950 __isl_take isl_space *left,
5951 __isl_take isl_space *right);
5953 #include <isl/map.h>
5954 __isl_give isl_basic_set *isl_basic_set_apply(
5955 __isl_take isl_basic_set *bset,
5956 __isl_take isl_basic_map *bmap);
5957 __isl_give isl_set *isl_set_apply(
5958 __isl_take isl_set *set,
5959 __isl_take isl_map *map);
5960 __isl_give isl_union_set *isl_union_set_apply(
5961 __isl_take isl_union_set *uset,
5962 __isl_take isl_union_map *umap);
5963 __isl_give isl_basic_map *isl_basic_map_apply_domain(
5964 __isl_take isl_basic_map *bmap1,
5965 __isl_take isl_basic_map *bmap2);
5966 __isl_give isl_basic_map *isl_basic_map_apply_range(
5967 __isl_take isl_basic_map *bmap1,
5968 __isl_take isl_basic_map *bmap2);
5969 __isl_give isl_map *isl_map_apply_domain(
5970 __isl_take isl_map *map1,
5971 __isl_take isl_map *map2);
5972 __isl_give isl_map *isl_map_apply_range(
5973 __isl_take isl_map *map1,
5974 __isl_take isl_map *map2);
5976 #include <isl/union_map.h>
5977 __isl_give isl_union_map *isl_union_map_apply_domain(
5978 __isl_take isl_union_map *umap1,
5979 __isl_take isl_union_map *umap2);
5980 __isl_give isl_union_map *isl_union_map_apply_range(
5981 __isl_take isl_union_map *umap1,
5982 __isl_take isl_union_map *umap2);
5984 #include <isl/aff.h>
5985 __isl_give isl_union_pw_aff *
5986 isl_multi_union_pw_aff_apply_aff(
5987 __isl_take isl_multi_union_pw_aff *mupa,
5988 __isl_take isl_aff *aff);
5989 __isl_give isl_union_pw_aff *
5990 isl_multi_union_pw_aff_apply_pw_aff(
5991 __isl_take isl_multi_union_pw_aff *mupa,
5992 __isl_take isl_pw_aff *pa);
5993 __isl_give isl_multi_union_pw_aff *
5994 isl_multi_union_pw_aff_apply_multi_aff(
5995 __isl_take isl_multi_union_pw_aff *mupa,
5996 __isl_take isl_multi_aff *ma);
5997 __isl_give isl_multi_union_pw_aff *
5998 isl_multi_union_pw_aff_apply_pw_multi_aff(
5999 __isl_take isl_multi_union_pw_aff *mupa,
6000 __isl_take isl_pw_multi_aff *pma);
6002 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
6003 over the shared domain of the elements of the input. The dimension is
6004 required to be greater than zero.
6005 The C<isl_multi_union_pw_aff> argument of
6006 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
6007 but only if the range of the C<isl_multi_aff> argument
6008 is also zero-dimensional.
6009 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
6011 #include <isl/polynomial.h>
6012 __isl_give isl_pw_qpolynomial_fold *
6013 isl_set_apply_pw_qpolynomial_fold(
6014 __isl_take isl_set *set,
6015 __isl_take isl_pw_qpolynomial_fold *pwf,
6017 __isl_give isl_pw_qpolynomial_fold *
6018 isl_map_apply_pw_qpolynomial_fold(
6019 __isl_take isl_map *map,
6020 __isl_take isl_pw_qpolynomial_fold *pwf,
6022 __isl_give isl_union_pw_qpolynomial_fold *
6023 isl_union_set_apply_union_pw_qpolynomial_fold(
6024 __isl_take isl_union_set *uset,
6025 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6027 __isl_give isl_union_pw_qpolynomial_fold *
6028 isl_union_map_apply_union_pw_qpolynomial_fold(
6029 __isl_take isl_union_map *umap,
6030 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6033 The functions taking a map
6034 compose the given map with the given piecewise quasipolynomial reduction.
6035 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
6036 over all elements in the intersection of the range of the map
6037 and the domain of the piecewise quasipolynomial reduction
6038 as a function of an element in the domain of the map.
6039 The functions taking a set compute a bound over all elements in the
6040 intersection of the set and the domain of the
6041 piecewise quasipolynomial reduction.
6045 #include <isl/set.h>
6046 __isl_give isl_basic_set *
6047 isl_basic_set_preimage_multi_aff(
6048 __isl_take isl_basic_set *bset,
6049 __isl_take isl_multi_aff *ma);
6050 __isl_give isl_set *isl_set_preimage_multi_aff(
6051 __isl_take isl_set *set,
6052 __isl_take isl_multi_aff *ma);
6053 __isl_give isl_set *isl_set_preimage_pw_multi_aff(
6054 __isl_take isl_set *set,
6055 __isl_take isl_pw_multi_aff *pma);
6056 __isl_give isl_set *isl_set_preimage_multi_pw_aff(
6057 __isl_take isl_set *set,
6058 __isl_take isl_multi_pw_aff *mpa);
6060 #include <isl/union_set.h>
6061 __isl_give isl_union_set *
6062 isl_union_set_preimage_multi_aff(
6063 __isl_take isl_union_set *uset,
6064 __isl_take isl_multi_aff *ma);
6065 __isl_give isl_union_set *
6066 isl_union_set_preimage_pw_multi_aff(
6067 __isl_take isl_union_set *uset,
6068 __isl_take isl_pw_multi_aff *pma);
6069 __isl_give isl_union_set *
6070 isl_union_set_preimage_union_pw_multi_aff(
6071 __isl_take isl_union_set *uset,
6072 __isl_take isl_union_pw_multi_aff *upma);
6074 #include <isl/map.h>
6075 __isl_give isl_basic_map *
6076 isl_basic_map_preimage_domain_multi_aff(
6077 __isl_take isl_basic_map *bmap,
6078 __isl_take isl_multi_aff *ma);
6079 __isl_give isl_map *isl_map_preimage_domain_multi_aff(
6080 __isl_take isl_map *map,
6081 __isl_take isl_multi_aff *ma);
6082 __isl_give isl_map *isl_map_preimage_range_multi_aff(
6083 __isl_take isl_map *map,
6084 __isl_take isl_multi_aff *ma);
6085 __isl_give isl_map *
6086 isl_map_preimage_domain_pw_multi_aff(
6087 __isl_take isl_map *map,
6088 __isl_take isl_pw_multi_aff *pma);
6089 __isl_give isl_map *
6090 isl_map_preimage_range_pw_multi_aff(
6091 __isl_take isl_map *map,
6092 __isl_take isl_pw_multi_aff *pma);
6093 __isl_give isl_map *
6094 isl_map_preimage_domain_multi_pw_aff(
6095 __isl_take isl_map *map,
6096 __isl_take isl_multi_pw_aff *mpa);
6097 __isl_give isl_basic_map *
6098 isl_basic_map_preimage_range_multi_aff(
6099 __isl_take isl_basic_map *bmap,
6100 __isl_take isl_multi_aff *ma);
6102 #include <isl/union_map.h>
6103 __isl_give isl_union_map *
6104 isl_union_map_preimage_domain_multi_aff(
6105 __isl_take isl_union_map *umap,
6106 __isl_take isl_multi_aff *ma);
6107 __isl_give isl_union_map *
6108 isl_union_map_preimage_range_multi_aff(
6109 __isl_take isl_union_map *umap,
6110 __isl_take isl_multi_aff *ma);
6111 __isl_give isl_union_map *
6112 isl_union_map_preimage_domain_pw_multi_aff(
6113 __isl_take isl_union_map *umap,
6114 __isl_take isl_pw_multi_aff *pma);
6115 __isl_give isl_union_map *
6116 isl_union_map_preimage_range_pw_multi_aff(
6117 __isl_take isl_union_map *umap,
6118 __isl_take isl_pw_multi_aff *pma);
6119 __isl_give isl_union_map *
6120 isl_union_map_preimage_domain_union_pw_multi_aff(
6121 __isl_take isl_union_map *umap,
6122 __isl_take isl_union_pw_multi_aff *upma);
6123 __isl_give isl_union_map *
6124 isl_union_map_preimage_range_union_pw_multi_aff(
6125 __isl_take isl_union_map *umap,
6126 __isl_take isl_union_pw_multi_aff *upma);
6128 These functions compute the preimage of the given set or map domain/range under
6129 the given function. In other words, the expression is plugged
6130 into the set description or into the domain/range of the map.
6134 #include <isl/aff.h>
6135 __isl_give isl_aff *isl_aff_pullback_aff(
6136 __isl_take isl_aff *aff1,
6137 __isl_take isl_aff *aff2);
6138 __isl_give isl_aff *isl_aff_pullback_multi_aff(
6139 __isl_take isl_aff *aff,
6140 __isl_take isl_multi_aff *ma);
6141 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
6142 __isl_take isl_pw_aff *pa,
6143 __isl_take isl_multi_aff *ma);
6144 __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
6145 __isl_take isl_pw_aff *pa,
6146 __isl_take isl_pw_multi_aff *pma);
6147 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
6148 __isl_take isl_pw_aff *pa,
6149 __isl_take isl_multi_pw_aff *mpa);
6150 __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
6151 __isl_take isl_multi_aff *ma1,
6152 __isl_take isl_multi_aff *ma2);
6153 __isl_give isl_pw_multi_aff *
6154 isl_pw_multi_aff_pullback_multi_aff(
6155 __isl_take isl_pw_multi_aff *pma,
6156 __isl_take isl_multi_aff *ma);
6157 __isl_give isl_multi_pw_aff *
6158 isl_multi_pw_aff_pullback_multi_aff(
6159 __isl_take isl_multi_pw_aff *mpa,
6160 __isl_take isl_multi_aff *ma);
6161 __isl_give isl_pw_multi_aff *
6162 isl_pw_multi_aff_pullback_pw_multi_aff(
6163 __isl_take isl_pw_multi_aff *pma1,
6164 __isl_take isl_pw_multi_aff *pma2);
6165 __isl_give isl_multi_pw_aff *
6166 isl_multi_pw_aff_pullback_pw_multi_aff(
6167 __isl_take isl_multi_pw_aff *mpa,
6168 __isl_take isl_pw_multi_aff *pma);
6169 __isl_give isl_multi_pw_aff *
6170 isl_multi_pw_aff_pullback_multi_pw_aff(
6171 __isl_take isl_multi_pw_aff *mpa1,
6172 __isl_take isl_multi_pw_aff *mpa2);
6173 __isl_give isl_union_pw_aff *
6174 isl_union_pw_aff_pullback_union_pw_multi_aff(
6175 __isl_take isl_union_pw_aff *upa,
6176 __isl_take isl_union_pw_multi_aff *upma);
6177 __isl_give isl_union_pw_multi_aff *
6178 isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
6179 __isl_take isl_union_pw_multi_aff *upma1,
6180 __isl_take isl_union_pw_multi_aff *upma2);
6181 __isl_give isl_multi_union_pw_aff *
6182 isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
6183 __isl_take isl_multi_union_pw_aff *mupa,
6184 __isl_take isl_union_pw_multi_aff *upma);
6186 These functions precompose the first expression by the second function.
6187 In other words, the second function is plugged
6188 into the first expression.
6192 #include <isl/aff.h>
6193 __isl_give isl_basic_set *isl_aff_eq_basic_set(
6194 __isl_take isl_aff *aff1,
6195 __isl_take isl_aff *aff2);
6196 __isl_give isl_set *isl_aff_eq_set(
6197 __isl_take isl_aff *aff1,
6198 __isl_take isl_aff *aff2);
6199 __isl_give isl_basic_set *isl_aff_le_basic_set(
6200 __isl_take isl_aff *aff1,
6201 __isl_take isl_aff *aff2);
6202 __isl_give isl_set *isl_aff_le_set(
6203 __isl_take isl_aff *aff1,
6204 __isl_take isl_aff *aff2);
6205 __isl_give isl_basic_set *isl_aff_ge_basic_set(
6206 __isl_take isl_aff *aff1,
6207 __isl_take isl_aff *aff2);
6208 __isl_give isl_set *isl_aff_ge_set(
6209 __isl_take isl_aff *aff1,
6210 __isl_take isl_aff *aff2);
6211 __isl_give isl_set *isl_pw_aff_eq_set(
6212 __isl_take isl_pw_aff *pwaff1,
6213 __isl_take isl_pw_aff *pwaff2);
6214 __isl_give isl_set *isl_pw_aff_ne_set(
6215 __isl_take isl_pw_aff *pwaff1,
6216 __isl_take isl_pw_aff *pwaff2);
6217 __isl_give isl_set *isl_pw_aff_le_set(
6218 __isl_take isl_pw_aff *pwaff1,
6219 __isl_take isl_pw_aff *pwaff2);
6220 __isl_give isl_set *isl_pw_aff_lt_set(
6221 __isl_take isl_pw_aff *pwaff1,
6222 __isl_take isl_pw_aff *pwaff2);
6223 __isl_give isl_set *isl_pw_aff_ge_set(
6224 __isl_take isl_pw_aff *pwaff1,
6225 __isl_take isl_pw_aff *pwaff2);
6226 __isl_give isl_set *isl_pw_aff_gt_set(
6227 __isl_take isl_pw_aff *pwaff1,
6228 __isl_take isl_pw_aff *pwaff2);
6230 __isl_give isl_set *isl_multi_aff_lex_le_set(
6231 __isl_take isl_multi_aff *ma1,
6232 __isl_take isl_multi_aff *ma2);
6233 __isl_give isl_set *isl_multi_aff_lex_lt_set(
6234 __isl_take isl_multi_aff *ma1,
6235 __isl_take isl_multi_aff *ma2);
6236 __isl_give isl_set *isl_multi_aff_lex_ge_set(
6237 __isl_take isl_multi_aff *ma1,
6238 __isl_take isl_multi_aff *ma2);
6239 __isl_give isl_set *isl_multi_aff_lex_gt_set(
6240 __isl_take isl_multi_aff *ma1,
6241 __isl_take isl_multi_aff *ma2);
6243 __isl_give isl_set *isl_pw_aff_list_eq_set(
6244 __isl_take isl_pw_aff_list *list1,
6245 __isl_take isl_pw_aff_list *list2);
6246 __isl_give isl_set *isl_pw_aff_list_ne_set(
6247 __isl_take isl_pw_aff_list *list1,
6248 __isl_take isl_pw_aff_list *list2);
6249 __isl_give isl_set *isl_pw_aff_list_le_set(
6250 __isl_take isl_pw_aff_list *list1,
6251 __isl_take isl_pw_aff_list *list2);
6252 __isl_give isl_set *isl_pw_aff_list_lt_set(
6253 __isl_take isl_pw_aff_list *list1,
6254 __isl_take isl_pw_aff_list *list2);
6255 __isl_give isl_set *isl_pw_aff_list_ge_set(
6256 __isl_take isl_pw_aff_list *list1,
6257 __isl_take isl_pw_aff_list *list2);
6258 __isl_give isl_set *isl_pw_aff_list_gt_set(
6259 __isl_take isl_pw_aff_list *list1,
6260 __isl_take isl_pw_aff_list *list2);
6262 The function C<isl_aff_ge_basic_set> returns a basic set
6263 containing those elements in the shared space
6264 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
6265 The function C<isl_pw_aff_ge_set> returns a set
6266 containing those elements in the shared domain
6267 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
6268 greater than or equal to C<pwaff2>.
6269 The function C<isl_multi_aff_lex_le_set> returns a set
6270 containing those elements in the shared domain space
6271 where C<ma1> is lexicographically smaller than or
6273 The functions operating on C<isl_pw_aff_list> apply the corresponding
6274 C<isl_pw_aff> function to each pair of elements in the two lists.
6276 #include <isl/aff.h>
6277 __isl_give isl_map *isl_pw_aff_eq_map(
6278 __isl_take isl_pw_aff *pa1,
6279 __isl_take isl_pw_aff *pa2);
6280 __isl_give isl_map *isl_pw_aff_lt_map(
6281 __isl_take isl_pw_aff *pa1,
6282 __isl_take isl_pw_aff *pa2);
6283 __isl_give isl_map *isl_pw_aff_gt_map(
6284 __isl_take isl_pw_aff *pa1,
6285 __isl_take isl_pw_aff *pa2);
6287 __isl_give isl_map *isl_multi_pw_aff_eq_map(
6288 __isl_take isl_multi_pw_aff *mpa1,
6289 __isl_take isl_multi_pw_aff *mpa2);
6290 __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
6291 __isl_take isl_multi_pw_aff *mpa1,
6292 __isl_take isl_multi_pw_aff *mpa2);
6293 __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
6294 __isl_take isl_multi_pw_aff *mpa1,
6295 __isl_take isl_multi_pw_aff *mpa2);
6297 These functions return a map between domain elements of the arguments
6298 where the function values satisfy the given relation.
6300 #include <isl/union_map.h>
6301 __isl_give isl_union_map *
6302 isl_union_map_eq_at_multi_union_pw_aff(
6303 __isl_take isl_union_map *umap,
6304 __isl_take isl_multi_union_pw_aff *mupa);
6305 __isl_give isl_union_map *
6306 isl_union_map_lex_lt_at_multi_union_pw_aff(
6307 __isl_take isl_union_map *umap,
6308 __isl_take isl_multi_union_pw_aff *mupa);
6309 __isl_give isl_union_map *
6310 isl_union_map_lex_gt_at_multi_union_pw_aff(
6311 __isl_take isl_union_map *umap,
6312 __isl_take isl_multi_union_pw_aff *mupa);
6314 These functions select the subset of elements in the union map
6315 that have an equal or lexicographically smaller function value.
6317 =item * Cartesian Product
6319 #include <isl/space.h>
6320 __isl_give isl_space *isl_space_product(
6321 __isl_take isl_space *space1,
6322 __isl_take isl_space *space2);
6323 __isl_give isl_space *isl_space_domain_product(
6324 __isl_take isl_space *space1,
6325 __isl_take isl_space *space2);
6326 __isl_give isl_space *isl_space_range_product(
6327 __isl_take isl_space *space1,
6328 __isl_take isl_space *space2);
6331 C<isl_space_product>, C<isl_space_domain_product>
6332 and C<isl_space_range_product> take pairs or relation spaces and
6333 produce a single relations space, where either the domain, the range
6334 or both domain and range are wrapped spaces of relations between
6335 the domains and/or ranges of the input spaces.
6336 If the product is only constructed over the domain or the range
6337 then the ranges or the domains of the inputs should be the same.
6338 The function C<isl_space_product> also accepts a pair of set spaces,
6339 in which case it returns a wrapped space of a relation between the
6342 #include <isl/set.h>
6343 __isl_give isl_set *isl_set_product(
6344 __isl_take isl_set *set1,
6345 __isl_take isl_set *set2);
6347 #include <isl/map.h>
6348 __isl_give isl_basic_map *isl_basic_map_domain_product(
6349 __isl_take isl_basic_map *bmap1,
6350 __isl_take isl_basic_map *bmap2);
6351 __isl_give isl_basic_map *isl_basic_map_range_product(
6352 __isl_take isl_basic_map *bmap1,
6353 __isl_take isl_basic_map *bmap2);
6354 __isl_give isl_basic_map *isl_basic_map_product(
6355 __isl_take isl_basic_map *bmap1,
6356 __isl_take isl_basic_map *bmap2);
6357 __isl_give isl_map *isl_map_domain_product(
6358 __isl_take isl_map *map1,
6359 __isl_take isl_map *map2);
6360 __isl_give isl_map *isl_map_range_product(
6361 __isl_take isl_map *map1,
6362 __isl_take isl_map *map2);
6363 __isl_give isl_map *isl_map_product(
6364 __isl_take isl_map *map1,
6365 __isl_take isl_map *map2);
6367 #include <isl/union_set.h>
6368 __isl_give isl_union_set *isl_union_set_product(
6369 __isl_take isl_union_set *uset1,
6370 __isl_take isl_union_set *uset2);
6372 #include <isl/union_map.h>
6373 __isl_give isl_union_map *isl_union_map_domain_product(
6374 __isl_take isl_union_map *umap1,
6375 __isl_take isl_union_map *umap2);
6376 __isl_give isl_union_map *isl_union_map_range_product(
6377 __isl_take isl_union_map *umap1,
6378 __isl_take isl_union_map *umap2);
6379 __isl_give isl_union_map *isl_union_map_product(
6380 __isl_take isl_union_map *umap1,
6381 __isl_take isl_union_map *umap2);
6383 #include <isl/val.h>
6384 __isl_give isl_multi_val *isl_multi_val_range_product(
6385 __isl_take isl_multi_val *mv1,
6386 __isl_take isl_multi_val *mv2);
6387 __isl_give isl_multi_val *isl_multi_val_product(
6388 __isl_take isl_multi_val *mv1,
6389 __isl_take isl_multi_val *mv2);
6391 #include <isl/aff.h>
6392 __isl_give isl_multi_aff *isl_multi_aff_range_product(
6393 __isl_take isl_multi_aff *ma1,
6394 __isl_take isl_multi_aff *ma2);
6395 __isl_give isl_multi_aff *isl_multi_aff_product(
6396 __isl_take isl_multi_aff *ma1,
6397 __isl_take isl_multi_aff *ma2);
6398 __isl_give isl_multi_pw_aff *
6399 isl_multi_pw_aff_range_product(
6400 __isl_take isl_multi_pw_aff *mpa1,
6401 __isl_take isl_multi_pw_aff *mpa2);
6402 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6403 __isl_take isl_multi_pw_aff *mpa1,
6404 __isl_take isl_multi_pw_aff *mpa2);
6405 __isl_give isl_pw_multi_aff *
6406 isl_pw_multi_aff_range_product(
6407 __isl_take isl_pw_multi_aff *pma1,
6408 __isl_take isl_pw_multi_aff *pma2);
6409 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6410 __isl_take isl_pw_multi_aff *pma1,
6411 __isl_take isl_pw_multi_aff *pma2);
6412 __isl_give isl_multi_union_pw_aff *
6413 isl_multi_union_pw_aff_range_product(
6414 __isl_take isl_multi_union_pw_aff *mupa1,
6415 __isl_take isl_multi_union_pw_aff *mupa2);
6417 The above functions compute the cross product of the given
6418 sets, relations or functions. The domains and ranges of the results
6419 are wrapped maps between domains and ranges of the inputs.
6420 To obtain a ``flat'' product, use the following functions
6423 #include <isl/set.h>
6424 __isl_give isl_basic_set *isl_basic_set_flat_product(
6425 __isl_take isl_basic_set *bset1,
6426 __isl_take isl_basic_set *bset2);
6427 __isl_give isl_set *isl_set_flat_product(
6428 __isl_take isl_set *set1,
6429 __isl_take isl_set *set2);
6431 #include <isl/map.h>
6432 __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6433 __isl_take isl_basic_map *bmap1,
6434 __isl_take isl_basic_map *bmap2);
6435 __isl_give isl_map *isl_map_flat_domain_product(
6436 __isl_take isl_map *map1,
6437 __isl_take isl_map *map2);
6438 __isl_give isl_map *isl_map_flat_range_product(
6439 __isl_take isl_map *map1,
6440 __isl_take isl_map *map2);
6441 __isl_give isl_basic_map *isl_basic_map_flat_product(
6442 __isl_take isl_basic_map *bmap1,
6443 __isl_take isl_basic_map *bmap2);
6444 __isl_give isl_map *isl_map_flat_product(
6445 __isl_take isl_map *map1,
6446 __isl_take isl_map *map2);
6448 #include <isl/union_map.h>
6449 __isl_give isl_union_map *
6450 isl_union_map_flat_domain_product(
6451 __isl_take isl_union_map *umap1,
6452 __isl_take isl_union_map *umap2);
6453 __isl_give isl_union_map *
6454 isl_union_map_flat_range_product(
6455 __isl_take isl_union_map *umap1,
6456 __isl_take isl_union_map *umap2);
6458 #include <isl/val.h>
6459 __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6460 __isl_take isl_multi_val *mv1,
6461 __isl_take isl_multi_aff *mv2);
6463 #include <isl/aff.h>
6464 __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6465 __isl_take isl_multi_aff *ma1,
6466 __isl_take isl_multi_aff *ma2);
6467 __isl_give isl_pw_multi_aff *
6468 isl_pw_multi_aff_flat_range_product(
6469 __isl_take isl_pw_multi_aff *pma1,
6470 __isl_take isl_pw_multi_aff *pma2);
6471 __isl_give isl_multi_pw_aff *
6472 isl_multi_pw_aff_flat_range_product(
6473 __isl_take isl_multi_pw_aff *mpa1,
6474 __isl_take isl_multi_pw_aff *mpa2);
6475 __isl_give isl_union_pw_multi_aff *
6476 isl_union_pw_multi_aff_flat_range_product(
6477 __isl_take isl_union_pw_multi_aff *upma1,
6478 __isl_take isl_union_pw_multi_aff *upma2);
6479 __isl_give isl_multi_union_pw_aff *
6480 isl_multi_union_pw_aff_flat_range_product(
6481 __isl_take isl_multi_union_pw_aff *mupa1,
6482 __isl_take isl_multi_union_pw_aff *mupa2);
6484 #include <isl/space.h>
6485 __isl_give isl_space *isl_space_factor_domain(
6486 __isl_take isl_space *space);
6487 __isl_give isl_space *isl_space_factor_range(
6488 __isl_take isl_space *space);
6489 __isl_give isl_space *isl_space_domain_factor_domain(
6490 __isl_take isl_space *space);
6491 __isl_give isl_space *isl_space_domain_factor_range(
6492 __isl_take isl_space *space);
6493 __isl_give isl_space *isl_space_range_factor_domain(
6494 __isl_take isl_space *space);
6495 __isl_give isl_space *isl_space_range_factor_range(
6496 __isl_take isl_space *space);
6498 The functions C<isl_space_range_factor_domain> and
6499 C<isl_space_range_factor_range> extract the two arguments from
6500 the result of a call to C<isl_space_range_product>.
6502 The arguments of a call to a product can be extracted
6503 from the result using the following functions.
6505 #include <isl/map.h>
6506 __isl_give isl_map *isl_map_factor_domain(
6507 __isl_take isl_map *map);
6508 __isl_give isl_map *isl_map_factor_range(
6509 __isl_take isl_map *map);
6510 __isl_give isl_map *isl_map_domain_factor_domain(
6511 __isl_take isl_map *map);
6512 __isl_give isl_map *isl_map_domain_factor_range(
6513 __isl_take isl_map *map);
6514 __isl_give isl_map *isl_map_range_factor_domain(
6515 __isl_take isl_map *map);
6516 __isl_give isl_map *isl_map_range_factor_range(
6517 __isl_take isl_map *map);
6519 #include <isl/union_map.h>
6520 __isl_give isl_union_map *isl_union_map_factor_domain(
6521 __isl_take isl_union_map *umap);
6522 __isl_give isl_union_map *isl_union_map_factor_range(
6523 __isl_take isl_union_map *umap);
6524 __isl_give isl_union_map *
6525 isl_union_map_domain_factor_domain(
6526 __isl_take isl_union_map *umap);
6527 __isl_give isl_union_map *
6528 isl_union_map_domain_factor_range(
6529 __isl_take isl_union_map *umap);
6530 __isl_give isl_union_map *
6531 isl_union_map_range_factor_domain(
6532 __isl_take isl_union_map *umap);
6533 __isl_give isl_union_map *
6534 isl_union_map_range_factor_range(
6535 __isl_take isl_union_map *umap);
6537 #include <isl/val.h>
6538 __isl_give isl_multi_val *isl_multi_val_factor_range(
6539 __isl_take isl_multi_val *mv);
6540 __isl_give isl_multi_val *
6541 isl_multi_val_range_factor_domain(
6542 __isl_take isl_multi_val *mv);
6543 __isl_give isl_multi_val *
6544 isl_multi_val_range_factor_range(
6545 __isl_take isl_multi_val *mv);
6547 #include <isl/aff.h>
6548 __isl_give isl_multi_aff *isl_multi_aff_factor_range(
6549 __isl_take isl_multi_aff *ma);
6550 __isl_give isl_multi_aff *
6551 isl_multi_aff_range_factor_domain(
6552 __isl_take isl_multi_aff *ma);
6553 __isl_give isl_multi_aff *
6554 isl_multi_aff_range_factor_range(
6555 __isl_take isl_multi_aff *ma);
6556 __isl_give isl_multi_pw_aff *
6557 isl_multi_pw_aff_factor_range(
6558 __isl_take isl_multi_pw_aff *mpa);
6559 __isl_give isl_multi_pw_aff *
6560 isl_multi_pw_aff_range_factor_domain(
6561 __isl_take isl_multi_pw_aff *mpa);
6562 __isl_give isl_multi_pw_aff *
6563 isl_multi_pw_aff_range_factor_range(
6564 __isl_take isl_multi_pw_aff *mpa);
6565 __isl_give isl_multi_union_pw_aff *
6566 isl_multi_union_pw_aff_factor_range(
6567 __isl_take isl_multi_union_pw_aff *mupa);
6568 __isl_give isl_multi_union_pw_aff *
6569 isl_multi_union_pw_aff_range_factor_domain(
6570 __isl_take isl_multi_union_pw_aff *mupa);
6571 __isl_give isl_multi_union_pw_aff *
6572 isl_multi_union_pw_aff_range_factor_range(
6573 __isl_take isl_multi_union_pw_aff *mupa);
6575 The splice functions are a generalization of the flat product functions,
6576 where the second argument may be inserted at any position inside
6577 the first argument rather than being placed at the end.
6578 The functions C<isl_multi_val_factor_range>,
6579 C<isl_multi_aff_factor_range>,
6580 C<isl_multi_pw_aff_factor_range> and
6581 C<isl_multi_union_pw_aff_factor_range>
6582 take functions that live in a set space.
6584 #include <isl/val.h>
6585 __isl_give isl_multi_val *isl_multi_val_range_splice(
6586 __isl_take isl_multi_val *mv1, unsigned pos,
6587 __isl_take isl_multi_val *mv2);
6589 #include <isl/aff.h>
6590 __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6591 __isl_take isl_multi_aff *ma1, unsigned pos,
6592 __isl_take isl_multi_aff *ma2);
6593 __isl_give isl_multi_aff *isl_multi_aff_splice(
6594 __isl_take isl_multi_aff *ma1,
6595 unsigned in_pos, unsigned out_pos,
6596 __isl_take isl_multi_aff *ma2);
6597 __isl_give isl_multi_pw_aff *
6598 isl_multi_pw_aff_range_splice(
6599 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6600 __isl_take isl_multi_pw_aff *mpa2);
6601 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6602 __isl_take isl_multi_pw_aff *mpa1,
6603 unsigned in_pos, unsigned out_pos,
6604 __isl_take isl_multi_pw_aff *mpa2);
6605 __isl_give isl_multi_union_pw_aff *
6606 isl_multi_union_pw_aff_range_splice(
6607 __isl_take isl_multi_union_pw_aff *mupa1,
6609 __isl_take isl_multi_union_pw_aff *mupa2);
6611 =item * Simplification
6613 When applied to a set or relation,
6614 the gist operation returns a set or relation that has the
6615 same intersection with the context as the input set or relation.
6616 Any implicit equality in the intersection is made explicit in the result,
6617 while all inequalities that are redundant with respect to the intersection
6619 In case of union sets and relations, the gist operation is performed
6622 When applied to a function,
6623 the gist operation applies the set gist operation to each of
6624 the cells in the domain of the input piecewise expression.
6625 The context is also exploited
6626 to simplify the expression associated to each cell.
6628 #include <isl/set.h>
6629 __isl_give isl_basic_set *isl_basic_set_gist(
6630 __isl_take isl_basic_set *bset,
6631 __isl_take isl_basic_set *context);
6632 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6633 __isl_take isl_set *context);
6634 __isl_give isl_set *isl_set_gist_params(
6635 __isl_take isl_set *set,
6636 __isl_take isl_set *context);
6638 #include <isl/map.h>
6639 __isl_give isl_basic_map *isl_basic_map_gist(
6640 __isl_take isl_basic_map *bmap,
6641 __isl_take isl_basic_map *context);
6642 __isl_give isl_basic_map *isl_basic_map_gist_domain(
6643 __isl_take isl_basic_map *bmap,
6644 __isl_take isl_basic_set *context);
6645 __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6646 __isl_take isl_map *context);
6647 __isl_give isl_map *isl_map_gist_params(
6648 __isl_take isl_map *map,
6649 __isl_take isl_set *context);
6650 __isl_give isl_map *isl_map_gist_domain(
6651 __isl_take isl_map *map,
6652 __isl_take isl_set *context);
6653 __isl_give isl_map *isl_map_gist_range(
6654 __isl_take isl_map *map,
6655 __isl_take isl_set *context);
6657 #include <isl/union_set.h>
6658 __isl_give isl_union_set *isl_union_set_gist(
6659 __isl_take isl_union_set *uset,
6660 __isl_take isl_union_set *context);
6661 __isl_give isl_union_set *isl_union_set_gist_params(
6662 __isl_take isl_union_set *uset,
6663 __isl_take isl_set *set);
6665 #include <isl/union_map.h>
6666 __isl_give isl_union_map *isl_union_map_gist(
6667 __isl_take isl_union_map *umap,
6668 __isl_take isl_union_map *context);
6669 __isl_give isl_union_map *isl_union_map_gist_params(
6670 __isl_take isl_union_map *umap,
6671 __isl_take isl_set *set);
6672 __isl_give isl_union_map *isl_union_map_gist_domain(
6673 __isl_take isl_union_map *umap,
6674 __isl_take isl_union_set *uset);
6675 __isl_give isl_union_map *isl_union_map_gist_range(
6676 __isl_take isl_union_map *umap,
6677 __isl_take isl_union_set *uset);
6679 #include <isl/aff.h>
6680 __isl_give isl_aff *isl_aff_gist_params(
6681 __isl_take isl_aff *aff,
6682 __isl_take isl_set *context);
6683 __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6684 __isl_take isl_set *context);
6685 __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6686 __isl_take isl_multi_aff *maff,
6687 __isl_take isl_set *context);
6688 __isl_give isl_multi_aff *isl_multi_aff_gist(
6689 __isl_take isl_multi_aff *maff,
6690 __isl_take isl_set *context);
6691 __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6692 __isl_take isl_pw_aff *pwaff,
6693 __isl_take isl_set *context);
6694 __isl_give isl_pw_aff *isl_pw_aff_gist(
6695 __isl_take isl_pw_aff *pwaff,
6696 __isl_take isl_set *context);
6697 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6698 __isl_take isl_pw_multi_aff *pma,
6699 __isl_take isl_set *set);
6700 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6701 __isl_take isl_pw_multi_aff *pma,
6702 __isl_take isl_set *set);
6703 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6704 __isl_take isl_multi_pw_aff *mpa,
6705 __isl_take isl_set *set);
6706 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6707 __isl_take isl_multi_pw_aff *mpa,
6708 __isl_take isl_set *set);
6709 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6710 __isl_take isl_union_pw_aff *upa,
6711 __isl_take isl_union_set *context);
6712 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6713 __isl_take isl_union_pw_aff *upa,
6714 __isl_take isl_set *context);
6715 __isl_give isl_union_pw_multi_aff *
6716 isl_union_pw_multi_aff_gist_params(
6717 __isl_take isl_union_pw_multi_aff *upma,
6718 __isl_take isl_set *context);
6719 __isl_give isl_union_pw_multi_aff *
6720 isl_union_pw_multi_aff_gist(
6721 __isl_take isl_union_pw_multi_aff *upma,
6722 __isl_take isl_union_set *context);
6723 __isl_give isl_multi_union_pw_aff *
6724 isl_multi_union_pw_aff_gist_params(
6725 __isl_take isl_multi_union_pw_aff *aff,
6726 __isl_take isl_set *context);
6727 __isl_give isl_multi_union_pw_aff *
6728 isl_multi_union_pw_aff_gist(
6729 __isl_take isl_multi_union_pw_aff *aff,
6730 __isl_take isl_union_set *context);
6732 #include <isl/polynomial.h>
6733 __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6734 __isl_take isl_qpolynomial *qp,
6735 __isl_take isl_set *context);
6736 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6737 __isl_take isl_qpolynomial *qp,
6738 __isl_take isl_set *context);
6739 __isl_give isl_qpolynomial_fold *
6740 isl_qpolynomial_fold_gist_params(
6741 __isl_take isl_qpolynomial_fold *fold,
6742 __isl_take isl_set *context);
6743 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6744 __isl_take isl_qpolynomial_fold *fold,
6745 __isl_take isl_set *context);
6746 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6747 __isl_take isl_pw_qpolynomial *pwqp,
6748 __isl_take isl_set *context);
6749 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6750 __isl_take isl_pw_qpolynomial *pwqp,
6751 __isl_take isl_set *context);
6752 __isl_give isl_pw_qpolynomial_fold *
6753 isl_pw_qpolynomial_fold_gist(
6754 __isl_take isl_pw_qpolynomial_fold *pwf,
6755 __isl_take isl_set *context);
6756 __isl_give isl_pw_qpolynomial_fold *
6757 isl_pw_qpolynomial_fold_gist_params(
6758 __isl_take isl_pw_qpolynomial_fold *pwf,
6759 __isl_take isl_set *context);
6760 __isl_give isl_union_pw_qpolynomial *
6761 isl_union_pw_qpolynomial_gist_params(
6762 __isl_take isl_union_pw_qpolynomial *upwqp,
6763 __isl_take isl_set *context);
6764 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6765 __isl_take isl_union_pw_qpolynomial *upwqp,
6766 __isl_take isl_union_set *context);
6767 __isl_give isl_union_pw_qpolynomial_fold *
6768 isl_union_pw_qpolynomial_fold_gist(
6769 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6770 __isl_take isl_union_set *context);
6771 __isl_give isl_union_pw_qpolynomial_fold *
6772 isl_union_pw_qpolynomial_fold_gist_params(
6773 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6774 __isl_take isl_set *context);
6776 =item * Binary Arithmetic Operations
6778 #include <isl/set.h>
6779 __isl_give isl_set *isl_set_sum(
6780 __isl_take isl_set *set1,
6781 __isl_take isl_set *set2);
6782 #include <isl/map.h>
6783 __isl_give isl_map *isl_map_sum(
6784 __isl_take isl_map *map1,
6785 __isl_take isl_map *map2);
6787 C<isl_set_sum> computes the Minkowski sum of its two arguments,
6788 i.e., the set containing the sums of pairs of elements from
6789 C<set1> and C<set2>.
6790 The domain of the result of C<isl_map_sum> is the intersection
6791 of the domains of its two arguments. The corresponding range
6792 elements are the sums of the corresponding range elements
6793 in the two arguments.
6795 #include <isl/val.h>
6796 __isl_give isl_multi_val *isl_multi_val_add(
6797 __isl_take isl_multi_val *mv1,
6798 __isl_take isl_multi_val *mv2);
6799 __isl_give isl_multi_val *isl_multi_val_sub(
6800 __isl_take isl_multi_val *mv1,
6801 __isl_take isl_multi_val *mv2);
6803 #include <isl/aff.h>
6804 __isl_give isl_aff *isl_aff_add(
6805 __isl_take isl_aff *aff1,
6806 __isl_take isl_aff *aff2);
6807 __isl_give isl_multi_aff *isl_multi_aff_add(
6808 __isl_take isl_multi_aff *maff1,
6809 __isl_take isl_multi_aff *maff2);
6810 __isl_give isl_pw_aff *isl_pw_aff_add(
6811 __isl_take isl_pw_aff *pwaff1,
6812 __isl_take isl_pw_aff *pwaff2);
6813 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
6814 __isl_take isl_multi_pw_aff *mpa1,
6815 __isl_take isl_multi_pw_aff *mpa2);
6816 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6817 __isl_take isl_pw_multi_aff *pma1,
6818 __isl_take isl_pw_multi_aff *pma2);
6819 __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6820 __isl_take isl_union_pw_aff *upa1,
6821 __isl_take isl_union_pw_aff *upa2);
6822 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6823 __isl_take isl_union_pw_multi_aff *upma1,
6824 __isl_take isl_union_pw_multi_aff *upma2);
6825 __isl_give isl_multi_union_pw_aff *
6826 isl_multi_union_pw_aff_add(
6827 __isl_take isl_multi_union_pw_aff *mupa1,
6828 __isl_take isl_multi_union_pw_aff *mupa2);
6829 __isl_give isl_pw_aff *isl_pw_aff_min(
6830 __isl_take isl_pw_aff *pwaff1,
6831 __isl_take isl_pw_aff *pwaff2);
6832 __isl_give isl_pw_aff *isl_pw_aff_max(
6833 __isl_take isl_pw_aff *pwaff1,
6834 __isl_take isl_pw_aff *pwaff2);
6835 __isl_give isl_aff *isl_aff_sub(
6836 __isl_take isl_aff *aff1,
6837 __isl_take isl_aff *aff2);
6838 __isl_give isl_multi_aff *isl_multi_aff_sub(
6839 __isl_take isl_multi_aff *ma1,
6840 __isl_take isl_multi_aff *ma2);
6841 __isl_give isl_pw_aff *isl_pw_aff_sub(
6842 __isl_take isl_pw_aff *pwaff1,
6843 __isl_take isl_pw_aff *pwaff2);
6844 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6845 __isl_take isl_multi_pw_aff *mpa1,
6846 __isl_take isl_multi_pw_aff *mpa2);
6847 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6848 __isl_take isl_pw_multi_aff *pma1,
6849 __isl_take isl_pw_multi_aff *pma2);
6850 __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6851 __isl_take isl_union_pw_aff *upa1,
6852 __isl_take isl_union_pw_aff *upa2);
6853 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6854 __isl_take isl_union_pw_multi_aff *upma1,
6855 __isl_take isl_union_pw_multi_aff *upma2);
6856 __isl_give isl_multi_union_pw_aff *
6857 isl_multi_union_pw_aff_sub(
6858 __isl_take isl_multi_union_pw_aff *mupa1,
6859 __isl_take isl_multi_union_pw_aff *mupa2);
6861 C<isl_aff_sub> subtracts the second argument from the first.
6863 #include <isl/polynomial.h>
6864 __isl_give isl_qpolynomial *isl_qpolynomial_add(
6865 __isl_take isl_qpolynomial *qp1,
6866 __isl_take isl_qpolynomial *qp2);
6867 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6868 __isl_take isl_pw_qpolynomial *pwqp1,
6869 __isl_take isl_pw_qpolynomial *pwqp2);
6870 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6871 __isl_take isl_pw_qpolynomial *pwqp1,
6872 __isl_take isl_pw_qpolynomial *pwqp2);
6873 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6874 __isl_take isl_pw_qpolynomial_fold *pwf1,
6875 __isl_take isl_pw_qpolynomial_fold *pwf2);
6876 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6877 __isl_take isl_union_pw_qpolynomial *upwqp1,
6878 __isl_take isl_union_pw_qpolynomial *upwqp2);
6879 __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6880 __isl_take isl_qpolynomial *qp1,
6881 __isl_take isl_qpolynomial *qp2);
6882 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6883 __isl_take isl_pw_qpolynomial *pwqp1,
6884 __isl_take isl_pw_qpolynomial *pwqp2);
6885 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6886 __isl_take isl_union_pw_qpolynomial *upwqp1,
6887 __isl_take isl_union_pw_qpolynomial *upwqp2);
6888 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6889 __isl_take isl_pw_qpolynomial_fold *pwf1,
6890 __isl_take isl_pw_qpolynomial_fold *pwf2);
6891 __isl_give isl_union_pw_qpolynomial_fold *
6892 isl_union_pw_qpolynomial_fold_fold(
6893 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6894 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6896 #include <isl/aff.h>
6897 __isl_give isl_pw_aff *isl_pw_aff_union_add(
6898 __isl_take isl_pw_aff *pwaff1,
6899 __isl_take isl_pw_aff *pwaff2);
6900 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6901 __isl_take isl_pw_multi_aff *pma1,
6902 __isl_take isl_pw_multi_aff *pma2);
6903 __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6904 __isl_take isl_union_pw_aff *upa1,
6905 __isl_take isl_union_pw_aff *upa2);
6906 __isl_give isl_union_pw_multi_aff *
6907 isl_union_pw_multi_aff_union_add(
6908 __isl_take isl_union_pw_multi_aff *upma1,
6909 __isl_take isl_union_pw_multi_aff *upma2);
6910 __isl_give isl_multi_union_pw_aff *
6911 isl_multi_union_pw_aff_union_add(
6912 __isl_take isl_multi_union_pw_aff *mupa1,
6913 __isl_take isl_multi_union_pw_aff *mupa2);
6914 __isl_give isl_pw_aff *isl_pw_aff_union_min(
6915 __isl_take isl_pw_aff *pwaff1,
6916 __isl_take isl_pw_aff *pwaff2);
6917 __isl_give isl_pw_aff *isl_pw_aff_union_max(
6918 __isl_take isl_pw_aff *pwaff1,
6919 __isl_take isl_pw_aff *pwaff2);
6921 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6922 expression with a domain that is the union of those of C<pwaff1> and
6923 C<pwaff2> and such that on each cell, the quasi-affine expression is
6924 the maximum of those of C<pwaff1> and C<pwaff2>. If only one of
6925 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6926 associated expression is the defined one.
6927 This in contrast to the C<isl_pw_aff_max> function, which is
6928 only defined on the shared definition domain of the arguments.
6930 #include <isl/val.h>
6931 __isl_give isl_multi_val *isl_multi_val_add_val(
6932 __isl_take isl_multi_val *mv,
6933 __isl_take isl_val *v);
6934 __isl_give isl_multi_val *isl_multi_val_mod_val(
6935 __isl_take isl_multi_val *mv,
6936 __isl_take isl_val *v);
6937 __isl_give isl_multi_val *isl_multi_val_scale_val(
6938 __isl_take isl_multi_val *mv,
6939 __isl_take isl_val *v);
6940 __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6941 __isl_take isl_multi_val *mv,
6942 __isl_take isl_val *v);
6944 #include <isl/aff.h>
6945 __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6946 __isl_take isl_val *mod);
6947 __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6948 __isl_take isl_pw_aff *pa,
6949 __isl_take isl_val *mod);
6950 __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6951 __isl_take isl_union_pw_aff *upa,
6952 __isl_take isl_val *f);
6953 __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6954 __isl_take isl_val *v);
6955 __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6956 __isl_take isl_multi_aff *ma,
6957 __isl_take isl_val *v);
6958 __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6959 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6960 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6961 __isl_take isl_multi_pw_aff *mpa,
6962 __isl_take isl_val *v);
6963 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6964 __isl_take isl_pw_multi_aff *pma,
6965 __isl_take isl_val *v);
6966 __isl_give isl_union_pw_multi_aff *
6967 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6968 __isl_take isl_union_pw_aff *upa,
6969 __isl_take isl_val *f);
6970 isl_union_pw_multi_aff_scale_val(
6971 __isl_take isl_union_pw_multi_aff *upma,
6972 __isl_take isl_val *val);
6973 __isl_give isl_multi_union_pw_aff *
6974 isl_multi_union_pw_aff_scale_val(
6975 __isl_take isl_multi_union_pw_aff *mupa,
6976 __isl_take isl_val *v);
6977 __isl_give isl_aff *isl_aff_scale_down_ui(
6978 __isl_take isl_aff *aff, unsigned f);
6979 __isl_give isl_aff *isl_aff_scale_down_val(
6980 __isl_take isl_aff *aff, __isl_take isl_val *v);
6981 __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6982 __isl_take isl_multi_aff *ma,
6983 __isl_take isl_val *v);
6984 __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6985 __isl_take isl_pw_aff *pa,
6986 __isl_take isl_val *f);
6987 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6988 __isl_take isl_multi_pw_aff *mpa,
6989 __isl_take isl_val *v);
6990 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6991 __isl_take isl_pw_multi_aff *pma,
6992 __isl_take isl_val *v);
6993 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6994 __isl_take isl_union_pw_aff *upa,
6995 __isl_take isl_val *v);
6996 __isl_give isl_union_pw_multi_aff *
6997 isl_union_pw_multi_aff_scale_down_val(
6998 __isl_take isl_union_pw_multi_aff *upma,
6999 __isl_take isl_val *val);
7000 __isl_give isl_multi_union_pw_aff *
7001 isl_multi_union_pw_aff_scale_down_val(
7002 __isl_take isl_multi_union_pw_aff *mupa,
7003 __isl_take isl_val *v);
7005 #include <isl/polynomial.h>
7006 __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
7007 __isl_take isl_qpolynomial *qp,
7008 __isl_take isl_val *v);
7009 __isl_give isl_qpolynomial_fold *
7010 isl_qpolynomial_fold_scale_val(
7011 __isl_take isl_qpolynomial_fold *fold,
7012 __isl_take isl_val *v);
7013 __isl_give isl_pw_qpolynomial *
7014 isl_pw_qpolynomial_scale_val(
7015 __isl_take isl_pw_qpolynomial *pwqp,
7016 __isl_take isl_val *v);
7017 __isl_give isl_pw_qpolynomial_fold *
7018 isl_pw_qpolynomial_fold_scale_val(
7019 __isl_take isl_pw_qpolynomial_fold *pwf,
7020 __isl_take isl_val *v);
7021 __isl_give isl_union_pw_qpolynomial *
7022 isl_union_pw_qpolynomial_scale_val(
7023 __isl_take isl_union_pw_qpolynomial *upwqp,
7024 __isl_take isl_val *v);
7025 __isl_give isl_union_pw_qpolynomial_fold *
7026 isl_union_pw_qpolynomial_fold_scale_val(
7027 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7028 __isl_take isl_val *v);
7029 __isl_give isl_qpolynomial *
7030 isl_qpolynomial_scale_down_val(
7031 __isl_take isl_qpolynomial *qp,
7032 __isl_take isl_val *v);
7033 __isl_give isl_qpolynomial_fold *
7034 isl_qpolynomial_fold_scale_down_val(
7035 __isl_take isl_qpolynomial_fold *fold,
7036 __isl_take isl_val *v);
7037 __isl_give isl_pw_qpolynomial *
7038 isl_pw_qpolynomial_scale_down_val(
7039 __isl_take isl_pw_qpolynomial *pwqp,
7040 __isl_take isl_val *v);
7041 __isl_give isl_pw_qpolynomial_fold *
7042 isl_pw_qpolynomial_fold_scale_down_val(
7043 __isl_take isl_pw_qpolynomial_fold *pwf,
7044 __isl_take isl_val *v);
7045 __isl_give isl_union_pw_qpolynomial *
7046 isl_union_pw_qpolynomial_scale_down_val(
7047 __isl_take isl_union_pw_qpolynomial *upwqp,
7048 __isl_take isl_val *v);
7049 __isl_give isl_union_pw_qpolynomial_fold *
7050 isl_union_pw_qpolynomial_fold_scale_down_val(
7051 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7052 __isl_take isl_val *v);
7054 #include <isl/val.h>
7055 __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
7056 __isl_take isl_multi_val *mv1,
7057 __isl_take isl_multi_val *mv2);
7058 __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
7059 __isl_take isl_multi_val *mv1,
7060 __isl_take isl_multi_val *mv2);
7061 __isl_give isl_multi_val *
7062 isl_multi_val_scale_down_multi_val(
7063 __isl_take isl_multi_val *mv1,
7064 __isl_take isl_multi_val *mv2);
7066 #include <isl/aff.h>
7067 __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
7068 __isl_take isl_multi_aff *ma,
7069 __isl_take isl_multi_val *mv);
7070 __isl_give isl_multi_union_pw_aff *
7071 isl_multi_union_pw_aff_mod_multi_val(
7072 __isl_take isl_multi_union_pw_aff *upma,
7073 __isl_take isl_multi_val *mv);
7074 __isl_give isl_multi_pw_aff *
7075 isl_multi_pw_aff_mod_multi_val(
7076 __isl_take isl_multi_pw_aff *mpa,
7077 __isl_take isl_multi_val *mv);
7078 __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
7079 __isl_take isl_multi_aff *ma,
7080 __isl_take isl_multi_val *mv);
7081 __isl_give isl_pw_multi_aff *
7082 isl_pw_multi_aff_scale_multi_val(
7083 __isl_take isl_pw_multi_aff *pma,
7084 __isl_take isl_multi_val *mv);
7085 __isl_give isl_multi_pw_aff *
7086 isl_multi_pw_aff_scale_multi_val(
7087 __isl_take isl_multi_pw_aff *mpa,
7088 __isl_take isl_multi_val *mv);
7089 __isl_give isl_multi_union_pw_aff *
7090 isl_multi_union_pw_aff_scale_multi_val(
7091 __isl_take isl_multi_union_pw_aff *mupa,
7092 __isl_take isl_multi_val *mv);
7093 __isl_give isl_union_pw_multi_aff *
7094 isl_union_pw_multi_aff_scale_multi_val(
7095 __isl_take isl_union_pw_multi_aff *upma,
7096 __isl_take isl_multi_val *mv);
7097 __isl_give isl_multi_aff *
7098 isl_multi_aff_scale_down_multi_val(
7099 __isl_take isl_multi_aff *ma,
7100 __isl_take isl_multi_val *mv);
7101 __isl_give isl_multi_pw_aff *
7102 isl_multi_pw_aff_scale_down_multi_val(
7103 __isl_take isl_multi_pw_aff *mpa,
7104 __isl_take isl_multi_val *mv);
7105 __isl_give isl_multi_union_pw_aff *
7106 isl_multi_union_pw_aff_scale_down_multi_val(
7107 __isl_take isl_multi_union_pw_aff *mupa,
7108 __isl_take isl_multi_val *mv);
7110 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
7111 by the corresponding elements of C<mv>.
7113 #include <isl/aff.h>
7114 __isl_give isl_aff *isl_aff_mul(
7115 __isl_take isl_aff *aff1,
7116 __isl_take isl_aff *aff2);
7117 __isl_give isl_aff *isl_aff_div(
7118 __isl_take isl_aff *aff1,
7119 __isl_take isl_aff *aff2);
7120 __isl_give isl_pw_aff *isl_pw_aff_mul(
7121 __isl_take isl_pw_aff *pwaff1,
7122 __isl_take isl_pw_aff *pwaff2);
7123 __isl_give isl_pw_aff *isl_pw_aff_div(
7124 __isl_take isl_pw_aff *pa1,
7125 __isl_take isl_pw_aff *pa2);
7126 __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
7127 __isl_take isl_pw_aff *pa1,
7128 __isl_take isl_pw_aff *pa2);
7129 __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
7130 __isl_take isl_pw_aff *pa1,
7131 __isl_take isl_pw_aff *pa2);
7133 When multiplying two affine expressions, at least one of the two needs
7134 to be a constant. Similarly, when dividing an affine expression by another,
7135 the second expression needs to be a constant.
7136 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
7137 rounding towards zero. C<isl_pw_aff_tdiv_r> computes the corresponding
7140 #include <isl/polynomial.h>
7141 __isl_give isl_qpolynomial *isl_qpolynomial_mul(
7142 __isl_take isl_qpolynomial *qp1,
7143 __isl_take isl_qpolynomial *qp2);
7144 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
7145 __isl_take isl_pw_qpolynomial *pwqp1,
7146 __isl_take isl_pw_qpolynomial *pwqp2);
7147 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
7148 __isl_take isl_union_pw_qpolynomial *upwqp1,
7149 __isl_take isl_union_pw_qpolynomial *upwqp2);
7153 =head3 Lexicographic Optimization
7155 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
7156 the following functions
7157 compute a set that contains the lexicographic minimum or maximum
7158 of the elements in C<set> (or C<bset>) for those values of the parameters
7159 that satisfy C<dom>.
7160 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7161 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
7163 In other words, the union of the parameter values
7164 for which the result is non-empty and of C<*empty>
7167 #include <isl/set.h>
7168 __isl_give isl_set *isl_basic_set_partial_lexmin(
7169 __isl_take isl_basic_set *bset,
7170 __isl_take isl_basic_set *dom,
7171 __isl_give isl_set **empty);
7172 __isl_give isl_set *isl_basic_set_partial_lexmax(
7173 __isl_take isl_basic_set *bset,
7174 __isl_take isl_basic_set *dom,
7175 __isl_give isl_set **empty);
7176 __isl_give isl_set *isl_set_partial_lexmin(
7177 __isl_take isl_set *set, __isl_take isl_set *dom,
7178 __isl_give isl_set **empty);
7179 __isl_give isl_set *isl_set_partial_lexmax(
7180 __isl_take isl_set *set, __isl_take isl_set *dom,
7181 __isl_give isl_set **empty);
7183 Given a (basic) set C<set> (or C<bset>), the following functions simply
7184 return a set containing the lexicographic minimum or maximum
7185 of the elements in C<set> (or C<bset>).
7186 In case of union sets, the optimum is computed per space.
7188 #include <isl/set.h>
7189 __isl_give isl_set *isl_basic_set_lexmin(
7190 __isl_take isl_basic_set *bset);
7191 __isl_give isl_set *isl_basic_set_lexmax(
7192 __isl_take isl_basic_set *bset);
7193 __isl_give isl_set *isl_set_lexmin(
7194 __isl_take isl_set *set);
7195 __isl_give isl_set *isl_set_lexmax(
7196 __isl_take isl_set *set);
7197 __isl_give isl_union_set *isl_union_set_lexmin(
7198 __isl_take isl_union_set *uset);
7199 __isl_give isl_union_set *isl_union_set_lexmax(
7200 __isl_take isl_union_set *uset);
7202 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
7203 the following functions
7204 compute a relation that maps each element of C<dom>
7205 to the single lexicographic minimum or maximum
7206 of the elements that are associated to that same
7207 element in C<map> (or C<bmap>).
7208 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7209 that contains the elements in C<dom> that do not map
7210 to any elements in C<map> (or C<bmap>).
7211 In other words, the union of the domain of the result and of C<*empty>
7214 #include <isl/map.h>
7215 __isl_give isl_map *isl_basic_map_partial_lexmax(
7216 __isl_take isl_basic_map *bmap,
7217 __isl_take isl_basic_set *dom,
7218 __isl_give isl_set **empty);
7219 __isl_give isl_map *isl_basic_map_partial_lexmin(
7220 __isl_take isl_basic_map *bmap,
7221 __isl_take isl_basic_set *dom,
7222 __isl_give isl_set **empty);
7223 __isl_give isl_map *isl_map_partial_lexmax(
7224 __isl_take isl_map *map, __isl_take isl_set *dom,
7225 __isl_give isl_set **empty);
7226 __isl_give isl_map *isl_map_partial_lexmin(
7227 __isl_take isl_map *map, __isl_take isl_set *dom,
7228 __isl_give isl_set **empty);
7230 Given a (basic) map C<map> (or C<bmap>), the following functions simply
7231 return a map mapping each element in the domain of
7232 C<map> (or C<bmap>) to the lexicographic minimum or maximum
7233 of all elements associated to that element.
7234 In case of union relations, the optimum is computed per space.
7236 #include <isl/map.h>
7237 __isl_give isl_map *isl_basic_map_lexmin(
7238 __isl_take isl_basic_map *bmap);
7239 __isl_give isl_map *isl_basic_map_lexmax(
7240 __isl_take isl_basic_map *bmap);
7241 __isl_give isl_map *isl_map_lexmin(
7242 __isl_take isl_map *map);
7243 __isl_give isl_map *isl_map_lexmax(
7244 __isl_take isl_map *map);
7245 __isl_give isl_union_map *isl_union_map_lexmin(
7246 __isl_take isl_union_map *umap);
7247 __isl_give isl_union_map *isl_union_map_lexmax(
7248 __isl_take isl_union_map *umap);
7250 The following functions return their result in the form of
7251 a piecewise multi-affine expression,
7252 but are otherwise equivalent to the corresponding functions
7253 returning a basic set or relation.
7255 #include <isl/set.h>
7256 __isl_give isl_pw_multi_aff *
7257 isl_basic_set_partial_lexmin_pw_multi_aff(
7258 __isl_take isl_basic_set *bset,
7259 __isl_take isl_basic_set *dom,
7260 __isl_give isl_set **empty);
7261 __isl_give isl_pw_multi_aff *
7262 isl_basic_set_partial_lexmax_pw_multi_aff(
7263 __isl_take isl_basic_set *bset,
7264 __isl_take isl_basic_set *dom,
7265 __isl_give isl_set **empty);
7266 __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
7267 __isl_take isl_set *set);
7268 __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
7269 __isl_take isl_set *set);
7271 #include <isl/map.h>
7272 __isl_give isl_pw_multi_aff *
7273 isl_basic_map_lexmin_pw_multi_aff(
7274 __isl_take isl_basic_map *bmap);
7275 __isl_give isl_pw_multi_aff *
7276 isl_basic_map_partial_lexmin_pw_multi_aff(
7277 __isl_take isl_basic_map *bmap,
7278 __isl_take isl_basic_set *dom,
7279 __isl_give isl_set **empty);
7280 __isl_give isl_pw_multi_aff *
7281 isl_basic_map_partial_lexmax_pw_multi_aff(
7282 __isl_take isl_basic_map *bmap,
7283 __isl_take isl_basic_set *dom,
7284 __isl_give isl_set **empty);
7285 __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
7286 __isl_take isl_map *map);
7287 __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
7288 __isl_take isl_map *map);
7290 The following functions return the lexicographic minimum or maximum
7291 on the shared domain of the inputs and the single defined function
7292 on those parts of the domain where only a single function is defined.
7294 #include <isl/aff.h>
7295 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
7296 __isl_take isl_pw_multi_aff *pma1,
7297 __isl_take isl_pw_multi_aff *pma2);
7298 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
7299 __isl_take isl_pw_multi_aff *pma1,
7300 __isl_take isl_pw_multi_aff *pma2);
7302 If the input to a lexicographic optimization problem has
7303 multiple constraints with the same coefficients for the optimized
7304 variables, then, by default, this symmetry is exploited by
7305 replacing those constraints by a single constraint with
7306 an abstract bound, which is in turn bounded by the corresponding terms
7307 in the original constraints.
7308 Without this optimization, the solver would typically consider
7309 all possible orderings of those original bounds, resulting in a needless
7310 decomposition of the domain.
7311 However, the optimization can also result in slowdowns since
7312 an extra parameter is introduced that may get used in additional
7314 The following option determines whether symmetry detection is applied
7315 during lexicographic optimization.
7317 #include <isl/options.h>
7318 isl_stat isl_options_set_pip_symmetry(isl_ctx *ctx,
7320 int isl_options_get_pip_symmetry(isl_ctx *ctx);
7324 See also \autoref{s:offline}.
7328 =head2 Ternary Operations
7330 #include <isl/aff.h>
7331 __isl_give isl_pw_aff *isl_pw_aff_cond(
7332 __isl_take isl_pw_aff *cond,
7333 __isl_take isl_pw_aff *pwaff_true,
7334 __isl_take isl_pw_aff *pwaff_false);
7336 The function C<isl_pw_aff_cond> performs a conditional operator
7337 and returns an expression that is equal to C<pwaff_true>
7338 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
7339 where C<cond> is zero.
7343 Lists are defined over several element types, including
7344 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
7345 C<isl_union_pw_multi_aff>, C<isl_constraint>,
7346 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
7347 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
7348 Here we take lists of C<isl_set>s as an example.
7349 Lists can be created, copied, modified and freed using the following functions.
7351 #include <isl/set.h>
7352 __isl_give isl_set_list *isl_set_list_from_set(
7353 __isl_take isl_set *el);
7354 __isl_give isl_set_list *isl_set_list_alloc(
7355 isl_ctx *ctx, int n);
7356 __isl_give isl_set_list *isl_set_list_copy(
7357 __isl_keep isl_set_list *list);
7358 __isl_give isl_set_list *isl_set_list_insert(
7359 __isl_take isl_set_list *list, unsigned pos,
7360 __isl_take isl_set *el);
7361 __isl_give isl_set_list *isl_set_list_add(
7362 __isl_take isl_set_list *list,
7363 __isl_take isl_set *el);
7364 __isl_give isl_set_list *isl_set_list_drop(
7365 __isl_take isl_set_list *list,
7366 unsigned first, unsigned n);
7367 __isl_give isl_set_list *isl_set_list_set_set(
7368 __isl_take isl_set_list *list, int index,
7369 __isl_take isl_set *set);
7370 __isl_give isl_set_list *isl_set_list_concat(
7371 __isl_take isl_set_list *list1,
7372 __isl_take isl_set_list *list2);
7373 __isl_give isl_set_list *isl_set_list_sort(
7374 __isl_take isl_set_list *list,
7375 int (*cmp)(__isl_keep isl_set *a,
7376 __isl_keep isl_set *b, void *user),
7378 __isl_null isl_set_list *isl_set_list_free(
7379 __isl_take isl_set_list *list);
7381 C<isl_set_list_alloc> creates an empty list with an initial capacity
7382 for C<n> elements. C<isl_set_list_insert> and C<isl_set_list_add>
7383 add elements to a list, increasing its capacity as needed.
7384 C<isl_set_list_from_set> creates a list with a single element.
7386 Lists can be inspected using the following functions.
7388 #include <isl/set.h>
7389 int isl_set_list_n_set(__isl_keep isl_set_list *list);
7390 __isl_give isl_set *isl_set_list_get_set(
7391 __isl_keep isl_set_list *list, int index);
7392 isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
7393 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7395 isl_stat isl_set_list_foreach_scc(
7396 __isl_keep isl_set_list *list,
7397 isl_bool (*follows)(__isl_keep isl_set *a,
7398 __isl_keep isl_set *b, void *user),
7400 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7403 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
7404 strongly connected components of the graph with as vertices the elements
7405 of C<list> and a directed edge from vertex C<b> to vertex C<a>
7406 iff C<follows(a, b)> returns C<isl_bool_true>. The callbacks C<follows> and
7407 C<fn> should return C<isl_bool_error> or C<isl_stat_error> on error.
7409 Lists can be printed using
7411 #include <isl/set.h>
7412 __isl_give isl_printer *isl_printer_print_set_list(
7413 __isl_take isl_printer *p,
7414 __isl_keep isl_set_list *list);
7416 =head2 Associative arrays
7418 Associative arrays map isl objects of a specific type to isl objects
7419 of some (other) specific type. They are defined for several pairs
7420 of types, including (C<isl_map>, C<isl_basic_set>),
7421 (C<isl_id>, C<isl_ast_expr>),
7422 (C<isl_id>, C<isl_id>) and
7423 (C<isl_id>, C<isl_pw_aff>).
7424 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7427 Associative arrays can be created, copied and freed using
7428 the following functions.
7430 #include <isl/id_to_ast_expr.h>
7431 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7432 isl_ctx *ctx, int min_size);
7433 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7434 __isl_keep isl_id_to_ast_expr *id2expr);
7435 __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7436 __isl_take isl_id_to_ast_expr *id2expr);
7438 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7439 to specify the expected size of the associative array.
7440 The associative array will be grown automatically as needed.
7442 Associative arrays can be inspected using the following functions.
7444 #include <isl/id_to_ast_expr.h>
7445 __isl_give isl_maybe_isl_ast_expr
7446 isl_id_to_ast_expr_try_get(
7447 __isl_keep isl_id_to_ast_expr *id2expr,
7448 __isl_keep isl_id *key);
7449 isl_bool isl_id_to_ast_expr_has(
7450 __isl_keep isl_id_to_ast_expr *id2expr,
7451 __isl_keep isl_id *key);
7452 __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7453 __isl_keep isl_id_to_ast_expr *id2expr,
7454 __isl_take isl_id *key);
7455 isl_stat isl_id_to_ast_expr_foreach(
7456 __isl_keep isl_id_to_ast_expr *id2expr,
7457 isl_stat (*fn)(__isl_take isl_id *key,
7458 __isl_take isl_ast_expr *val, void *user),
7461 The function C<isl_id_to_ast_expr_try_get> returns a structure
7462 containing two elements, C<valid> and C<value>.
7463 If there is a value associated to the key, then C<valid>
7464 is set to C<isl_bool_true> and C<value> contains a copy of
7465 the associated value. Otherwise C<value> is C<NULL> and
7466 C<valid> may be C<isl_bool_error> or C<isl_bool_false> depending
7467 on whether some error has occurred or there simply is no associated value.
7468 The function C<isl_id_to_ast_expr_has> returns the C<valid> field
7469 in the structure and
7470 the function C<isl_id_to_ast_expr_get> returns the C<value> field.
7472 Associative arrays can be modified using the following functions.
7474 #include <isl/id_to_ast_expr.h>
7475 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7476 __isl_take isl_id_to_ast_expr *id2expr,
7477 __isl_take isl_id *key,
7478 __isl_take isl_ast_expr *val);
7479 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7480 __isl_take isl_id_to_ast_expr *id2expr,
7481 __isl_take isl_id *key);
7483 Associative arrays can be printed using the following function.
7485 #include <isl/id_to_ast_expr.h>
7486 __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7487 __isl_take isl_printer *p,
7488 __isl_keep isl_id_to_ast_expr *id2expr);
7492 Vectors can be created, copied and freed using the following functions.
7494 #include <isl/vec.h>
7495 __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7497 __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7498 __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7500 Note that the elements of a newly created vector may have arbitrary values.
7501 The elements can be changed and inspected using the following functions.
7503 int isl_vec_size(__isl_keep isl_vec *vec);
7504 __isl_give isl_val *isl_vec_get_element_val(
7505 __isl_keep isl_vec *vec, int pos);
7506 __isl_give isl_vec *isl_vec_set_element_si(
7507 __isl_take isl_vec *vec, int pos, int v);
7508 __isl_give isl_vec *isl_vec_set_element_val(
7509 __isl_take isl_vec *vec, int pos,
7510 __isl_take isl_val *v);
7511 __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7513 __isl_give isl_vec *isl_vec_set_val(
7514 __isl_take isl_vec *vec, __isl_take isl_val *v);
7515 int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7516 __isl_keep isl_vec *vec2, int pos);
7518 C<isl_vec_get_element> will return a negative value if anything went wrong.
7519 In that case, the value of C<*v> is undefined.
7521 The following function can be used to concatenate two vectors.
7523 __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7524 __isl_take isl_vec *vec2);
7528 Matrices can be created, copied and freed using the following functions.
7530 #include <isl/mat.h>
7531 __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7532 unsigned n_row, unsigned n_col);
7533 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7534 __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7536 Note that the elements of a newly created matrix may have arbitrary values.
7537 The elements can be changed and inspected using the following functions.
7539 int isl_mat_rows(__isl_keep isl_mat *mat);
7540 int isl_mat_cols(__isl_keep isl_mat *mat);
7541 __isl_give isl_val *isl_mat_get_element_val(
7542 __isl_keep isl_mat *mat, int row, int col);
7543 __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7544 int row, int col, int v);
7545 __isl_give isl_mat *isl_mat_set_element_val(
7546 __isl_take isl_mat *mat, int row, int col,
7547 __isl_take isl_val *v);
7549 C<isl_mat_get_element> will return a negative value if anything went wrong.
7550 In that case, the value of C<*v> is undefined.
7552 The following function can be used to compute the (right) inverse
7553 of a matrix, i.e., a matrix such that the product of the original
7554 and the inverse (in that order) is a multiple of the identity matrix.
7555 The input matrix is assumed to be of full row-rank.
7557 __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7559 The following function can be used to compute the (right) kernel
7560 (or null space) of a matrix, i.e., a matrix such that the product of
7561 the original and the kernel (in that order) is the zero matrix.
7563 __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7565 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7567 The following functions determine
7568 an upper or lower bound on a quasipolynomial over its domain.
7570 __isl_give isl_pw_qpolynomial_fold *
7571 isl_pw_qpolynomial_bound(
7572 __isl_take isl_pw_qpolynomial *pwqp,
7573 enum isl_fold type, int *tight);
7575 __isl_give isl_union_pw_qpolynomial_fold *
7576 isl_union_pw_qpolynomial_bound(
7577 __isl_take isl_union_pw_qpolynomial *upwqp,
7578 enum isl_fold type, int *tight);
7580 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7581 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7582 is the returned bound is known be tight, i.e., for each value
7583 of the parameters there is at least
7584 one element in the domain that reaches the bound.
7585 If the domain of C<pwqp> is not wrapping, then the bound is computed
7586 over all elements in that domain and the result has a purely parametric
7587 domain. If the domain of C<pwqp> is wrapping, then the bound is
7588 computed over the range of the wrapped relation. The domain of the
7589 wrapped relation becomes the domain of the result.
7591 =head2 Parametric Vertex Enumeration
7593 The parametric vertex enumeration described in this section
7594 is mainly intended to be used internally and by the C<barvinok>
7597 #include <isl/vertices.h>
7598 __isl_give isl_vertices *isl_basic_set_compute_vertices(
7599 __isl_keep isl_basic_set *bset);
7601 The function C<isl_basic_set_compute_vertices> performs the
7602 actual computation of the parametric vertices and the chamber
7603 decomposition and store the result in an C<isl_vertices> object.
7604 This information can be queried by either iterating over all
7605 the vertices or iterating over all the chambers or cells
7606 and then iterating over all vertices that are active on the chamber.
7608 isl_stat isl_vertices_foreach_vertex(
7609 __isl_keep isl_vertices *vertices,
7610 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7611 void *user), void *user);
7613 isl_stat isl_vertices_foreach_cell(
7614 __isl_keep isl_vertices *vertices,
7615 isl_stat (*fn)(__isl_take isl_cell *cell,
7616 void *user), void *user);
7617 isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7618 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7619 void *user), void *user);
7621 Other operations that can be performed on an C<isl_vertices> object are
7624 int isl_vertices_get_n_vertices(
7625 __isl_keep isl_vertices *vertices);
7626 void isl_vertices_free(__isl_take isl_vertices *vertices);
7628 Vertices can be inspected and destroyed using the following functions.
7630 int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7631 __isl_give isl_basic_set *isl_vertex_get_domain(
7632 __isl_keep isl_vertex *vertex);
7633 __isl_give isl_multi_aff *isl_vertex_get_expr(
7634 __isl_keep isl_vertex *vertex);
7635 void isl_vertex_free(__isl_take isl_vertex *vertex);
7637 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7638 describing the vertex in terms of the parameters,
7639 while C<isl_vertex_get_domain> returns the activity domain
7642 Chambers can be inspected and destroyed using the following functions.
7644 __isl_give isl_basic_set *isl_cell_get_domain(
7645 __isl_keep isl_cell *cell);
7646 void isl_cell_free(__isl_take isl_cell *cell);
7648 =head1 Polyhedral Compilation Library
7650 This section collects functionality in C<isl> that has been specifically
7651 designed for use during polyhedral compilation.
7653 =head2 Schedule Trees
7655 A schedule tree is a structured representation of a schedule,
7656 assigning a relative order to a set of domain elements.
7657 The relative order expressed by the schedule tree is
7658 defined recursively. In particular, the order between
7659 two domain elements is determined by the node that is closest
7660 to the root that refers to both elements and that orders them apart.
7661 Each node in the tree is of one of several types.
7662 The root node is always of type C<isl_schedule_node_domain>
7663 (or C<isl_schedule_node_extension>)
7664 and it describes the (extra) domain elements to which the schedule applies.
7665 The other types of nodes are as follows.
7669 =item C<isl_schedule_node_band>
7671 A band of schedule dimensions. Each schedule dimension is represented
7672 by a union piecewise quasi-affine expression. If this expression
7673 assigns a different value to two domain elements, while all previous
7674 schedule dimensions in the same band assign them the same value,
7675 then the two domain elements are ordered according to these two
7677 Each expression is required to be total in the domain elements
7678 that reach the band node.
7680 =item C<isl_schedule_node_expansion>
7682 An expansion node maps each of the domain elements that reach the node
7683 to one or more domain elements. The image of this mapping forms
7684 the set of domain elements that reach the child of the expansion node.
7685 The function that maps each of the expanded domain elements
7686 to the original domain element from which it was expanded
7687 is called the contraction.
7689 =item C<isl_schedule_node_filter>
7691 A filter node does not impose any ordering, but rather intersects
7692 the set of domain elements that the current subtree refers to
7693 with a given union set. The subtree of the filter node only
7694 refers to domain elements in the intersection.
7695 A filter node is typically only used as a child of a sequence or
7698 =item C<isl_schedule_node_leaf>
7700 A leaf of the schedule tree. Leaf nodes do not impose any ordering.
7702 =item C<isl_schedule_node_mark>
7704 A mark node can be used to attach any kind of information to a subtree
7705 of the schedule tree.
7707 =item C<isl_schedule_node_sequence>
7709 A sequence node has one or more children, each of which is a filter node.
7710 The filters on these filter nodes form a partition of
7711 the domain elements that the current subtree refers to.
7712 If two domain elements appear in distinct filters then the sequence
7713 node orders them according to the child positions of the corresponding
7716 =item C<isl_schedule_node_set>
7718 A set node is similar to a sequence node, except that
7719 it expresses that domain elements appearing in distinct filters
7720 may have any order. The order of the children of a set node
7721 is therefore also immaterial.
7725 The following node types are only supported by the AST generator.
7729 =item C<isl_schedule_node_context>
7731 The context describes constraints on the parameters and
7732 the schedule dimensions of outer
7733 bands that the AST generator may assume to hold. It is also the only
7734 kind of node that may introduce additional parameters.
7735 The space of the context is that of the flat product of the outer
7736 band nodes. In particular, if there are no outer band nodes, then
7737 this space is the unnamed zero-dimensional space.
7738 Since a context node references the outer band nodes, any tree
7739 containing a context node is considered to be anchored.
7741 =item C<isl_schedule_node_extension>
7743 An extension node instructs the AST generator to add additional
7744 domain elements that need to be scheduled.
7745 The additional domain elements are described by the range of
7746 the extension map in terms of the outer schedule dimensions,
7747 i.e., the flat product of the outer band nodes.
7748 Note that domain elements are added whenever the AST generator
7749 reaches the extension node, meaning that there are still some
7750 active domain elements for which an AST needs to be generated.
7751 The conditions under which some domain elements are still active
7752 may however not be completely described by the outer AST nodes
7753 generated at that point.
7755 An extension node may also appear as the root of a schedule tree,
7756 when it is intended to be inserted into another tree
7757 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
7758 In this case, the domain of the extension node should
7759 correspond to the flat product of the outer band nodes
7760 in this other schedule tree at the point where the extension tree
7763 =item C<isl_schedule_node_guard>
7765 The guard describes constraints on the parameters and
7766 the schedule dimensions of outer
7767 bands that need to be enforced by the outer nodes
7768 in the generated AST.
7769 The space of the guard is that of the flat product of the outer
7770 band nodes. In particular, if there are no outer band nodes, then
7771 this space is the unnamed zero-dimensional space.
7772 Since a guard node references the outer band nodes, any tree
7773 containing a guard node is considered to be anchored.
7777 Except for the C<isl_schedule_node_context> nodes,
7778 none of the nodes may introduce any parameters that were not
7779 already present in the root domain node.
7781 A schedule tree is encapsulated in an C<isl_schedule> object.
7782 The simplest such objects, those with a tree consisting of single domain node,
7783 can be created using the following functions with either an empty
7784 domain or a given domain.
7786 #include <isl/schedule.h>
7787 __isl_give isl_schedule *isl_schedule_empty(
7788 __isl_take isl_space *space);
7789 __isl_give isl_schedule *isl_schedule_from_domain(
7790 __isl_take isl_union_set *domain);
7792 The function C<isl_schedule_constraints_compute_schedule> described
7793 in L</"Scheduling"> can also be used to construct schedules.
7795 C<isl_schedule> objects may be copied and freed using the following functions.
7797 #include <isl/schedule.h>
7798 __isl_give isl_schedule *isl_schedule_copy(
7799 __isl_keep isl_schedule *sched);
7800 __isl_null isl_schedule *isl_schedule_free(
7801 __isl_take isl_schedule *sched);
7803 The following functions checks whether two C<isl_schedule> objects
7804 are obviously the same.
7806 #include <isl/schedule.h>
7807 isl_bool isl_schedule_plain_is_equal(
7808 __isl_keep isl_schedule *schedule1,
7809 __isl_keep isl_schedule *schedule2);
7811 The domain of the schedule, i.e., the domain described by the root node,
7812 can be obtained using the following function.
7814 #include <isl/schedule.h>
7815 __isl_give isl_union_set *isl_schedule_get_domain(
7816 __isl_keep isl_schedule *schedule);
7818 An extra top-level band node (right underneath the domain node) can
7819 be introduced into the schedule using the following function.
7820 The schedule tree is assumed not to have any anchored nodes.
7822 #include <isl/schedule.h>
7823 __isl_give isl_schedule *
7824 isl_schedule_insert_partial_schedule(
7825 __isl_take isl_schedule *schedule,
7826 __isl_take isl_multi_union_pw_aff *partial);
7828 A top-level context node (right underneath the domain node) can
7829 be introduced into the schedule using the following function.
7831 #include <isl/schedule.h>
7832 __isl_give isl_schedule *isl_schedule_insert_context(
7833 __isl_take isl_schedule *schedule,
7834 __isl_take isl_set *context)
7836 A top-level guard node (right underneath the domain node) can
7837 be introduced into the schedule using the following function.
7839 #include <isl/schedule.h>
7840 __isl_give isl_schedule *isl_schedule_insert_guard(
7841 __isl_take isl_schedule *schedule,
7842 __isl_take isl_set *guard)
7844 A schedule that combines two schedules either in the given
7845 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
7846 or an C<isl_schedule_node_set> node,
7847 can be created using the following functions.
7849 #include <isl/schedule.h>
7850 __isl_give isl_schedule *isl_schedule_sequence(
7851 __isl_take isl_schedule *schedule1,
7852 __isl_take isl_schedule *schedule2);
7853 __isl_give isl_schedule *isl_schedule_set(
7854 __isl_take isl_schedule *schedule1,
7855 __isl_take isl_schedule *schedule2);
7857 The domains of the two input schedules need to be disjoint.
7859 The following function can be used to restrict the domain
7860 of a schedule with a domain node as root to be a subset of the given union set.
7861 This operation may remove nodes in the tree that have become
7864 #include <isl/schedule.h>
7865 __isl_give isl_schedule *isl_schedule_intersect_domain(
7866 __isl_take isl_schedule *schedule,
7867 __isl_take isl_union_set *domain);
7869 The following function can be used to simplify the domain
7870 of a schedule with a domain node as root with respect to the given
7873 #include <isl/schedule.h>
7874 __isl_give isl_schedule *isl_schedule_gist_domain_params(
7875 __isl_take isl_schedule *schedule,
7876 __isl_take isl_set *context);
7878 The following function resets the user pointers on all parameter
7879 and tuple identifiers referenced by the nodes of the given schedule.
7881 #include <isl/schedule.h>
7882 __isl_give isl_schedule *isl_schedule_reset_user(
7883 __isl_take isl_schedule *schedule);
7885 The following function aligns the parameters of all nodes
7886 in the given schedule to the given space.
7888 #include <isl/schedule.h>
7889 __isl_give isl_schedule *isl_schedule_align_params(
7890 __isl_take isl_schedule *schedule,
7891 __isl_take isl_space *space);
7893 The following function allows the user to plug in a given function
7894 in the iteration domains. The input schedule is not allowed to contain
7895 any expansion nodes.
7897 #include <isl/schedule.h>
7898 __isl_give isl_schedule *
7899 isl_schedule_pullback_union_pw_multi_aff(
7900 __isl_take isl_schedule *schedule,
7901 __isl_take isl_union_pw_multi_aff *upma);
7903 The following function can be used to plug in the schedule C<expansion>
7904 in the leaves of C<schedule>, where C<contraction> describes how
7905 the domain elements of C<expansion> map to the domain elements
7906 at the original leaves of C<schedule>.
7907 The resulting schedule will contain expansion nodes, unless
7908 C<contraction> is an identity function.
7910 #include <isl/schedule.h>
7911 __isl_give isl_schedule *isl_schedule_expand(
7912 __isl_take isl_schedule *schedule,
7913 __isl_take isl_union_pw_multi_aff *contraction,
7914 __isl_take isl_schedule *expansion);
7916 An C<isl_union_map> representation of the schedule can be obtained
7917 from an C<isl_schedule> using the following function.
7919 #include <isl/schedule.h>
7920 __isl_give isl_union_map *isl_schedule_get_map(
7921 __isl_keep isl_schedule *sched);
7923 The resulting relation encodes the same relative ordering as
7924 the schedule by mapping the domain elements to a common schedule space.
7925 If the schedule_separate_components option is set, then the order
7926 of the children of a set node is explicitly encoded in the result.
7927 If the tree contains any expansion nodes, then the relation
7928 is formulated in terms of the expanded domain elements.
7930 Schedules can be read from input using the following functions.
7932 #include <isl/schedule.h>
7933 __isl_give isl_schedule *isl_schedule_read_from_file(
7934 isl_ctx *ctx, FILE *input);
7935 __isl_give isl_schedule *isl_schedule_read_from_str(
7936 isl_ctx *ctx, const char *str);
7938 A representation of the schedule can be printed using
7940 #include <isl/schedule.h>
7941 __isl_give isl_printer *isl_printer_print_schedule(
7942 __isl_take isl_printer *p,
7943 __isl_keep isl_schedule *schedule);
7944 __isl_give char *isl_schedule_to_str(
7945 __isl_keep isl_schedule *schedule);
7947 C<isl_schedule_to_str> prints the schedule in flow format.
7949 The schedule tree can be traversed through the use of
7950 C<isl_schedule_node> objects that point to a particular
7951 position in the schedule tree. Whenever a C<isl_schedule_node>
7952 is use to modify a node in the schedule tree, the original schedule
7953 tree is left untouched and the modifications are performed to a copy
7954 of the tree. The returned C<isl_schedule_node> then points to
7955 this modified copy of the tree.
7957 The root of the schedule tree can be obtained using the following function.
7959 #include <isl/schedule.h>
7960 __isl_give isl_schedule_node *isl_schedule_get_root(
7961 __isl_keep isl_schedule *schedule);
7963 A pointer to a newly created schedule tree with a single domain
7964 node can be created using the following functions.
7966 #include <isl/schedule_node.h>
7967 __isl_give isl_schedule_node *
7968 isl_schedule_node_from_domain(
7969 __isl_take isl_union_set *domain);
7970 __isl_give isl_schedule_node *
7971 isl_schedule_node_from_extension(
7972 __isl_take isl_union_map *extension);
7974 C<isl_schedule_node_from_extension> creates a tree with an extension
7977 Schedule nodes can be copied and freed using the following functions.
7979 #include <isl/schedule_node.h>
7980 __isl_give isl_schedule_node *isl_schedule_node_copy(
7981 __isl_keep isl_schedule_node *node);
7982 __isl_null isl_schedule_node *isl_schedule_node_free(
7983 __isl_take isl_schedule_node *node);
7985 The following functions can be used to check if two schedule
7986 nodes point to the same position in the same schedule.
7988 #include <isl/schedule_node.h>
7989 isl_bool isl_schedule_node_is_equal(
7990 __isl_keep isl_schedule_node *node1,
7991 __isl_keep isl_schedule_node *node2);
7993 The following properties can be obtained from a schedule node.
7995 #include <isl/schedule_node.h>
7996 enum isl_schedule_node_type isl_schedule_node_get_type(
7997 __isl_keep isl_schedule_node *node);
7998 enum isl_schedule_node_type
7999 isl_schedule_node_get_parent_type(
8000 __isl_keep isl_schedule_node *node);
8001 __isl_give isl_schedule *isl_schedule_node_get_schedule(
8002 __isl_keep isl_schedule_node *node);
8004 The function C<isl_schedule_node_get_type> returns the type of
8005 the node, while C<isl_schedule_node_get_parent_type> returns
8006 type of the parent of the node, which is required to exist.
8007 The function C<isl_schedule_node_get_schedule> returns a copy
8008 to the schedule to which the node belongs.
8010 The following functions can be used to move the schedule node
8011 to a different position in the tree or to check if such a position
8014 #include <isl/schedule_node.h>
8015 isl_bool isl_schedule_node_has_parent(
8016 __isl_keep isl_schedule_node *node);
8017 __isl_give isl_schedule_node *isl_schedule_node_parent(
8018 __isl_take isl_schedule_node *node);
8019 __isl_give isl_schedule_node *isl_schedule_node_root(
8020 __isl_take isl_schedule_node *node);
8021 __isl_give isl_schedule_node *isl_schedule_node_ancestor(
8022 __isl_take isl_schedule_node *node,
8024 int isl_schedule_node_n_children(
8025 __isl_keep isl_schedule_node *node);
8026 __isl_give isl_schedule_node *isl_schedule_node_child(
8027 __isl_take isl_schedule_node *node, int pos);
8028 isl_bool isl_schedule_node_has_children(
8029 __isl_keep isl_schedule_node *node);
8030 __isl_give isl_schedule_node *isl_schedule_node_first_child(
8031 __isl_take isl_schedule_node *node);
8032 isl_bool isl_schedule_node_has_previous_sibling(
8033 __isl_keep isl_schedule_node *node);
8034 __isl_give isl_schedule_node *
8035 isl_schedule_node_previous_sibling(
8036 __isl_take isl_schedule_node *node);
8037 isl_bool isl_schedule_node_has_next_sibling(
8038 __isl_keep isl_schedule_node *node);
8039 __isl_give isl_schedule_node *
8040 isl_schedule_node_next_sibling(
8041 __isl_take isl_schedule_node *node);
8043 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
8044 is the node itself, the ancestor of generation 1 is its parent and so on.
8046 It is also possible to query the number of ancestors of a node,
8047 the position of the current node
8048 within the children of its parent, the position of the subtree
8049 containing a node within the children of an ancestor
8050 or to obtain a copy of a given
8051 child without destroying the current node.
8052 Given two nodes that point to the same schedule, their closest
8053 shared ancestor can be obtained using
8054 C<isl_schedule_node_get_shared_ancestor>.
8056 #include <isl/schedule_node.h>
8057 int isl_schedule_node_get_tree_depth(
8058 __isl_keep isl_schedule_node *node);
8059 int isl_schedule_node_get_child_position(
8060 __isl_keep isl_schedule_node *node);
8061 int isl_schedule_node_get_ancestor_child_position(
8062 __isl_keep isl_schedule_node *node,
8063 __isl_keep isl_schedule_node *ancestor);
8064 __isl_give isl_schedule_node *isl_schedule_node_get_child(
8065 __isl_keep isl_schedule_node *node, int pos);
8066 __isl_give isl_schedule_node *
8067 isl_schedule_node_get_shared_ancestor(
8068 __isl_keep isl_schedule_node *node1,
8069 __isl_keep isl_schedule_node *node2);
8071 All nodes in a schedule tree or
8072 all descendants of a specific node (including the node) can be visited
8073 in depth-first pre-order using the following functions.
8075 #include <isl/schedule.h>
8076 isl_stat isl_schedule_foreach_schedule_node_top_down(
8077 __isl_keep isl_schedule *sched,
8078 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8079 void *user), void *user);
8081 #include <isl/schedule_node.h>
8082 isl_stat isl_schedule_node_foreach_descendant_top_down(
8083 __isl_keep isl_schedule_node *node,
8084 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8085 void *user), void *user);
8087 The callback function is slightly different from the usual
8088 callbacks in that it not only indicates success (non-negative result)
8089 or failure (negative result), but also indicates whether the children
8090 of the given node should be visited. In particular, if the callback
8091 returns a positive value, then the children are visited, but if
8092 the callback returns zero, then the children are not visited.
8094 The ancestors of a node in a schedule tree can be visited from
8095 the root down to and including the parent of the node using
8096 the following function.
8098 #include <isl/schedule_node.h>
8099 isl_stat isl_schedule_node_foreach_ancestor_top_down(
8100 __isl_keep isl_schedule_node *node,
8101 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
8102 void *user), void *user);
8104 The following functions allows for a depth-first post-order
8105 traversal of the nodes in a schedule tree or
8106 of the descendants of a specific node (including the node
8107 itself), where the user callback is allowed to modify the
8110 #include <isl/schedule.h>
8111 __isl_give isl_schedule *
8112 isl_schedule_map_schedule_node_bottom_up(
8113 __isl_take isl_schedule *schedule,
8114 __isl_give isl_schedule_node *(*fn)(
8115 __isl_take isl_schedule_node *node,
8116 void *user), void *user);
8118 #include <isl/schedule_node.h>
8119 __isl_give isl_schedule_node *
8120 isl_schedule_node_map_descendant_bottom_up(
8121 __isl_take isl_schedule_node *node,
8122 __isl_give isl_schedule_node *(*fn)(
8123 __isl_take isl_schedule_node *node,
8124 void *user), void *user);
8126 The traversal continues from the node returned by the callback function.
8127 It is the responsibility of the user to ensure that this does not
8128 lead to an infinite loop. It is safest to always return a pointer
8129 to the same position (same ancestors and child positions) as the input node.
8131 The following function removes a node (along with its descendants)
8132 from a schedule tree and returns a pointer to the leaf at the
8133 same position in the updated tree.
8134 It is not allowed to remove the root of a schedule tree or
8135 a child of a set or sequence node.
8137 #include <isl/schedule_node.h>
8138 __isl_give isl_schedule_node *isl_schedule_node_cut(
8139 __isl_take isl_schedule_node *node);
8141 The following function removes a single node
8142 from a schedule tree and returns a pointer to the child
8143 of the node, now located at the position of the original node
8144 or to a leaf node at that position if there was no child.
8145 It is not allowed to remove the root of a schedule tree,
8146 a set or sequence node, a child of a set or sequence node or
8147 a band node with an anchored subtree.
8149 #include <isl/schedule_node.h>
8150 __isl_give isl_schedule_node *isl_schedule_node_delete(
8151 __isl_take isl_schedule_node *node);
8153 Most nodes in a schedule tree only contain local information.
8154 In some cases, however, a node may also refer to outer band nodes.
8155 This means that the position of the node within the tree should
8156 not be changed, or at least that no changes are performed to the
8157 outer band nodes. The following function can be used to test
8158 whether the subtree rooted at a given node contains any such nodes.
8160 #include <isl/schedule_node.h>
8161 isl_bool isl_schedule_node_is_subtree_anchored(
8162 __isl_keep isl_schedule_node *node);
8164 The following function resets the user pointers on all parameter
8165 and tuple identifiers referenced by the given schedule node.
8167 #include <isl/schedule_node.h>
8168 __isl_give isl_schedule_node *isl_schedule_node_reset_user(
8169 __isl_take isl_schedule_node *node);
8171 The following function aligns the parameters of the given schedule
8172 node to the given space.
8174 #include <isl/schedule_node.h>
8175 __isl_give isl_schedule_node *
8176 isl_schedule_node_align_params(
8177 __isl_take isl_schedule_node *node,
8178 __isl_take isl_space *space);
8180 Several node types have their own functions for querying
8181 (and in some cases setting) some node type specific properties.
8183 #include <isl/schedule_node.h>
8184 __isl_give isl_space *isl_schedule_node_band_get_space(
8185 __isl_keep isl_schedule_node *node);
8186 __isl_give isl_multi_union_pw_aff *
8187 isl_schedule_node_band_get_partial_schedule(
8188 __isl_keep isl_schedule_node *node);
8189 __isl_give isl_union_map *
8190 isl_schedule_node_band_get_partial_schedule_union_map(
8191 __isl_keep isl_schedule_node *node);
8192 unsigned isl_schedule_node_band_n_member(
8193 __isl_keep isl_schedule_node *node);
8194 isl_bool isl_schedule_node_band_member_get_coincident(
8195 __isl_keep isl_schedule_node *node, int pos);
8196 __isl_give isl_schedule_node *
8197 isl_schedule_node_band_member_set_coincident(
8198 __isl_take isl_schedule_node *node, int pos,
8200 isl_bool isl_schedule_node_band_get_permutable(
8201 __isl_keep isl_schedule_node *node);
8202 __isl_give isl_schedule_node *
8203 isl_schedule_node_band_set_permutable(
8204 __isl_take isl_schedule_node *node, int permutable);
8205 enum isl_ast_loop_type
8206 isl_schedule_node_band_member_get_ast_loop_type(
8207 __isl_keep isl_schedule_node *node, int pos);
8208 __isl_give isl_schedule_node *
8209 isl_schedule_node_band_member_set_ast_loop_type(
8210 __isl_take isl_schedule_node *node, int pos,
8211 enum isl_ast_loop_type type);
8212 __isl_give isl_union_set *
8213 enum isl_ast_loop_type
8214 isl_schedule_node_band_member_get_isolate_ast_loop_type(
8215 __isl_keep isl_schedule_node *node, int pos);
8216 __isl_give isl_schedule_node *
8217 isl_schedule_node_band_member_set_isolate_ast_loop_type(
8218 __isl_take isl_schedule_node *node, int pos,
8219 enum isl_ast_loop_type type);
8220 isl_schedule_node_band_get_ast_build_options(
8221 __isl_keep isl_schedule_node *node);
8222 __isl_give isl_schedule_node *
8223 isl_schedule_node_band_set_ast_build_options(
8224 __isl_take isl_schedule_node *node,
8225 __isl_take isl_union_set *options);
8226 __isl_give isl_set *
8227 isl_schedule_node_band_get_ast_isolate_option(
8228 __isl_keep isl_schedule_node *node);
8230 The function C<isl_schedule_node_band_get_space> returns the space
8231 of the partial schedule of the band.
8232 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
8233 returns a representation of the partial schedule of the band node
8234 in the form of an C<isl_union_map>.
8235 The coincident and permutable properties are set by
8236 C<isl_schedule_constraints_compute_schedule> on the schedule tree
8238 A scheduling dimension is considered to be ``coincident''
8239 if it satisfies the coincidence constraints within its band.
8240 That is, if the dependence distances of the coincidence
8241 constraints are all zero in that direction (for fixed
8242 iterations of outer bands).
8243 A band is marked permutable if it was produced using the Pluto-like scheduler.
8244 Note that the scheduler may have to resort to a Feautrier style scheduling
8245 step even if the default scheduler is used.
8246 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
8247 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
8248 For the meaning of these loop AST generation types and the difference
8249 between the regular loop AST generation type and the isolate
8250 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
8251 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
8252 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
8253 may return C<isl_ast_loop_error> if an error occurs.
8254 The AST build options govern how an AST is generated for
8255 the individual schedule dimensions during AST generation.
8256 See L</"AST Generation Options (Schedule Tree)">.
8257 The isolate option for the given node can be extracted from these
8258 AST build options using the function
8259 C<isl_schedule_node_band_get_ast_isolate_option>.
8261 #include <isl/schedule_node.h>
8262 __isl_give isl_set *
8263 isl_schedule_node_context_get_context(
8264 __isl_keep isl_schedule_node *node);
8266 #include <isl/schedule_node.h>
8267 __isl_give isl_union_set *
8268 isl_schedule_node_domain_get_domain(
8269 __isl_keep isl_schedule_node *node);
8271 #include <isl/schedule_node.h>
8272 __isl_give isl_union_map *
8273 isl_schedule_node_expansion_get_expansion(
8274 __isl_keep isl_schedule_node *node);
8275 __isl_give isl_union_pw_multi_aff *
8276 isl_schedule_node_expansion_get_contraction(
8277 __isl_keep isl_schedule_node *node);
8279 #include <isl/schedule_node.h>
8280 __isl_give isl_union_map *
8281 isl_schedule_node_extension_get_extension(
8282 __isl_keep isl_schedule_node *node);
8284 #include <isl/schedule_node.h>
8285 __isl_give isl_union_set *
8286 isl_schedule_node_filter_get_filter(
8287 __isl_keep isl_schedule_node *node);
8289 #include <isl/schedule_node.h>
8290 __isl_give isl_set *isl_schedule_node_guard_get_guard(
8291 __isl_keep isl_schedule_node *node);
8293 #include <isl/schedule_node.h>
8294 __isl_give isl_id *isl_schedule_node_mark_get_id(
8295 __isl_keep isl_schedule_node *node);
8297 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
8298 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
8299 partial schedules related to the node.
8301 #include <isl/schedule_node.h>
8302 __isl_give isl_multi_union_pw_aff *
8303 isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
8304 __isl_keep isl_schedule_node *node);
8305 __isl_give isl_union_pw_multi_aff *
8306 isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
8307 __isl_keep isl_schedule_node *node);
8308 __isl_give isl_union_map *
8309 isl_schedule_node_get_prefix_schedule_union_map(
8310 __isl_keep isl_schedule_node *node);
8311 __isl_give isl_union_map *
8312 isl_schedule_node_get_prefix_schedule_relation(
8313 __isl_keep isl_schedule_node *node);
8314 __isl_give isl_union_map *
8315 isl_schedule_node_get_subtree_schedule_union_map(
8316 __isl_keep isl_schedule_node *node);
8318 In particular, the functions
8319 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
8320 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
8321 and C<isl_schedule_node_get_prefix_schedule_union_map>
8322 return a relative ordering on the domain elements that reach the given
8323 node determined by its ancestors.
8324 The function C<isl_schedule_node_get_prefix_schedule_relation>
8325 additionally includes the domain constraints in the result.
8326 The function C<isl_schedule_node_get_subtree_schedule_union_map>
8327 returns a representation of the partial schedule defined by the
8328 subtree rooted at the given node.
8329 If the tree contains any expansion nodes, then the subtree schedule
8330 is formulated in terms of the expanded domain elements.
8331 The tree passed to functions returning a prefix schedule
8332 may only contain extension nodes if these would not affect
8333 the result of these functions. That is, if one of the ancestors
8334 is an extension node, then all of the domain elements that were
8335 added by the extension node need to have been filtered out
8336 by filter nodes between the extension node and the input node.
8337 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
8338 may not contain in extension nodes in the selected subtree.
8340 The expansion/contraction defined by an entire subtree, combining
8341 the expansions/contractions
8342 on the expansion nodes in the subtree, can be obtained using
8343 the following functions.
8345 #include <isl/schedule_node.h>
8346 __isl_give isl_union_map *
8347 isl_schedule_node_get_subtree_expansion(
8348 __isl_keep isl_schedule_node *node);
8349 __isl_give isl_union_pw_multi_aff *
8350 isl_schedule_node_get_subtree_contraction(
8351 __isl_keep isl_schedule_node *node);
8353 The total number of outer band members of given node, i.e.,
8354 the shared output dimension of the maps in the result
8355 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
8356 using the following function.
8358 #include <isl/schedule_node.h>
8359 int isl_schedule_node_get_schedule_depth(
8360 __isl_keep isl_schedule_node *node);
8362 The following functions return the elements that reach the given node
8363 or the union of universes in the spaces that contain these elements.
8365 #include <isl/schedule_node.h>
8366 __isl_give isl_union_set *
8367 isl_schedule_node_get_domain(
8368 __isl_keep isl_schedule_node *node);
8369 __isl_give isl_union_set *
8370 isl_schedule_node_get_universe_domain(
8371 __isl_keep isl_schedule_node *node);
8373 The input tree of C<isl_schedule_node_get_domain>
8374 may only contain extension nodes if these would not affect
8375 the result of this function. That is, if one of the ancestors
8376 is an extension node, then all of the domain elements that were
8377 added by the extension node need to have been filtered out
8378 by filter nodes between the extension node and the input node.
8380 The following functions can be used to introduce additional nodes
8381 in the schedule tree. The new node is introduced at the point
8382 in the tree where the C<isl_schedule_node> points to and
8383 the results points to the new node.
8385 #include <isl/schedule_node.h>
8386 __isl_give isl_schedule_node *
8387 isl_schedule_node_insert_partial_schedule(
8388 __isl_take isl_schedule_node *node,
8389 __isl_take isl_multi_union_pw_aff *schedule);
8391 This function inserts a new band node with (the greatest integer
8392 part of) the given partial schedule.
8393 The subtree rooted at the given node is assumed not to have
8396 #include <isl/schedule_node.h>
8397 __isl_give isl_schedule_node *
8398 isl_schedule_node_insert_context(
8399 __isl_take isl_schedule_node *node,
8400 __isl_take isl_set *context);
8402 This function inserts a new context node with the given context constraints.
8404 #include <isl/schedule_node.h>
8405 __isl_give isl_schedule_node *
8406 isl_schedule_node_insert_filter(
8407 __isl_take isl_schedule_node *node,
8408 __isl_take isl_union_set *filter);
8410 This function inserts a new filter node with the given filter.
8411 If the original node already pointed to a filter node, then the
8412 two filter nodes are merged into one.
8414 #include <isl/schedule_node.h>
8415 __isl_give isl_schedule_node *
8416 isl_schedule_node_insert_guard(
8417 __isl_take isl_schedule_node *node,
8418 __isl_take isl_set *guard);
8420 This function inserts a new guard node with the given guard constraints.
8422 #include <isl/schedule_node.h>
8423 __isl_give isl_schedule_node *
8424 isl_schedule_node_insert_mark(
8425 __isl_take isl_schedule_node *node,
8426 __isl_take isl_id *mark);
8428 This function inserts a new mark node with the give mark identifier.
8430 #include <isl/schedule_node.h>
8431 __isl_give isl_schedule_node *
8432 isl_schedule_node_insert_sequence(
8433 __isl_take isl_schedule_node *node,
8434 __isl_take isl_union_set_list *filters);
8435 __isl_give isl_schedule_node *
8436 isl_schedule_node_insert_set(
8437 __isl_take isl_schedule_node *node,
8438 __isl_take isl_union_set_list *filters);
8440 These functions insert a new sequence or set node with the given
8441 filters as children.
8443 #include <isl/schedule_node.h>
8444 __isl_give isl_schedule_node *isl_schedule_node_group(
8445 __isl_take isl_schedule_node *node,
8446 __isl_take isl_id *group_id);
8448 This function introduces an expansion node in between the current
8449 node and its parent that expands instances of a space with tuple
8450 identifier C<group_id> to the original domain elements that reach
8451 the node. The group instances are identified by the prefix schedule
8452 of those domain elements. The ancestors of the node are adjusted
8453 to refer to the group instances instead of the original domain
8454 elements. The return value points to the same node in the updated
8455 schedule tree as the input node, i.e., to the child of the newly
8456 introduced expansion node. Grouping instances of different statements
8457 ensures that they will be treated as a single statement by the
8458 AST generator up to the point of the expansion node.
8460 The following function can be used to flatten a nested
8463 #include <isl/schedule_node.h>
8464 __isl_give isl_schedule_node *
8465 isl_schedule_node_sequence_splice_child(
8466 __isl_take isl_schedule_node *node, int pos);
8468 That is, given a sequence node C<node> that has another sequence node
8469 in its child at position C<pos> (in particular, the child of that filter
8470 node is a sequence node), attach the children of that other sequence
8471 node as children of C<node>, replacing the original child at position
8474 The partial schedule of a band node can be scaled (down) or reduced using
8475 the following functions.
8477 #include <isl/schedule_node.h>
8478 __isl_give isl_schedule_node *
8479 isl_schedule_node_band_scale(
8480 __isl_take isl_schedule_node *node,
8481 __isl_take isl_multi_val *mv);
8482 __isl_give isl_schedule_node *
8483 isl_schedule_node_band_scale_down(
8484 __isl_take isl_schedule_node *node,
8485 __isl_take isl_multi_val *mv);
8486 __isl_give isl_schedule_node *
8487 isl_schedule_node_band_mod(
8488 __isl_take isl_schedule_node *node,
8489 __isl_take isl_multi_val *mv);
8491 The spaces of the two arguments need to match.
8492 After scaling, the partial schedule is replaced by its greatest
8493 integer part to ensure that the schedule remains integral.
8495 The partial schedule of a band node can be shifted by an
8496 C<isl_multi_union_pw_aff> with a domain that is a superset
8497 of the domain of the partial schedule using
8498 the following function.
8500 #include <isl/schedule_node.h>
8501 __isl_give isl_schedule_node *
8502 isl_schedule_node_band_shift(
8503 __isl_take isl_schedule_node *node,
8504 __isl_take isl_multi_union_pw_aff *shift);
8506 A band node can be tiled using the following function.
8508 #include <isl/schedule_node.h>
8509 __isl_give isl_schedule_node *isl_schedule_node_band_tile(
8510 __isl_take isl_schedule_node *node,
8511 __isl_take isl_multi_val *sizes);
8513 isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8515 int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8516 isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8518 int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8520 The C<isl_schedule_node_band_tile> function tiles
8521 the band using the given tile sizes inside its schedule.
8522 A new child band node is created to represent the point loops and it is
8523 inserted between the modified band and its children.
8524 The subtree rooted at the given node is assumed not to have
8526 The C<tile_scale_tile_loops> option specifies whether the tile
8527 loops iterators should be scaled by the tile sizes.
8528 If the C<tile_shift_point_loops> option is set, then the point loops
8529 are shifted to start at zero.
8531 A band node can be split into two nested band nodes
8532 using the following function.
8534 #include <isl/schedule_node.h>
8535 __isl_give isl_schedule_node *isl_schedule_node_band_split(
8536 __isl_take isl_schedule_node *node, int pos);
8538 The resulting outer band node contains the first C<pos> dimensions of
8539 the schedule of C<node> while the inner band contains the remaining dimensions.
8540 The schedules of the two band nodes live in anonymous spaces.
8541 The loop AST generation type options and the isolate option
8542 are split over the the two band nodes.
8544 A band node can be moved down to the leaves of the subtree rooted
8545 at the band node using the following function.
8547 #include <isl/schedule_node.h>
8548 __isl_give isl_schedule_node *isl_schedule_node_band_sink(
8549 __isl_take isl_schedule_node *node);
8551 The subtree rooted at the given node is assumed not to have
8553 The result points to the node in the resulting tree that is in the same
8554 position as the node pointed to by C<node> in the original tree.
8556 #include <isl/schedule_node.h>
8557 __isl_give isl_schedule_node *
8558 isl_schedule_node_order_before(
8559 __isl_take isl_schedule_node *node,
8560 __isl_take isl_union_set *filter);
8561 __isl_give isl_schedule_node *
8562 isl_schedule_node_order_after(
8563 __isl_take isl_schedule_node *node,
8564 __isl_take isl_union_set *filter);
8566 These functions split the domain elements that reach C<node>
8567 into those that satisfy C<filter> and those that do not and
8568 arranges for the elements that do satisfy the filter to be
8569 executed before (in case of C<isl_schedule_node_order_before>)
8570 or after (in case of C<isl_schedule_node_order_after>)
8571 those that do not. The order is imposed by
8572 a sequence node, possibly reusing the grandparent of C<node>
8573 on two copies of the subtree attached to the original C<node>.
8574 Both copies are simplified with respect to their filter.
8576 Return a pointer to the copy of the subtree that does not
8577 satisfy C<filter>. If there is no such copy (because all
8578 reaching domain elements satisfy the filter), then return
8579 the original pointer.
8581 #include <isl/schedule_node.h>
8582 __isl_give isl_schedule_node *
8583 isl_schedule_node_graft_before(
8584 __isl_take isl_schedule_node *node,
8585 __isl_take isl_schedule_node *graft);
8586 __isl_give isl_schedule_node *
8587 isl_schedule_node_graft_after(
8588 __isl_take isl_schedule_node *node,
8589 __isl_take isl_schedule_node *graft);
8591 This function inserts the C<graft> tree into the tree containing C<node>
8592 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
8593 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
8594 The root node of C<graft>
8595 should be an extension node where the domain of the extension
8596 is the flat product of all outer band nodes of C<node>.
8597 The root node may also be a domain node.
8598 The elements of the domain or the range of the extension may not
8599 intersect with the domain elements that reach "node".
8600 The schedule tree of C<graft> may not be anchored.
8602 The schedule tree of C<node> is modified to include an extension node
8603 corresponding to the root node of C<graft> as a child of the original
8604 parent of C<node>. The original node that C<node> points to and the
8605 child of the root node of C<graft> are attached to this extension node
8606 through a sequence, with appropriate filters and with the child
8607 of C<graft> appearing before or after the original C<node>.
8609 If C<node> already appears inside a sequence that is the child of
8610 an extension node and if the spaces of the new domain elements
8611 do not overlap with those of the original domain elements,
8612 then that extension node is extended with the new extension
8613 rather than introducing a new segment of extension and sequence nodes.
8615 Return a pointer to the same node in the modified tree that
8616 C<node> pointed to in the original tree.
8618 A representation of the schedule node can be printed using
8620 #include <isl/schedule_node.h>
8621 __isl_give isl_printer *isl_printer_print_schedule_node(
8622 __isl_take isl_printer *p,
8623 __isl_keep isl_schedule_node *node);
8624 __isl_give char *isl_schedule_node_to_str(
8625 __isl_keep isl_schedule_node *node);
8627 C<isl_schedule_node_to_str> prints the schedule node in block format.
8629 =head2 Dependence Analysis
8631 C<isl> contains specialized functionality for performing
8632 array dataflow analysis. That is, given a I<sink> access relation
8633 and a collection of possible I<source> access relations,
8634 C<isl> can compute relations that describe
8635 for each iteration of the sink access, which iteration
8636 of which of the source access relations was the last
8637 to access the same data element before the given iteration
8639 The resulting dependence relations map source iterations
8640 to either the corresponding sink iterations or
8641 pairs of corresponding sink iterations and accessed data elements.
8642 To compute standard flow dependences, the sink should be
8643 a read, while the sources should be writes.
8644 If any of the source accesses are marked as being I<may>
8645 accesses, then there will be a dependence from the last
8646 I<must> access B<and> from any I<may> access that follows
8647 this last I<must> access.
8648 In particular, if I<all> sources are I<may> accesses,
8649 then memory based dependence analysis is performed.
8650 If, on the other hand, all sources are I<must> accesses,
8651 then value based dependence analysis is performed.
8653 =head3 High-level Interface
8655 A high-level interface to dependence analysis is provided
8656 by the following function.
8658 #include <isl/flow.h>
8659 __isl_give isl_union_flow *
8660 isl_union_access_info_compute_flow(
8661 __isl_take isl_union_access_info *access);
8663 The input C<isl_union_access_info> object describes the sink
8664 access relations, the source access relations and a schedule,
8665 while the output C<isl_union_flow> object describes
8666 the resulting dependence relations and the subsets of the
8667 sink relations for which no source was found.
8669 An C<isl_union_access_info> is created, modified, copied and freed using
8670 the following functions.
8672 #include <isl/flow.h>
8673 __isl_give isl_union_access_info *
8674 isl_union_access_info_from_sink(
8675 __isl_take isl_union_map *sink);
8676 __isl_give isl_union_access_info *
8677 isl_union_access_info_set_must_source(
8678 __isl_take isl_union_access_info *access,
8679 __isl_take isl_union_map *must_source);
8680 __isl_give isl_union_access_info *
8681 isl_union_access_info_set_may_source(
8682 __isl_take isl_union_access_info *access,
8683 __isl_take isl_union_map *may_source);
8684 __isl_give isl_union_access_info *
8685 isl_union_access_info_set_schedule(
8686 __isl_take isl_union_access_info *access,
8687 __isl_take isl_schedule *schedule);
8688 __isl_give isl_union_access_info *
8689 isl_union_access_info_set_schedule_map(
8690 __isl_take isl_union_access_info *access,
8691 __isl_take isl_union_map *schedule_map);
8692 __isl_give isl_union_access_info *
8693 isl_union_access_info_copy(
8694 __isl_keep isl_union_access_info *access);
8695 __isl_null isl_union_access_info *
8696 isl_union_access_info_free(
8697 __isl_take isl_union_access_info *access);
8699 The may sources set by C<isl_union_access_info_set_may_source>
8700 do not need to include the must sources set by
8701 C<isl_union_access_info_set_must_source> as a subset.
8702 The user is free not to call one (or both) of these functions,
8703 in which case the corresponding set is kept to its empty default.
8704 Similarly, the default schedule initialized by
8705 C<isl_union_access_info_from_sink> is empty.
8706 The current schedule is determined by the last call to either
8707 C<isl_union_access_info_set_schedule> or
8708 C<isl_union_access_info_set_schedule_map>.
8709 The domain of the schedule corresponds to the domains of
8710 the access relations. In particular, the domains of the access
8711 relations are effectively intersected with the domain of the schedule
8712 and only the resulting accesses are considered by the dependence analysis.
8714 A representation of the information contained in an object
8715 of type C<isl_union_access_info> can be obtained using
8717 #include <isl/flow.h>
8718 __isl_give isl_printer *
8719 isl_printer_print_union_access_info(
8720 __isl_take isl_printer *p,
8721 __isl_keep isl_union_access_info *access);
8722 __isl_give char *isl_union_access_info_to_str(
8723 __isl_keep isl_union_access_info *access);
8725 C<isl_union_access_info_to_str> prints the information in flow format.
8727 The output of C<isl_union_access_info_compute_flow> can be examined
8728 and freed using the following functions.
8730 #include <isl/flow.h>
8731 __isl_give isl_union_map *isl_union_flow_get_must_dependence(
8732 __isl_keep isl_union_flow *flow);
8733 __isl_give isl_union_map *isl_union_flow_get_may_dependence(
8734 __isl_keep isl_union_flow *flow);
8735 __isl_give isl_union_map *
8736 isl_union_flow_get_full_must_dependence(
8737 __isl_keep isl_union_flow *flow);
8738 __isl_give isl_union_map *
8739 isl_union_flow_get_full_may_dependence(
8740 __isl_keep isl_union_flow *flow);
8741 __isl_give isl_union_map *isl_union_flow_get_must_no_source(
8742 __isl_keep isl_union_flow *flow);
8743 __isl_give isl_union_map *isl_union_flow_get_may_no_source(
8744 __isl_keep isl_union_flow *flow);
8745 __isl_null isl_union_flow *isl_union_flow_free(
8746 __isl_take isl_union_flow *flow);
8748 The relation returned by C<isl_union_flow_get_must_dependence>
8749 relates domain elements of must sources to domain elements of the sink.
8750 The relation returned by C<isl_union_flow_get_may_dependence>
8751 relates domain elements of must or may sources to domain elements of the sink
8752 and includes the previous relation as a subset.
8753 The relation returned by C<isl_union_flow_get_full_must_dependence>
8754 relates domain elements of must sources to pairs of domain elements of the sink
8755 and accessed data elements.
8756 The relation returned by C<isl_union_flow_get_full_may_dependence>
8757 relates domain elements of must or may sources to pairs of
8758 domain elements of the sink and accessed data elements.
8759 This relation includes the previous relation as a subset.
8760 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
8761 of the sink relation for which no dependences have been found.
8762 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
8763 of the sink relation for which no definite dependences have been found.
8764 That is, it contains those sink access that do not contribute to any
8765 of the elements in the relation returned
8766 by C<isl_union_flow_get_must_dependence>.
8768 A representation of the information contained in an object
8769 of type C<isl_union_flow> can be obtained using
8771 #include <isl/flow.h>
8772 __isl_give isl_printer *isl_printer_print_union_flow(
8773 __isl_take isl_printer *p,
8774 __isl_keep isl_union_flow *flow);
8775 __isl_give char *isl_union_flow_to_str(
8776 __isl_keep isl_union_flow *flow);
8778 C<isl_union_flow_to_str> prints the information in flow format.
8780 =head3 Low-level Interface
8782 A lower-level interface is provided by the following functions.
8784 #include <isl/flow.h>
8786 typedef int (*isl_access_level_before)(void *first, void *second);
8788 __isl_give isl_access_info *isl_access_info_alloc(
8789 __isl_take isl_map *sink,
8790 void *sink_user, isl_access_level_before fn,
8792 __isl_give isl_access_info *isl_access_info_add_source(
8793 __isl_take isl_access_info *acc,
8794 __isl_take isl_map *source, int must,
8796 __isl_null isl_access_info *isl_access_info_free(
8797 __isl_take isl_access_info *acc);
8799 __isl_give isl_flow *isl_access_info_compute_flow(
8800 __isl_take isl_access_info *acc);
8802 isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
8803 isl_stat (*fn)(__isl_take isl_map *dep, int must,
8804 void *dep_user, void *user),
8806 __isl_give isl_map *isl_flow_get_no_source(
8807 __isl_keep isl_flow *deps, int must);
8808 void isl_flow_free(__isl_take isl_flow *deps);
8810 The function C<isl_access_info_compute_flow> performs the actual
8811 dependence analysis. The other functions are used to construct
8812 the input for this function or to read off the output.
8814 The input is collected in an C<isl_access_info>, which can
8815 be created through a call to C<isl_access_info_alloc>.
8816 The arguments to this functions are the sink access relation
8817 C<sink>, a token C<sink_user> used to identify the sink
8818 access to the user, a callback function for specifying the
8819 relative order of source and sink accesses, and the number
8820 of source access relations that will be added.
8821 The callback function has type C<int (*)(void *first, void *second)>.
8822 The function is called with two user supplied tokens identifying
8823 either a source or the sink and it should return the shared nesting
8824 level and the relative order of the two accesses.
8825 In particular, let I<n> be the number of loops shared by
8826 the two accesses. If C<first> precedes C<second> textually,
8827 then the function should return I<2 * n + 1>; otherwise,
8828 it should return I<2 * n>.
8829 The sources can be added to the C<isl_access_info> by performing
8830 (at most) C<max_source> calls to C<isl_access_info_add_source>.
8831 C<must> indicates whether the source is a I<must> access
8832 or a I<may> access. Note that a multi-valued access relation
8833 should only be marked I<must> if every iteration in the domain
8834 of the relation accesses I<all> elements in its image.
8835 The C<source_user> token is again used to identify
8836 the source access. The range of the source access relation
8837 C<source> should have the same dimension as the range
8838 of the sink access relation.
8839 The C<isl_access_info_free> function should usually not be
8840 called explicitly, because it is called implicitly by
8841 C<isl_access_info_compute_flow>.
8843 The result of the dependence analysis is collected in an
8844 C<isl_flow>. There may be elements of
8845 the sink access for which no preceding source access could be
8846 found or for which all preceding sources are I<may> accesses.
8847 The relations containing these elements can be obtained through
8848 calls to C<isl_flow_get_no_source>, the first with C<must> set
8849 and the second with C<must> unset.
8850 In the case of standard flow dependence analysis,
8851 with the sink a read and the sources I<must> writes,
8852 the first relation corresponds to the reads from uninitialized
8853 array elements and the second relation is empty.
8854 The actual flow dependences can be extracted using
8855 C<isl_flow_foreach>. This function will call the user-specified
8856 callback function C<fn> for each B<non-empty> dependence between
8857 a source and the sink. The callback function is called
8858 with four arguments, the actual flow dependence relation
8859 mapping source iterations to sink iterations, a boolean that
8860 indicates whether it is a I<must> or I<may> dependence, a token
8861 identifying the source and an additional C<void *> with value
8862 equal to the third argument of the C<isl_flow_foreach> call.
8863 A dependence is marked I<must> if it originates from a I<must>
8864 source and if it is not followed by any I<may> sources.
8866 After finishing with an C<isl_flow>, the user should call
8867 C<isl_flow_free> to free all associated memory.
8869 =head3 Interaction with the Low-level Interface
8871 During the dependence analysis, we frequently need to perform
8872 the following operation. Given a relation between sink iterations
8873 and potential source iterations from a particular source domain,
8874 what is the last potential source iteration corresponding to each
8875 sink iteration. It can sometimes be convenient to adjust
8876 the set of potential source iterations before or after each such operation.
8877 The prototypical example is fuzzy array dataflow analysis,
8878 where we need to analyze if, based on data-dependent constraints,
8879 the sink iteration can ever be executed without one or more of
8880 the corresponding potential source iterations being executed.
8881 If so, we can introduce extra parameters and select an unknown
8882 but fixed source iteration from the potential source iterations.
8883 To be able to perform such manipulations, C<isl> provides the following
8886 #include <isl/flow.h>
8888 typedef __isl_give isl_restriction *(*isl_access_restrict)(
8889 __isl_keep isl_map *source_map,
8890 __isl_keep isl_set *sink, void *source_user,
8892 __isl_give isl_access_info *isl_access_info_set_restrict(
8893 __isl_take isl_access_info *acc,
8894 isl_access_restrict fn, void *user);
8896 The function C<isl_access_info_set_restrict> should be called
8897 before calling C<isl_access_info_compute_flow> and registers a callback function
8898 that will be called any time C<isl> is about to compute the last
8899 potential source. The first argument is the (reverse) proto-dependence,
8900 mapping sink iterations to potential source iterations.
8901 The second argument represents the sink iterations for which
8902 we want to compute the last source iteration.
8903 The third argument is the token corresponding to the source
8904 and the final argument is the token passed to C<isl_access_info_set_restrict>.
8905 The callback is expected to return a restriction on either the input or
8906 the output of the operation computing the last potential source.
8907 If the input needs to be restricted then restrictions are needed
8908 for both the source and the sink iterations. The sink iterations
8909 and the potential source iterations will be intersected with these sets.
8910 If the output needs to be restricted then only a restriction on the source
8911 iterations is required.
8912 If any error occurs, the callback should return C<NULL>.
8913 An C<isl_restriction> object can be created, freed and inspected
8914 using the following functions.
8916 #include <isl/flow.h>
8918 __isl_give isl_restriction *isl_restriction_input(
8919 __isl_take isl_set *source_restr,
8920 __isl_take isl_set *sink_restr);
8921 __isl_give isl_restriction *isl_restriction_output(
8922 __isl_take isl_set *source_restr);
8923 __isl_give isl_restriction *isl_restriction_none(
8924 __isl_take isl_map *source_map);
8925 __isl_give isl_restriction *isl_restriction_empty(
8926 __isl_take isl_map *source_map);
8927 __isl_null isl_restriction *isl_restriction_free(
8928 __isl_take isl_restriction *restr);
8930 C<isl_restriction_none> and C<isl_restriction_empty> are special
8931 cases of C<isl_restriction_input>. C<isl_restriction_none>
8932 is essentially equivalent to
8934 isl_restriction_input(isl_set_universe(
8935 isl_space_range(isl_map_get_space(source_map))),
8937 isl_space_domain(isl_map_get_space(source_map))));
8939 whereas C<isl_restriction_empty> is essentially equivalent to
8941 isl_restriction_input(isl_set_empty(
8942 isl_space_range(isl_map_get_space(source_map))),
8944 isl_space_domain(isl_map_get_space(source_map))));
8948 #include <isl/schedule.h>
8949 __isl_give isl_schedule *
8950 isl_schedule_constraints_compute_schedule(
8951 __isl_take isl_schedule_constraints *sc);
8953 The function C<isl_schedule_constraints_compute_schedule> can be
8954 used to compute a schedule that satisfies the given schedule constraints.
8955 These schedule constraints include the iteration domain for which
8956 a schedule should be computed and dependences between pairs of
8957 iterations. In particular, these dependences include
8958 I<validity> dependences and I<proximity> dependences.
8959 By default, the algorithm used to construct the schedule is similar
8960 to that of C<Pluto>.
8961 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
8963 The generated schedule respects all validity dependences.
8964 That is, all dependence distances over these dependences in the
8965 scheduled space are lexicographically positive.
8967 The default algorithm tries to ensure that the dependence distances
8968 over coincidence constraints are zero and to minimize the
8969 dependence distances over proximity dependences.
8970 Moreover, it tries to obtain sequences (bands) of schedule dimensions
8971 for groups of domains where the dependence distances over validity
8972 dependences have only non-negative values.
8973 Note that when minimizing the maximal dependence distance
8974 over proximity dependences, a single affine expression in the parameters
8975 is constructed that bounds all dependence distances. If no such expression
8976 exists, then the algorithm will fail and resort to an alternative
8977 scheduling algorithm. In particular, this means that adding proximity
8978 dependences may eliminate valid solutions. A typical example where this
8979 phenomenon may occur is when some subset of the proximity dependences
8980 has no restriction on some parameter, forcing the coefficient of that
8981 parameter to be zero, while some other subset forces the dependence
8982 distance to depend on that parameter, requiring the same coefficient
8984 When using Feautrier's algorithm, the coincidence and proximity constraints
8985 are only taken into account during the extension to a
8986 full-dimensional schedule.
8988 An C<isl_schedule_constraints> object can be constructed
8989 and manipulated using the following functions.
8991 #include <isl/schedule.h>
8992 __isl_give isl_schedule_constraints *
8993 isl_schedule_constraints_copy(
8994 __isl_keep isl_schedule_constraints *sc);
8995 __isl_give isl_schedule_constraints *
8996 isl_schedule_constraints_on_domain(
8997 __isl_take isl_union_set *domain);
8998 __isl_give isl_schedule_constraints *
8999 isl_schedule_constraints_set_context(
9000 __isl_take isl_schedule_constraints *sc,
9001 __isl_take isl_set *context);
9002 __isl_give isl_schedule_constraints *
9003 isl_schedule_constraints_set_validity(
9004 __isl_take isl_schedule_constraints *sc,
9005 __isl_take isl_union_map *validity);
9006 __isl_give isl_schedule_constraints *
9007 isl_schedule_constraints_set_coincidence(
9008 __isl_take isl_schedule_constraints *sc,
9009 __isl_take isl_union_map *coincidence);
9010 __isl_give isl_schedule_constraints *
9011 isl_schedule_constraints_set_proximity(
9012 __isl_take isl_schedule_constraints *sc,
9013 __isl_take isl_union_map *proximity);
9014 __isl_give isl_schedule_constraints *
9015 isl_schedule_constraints_set_conditional_validity(
9016 __isl_take isl_schedule_constraints *sc,
9017 __isl_take isl_union_map *condition,
9018 __isl_take isl_union_map *validity);
9019 __isl_give isl_schedule_constraints *
9020 isl_schedule_constraints_apply(
9021 __isl_take isl_schedule_constraints *sc,
9022 __isl_take isl_union_map *umap);
9023 __isl_null isl_schedule_constraints *
9024 isl_schedule_constraints_free(
9025 __isl_take isl_schedule_constraints *sc);
9027 The initial C<isl_schedule_constraints> object created by
9028 C<isl_schedule_constraints_on_domain> does not impose any constraints.
9029 That is, it has an empty set of dependences.
9030 The function C<isl_schedule_constraints_set_context> allows the user
9031 to specify additional constraints on the parameters that may
9032 be assumed to hold during the construction of the schedule.
9033 The function C<isl_schedule_constraints_set_validity> replaces the
9034 validity dependences, mapping domain elements I<i> to domain
9035 elements that should be scheduled after I<i>.
9036 The function C<isl_schedule_constraints_set_coincidence> replaces the
9037 coincidence dependences, mapping domain elements I<i> to domain
9038 elements that should be scheduled together with I<I>, if possible.
9039 The function C<isl_schedule_constraints_set_proximity> replaces the
9040 proximity dependences, mapping domain elements I<i> to domain
9041 elements that should be scheduled either before I<I>
9042 or as early as possible after I<i>.
9044 The function C<isl_schedule_constraints_set_conditional_validity>
9045 replaces the conditional validity constraints.
9046 A conditional validity constraint is only imposed when any of the corresponding
9047 conditions is satisfied, i.e., when any of them is non-zero.
9048 That is, the scheduler ensures that within each band if the dependence
9049 distances over the condition constraints are not all zero
9050 then all corresponding conditional validity constraints are respected.
9051 A conditional validity constraint corresponds to a condition
9052 if the two are adjacent, i.e., if the domain of one relation intersect
9053 the range of the other relation.
9054 The typical use case of conditional validity constraints is
9055 to allow order constraints between live ranges to be violated
9056 as long as the live ranges themselves are local to the band.
9057 To allow more fine-grained control over which conditions correspond
9058 to which conditional validity constraints, the domains and ranges
9059 of these relations may include I<tags>. That is, the domains and
9060 ranges of those relation may themselves be wrapped relations
9061 where the iteration domain appears in the domain of those wrapped relations
9062 and the range of the wrapped relations can be arbitrarily chosen
9063 by the user. Conditions and conditional validity constraints are only
9064 considered adjacent to each other if the entire wrapped relation matches.
9065 In particular, a relation with a tag will never be considered adjacent
9066 to a relation without a tag.
9068 The function C<isl_schedule_constraints_compute_schedule> takes
9069 schedule constraints that are defined on some set of domain elements
9070 and transforms them to schedule constraints on the elements
9071 to which these domain elements are mapped by the given transformation.
9073 An C<isl_schedule_constraints> object can be inspected
9074 using the following functions.
9076 #include <isl/schedule.h>
9077 __isl_give isl_union_set *
9078 isl_schedule_constraints_get_domain(
9079 __isl_keep isl_schedule_constraints *sc);
9080 __isl_give isl_union_map *
9081 isl_schedule_constraints_get_validity(
9082 __isl_keep isl_schedule_constraints *sc);
9083 __isl_give isl_union_map *
9084 isl_schedule_constraints_get_coincidence(
9085 __isl_keep isl_schedule_constraints *sc);
9086 __isl_give isl_union_map *
9087 isl_schedule_constraints_get_proximity(
9088 __isl_keep isl_schedule_constraints *sc);
9089 __isl_give isl_union_map *
9090 isl_schedule_constraints_get_conditional_validity(
9091 __isl_keep isl_schedule_constraints *sc);
9092 __isl_give isl_union_map *
9093 isl_schedule_constraints_get_conditional_validity_condition(
9094 __isl_keep isl_schedule_constraints *sc);
9096 The following function computes a schedule directly from
9097 an iteration domain and validity and proximity dependences
9098 and is implemented in terms of the functions described above.
9099 The use of C<isl_union_set_compute_schedule> is discouraged.
9101 #include <isl/schedule.h>
9102 __isl_give isl_schedule *isl_union_set_compute_schedule(
9103 __isl_take isl_union_set *domain,
9104 __isl_take isl_union_map *validity,
9105 __isl_take isl_union_map *proximity);
9107 The generated schedule represents a schedule tree.
9108 For more information on schedule trees, see
9109 L</"Schedule Trees">.
9113 #include <isl/schedule.h>
9114 isl_stat isl_options_set_schedule_max_coefficient(
9115 isl_ctx *ctx, int val);
9116 int isl_options_get_schedule_max_coefficient(
9118 isl_stat isl_options_set_schedule_max_constant_term(
9119 isl_ctx *ctx, int val);
9120 int isl_options_get_schedule_max_constant_term(
9122 isl_stat isl_options_set_schedule_serialize_sccs(
9123 isl_ctx *ctx, int val);
9124 int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
9125 isl_stat isl_options_set_schedule_whole_component(
9126 isl_ctx *ctx, int val);
9127 int isl_options_get_schedule_whole_component(
9129 isl_stat isl_options_set_schedule_maximize_band_depth(
9130 isl_ctx *ctx, int val);
9131 int isl_options_get_schedule_maximize_band_depth(
9133 isl_stat isl_options_set_schedule_maximize_coincidence(
9134 isl_ctx *ctx, int val);
9135 int isl_options_get_schedule_maximize_coincidence(
9137 isl_stat isl_options_set_schedule_outer_coincidence(
9138 isl_ctx *ctx, int val);
9139 int isl_options_get_schedule_outer_coincidence(
9141 isl_stat isl_options_set_schedule_split_scaled(
9142 isl_ctx *ctx, int val);
9143 int isl_options_get_schedule_split_scaled(
9145 isl_stat isl_options_set_schedule_treat_coalescing(
9146 isl_ctx *ctx, int val);
9147 int isl_options_get_schedule_treat_coalescing(
9149 isl_stat isl_options_set_schedule_algorithm(
9150 isl_ctx *ctx, int val);
9151 int isl_options_get_schedule_algorithm(
9153 isl_stat isl_options_set_schedule_separate_components(
9154 isl_ctx *ctx, int val);
9155 int isl_options_get_schedule_separate_components(
9160 =item * schedule_max_coefficient
9162 This option enforces that the coefficients for variable and parameter
9163 dimensions in the calculated schedule are not larger than the specified value.
9164 This option can significantly increase the speed of the scheduling calculation
9165 and may also prevent fusing of unrelated dimensions. A value of -1 means that
9166 this option does not introduce bounds on the variable or parameter
9169 =item * schedule_max_constant_term
9171 This option enforces that the constant coefficients in the calculated schedule
9172 are not larger than the maximal constant term. This option can significantly
9173 increase the speed of the scheduling calculation and may also prevent fusing of
9174 unrelated dimensions. A value of -1 means that this option does not introduce
9175 bounds on the constant coefficients.
9177 =item * schedule_serialize_sccs
9179 If this option is set, then all strongly connected components
9180 in the dependence graph are serialized as soon as they are detected.
9181 This means in particular that instances of statements will only
9182 appear in the same band node if these statements belong
9183 to the same strongly connected component at the point where
9184 the band node is constructed.
9186 =item * schedule_whole_component
9188 If this option is set, then entire (weakly) connected
9189 components in the dependence graph are scheduled together
9191 Otherwise, each strongly connected component within
9192 such a weakly connected component is first scheduled separately
9193 and then combined with other strongly connected components.
9194 This option has no effect if C<schedule_serialize_sccs> is set.
9196 =item * schedule_maximize_band_depth
9198 If this option is set, then the scheduler tries to maximize
9199 the width of the bands. Wider bands give more possibilities for tiling.
9200 In particular, if the C<schedule_whole_component> option is set,
9201 then bands are split if this might result in wider bands.
9202 Otherwise, the effect of this option is to only allow
9203 strongly connected components to be combined if this does
9204 not reduce the width of the bands.
9205 Note that if the C<schedule_serialize_sccs> options is set, then
9206 the C<schedule_maximize_band_depth> option therefore has no effect.
9208 =item * schedule_maximize_coincidence
9210 This option is only effective if the C<schedule_whole_component>
9211 option is turned off.
9212 If the C<schedule_maximize_coincidence> option is set, then (clusters of)
9213 strongly connected components are only combined with each other
9214 if this does not reduce the number of coincident band members.
9216 =item * schedule_outer_coincidence
9218 If this option is set, then we try to construct schedules
9219 where the outermost scheduling dimension in each band
9220 satisfies the coincidence constraints.
9222 =item * schedule_algorithm
9224 Selects the scheduling algorithm to be used.
9225 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
9226 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
9228 =item * schedule_split_scaled
9230 If this option is set, then we try to construct schedules in which the
9231 constant term is split off from the linear part if the linear parts of
9232 the scheduling rows for all nodes in the graphs have a common non-trivial
9234 The constant term is then placed in a separate band and the linear
9236 This option is only effective when the Feautrier style scheduler is
9237 being used, either as the main scheduler or as a fallback for the
9238 Pluto-like scheduler.
9240 =item * schedule_treat_coalescing
9242 If this option is set, then the scheduler will try and avoid
9243 producing schedules that perform loop coalescing.
9244 In particular, for the Pluto-like scheduler, this option places
9245 bounds on the schedule coefficients based on the sizes of the instance sets.
9246 For the Feautrier style scheduler, this option detects potentially
9247 coalescing schedules and then tries to adjust the schedule to avoid
9250 =item * schedule_separate_components
9252 If this option is set then the function C<isl_schedule_get_map>
9253 will treat set nodes in the same way as sequence nodes.
9257 =head2 AST Generation
9259 This section describes the C<isl> functionality for generating
9260 ASTs that visit all the elements
9261 in a domain in an order specified by a schedule tree or
9263 In case the schedule given as a C<isl_union_map>, an AST is generated
9264 that visits all the elements in the domain of the C<isl_union_map>
9265 according to the lexicographic order of the corresponding image
9266 element(s). If the range of the C<isl_union_map> consists of
9267 elements in more than one space, then each of these spaces is handled
9268 separately in an arbitrary order.
9269 It should be noted that the schedule tree or the image elements
9270 in a schedule map only specify the I<order>
9271 in which the corresponding domain elements should be visited.
9272 No direct relation between the partial schedule values
9273 or the image elements on the one hand and the loop iterators
9274 in the generated AST on the other hand should be assumed.
9276 Each AST is generated within a build. The initial build
9277 simply specifies the constraints on the parameters (if any)
9278 and can be created, inspected, copied and freed using the following functions.
9280 #include <isl/ast_build.h>
9281 __isl_give isl_ast_build *isl_ast_build_alloc(
9283 __isl_give isl_ast_build *isl_ast_build_from_context(
9284 __isl_take isl_set *set);
9285 __isl_give isl_ast_build *isl_ast_build_copy(
9286 __isl_keep isl_ast_build *build);
9287 __isl_null isl_ast_build *isl_ast_build_free(
9288 __isl_take isl_ast_build *build);
9290 The C<set> argument is usually a parameter set with zero or more parameters.
9291 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
9292 this set is required to be a parameter set.
9293 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
9294 specify any parameter constraints.
9295 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
9296 and L</"Fine-grained Control over AST Generation">.
9297 Finally, the AST itself can be constructed using one of the following
9300 #include <isl/ast_build.h>
9301 __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
9302 __isl_keep isl_ast_build *build,
9303 __isl_take isl_schedule *schedule);
9304 __isl_give isl_ast_node *
9305 isl_ast_build_node_from_schedule_map(
9306 __isl_keep isl_ast_build *build,
9307 __isl_take isl_union_map *schedule);
9309 =head3 Inspecting the AST
9311 The basic properties of an AST node can be obtained as follows.
9313 #include <isl/ast.h>
9314 enum isl_ast_node_type isl_ast_node_get_type(
9315 __isl_keep isl_ast_node *node);
9317 The type of an AST node is one of
9318 C<isl_ast_node_for>,
9320 C<isl_ast_node_block>,
9321 C<isl_ast_node_mark> or
9322 C<isl_ast_node_user>.
9323 An C<isl_ast_node_for> represents a for node.
9324 An C<isl_ast_node_if> represents an if node.
9325 An C<isl_ast_node_block> represents a compound node.
9326 An C<isl_ast_node_mark> introduces a mark in the AST.
9327 An C<isl_ast_node_user> represents an expression statement.
9328 An expression statement typically corresponds to a domain element, i.e.,
9329 one of the elements that is visited by the AST.
9331 Each type of node has its own additional properties.
9333 #include <isl/ast.h>
9334 __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
9335 __isl_keep isl_ast_node *node);
9336 __isl_give isl_ast_expr *isl_ast_node_for_get_init(
9337 __isl_keep isl_ast_node *node);
9338 __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
9339 __isl_keep isl_ast_node *node);
9340 __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
9341 __isl_keep isl_ast_node *node);
9342 __isl_give isl_ast_node *isl_ast_node_for_get_body(
9343 __isl_keep isl_ast_node *node);
9344 isl_bool isl_ast_node_for_is_degenerate(
9345 __isl_keep isl_ast_node *node);
9347 An C<isl_ast_for> is considered degenerate if it is known to execute
9350 #include <isl/ast.h>
9351 __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
9352 __isl_keep isl_ast_node *node);
9353 __isl_give isl_ast_node *isl_ast_node_if_get_then(
9354 __isl_keep isl_ast_node *node);
9355 isl_bool isl_ast_node_if_has_else(
9356 __isl_keep isl_ast_node *node);
9357 __isl_give isl_ast_node *isl_ast_node_if_get_else(
9358 __isl_keep isl_ast_node *node);
9360 __isl_give isl_ast_node_list *
9361 isl_ast_node_block_get_children(
9362 __isl_keep isl_ast_node *node);
9364 __isl_give isl_id *isl_ast_node_mark_get_id(
9365 __isl_keep isl_ast_node *node);
9366 __isl_give isl_ast_node *isl_ast_node_mark_get_node(
9367 __isl_keep isl_ast_node *node);
9369 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
9370 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
9372 #include <isl/ast.h>
9373 __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
9374 __isl_keep isl_ast_node *node);
9376 All descendants of a specific node in the AST (including the node itself)
9378 in depth-first pre-order using the following function.
9380 #include <isl/ast.h>
9381 isl_stat isl_ast_node_foreach_descendant_top_down(
9382 __isl_keep isl_ast_node *node,
9383 isl_bool (*fn)(__isl_keep isl_ast_node *node,
9384 void *user), void *user);
9386 The callback function should return C<isl_bool_true> if the children
9387 of the given node should be visited and C<isl_bool_false> if they should not.
9388 It should return C<isl_bool_error> in case of failure, in which case
9389 the entire traversal is aborted.
9391 Each of the returned C<isl_ast_expr>s can in turn be inspected using
9392 the following functions.
9394 #include <isl/ast.h>
9395 enum isl_ast_expr_type isl_ast_expr_get_type(
9396 __isl_keep isl_ast_expr *expr);
9398 The type of an AST expression is one of
9400 C<isl_ast_expr_id> or
9401 C<isl_ast_expr_int>.
9402 An C<isl_ast_expr_op> represents the result of an operation.
9403 An C<isl_ast_expr_id> represents an identifier.
9404 An C<isl_ast_expr_int> represents an integer value.
9406 Each type of expression has its own additional properties.
9408 #include <isl/ast.h>
9409 enum isl_ast_op_type isl_ast_expr_get_op_type(
9410 __isl_keep isl_ast_expr *expr);
9411 int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
9412 __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
9413 __isl_keep isl_ast_expr *expr, int pos);
9414 isl_stat isl_ast_expr_foreach_ast_op_type(
9415 __isl_keep isl_ast_expr *expr,
9416 isl_stat (*fn)(enum isl_ast_op_type type,
9417 void *user), void *user);
9418 isl_stat isl_ast_node_foreach_ast_op_type(
9419 __isl_keep isl_ast_node *node,
9420 isl_stat (*fn)(enum isl_ast_op_type type,
9421 void *user), void *user);
9423 C<isl_ast_expr_get_op_type> returns the type of the operation
9424 performed. C<isl_ast_expr_get_op_n_arg> returns the number of
9425 arguments. C<isl_ast_expr_get_op_arg> returns the specified
9427 C<isl_ast_expr_foreach_ast_op_type> calls C<fn> for each distinct
9428 C<isl_ast_op_type> that appears in C<expr>.
9429 C<isl_ast_node_foreach_ast_op_type> does the same for each distinct
9430 C<isl_ast_op_type> that appears in C<node>.
9431 The operation type is one of the following.
9435 =item C<isl_ast_op_and>
9437 Logical I<and> of two arguments.
9438 Both arguments can be evaluated.
9440 =item C<isl_ast_op_and_then>
9442 Logical I<and> of two arguments.
9443 The second argument can only be evaluated if the first evaluates to true.
9445 =item C<isl_ast_op_or>
9447 Logical I<or> of two arguments.
9448 Both arguments can be evaluated.
9450 =item C<isl_ast_op_or_else>
9452 Logical I<or> of two arguments.
9453 The second argument can only be evaluated if the first evaluates to false.
9455 =item C<isl_ast_op_max>
9457 Maximum of two or more arguments.
9459 =item C<isl_ast_op_min>
9461 Minimum of two or more arguments.
9463 =item C<isl_ast_op_minus>
9467 =item C<isl_ast_op_add>
9469 Sum of two arguments.
9471 =item C<isl_ast_op_sub>
9473 Difference of two arguments.
9475 =item C<isl_ast_op_mul>
9477 Product of two arguments.
9479 =item C<isl_ast_op_div>
9481 Exact division. That is, the result is known to be an integer.
9483 =item C<isl_ast_op_fdiv_q>
9485 Result of integer division, rounded towards negative
9488 =item C<isl_ast_op_pdiv_q>
9490 Result of integer division, where dividend is known to be non-negative.
9492 =item C<isl_ast_op_pdiv_r>
9494 Remainder of integer division, where dividend is known to be non-negative.
9496 =item C<isl_ast_op_zdiv_r>
9498 Equal to zero iff the remainder on integer division is zero.
9500 =item C<isl_ast_op_cond>
9502 Conditional operator defined on three arguments.
9503 If the first argument evaluates to true, then the result
9504 is equal to the second argument. Otherwise, the result
9505 is equal to the third argument.
9506 The second and third argument may only be evaluated if
9507 the first argument evaluates to true and false, respectively.
9508 Corresponds to C<a ? b : c> in C.
9510 =item C<isl_ast_op_select>
9512 Conditional operator defined on three arguments.
9513 If the first argument evaluates to true, then the result
9514 is equal to the second argument. Otherwise, the result
9515 is equal to the third argument.
9516 The second and third argument may be evaluated independently
9517 of the value of the first argument.
9518 Corresponds to C<a * b + (1 - a) * c> in C.
9520 =item C<isl_ast_op_eq>
9524 =item C<isl_ast_op_le>
9526 Less than or equal relation.
9528 =item C<isl_ast_op_lt>
9532 =item C<isl_ast_op_ge>
9534 Greater than or equal relation.
9536 =item C<isl_ast_op_gt>
9538 Greater than relation.
9540 =item C<isl_ast_op_call>
9543 The number of arguments of the C<isl_ast_expr> is one more than
9544 the number of arguments in the function call, the first argument
9545 representing the function being called.
9547 =item C<isl_ast_op_access>
9550 The number of arguments of the C<isl_ast_expr> is one more than
9551 the number of index expressions in the array access, the first argument
9552 representing the array being accessed.
9554 =item C<isl_ast_op_member>
9557 This operation has two arguments, a structure and the name of
9558 the member of the structure being accessed.
9562 #include <isl/ast.h>
9563 __isl_give isl_id *isl_ast_expr_get_id(
9564 __isl_keep isl_ast_expr *expr);
9566 Return the identifier represented by the AST expression.
9568 #include <isl/ast.h>
9569 __isl_give isl_val *isl_ast_expr_get_val(
9570 __isl_keep isl_ast_expr *expr);
9572 Return the integer represented by the AST expression.
9574 =head3 Properties of ASTs
9576 #include <isl/ast.h>
9577 isl_bool isl_ast_expr_is_equal(
9578 __isl_keep isl_ast_expr *expr1,
9579 __isl_keep isl_ast_expr *expr2);
9581 Check if two C<isl_ast_expr>s are equal to each other.
9583 =head3 Manipulating and printing the AST
9585 AST nodes can be copied and freed using the following functions.
9587 #include <isl/ast.h>
9588 __isl_give isl_ast_node *isl_ast_node_copy(
9589 __isl_keep isl_ast_node *node);
9590 __isl_null isl_ast_node *isl_ast_node_free(
9591 __isl_take isl_ast_node *node);
9593 AST expressions can be copied and freed using the following functions.
9595 #include <isl/ast.h>
9596 __isl_give isl_ast_expr *isl_ast_expr_copy(
9597 __isl_keep isl_ast_expr *expr);
9598 __isl_null isl_ast_expr *isl_ast_expr_free(
9599 __isl_take isl_ast_expr *expr);
9601 New AST expressions can be created either directly or within
9602 the context of an C<isl_ast_build>.
9604 #include <isl/ast.h>
9605 __isl_give isl_ast_expr *isl_ast_expr_from_val(
9606 __isl_take isl_val *v);
9607 __isl_give isl_ast_expr *isl_ast_expr_from_id(
9608 __isl_take isl_id *id);
9609 __isl_give isl_ast_expr *isl_ast_expr_neg(
9610 __isl_take isl_ast_expr *expr);
9611 __isl_give isl_ast_expr *isl_ast_expr_address_of(
9612 __isl_take isl_ast_expr *expr);
9613 __isl_give isl_ast_expr *isl_ast_expr_add(
9614 __isl_take isl_ast_expr *expr1,
9615 __isl_take isl_ast_expr *expr2);
9616 __isl_give isl_ast_expr *isl_ast_expr_sub(
9617 __isl_take isl_ast_expr *expr1,
9618 __isl_take isl_ast_expr *expr2);
9619 __isl_give isl_ast_expr *isl_ast_expr_mul(
9620 __isl_take isl_ast_expr *expr1,
9621 __isl_take isl_ast_expr *expr2);
9622 __isl_give isl_ast_expr *isl_ast_expr_div(
9623 __isl_take isl_ast_expr *expr1,
9624 __isl_take isl_ast_expr *expr2);
9625 __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
9626 __isl_take isl_ast_expr *expr1,
9627 __isl_take isl_ast_expr *expr2);
9628 __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
9629 __isl_take isl_ast_expr *expr1,
9630 __isl_take isl_ast_expr *expr2);
9631 __isl_give isl_ast_expr *isl_ast_expr_and(
9632 __isl_take isl_ast_expr *expr1,
9633 __isl_take isl_ast_expr *expr2)
9634 __isl_give isl_ast_expr *isl_ast_expr_and_then(
9635 __isl_take isl_ast_expr *expr1,
9636 __isl_take isl_ast_expr *expr2)
9637 __isl_give isl_ast_expr *isl_ast_expr_or(
9638 __isl_take isl_ast_expr *expr1,
9639 __isl_take isl_ast_expr *expr2)
9640 __isl_give isl_ast_expr *isl_ast_expr_or_else(
9641 __isl_take isl_ast_expr *expr1,
9642 __isl_take isl_ast_expr *expr2)
9643 __isl_give isl_ast_expr *isl_ast_expr_eq(
9644 __isl_take isl_ast_expr *expr1,
9645 __isl_take isl_ast_expr *expr2);
9646 __isl_give isl_ast_expr *isl_ast_expr_le(
9647 __isl_take isl_ast_expr *expr1,
9648 __isl_take isl_ast_expr *expr2);
9649 __isl_give isl_ast_expr *isl_ast_expr_lt(
9650 __isl_take isl_ast_expr *expr1,
9651 __isl_take isl_ast_expr *expr2);
9652 __isl_give isl_ast_expr *isl_ast_expr_ge(
9653 __isl_take isl_ast_expr *expr1,
9654 __isl_take isl_ast_expr *expr2);
9655 __isl_give isl_ast_expr *isl_ast_expr_gt(
9656 __isl_take isl_ast_expr *expr1,
9657 __isl_take isl_ast_expr *expr2);
9658 __isl_give isl_ast_expr *isl_ast_expr_access(
9659 __isl_take isl_ast_expr *array,
9660 __isl_take isl_ast_expr_list *indices);
9661 __isl_give isl_ast_expr *isl_ast_expr_call(
9662 __isl_take isl_ast_expr *function,
9663 __isl_take isl_ast_expr_list *arguments);
9665 The function C<isl_ast_expr_address_of> can be applied to an
9666 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
9667 to represent the address of the C<isl_ast_expr_access>. The function
9668 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
9669 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
9671 #include <isl/ast_build.h>
9672 __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
9673 __isl_keep isl_ast_build *build,
9674 __isl_take isl_set *set);
9675 __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
9676 __isl_keep isl_ast_build *build,
9677 __isl_take isl_pw_aff *pa);
9678 __isl_give isl_ast_expr *
9679 isl_ast_build_access_from_pw_multi_aff(
9680 __isl_keep isl_ast_build *build,
9681 __isl_take isl_pw_multi_aff *pma);
9682 __isl_give isl_ast_expr *
9683 isl_ast_build_access_from_multi_pw_aff(
9684 __isl_keep isl_ast_build *build,
9685 __isl_take isl_multi_pw_aff *mpa);
9686 __isl_give isl_ast_expr *
9687 isl_ast_build_call_from_pw_multi_aff(
9688 __isl_keep isl_ast_build *build,
9689 __isl_take isl_pw_multi_aff *pma);
9690 __isl_give isl_ast_expr *
9691 isl_ast_build_call_from_multi_pw_aff(
9692 __isl_keep isl_ast_build *build,
9693 __isl_take isl_multi_pw_aff *mpa);
9696 the domains of C<pa>, C<mpa> and C<pma> should correspond
9697 to the schedule space of C<build>.
9698 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
9699 the function being called.
9700 If the accessed space is a nested relation, then it is taken
9701 to represent an access of the member specified by the range
9702 of this nested relation of the structure specified by the domain
9703 of the nested relation.
9705 The following functions can be used to modify an C<isl_ast_expr>.
9707 #include <isl/ast.h>
9708 __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
9709 __isl_take isl_ast_expr *expr, int pos,
9710 __isl_take isl_ast_expr *arg);
9712 Replace the argument of C<expr> at position C<pos> by C<arg>.
9714 #include <isl/ast.h>
9715 __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
9716 __isl_take isl_ast_expr *expr,
9717 __isl_take isl_id_to_ast_expr *id2expr);
9719 The function C<isl_ast_expr_substitute_ids> replaces the
9720 subexpressions of C<expr> of type C<isl_ast_expr_id>
9721 by the corresponding expression in C<id2expr>, if there is any.
9724 User specified data can be attached to an C<isl_ast_node> and obtained
9725 from the same C<isl_ast_node> using the following functions.
9727 #include <isl/ast.h>
9728 __isl_give isl_ast_node *isl_ast_node_set_annotation(
9729 __isl_take isl_ast_node *node,
9730 __isl_take isl_id *annotation);
9731 __isl_give isl_id *isl_ast_node_get_annotation(
9732 __isl_keep isl_ast_node *node);
9734 Basic printing can be performed using the following functions.
9736 #include <isl/ast.h>
9737 __isl_give isl_printer *isl_printer_print_ast_expr(
9738 __isl_take isl_printer *p,
9739 __isl_keep isl_ast_expr *expr);
9740 __isl_give isl_printer *isl_printer_print_ast_node(
9741 __isl_take isl_printer *p,
9742 __isl_keep isl_ast_node *node);
9743 __isl_give char *isl_ast_expr_to_str(
9744 __isl_keep isl_ast_expr *expr);
9745 __isl_give char *isl_ast_node_to_str(
9746 __isl_keep isl_ast_node *node);
9747 __isl_give char *isl_ast_expr_to_C_str(
9748 __isl_keep isl_ast_expr *expr);
9749 __isl_give char *isl_ast_node_to_C_str(
9750 __isl_keep isl_ast_node *node);
9752 The functions C<isl_ast_expr_to_C_str> and
9753 C<isl_ast_node_to_C_str> are convenience functions
9754 that return a string representation of the input in C format.
9756 More advanced printing can be performed using the following functions.
9758 #include <isl/ast.h>
9759 __isl_give isl_printer *isl_ast_op_type_set_print_name(
9760 __isl_take isl_printer *p,
9761 enum isl_ast_op_type type,
9762 __isl_keep const char *name);
9763 isl_stat isl_options_set_ast_print_macro_once(
9764 isl_ctx *ctx, int val);
9765 int isl_options_get_ast_print_macro_once(isl_ctx *ctx);
9766 __isl_give isl_printer *isl_ast_op_type_print_macro(
9767 enum isl_ast_op_type type,
9768 __isl_take isl_printer *p);
9769 __isl_give isl_printer *isl_ast_expr_print_macros(
9770 __isl_keep isl_ast_expr *expr,
9771 __isl_take isl_printer *p);
9772 __isl_give isl_printer *isl_ast_node_print_macros(
9773 __isl_keep isl_ast_node *node,
9774 __isl_take isl_printer *p);
9775 __isl_give isl_printer *isl_ast_node_print(
9776 __isl_keep isl_ast_node *node,
9777 __isl_take isl_printer *p,
9778 __isl_take isl_ast_print_options *options);
9779 __isl_give isl_printer *isl_ast_node_for_print(
9780 __isl_keep isl_ast_node *node,
9781 __isl_take isl_printer *p,
9782 __isl_take isl_ast_print_options *options);
9783 __isl_give isl_printer *isl_ast_node_if_print(
9784 __isl_keep isl_ast_node *node,
9785 __isl_take isl_printer *p,
9786 __isl_take isl_ast_print_options *options);
9788 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
9789 C<isl> may print out an AST that makes use of macros such
9790 as C<floord>, C<min> and C<max>.
9791 The names of these macros may be modified by a call
9792 to C<isl_ast_op_type_set_print_name>. The user-specified
9793 names are associated to the printer object.
9794 C<isl_ast_op_type_print_macro> prints out the macro
9795 corresponding to a specific C<isl_ast_op_type>.
9796 If the print-macro-once option is set, then a given macro definition
9797 is only printed once to any given printer object.
9798 C<isl_ast_expr_print_macros> scans the C<isl_ast_expr>
9799 for subexpressions where these macros would be used and prints
9800 out the required macro definitions.
9801 Essentially, C<isl_ast_expr_print_macros> calls
9802 C<isl_ast_expr_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
9803 as function argument.
9804 C<isl_ast_node_print_macros> does the same
9805 for expressions in its C<isl_ast_node> argument.
9806 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
9807 C<isl_ast_node_if_print> print an C<isl_ast_node>
9808 in C<ISL_FORMAT_C>, but allow for some extra control
9809 through an C<isl_ast_print_options> object.
9810 This object can be created using the following functions.
9812 #include <isl/ast.h>
9813 __isl_give isl_ast_print_options *
9814 isl_ast_print_options_alloc(isl_ctx *ctx);
9815 __isl_give isl_ast_print_options *
9816 isl_ast_print_options_copy(
9817 __isl_keep isl_ast_print_options *options);
9818 __isl_null isl_ast_print_options *
9819 isl_ast_print_options_free(
9820 __isl_take isl_ast_print_options *options);
9822 __isl_give isl_ast_print_options *
9823 isl_ast_print_options_set_print_user(
9824 __isl_take isl_ast_print_options *options,
9825 __isl_give isl_printer *(*print_user)(
9826 __isl_take isl_printer *p,
9827 __isl_take isl_ast_print_options *options,
9828 __isl_keep isl_ast_node *node, void *user),
9830 __isl_give isl_ast_print_options *
9831 isl_ast_print_options_set_print_for(
9832 __isl_take isl_ast_print_options *options,
9833 __isl_give isl_printer *(*print_for)(
9834 __isl_take isl_printer *p,
9835 __isl_take isl_ast_print_options *options,
9836 __isl_keep isl_ast_node *node, void *user),
9839 The callback set by C<isl_ast_print_options_set_print_user>
9840 is called whenever a node of type C<isl_ast_node_user> needs to
9842 The callback set by C<isl_ast_print_options_set_print_for>
9843 is called whenever a node of type C<isl_ast_node_for> needs to
9845 Note that C<isl_ast_node_for_print> will I<not> call the
9846 callback set by C<isl_ast_print_options_set_print_for> on the node
9847 on which C<isl_ast_node_for_print> is called, but only on nested
9848 nodes of type C<isl_ast_node_for>. It is therefore safe to
9849 call C<isl_ast_node_for_print> from within the callback set by
9850 C<isl_ast_print_options_set_print_for>.
9852 The following option determines the type to be used for iterators
9853 while printing the AST.
9855 isl_stat isl_options_set_ast_iterator_type(
9856 isl_ctx *ctx, const char *val);
9857 const char *isl_options_get_ast_iterator_type(
9860 The AST printer only prints body nodes as blocks if these
9861 blocks cannot be safely omitted.
9862 For example, a C<for> node with one body node will not be
9863 surrounded with braces in C<ISL_FORMAT_C>.
9864 A block will always be printed by setting the following option.
9866 isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
9868 int isl_options_get_ast_always_print_block(isl_ctx *ctx);
9872 #include <isl/ast_build.h>
9873 isl_stat isl_options_set_ast_build_atomic_upper_bound(
9874 isl_ctx *ctx, int val);
9875 int isl_options_get_ast_build_atomic_upper_bound(
9877 isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
9879 int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
9880 isl_stat isl_options_set_ast_build_detect_min_max(
9881 isl_ctx *ctx, int val);
9882 int isl_options_get_ast_build_detect_min_max(
9884 isl_stat isl_options_set_ast_build_exploit_nested_bounds(
9885 isl_ctx *ctx, int val);
9886 int isl_options_get_ast_build_exploit_nested_bounds(
9888 isl_stat isl_options_set_ast_build_group_coscheduled(
9889 isl_ctx *ctx, int val);
9890 int isl_options_get_ast_build_group_coscheduled(
9892 isl_stat isl_options_set_ast_build_scale_strides(
9893 isl_ctx *ctx, int val);
9894 int isl_options_get_ast_build_scale_strides(
9896 isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
9898 int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
9899 isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
9901 int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
9905 =item * ast_build_atomic_upper_bound
9907 Generate loop upper bounds that consist of the current loop iterator,
9908 an operator and an expression not involving the iterator.
9909 If this option is not set, then the current loop iterator may appear
9910 several times in the upper bound.
9911 For example, when this option is turned off, AST generation
9914 [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
9918 for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
9921 When the option is turned on, the following AST is generated
9923 for (int c0 = 0; c0 <= min(100, n); c0 += 1)
9926 =item * ast_build_prefer_pdiv
9928 If this option is turned off, then the AST generation will
9929 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
9930 operators, but no C<isl_ast_op_pdiv_q> or
9931 C<isl_ast_op_pdiv_r> operators.
9932 If this option is turned on, then C<isl> will try to convert
9933 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
9934 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
9936 =item * ast_build_detect_min_max
9938 If this option is turned on, then C<isl> will try and detect
9939 min or max-expressions when building AST expressions from
9940 piecewise affine expressions.
9942 =item * ast_build_exploit_nested_bounds
9944 Simplify conditions based on bounds of nested for loops.
9945 In particular, remove conditions that are implied by the fact
9946 that one or more nested loops have at least one iteration,
9947 meaning that the upper bound is at least as large as the lower bound.
9948 For example, when this option is turned off, AST generation
9951 [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
9957 for (int c0 = 0; c0 <= N; c0 += 1)
9958 for (int c1 = 0; c1 <= M; c1 += 1)
9961 When the option is turned on, the following AST is generated
9963 for (int c0 = 0; c0 <= N; c0 += 1)
9964 for (int c1 = 0; c1 <= M; c1 += 1)
9967 =item * ast_build_group_coscheduled
9969 If two domain elements are assigned the same schedule point, then
9970 they may be executed in any order and they may even appear in different
9971 loops. If this options is set, then the AST generator will make
9972 sure that coscheduled domain elements do not appear in separate parts
9973 of the AST. This is useful in case of nested AST generation
9974 if the outer AST generation is given only part of a schedule
9975 and the inner AST generation should handle the domains that are
9976 coscheduled by this initial part of the schedule together.
9977 For example if an AST is generated for a schedule
9979 { A[i] -> [0]; B[i] -> [0] }
9981 then the C<isl_ast_build_set_create_leaf> callback described
9982 below may get called twice, once for each domain.
9983 Setting this option ensures that the callback is only called once
9984 on both domains together.
9986 =item * ast_build_separation_bounds
9988 This option specifies which bounds to use during separation.
9989 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
9990 then all (possibly implicit) bounds on the current dimension will
9991 be used during separation.
9992 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
9993 then only those bounds that are explicitly available will
9994 be used during separation.
9996 =item * ast_build_scale_strides
9998 This option specifies whether the AST generator is allowed
9999 to scale down iterators of strided loops.
10001 =item * ast_build_allow_else
10003 This option specifies whether the AST generator is allowed
10004 to construct if statements with else branches.
10006 =item * ast_build_allow_or
10008 This option specifies whether the AST generator is allowed
10009 to construct if conditions with disjunctions.
10013 =head3 AST Generation Options (Schedule Tree)
10015 In case of AST construction from a schedule tree, the options
10016 that control how an AST is created from the individual schedule
10017 dimensions are stored in the band nodes of the tree
10018 (see L</"Schedule Trees">).
10020 In particular, a schedule dimension can be handled in four
10021 different ways, atomic, separate, unroll or the default.
10022 This loop AST generation type can be set using
10023 C<isl_schedule_node_band_member_set_ast_loop_type>.
10025 the first three can be selected by including a one-dimensional
10026 element with as value the position of the schedule dimension
10027 within the band and as name one of C<atomic>, C<separate>
10028 or C<unroll> in the options
10029 set by C<isl_schedule_node_band_set_ast_build_options>.
10030 Only one of these three may be specified for
10031 any given schedule dimension within a band node.
10032 If none of these is specified, then the default
10033 is used. The meaning of the options is as follows.
10039 When this option is specified, the AST generator will make
10040 sure that a given domains space only appears in a single
10041 loop at the specified level.
10043 For example, for the schedule tree
10045 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10047 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10048 options: "{ atomic[x] }"
10050 the following AST will be generated
10052 for (int c0 = 0; c0 <= 10; c0 += 1) {
10059 On the other hand, for the schedule tree
10061 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10063 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10064 options: "{ separate[x] }"
10066 the following AST will be generated
10070 for (int c0 = 1; c0 <= 9; c0 += 1) {
10077 If neither C<atomic> nor C<separate> is specified, then the AST generator
10078 may produce either of these two results or some intermediate form.
10082 When this option is specified, the AST generator will
10083 split the domain of the specified schedule dimension
10084 into pieces with a fixed set of statements for which
10085 instances need to be executed by the iterations in
10086 the schedule domain part. This option tends to avoid
10087 the generation of guards inside the corresponding loops.
10088 See also the C<atomic> option.
10092 When this option is specified, the AST generator will
10093 I<completely> unroll the corresponding schedule dimension.
10094 It is the responsibility of the user to ensure that such
10095 unrolling is possible.
10096 To obtain a partial unrolling, the user should apply an additional
10097 strip-mining to the schedule and fully unroll the inner schedule
10102 The C<isolate> option is a bit more involved. It allows the user
10103 to isolate a range of schedule dimension values from smaller and
10104 greater values. Additionally, the user may specify a different
10105 atomic/separate/unroll choice for the isolated part and the remaining
10106 parts. The typical use case of the C<isolate> option is to isolate
10107 full tiles from partial tiles.
10108 The part that needs to be isolated may depend on outer schedule dimensions.
10109 The option therefore needs to be able to reference those outer schedule
10110 dimensions. In particular, the space of the C<isolate> option is that
10111 of a wrapped map with as domain the flat product of all outer band nodes
10112 and as range the space of the current band node.
10113 The atomic/separate/unroll choice for the isolated part is determined
10114 by an option that lives in an unnamed wrapped space with as domain
10115 a zero-dimensional C<isolate> space and as range the regular
10116 C<atomic>, C<separate> or C<unroll> space.
10117 This option may also be set directly using
10118 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
10119 The atomic/separate/unroll choice for the remaining part is determined
10120 by the regular C<atomic>, C<separate> or C<unroll> option.
10121 Since the C<isolate> option references outer schedule dimensions,
10122 its use in a band node causes any tree containing the node
10123 to be considered anchored.
10125 As an example, consider the isolation of full tiles from partial tiles
10126 in a tiling of a triangular domain. The original schedule is as follows.
10128 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10130 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10131 { A[i,j] -> [floor(j/10)] }, \
10132 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10136 for (int c0 = 0; c0 <= 10; c0 += 1)
10137 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10138 for (int c2 = 10 * c0;
10139 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10140 for (int c3 = 10 * c1;
10141 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10144 Isolating the full tiles, we have the following input
10146 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10148 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10149 { A[i,j] -> [floor(j/10)] }, \
10150 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10151 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10152 10a+9+10b+9 <= 100 }"
10157 for (int c0 = 0; c0 <= 8; c0 += 1) {
10158 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10159 for (int c2 = 10 * c0;
10160 c2 <= 10 * c0 + 9; c2 += 1)
10161 for (int c3 = 10 * c1;
10162 c3 <= 10 * c1 + 9; c3 += 1)
10164 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10165 for (int c2 = 10 * c0;
10166 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10167 for (int c3 = 10 * c1;
10168 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10171 for (int c0 = 9; c0 <= 10; c0 += 1)
10172 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10173 for (int c2 = 10 * c0;
10174 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10175 for (int c3 = 10 * c1;
10176 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10180 We may then additionally unroll the innermost loop of the isolated part
10182 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10184 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10185 { A[i,j] -> [floor(j/10)] }, \
10186 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10187 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10188 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
10193 for (int c0 = 0; c0 <= 8; c0 += 1) {
10194 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10195 for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
10197 A(c2, 10 * c1 + 1);
10198 A(c2, 10 * c1 + 2);
10199 A(c2, 10 * c1 + 3);
10200 A(c2, 10 * c1 + 4);
10201 A(c2, 10 * c1 + 5);
10202 A(c2, 10 * c1 + 6);
10203 A(c2, 10 * c1 + 7);
10204 A(c2, 10 * c1 + 8);
10205 A(c2, 10 * c1 + 9);
10207 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10208 for (int c2 = 10 * c0;
10209 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10210 for (int c3 = 10 * c1;
10211 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10214 for (int c0 = 9; c0 <= 10; c0 += 1)
10215 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10216 for (int c2 = 10 * c0;
10217 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10218 for (int c3 = 10 * c1;
10219 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10224 =head3 AST Generation Options (Schedule Map)
10226 In case of AST construction using
10227 C<isl_ast_build_node_from_schedule_map>, the options
10228 that control how an AST is created from the individual schedule
10229 dimensions are stored in the C<isl_ast_build>.
10230 They can be set using the following function.
10232 #include <isl/ast_build.h>
10233 __isl_give isl_ast_build *
10234 isl_ast_build_set_options(
10235 __isl_take isl_ast_build *control,
10236 __isl_take isl_union_map *options);
10238 The options are encoded in an C<isl_union_map>.
10239 The domain of this union relation refers to the schedule domain,
10240 i.e., the range of the schedule passed
10241 to C<isl_ast_build_node_from_schedule_map>.
10242 In the case of nested AST generation (see L</"Nested AST Generation">),
10243 the domain of C<options> should refer to the extra piece of the schedule.
10244 That is, it should be equal to the range of the wrapped relation in the
10245 range of the schedule.
10246 The range of the options can consist of elements in one or more spaces,
10247 the names of which determine the effect of the option.
10248 The values of the range typically also refer to the schedule dimension
10249 to which the option applies. In case of nested AST generation
10250 (see L</"Nested AST Generation">), these values refer to the position
10251 of the schedule dimension within the innermost AST generation.
10252 The constraints on the domain elements of
10253 the option should only refer to this dimension and earlier dimensions.
10254 We consider the following spaces.
10258 =item C<separation_class>
10260 B<This option has been deprecated. Use the isolate option on
10261 schedule trees instead.>
10263 This space is a wrapped relation between two one dimensional spaces.
10264 The input space represents the schedule dimension to which the option
10265 applies and the output space represents the separation class.
10266 While constructing a loop corresponding to the specified schedule
10267 dimension(s), the AST generator will try to generate separate loops
10268 for domain elements that are assigned different classes.
10269 If only some of the elements are assigned a class, then those elements
10270 that are not assigned any class will be treated as belonging to a class
10271 that is separate from the explicitly assigned classes.
10272 The typical use case for this option is to separate full tiles from
10274 The other options, described below, are applied after the separation
10277 As an example, consider the separation into full and partial tiles
10278 of a tiling of a triangular domain.
10279 Take, for example, the domain
10281 { A[i,j] : 0 <= i,j and i + j <= 100 }
10283 and a tiling into tiles of 10 by 10. The input to the AST generator
10284 is then the schedule
10286 { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
10289 Without any options, the following AST is generated
10291 for (int c0 = 0; c0 <= 10; c0 += 1)
10292 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10293 for (int c2 = 10 * c0;
10294 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10296 for (int c3 = 10 * c1;
10297 c3 <= min(10 * c1 + 9, -c2 + 100);
10301 Separation into full and partial tiles can be obtained by assigning
10302 a class, say C<0>, to the full tiles. The full tiles are represented by those
10303 values of the first and second schedule dimensions for which there are
10304 values of the third and fourth dimensions to cover an entire tile.
10305 That is, we need to specify the following option
10307 { [a,b,c,d] -> separation_class[[0]->[0]] :
10308 exists b': 0 <= 10a,10b' and
10309 10a+9+10b'+9 <= 100;
10310 [a,b,c,d] -> separation_class[[1]->[0]] :
10311 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
10313 which simplifies to
10315 { [a, b, c, d] -> separation_class[[1] -> [0]] :
10316 a >= 0 and b >= 0 and b <= 8 - a;
10317 [a, b, c, d] -> separation_class[[0] -> [0]] :
10318 a >= 0 and a <= 8 }
10320 With this option, the generated AST is as follows
10323 for (int c0 = 0; c0 <= 8; c0 += 1) {
10324 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10325 for (int c2 = 10 * c0;
10326 c2 <= 10 * c0 + 9; c2 += 1)
10327 for (int c3 = 10 * c1;
10328 c3 <= 10 * c1 + 9; c3 += 1)
10330 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10331 for (int c2 = 10 * c0;
10332 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10334 for (int c3 = 10 * c1;
10335 c3 <= min(-c2 + 100, 10 * c1 + 9);
10339 for (int c0 = 9; c0 <= 10; c0 += 1)
10340 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10341 for (int c2 = 10 * c0;
10342 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10344 for (int c3 = 10 * c1;
10345 c3 <= min(10 * c1 + 9, -c2 + 100);
10352 This is a single-dimensional space representing the schedule dimension(s)
10353 to which ``separation'' should be applied. Separation tries to split
10354 a loop into several pieces if this can avoid the generation of guards
10356 See also the C<atomic> option.
10360 This is a single-dimensional space representing the schedule dimension(s)
10361 for which the domains should be considered ``atomic''. That is, the
10362 AST generator will make sure that any given domain space will only appear
10363 in a single loop at the specified level.
10365 Consider the following schedule
10367 { a[i] -> [i] : 0 <= i < 10;
10368 b[i] -> [i+1] : 0 <= i < 10 }
10370 If the following option is specified
10372 { [i] -> separate[x] }
10374 then the following AST will be generated
10378 for (int c0 = 1; c0 <= 9; c0 += 1) {
10385 If, on the other hand, the following option is specified
10387 { [i] -> atomic[x] }
10389 then the following AST will be generated
10391 for (int c0 = 0; c0 <= 10; c0 += 1) {
10398 If neither C<atomic> nor C<separate> is specified, then the AST generator
10399 may produce either of these two results or some intermediate form.
10403 This is a single-dimensional space representing the schedule dimension(s)
10404 that should be I<completely> unrolled.
10405 To obtain a partial unrolling, the user should apply an additional
10406 strip-mining to the schedule and fully unroll the inner loop.
10410 =head3 Fine-grained Control over AST Generation
10412 Besides specifying the constraints on the parameters,
10413 an C<isl_ast_build> object can be used to control
10414 various aspects of the AST generation process.
10415 In case of AST construction using
10416 C<isl_ast_build_node_from_schedule_map>,
10417 the most prominent way of control is through ``options'',
10418 as explained above.
10420 Additional control is available through the following functions.
10422 #include <isl/ast_build.h>
10423 __isl_give isl_ast_build *
10424 isl_ast_build_set_iterators(
10425 __isl_take isl_ast_build *control,
10426 __isl_take isl_id_list *iterators);
10428 The function C<isl_ast_build_set_iterators> allows the user to
10429 specify a list of iterator C<isl_id>s to be used as iterators.
10430 If the input schedule is injective, then
10431 the number of elements in this list should be as large as the dimension
10432 of the schedule space, but no direct correspondence should be assumed
10433 between dimensions and elements.
10434 If the input schedule is not injective, then an additional number
10435 of C<isl_id>s equal to the largest dimension of the input domains
10437 If the number of provided C<isl_id>s is insufficient, then additional
10438 names are automatically generated.
10440 #include <isl/ast_build.h>
10441 __isl_give isl_ast_build *
10442 isl_ast_build_set_create_leaf(
10443 __isl_take isl_ast_build *control,
10444 __isl_give isl_ast_node *(*fn)(
10445 __isl_take isl_ast_build *build,
10446 void *user), void *user);
10449 C<isl_ast_build_set_create_leaf> function allows for the
10450 specification of a callback that should be called whenever the AST
10451 generator arrives at an element of the schedule domain.
10452 The callback should return an AST node that should be inserted
10453 at the corresponding position of the AST. The default action (when
10454 the callback is not set) is to continue generating parts of the AST to scan
10455 all the domain elements associated to the schedule domain element
10456 and to insert user nodes, ``calling'' the domain element, for each of them.
10457 The C<build> argument contains the current state of the C<isl_ast_build>.
10458 To ease nested AST generation (see L</"Nested AST Generation">),
10459 all control information that is
10460 specific to the current AST generation such as the options and
10461 the callbacks has been removed from this C<isl_ast_build>.
10462 The callback would typically return the result of a nested
10463 AST generation or a
10464 user defined node created using the following function.
10466 #include <isl/ast.h>
10467 __isl_give isl_ast_node *isl_ast_node_alloc_user(
10468 __isl_take isl_ast_expr *expr);
10470 #include <isl/ast_build.h>
10471 __isl_give isl_ast_build *
10472 isl_ast_build_set_at_each_domain(
10473 __isl_take isl_ast_build *build,
10474 __isl_give isl_ast_node *(*fn)(
10475 __isl_take isl_ast_node *node,
10476 __isl_keep isl_ast_build *build,
10477 void *user), void *user);
10478 __isl_give isl_ast_build *
10479 isl_ast_build_set_before_each_for(
10480 __isl_take isl_ast_build *build,
10481 __isl_give isl_id *(*fn)(
10482 __isl_keep isl_ast_build *build,
10483 void *user), void *user);
10484 __isl_give isl_ast_build *
10485 isl_ast_build_set_after_each_for(
10486 __isl_take isl_ast_build *build,
10487 __isl_give isl_ast_node *(*fn)(
10488 __isl_take isl_ast_node *node,
10489 __isl_keep isl_ast_build *build,
10490 void *user), void *user);
10491 __isl_give isl_ast_build *
10492 isl_ast_build_set_before_each_mark(
10493 __isl_take isl_ast_build *build,
10494 isl_stat (*fn)(__isl_keep isl_id *mark,
10495 __isl_keep isl_ast_build *build,
10496 void *user), void *user);
10497 __isl_give isl_ast_build *
10498 isl_ast_build_set_after_each_mark(
10499 __isl_take isl_ast_build *build,
10500 __isl_give isl_ast_node *(*fn)(
10501 __isl_take isl_ast_node *node,
10502 __isl_keep isl_ast_build *build,
10503 void *user), void *user);
10505 The callback set by C<isl_ast_build_set_at_each_domain> will
10506 be called for each domain AST node.
10507 The callbacks set by C<isl_ast_build_set_before_each_for>
10508 and C<isl_ast_build_set_after_each_for> will be called
10509 for each for AST node. The first will be called in depth-first
10510 pre-order, while the second will be called in depth-first post-order.
10511 Since C<isl_ast_build_set_before_each_for> is called before the for
10512 node is actually constructed, it is only passed an C<isl_ast_build>.
10513 The returned C<isl_id> will be added as an annotation (using
10514 C<isl_ast_node_set_annotation>) to the constructed for node.
10515 In particular, if the user has also specified an C<after_each_for>
10516 callback, then the annotation can be retrieved from the node passed to
10517 that callback using C<isl_ast_node_get_annotation>.
10518 The callbacks set by C<isl_ast_build_set_before_each_mark>
10519 and C<isl_ast_build_set_after_each_mark> will be called for each
10520 mark AST node that is created, i.e., for each mark schedule node
10521 in the input schedule tree. The first will be called in depth-first
10522 pre-order, while the second will be called in depth-first post-order.
10523 Since the callback set by C<isl_ast_build_set_before_each_mark>
10524 is called before the mark AST node is actually constructed, it is passed
10525 the identifier of the mark node.
10526 All callbacks should C<NULL> (or -1) on failure.
10527 The given C<isl_ast_build> can be used to create new
10528 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
10529 or C<isl_ast_build_call_from_pw_multi_aff>.
10531 =head3 Nested AST Generation
10533 C<isl> allows the user to create an AST within the context
10534 of another AST. These nested ASTs are created using the
10535 same C<isl_ast_build_node_from_schedule_map> function that is used to create
10536 the outer AST. The C<build> argument should be an C<isl_ast_build>
10537 passed to a callback set by
10538 C<isl_ast_build_set_create_leaf>.
10539 The space of the range of the C<schedule> argument should refer
10540 to this build. In particular, the space should be a wrapped
10541 relation and the domain of this wrapped relation should be the
10542 same as that of the range of the schedule returned by
10543 C<isl_ast_build_get_schedule> below.
10544 In practice, the new schedule is typically
10545 created by calling C<isl_union_map_range_product> on the old schedule
10546 and some extra piece of the schedule.
10547 The space of the schedule domain is also available from
10548 the C<isl_ast_build>.
10550 #include <isl/ast_build.h>
10551 __isl_give isl_union_map *isl_ast_build_get_schedule(
10552 __isl_keep isl_ast_build *build);
10553 __isl_give isl_space *isl_ast_build_get_schedule_space(
10554 __isl_keep isl_ast_build *build);
10555 __isl_give isl_ast_build *isl_ast_build_restrict(
10556 __isl_take isl_ast_build *build,
10557 __isl_take isl_set *set);
10559 The C<isl_ast_build_get_schedule> function returns a (partial)
10560 schedule for the domains elements for which part of the AST still needs to
10561 be generated in the current build.
10562 In particular, the domain elements are mapped to those iterations of the loops
10563 enclosing the current point of the AST generation inside which
10564 the domain elements are executed.
10565 No direct correspondence between
10566 the input schedule and this schedule should be assumed.
10567 The space obtained from C<isl_ast_build_get_schedule_space> can be used
10568 to create a set for C<isl_ast_build_restrict> to intersect
10569 with the current build. In particular, the set passed to
10570 C<isl_ast_build_restrict> can have additional parameters.
10571 The ids of the set dimensions in the space returned by
10572 C<isl_ast_build_get_schedule_space> correspond to the
10573 iterators of the already generated loops.
10574 The user should not rely on the ids of the output dimensions
10575 of the relations in the union relation returned by
10576 C<isl_ast_build_get_schedule> having any particular value.
10578 =head1 Applications
10580 Although C<isl> is mainly meant to be used as a library,
10581 it also contains some basic applications that use some
10582 of the functionality of C<isl>.
10583 The input may be specified in either the L<isl format>
10584 or the L<PolyLib format>.
10586 =head2 C<isl_polyhedron_sample>
10588 C<isl_polyhedron_sample> takes a polyhedron as input and prints
10589 an integer element of the polyhedron, if there is any.
10590 The first column in the output is the denominator and is always
10591 equal to 1. If the polyhedron contains no integer points,
10592 then a vector of length zero is printed.
10596 C<isl_pip> takes the same input as the C<example> program
10597 from the C<piplib> distribution, i.e., a set of constraints
10598 on the parameters, a line containing only -1 and finally a set
10599 of constraints on a parametric polyhedron.
10600 The coefficients of the parameters appear in the last columns
10601 (but before the final constant column).
10602 The output is the lexicographic minimum of the parametric polyhedron.
10603 As C<isl> currently does not have its own output format, the output
10604 is just a dump of the internal state.
10606 =head2 C<isl_polyhedron_minimize>
10608 C<isl_polyhedron_minimize> computes the minimum of some linear
10609 or affine objective function over the integer points in a polyhedron.
10610 If an affine objective function
10611 is given, then the constant should appear in the last column.
10613 =head2 C<isl_polytope_scan>
10615 Given a polytope, C<isl_polytope_scan> prints
10616 all integer points in the polytope.
10618 =head2 C<isl_codegen>
10620 Given a schedule, a context set and an options relation,
10621 C<isl_codegen> prints out an AST that scans the domain elements
10622 of the schedule in the order of their image(s) taking into account
10623 the constraints in the context set.