3 C<isl> is a thread-safe C library for manipulating
4 sets and relations of integer points bounded by affine constraints.
5 The descriptions of the sets and relations may involve
6 both parameters and existentially quantified variables.
7 All computations are performed in exact integer arithmetic
8 using C<GMP> or C<imath>.
9 The C<isl> library offers functionality that is similar
10 to that offered by the C<Omega> and C<Omega+> libraries,
11 but the underlying algorithms are in most cases completely different.
13 The library is by no means complete and some fairly basic
14 functionality is still missing.
15 Still, even in its current form, the library has been successfully
16 used as a backend polyhedral library for the polyhedral
17 scanner C<CLooG> and as part of an equivalence checker of
18 static affine programs.
19 For bug reports, feature requests and questions,
20 visit the discussion group at
21 L<http://groups.google.com/group/isl-development>.
23 =head2 Backward Incompatible Changes
25 =head3 Changes since isl-0.02
29 =item * The old printing functions have been deprecated
30 and replaced by C<isl_printer> functions, see L<Input and Output>.
32 =item * Most functions related to dependence analysis have acquired
33 an extra C<must> argument. To obtain the old behavior, this argument
34 should be given the value 1. See L<Dependence Analysis>.
38 =head3 Changes since isl-0.03
42 =item * The function C<isl_pw_qpolynomial_fold_add> has been
43 renamed to C<isl_pw_qpolynomial_fold_fold>.
44 Similarly, C<isl_union_pw_qpolynomial_fold_add> has been
45 renamed to C<isl_union_pw_qpolynomial_fold_fold>.
49 =head3 Changes since isl-0.04
53 =item * All header files have been renamed from C<isl_header.h>
58 =head3 Changes since isl-0.05
62 =item * The functions C<isl_printer_print_basic_set> and
63 C<isl_printer_print_basic_map> no longer print a newline.
65 =item * The functions C<isl_flow_get_no_source>
66 and C<isl_union_map_compute_flow> now return
67 the accesses for which no source could be found instead of
68 the iterations where those accesses occur.
70 =item * The functions C<isl_basic_map_identity> and
71 C<isl_map_identity> now take a B<map> space as input. An old call
72 C<isl_map_identity(space)> can be rewritten to
73 C<isl_map_identity(isl_space_map_from_set(space))>.
75 =item * The function C<isl_map_power> no longer takes
76 a parameter position as input. Instead, the exponent
77 is now expressed as the domain of the resulting relation.
81 =head3 Changes since isl-0.06
85 =item * The format of C<isl_printer_print_qpolynomial>'s
86 C<ISL_FORMAT_ISL> output has changed.
87 Use C<ISL_FORMAT_C> to obtain the old output.
89 =item * The C<*_fast_*> functions have been renamed to C<*_plain_*>.
90 Some of the old names have been kept for backward compatibility,
91 but they will be removed in the future.
95 =head3 Changes since isl-0.07
99 =item * The function C<isl_pw_aff_max> has been renamed to
100 C<isl_pw_aff_union_max>.
101 Similarly, the function C<isl_pw_aff_add> has been renamed to
102 C<isl_pw_aff_union_add>.
104 =item * The C<isl_dim> type has been renamed to C<isl_space>
105 along with the associated functions.
106 Some of the old names have been kept for backward compatibility,
107 but they will be removed in the future.
109 =item * Spaces of maps, sets and parameter domains are now
110 treated differently. The distinction between map spaces and set spaces
111 has always been made on a conceptual level, but proper use of such spaces
112 was never checked. Furthermore, up until isl-0.07 there was no way
113 of explicitly creating a parameter space. These can now be created
114 directly using C<isl_space_params_alloc> or from other spaces using
117 =item * The space in which C<isl_aff>, C<isl_pw_aff>, C<isl_qpolynomial>,
118 C<isl_pw_qpolynomial>, C<isl_qpolynomial_fold> and C<isl_pw_qpolynomial_fold>
119 objects live is now a map space
120 instead of a set space. This means, for example, that the dimensions
121 of the domain of an C<isl_aff> are now considered to be of type
122 C<isl_dim_in> instead of C<isl_dim_set>. Extra functions have been
123 added to obtain the domain space. Some of the constructors still
124 take a domain space and have therefore been renamed.
126 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
127 now take an C<isl_local_space> instead of an C<isl_space>.
128 An C<isl_local_space> can be created from an C<isl_space>
129 using C<isl_local_space_from_space>.
131 =item * The C<isl_div> type has been removed. Functions that used
132 to return an C<isl_div> now return an C<isl_aff>.
133 Note that the space of an C<isl_aff> is that of relation.
134 When replacing a call to C<isl_div_get_coefficient> by a call to
135 C<isl_aff_get_coefficient> any C<isl_dim_set> argument needs
136 to be replaced by C<isl_dim_in>.
137 A call to C<isl_aff_from_div> can be replaced by a call
139 A call to C<isl_qpolynomial_div(div)> call be replaced by
142 isl_qpolynomial_from_aff(isl_aff_floor(div))
144 The function C<isl_constraint_div> has also been renamed
145 to C<isl_constraint_get_div>.
147 =item * The C<nparam> argument has been removed from
148 C<isl_map_read_from_str> and similar functions.
149 When reading input in the original PolyLib format,
150 the result will have no parameters.
151 If parameters are expected, the caller may want to perform
152 dimension manipulation on the result.
156 =head3 Changes since isl-0.09
160 =item * The C<schedule_split_parallel> option has been replaced
161 by the C<schedule_split_scaled> option.
163 =item * The first argument of C<isl_pw_aff_cond> is now
164 an C<isl_pw_aff> instead of an C<isl_set>.
165 A call C<isl_pw_aff_cond(a, b, c)> can be replaced by
167 isl_pw_aff_cond(isl_set_indicator_function(a), b, c)
171 =head3 Changes since isl-0.10
175 =item * The functions C<isl_set_dim_has_lower_bound> and
176 C<isl_set_dim_has_upper_bound> have been renamed to
177 C<isl_set_dim_has_any_lower_bound> and
178 C<isl_set_dim_has_any_upper_bound>.
179 The new C<isl_set_dim_has_lower_bound> and
180 C<isl_set_dim_has_upper_bound> have slightly different meanings.
184 =head3 Changes since isl-0.12
188 =item * C<isl_int> has been replaced by C<isl_val>.
189 Some of the old functions are still available in C<isl/deprecated/*.h>
190 but they will be removed in the future.
192 =item * The functions C<isl_pw_qpolynomial_eval>,
193 C<isl_union_pw_qpolynomial_eval>, C<isl_pw_qpolynomial_fold_eval>
194 and C<isl_union_pw_qpolynomial_fold_eval> have been changed to return
195 an C<isl_val> instead of an C<isl_qpolynomial>.
197 =item * The function C<isl_band_member_is_zero_distance>
198 has been removed. Essentially the same functionality is available
199 through C<isl_band_member_is_coincident>, except that is requires
200 setting up coincidence constraints.
201 The option C<schedule_outer_zero_distance> has accordingly been
202 replaced by the option C<schedule_outer_coincidence>.
204 =item * The function C<isl_vertex_get_expr> has been changed
205 to return an C<isl_multi_aff> instead of a rational C<isl_basic_set>.
206 The function C<isl_vertex_get_domain> has been changed to return
207 a regular basic set, rather than a rational basic set.
211 =head3 Changes since isl-0.14
215 =item * Objects of type C<isl_union_pw_multi_aff> can no longer contain
216 two or more C<isl_pw_multi_aff> objects with the same domain space.
218 =item * The function C<isl_union_pw_multi_aff_add> now consistently
219 computes the sum on the shared definition domain.
220 The function C<isl_union_pw_multi_aff_union_add> has been added
221 to compute the sum on the union of definition domains.
222 The original behavior of C<isl_union_pw_multi_aff_add> was
223 confused and is no longer available.
225 =item * Band forests have been replaced by schedule trees.
227 =item * The function C<isl_union_map_compute_flow> has been
228 replaced by the function C<isl_union_access_info_compute_flow>.
229 Note that the may dependence relation returned by
230 C<isl_union_flow_get_may_dependence> is the union of
231 the two dependence relations returned by
232 C<isl_union_map_compute_flow>. Similarly for the no source relations.
233 The function C<isl_union_map_compute_flow> is still available
234 for backward compatibility, but it will be removed in the future.
236 =item * The function C<isl_basic_set_drop_constraint> has been
239 =item * The function C<isl_ast_build_ast_from_schedule> has been
240 renamed to C<isl_ast_build_node_from_schedule_map>.
241 The original name is still available
242 for backward compatibility, but it will be removed in the future.
244 =item * The C<separation_class> AST generation option has been
251 C<isl> is released under the MIT license.
255 Permission is hereby granted, free of charge, to any person obtaining a copy of
256 this software and associated documentation files (the "Software"), to deal in
257 the Software without restriction, including without limitation the rights to
258 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
259 of the Software, and to permit persons to whom the Software is furnished to do
260 so, subject to the following conditions:
262 The above copyright notice and this permission notice shall be included in all
263 copies or substantial portions of the Software.
265 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
266 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
267 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
268 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
269 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
270 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
275 Note that by default C<isl> requires C<GMP>, which is released
276 under the GNU Lesser General Public License (LGPL). This means
277 that code linked against C<isl> is also linked against LGPL code.
279 When configuring with C<--with-int=imath>, C<isl> will link against C<imath>, a
280 library for exact integer arithmetic released under the MIT license.
284 The source of C<isl> can be obtained either as a tarball
285 or from the git repository. Both are available from
286 L<http://freshmeat.net/projects/isl/>.
287 The installation process depends on how you obtained
290 =head2 Installation from the git repository
294 =item 1 Clone or update the repository
296 The first time the source is obtained, you need to clone
299 git clone git://repo.or.cz/isl.git
301 To obtain updates, you need to pull in the latest changes
305 =item 2 Optionally get C<imath> submodule
307 To build C<isl> with C<imath>, you need to obtain the C<imath>
308 submodule by running in the git source tree of C<isl>
313 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
315 =item 2 Generate C<configure>
321 After performing the above steps, continue
322 with the L<Common installation instructions>.
324 =head2 Common installation instructions
328 =item 1 Obtain C<GMP>
330 By default, building C<isl> requires C<GMP>, including its headers files.
331 Your distribution may not provide these header files by default
332 and you may need to install a package called C<gmp-devel> or something
333 similar. Alternatively, C<GMP> can be built from
334 source, available from L<http://gmplib.org/>.
335 C<GMP> is not needed if you build C<isl> with C<imath>.
339 C<isl> uses the standard C<autoconf> C<configure> script.
344 optionally followed by some configure options.
345 A complete list of options can be obtained by running
349 Below we discuss some of the more common options.
355 Installation prefix for C<isl>
357 =item C<--with-int=[gmp|imath]>
359 Select the integer library to be used by C<isl>, the default is C<gmp>.
360 Note that C<isl> may run significantly slower if you use C<imath>.
362 =item C<--with-gmp-prefix>
364 Installation prefix for C<GMP> (architecture-independent files).
366 =item C<--with-gmp-exec-prefix>
368 Installation prefix for C<GMP> (architecture-dependent files).
376 =item 4 Install (optional)
382 =head1 Integer Set Library
384 =head2 Memory Management
386 Since a high-level operation on isl objects usually involves
387 several substeps and since the user is usually not interested in
388 the intermediate results, most functions that return a new object
389 will also release all the objects passed as arguments.
390 If the user still wants to use one or more of these arguments
391 after the function call, she should pass along a copy of the
392 object rather than the object itself.
393 The user is then responsible for making sure that the original
394 object gets used somewhere else or is explicitly freed.
396 The arguments and return values of all documented functions are
397 annotated to make clear which arguments are released and which
398 arguments are preserved. In particular, the following annotations
405 C<__isl_give> means that a new object is returned.
406 The user should make sure that the returned pointer is
407 used exactly once as a value for an C<__isl_take> argument.
408 In between, it can be used as a value for as many
409 C<__isl_keep> arguments as the user likes.
410 There is one exception, and that is the case where the
411 pointer returned is C<NULL>. Is this case, the user
412 is free to use it as an C<__isl_take> argument or not.
413 When applied to a C<char *>, the returned pointer needs to be
418 C<__isl_null> means that a C<NULL> value is returned.
422 C<__isl_take> means that the object the argument points to
423 is taken over by the function and may no longer be used
424 by the user as an argument to any other function.
425 The pointer value must be one returned by a function
426 returning an C<__isl_give> pointer.
427 If the user passes in a C<NULL> value, then this will
428 be treated as an error in the sense that the function will
429 not perform its usual operation. However, it will still
430 make sure that all the other C<__isl_take> arguments
435 C<__isl_keep> means that the function will only use the object
436 temporarily. After the function has finished, the user
437 can still use it as an argument to other functions.
438 A C<NULL> value will be treated in the same way as
439 a C<NULL> value for an C<__isl_take> argument.
440 This annotation may also be used on return values of
441 type C<const char *>, in which case the returned pointer should
442 not be freed by the user and is only valid until the object
443 from which it was derived is updated or freed.
447 =head2 Initialization
449 All manipulations of integer sets and relations occur within
450 the context of an C<isl_ctx>.
451 A given C<isl_ctx> can only be used within a single thread.
452 All arguments of a function are required to have been allocated
453 within the same context.
454 There are currently no functions available for moving an object
455 from one C<isl_ctx> to another C<isl_ctx>. This means that
456 there is currently no way of safely moving an object from one
457 thread to another, unless the whole C<isl_ctx> is moved.
459 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
460 freed using C<isl_ctx_free>.
461 All objects allocated within an C<isl_ctx> should be freed
462 before the C<isl_ctx> itself is freed.
464 isl_ctx *isl_ctx_alloc();
465 void isl_ctx_free(isl_ctx *ctx);
467 The user can impose a bound on the number of low-level I<operations>
468 that can be performed by an C<isl_ctx>. This bound can be set and
469 retrieved using the following functions. A bound of zero means that
470 no bound is imposed. The number of operations performed can be
471 reset using C<isl_ctx_reset_operations>. Note that the number
472 of low-level operations needed to perform a high-level computation
473 may differ significantly across different versions
474 of C<isl>, but it should be the same across different platforms
475 for the same version of C<isl>.
477 Warning: This feature is experimental. C<isl> has good support to abort and
478 bail out during the computation, but this feature may exercise error code paths
479 that are normally not used that much. Consequently, it is not unlikely that
480 hidden bugs will be exposed.
482 void isl_ctx_set_max_operations(isl_ctx *ctx,
483 unsigned long max_operations);
484 unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
485 void isl_ctx_reset_operations(isl_ctx *ctx);
487 In order to be able to create an object in the same context
488 as another object, most object types (described later in
489 this document) provide a function to obtain the context
490 in which the object was created.
493 isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
494 isl_ctx *isl_multi_val_get_ctx(
495 __isl_keep isl_multi_val *mv);
498 isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
500 #include <isl/local_space.h>
501 isl_ctx *isl_local_space_get_ctx(
502 __isl_keep isl_local_space *ls);
505 isl_ctx *isl_set_list_get_ctx(
506 __isl_keep isl_set_list *list);
509 isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
510 isl_ctx *isl_multi_aff_get_ctx(
511 __isl_keep isl_multi_aff *maff);
512 isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
513 isl_ctx *isl_pw_multi_aff_get_ctx(
514 __isl_keep isl_pw_multi_aff *pma);
515 isl_ctx *isl_multi_pw_aff_get_ctx(
516 __isl_keep isl_multi_pw_aff *mpa);
517 isl_ctx *isl_union_pw_aff_get_ctx(
518 __isl_keep isl_union_pw_aff *upa);
519 isl_ctx *isl_union_pw_multi_aff_get_ctx(
520 __isl_keep isl_union_pw_multi_aff *upma);
521 isl_ctx *isl_multi_union_pw_aff_get_ctx(
522 __isl_keep isl_multi_union_pw_aff *mupa);
524 #include <isl/id_to_ast_expr.h>
525 isl_ctx *isl_id_to_ast_expr_get_ctx(
526 __isl_keep isl_id_to_ast_expr *id2expr);
528 #include <isl/point.h>
529 isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
532 isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
535 isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
537 #include <isl/vertices.h>
538 isl_ctx *isl_vertices_get_ctx(
539 __isl_keep isl_vertices *vertices);
540 isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
541 isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
543 #include <isl/flow.h>
544 isl_ctx *isl_restriction_get_ctx(
545 __isl_keep isl_restriction *restr);
547 #include <isl/schedule.h>
548 isl_ctx *isl_schedule_get_ctx(
549 __isl_keep isl_schedule *sched);
550 isl_ctx *isl_schedule_constraints_get_ctx(
551 __isl_keep isl_schedule_constraints *sc);
553 #include <isl/schedule_node.h>
554 isl_ctx *isl_schedule_node_get_ctx(
555 __isl_keep isl_schedule_node *node);
557 #include <isl/band.h>
558 isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
560 #include <isl/ast_build.h>
561 isl_ctx *isl_ast_build_get_ctx(
562 __isl_keep isl_ast_build *build);
565 isl_ctx *isl_ast_expr_get_ctx(
566 __isl_keep isl_ast_expr *expr);
567 isl_ctx *isl_ast_node_get_ctx(
568 __isl_keep isl_ast_node *node);
572 C<isl> uses two special return types for functions that either return
573 a boolean or that in principle do not return anything.
574 In particular, the C<isl_bool> type has three possible values:
575 C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
576 C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
577 C<isl_bool_error> (a negative integer value), indicating that something
579 The C<isl_stat> type has two possible values:
580 C<isl_stat_ok> (the integer value zero), indicating a successful
582 C<isl_stat_error> (a negative integer value), indicating that something
584 See L</"Error Handling"> for more information on
585 C<isl_bool_error> and C<isl_stat_error>.
589 An C<isl_val> represents an integer value, a rational value
590 or one of three special values, infinity, negative infinity and NaN.
591 Some predefined values can be created using the following functions.
594 __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
595 __isl_give isl_val *isl_val_one(isl_ctx *ctx);
596 __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
597 __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
598 __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
599 __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
601 Specific integer values can be created using the following functions.
604 __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
606 __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
608 __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
609 size_t n, size_t size, const void *chunks);
611 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
612 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
613 The least significant digit is assumed to be stored first.
615 Value objects can be copied and freed using the following functions.
618 __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
619 __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
621 They can be inspected using the following functions.
624 long isl_val_get_num_si(__isl_keep isl_val *v);
625 long isl_val_get_den_si(__isl_keep isl_val *v);
626 double isl_val_get_d(__isl_keep isl_val *v);
627 size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
629 int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
630 size_t size, void *chunks);
632 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
633 of C<size> bytes needed to store the absolute value of the
635 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
636 which is assumed to have been preallocated by the caller.
637 The least significant digit is stored first.
638 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
639 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
640 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
642 An C<isl_val> can be modified using the following function.
645 __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
648 The following unary properties are defined on C<isl_val>s.
651 int isl_val_sgn(__isl_keep isl_val *v);
652 isl_bool isl_val_is_zero(__isl_keep isl_val *v);
653 isl_bool isl_val_is_one(__isl_keep isl_val *v);
654 isl_bool isl_val_is_negone(__isl_keep isl_val *v);
655 isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
656 isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
657 isl_bool isl_val_is_pos(__isl_keep isl_val *v);
658 isl_bool isl_val_is_neg(__isl_keep isl_val *v);
659 isl_bool isl_val_is_int(__isl_keep isl_val *v);
660 isl_bool isl_val_is_rat(__isl_keep isl_val *v);
661 isl_bool isl_val_is_nan(__isl_keep isl_val *v);
662 isl_bool isl_val_is_infty(__isl_keep isl_val *v);
663 isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
665 Note that the sign of NaN is undefined.
667 The following binary properties are defined on pairs of C<isl_val>s.
670 isl_bool isl_val_lt(__isl_keep isl_val *v1,
671 __isl_keep isl_val *v2);
672 isl_bool isl_val_le(__isl_keep isl_val *v1,
673 __isl_keep isl_val *v2);
674 isl_bool isl_val_gt(__isl_keep isl_val *v1,
675 __isl_keep isl_val *v2);
676 isl_bool isl_val_ge(__isl_keep isl_val *v1,
677 __isl_keep isl_val *v2);
678 isl_bool isl_val_eq(__isl_keep isl_val *v1,
679 __isl_keep isl_val *v2);
680 isl_bool isl_val_ne(__isl_keep isl_val *v1,
681 __isl_keep isl_val *v2);
682 isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
683 __isl_keep isl_val *v2);
685 The function C<isl_val_abs_eq> checks whether its two arguments
686 are equal in absolute value.
688 For integer C<isl_val>s we additionally have the following binary property.
691 isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
692 __isl_keep isl_val *v2);
694 An C<isl_val> can also be compared to an integer using the following
695 function. The result is undefined for NaN.
698 int isl_val_cmp_si(__isl_keep isl_val *v, long i);
700 The following unary operations are available on C<isl_val>s.
703 __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
704 __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
705 __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
706 __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
707 __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
708 __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
709 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
711 The following binary operations are available on C<isl_val>s.
714 __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
715 __isl_take isl_val *v2);
716 __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
717 __isl_take isl_val *v2);
718 __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
719 __isl_take isl_val *v2);
720 __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
722 __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
723 __isl_take isl_val *v2);
724 __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
726 __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
727 __isl_take isl_val *v2);
728 __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
730 __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
731 __isl_take isl_val *v2);
733 On integer values, we additionally have the following operations.
736 __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
737 __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
738 __isl_take isl_val *v2);
739 __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
740 __isl_take isl_val *v2);
741 __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
742 __isl_take isl_val *v2, __isl_give isl_val **x,
743 __isl_give isl_val **y);
745 The function C<isl_val_gcdext> returns the greatest common divisor g
746 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
747 that C<*x> * C<v1> + C<*y> * C<v2> = g.
749 =head3 GMP specific functions
751 These functions are only available if C<isl> has been compiled with C<GMP>
754 Specific integer and rational values can be created from C<GMP> values using
755 the following functions.
757 #include <isl/val_gmp.h>
758 __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
760 __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
761 const mpz_t n, const mpz_t d);
763 The numerator and denominator of a rational value can be extracted as
764 C<GMP> values using the following functions.
766 #include <isl/val_gmp.h>
767 int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
768 int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
770 =head2 Sets and Relations
772 C<isl> uses six types of objects for representing sets and relations,
773 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
774 C<isl_union_set> and C<isl_union_map>.
775 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
776 can be described as a conjunction of affine constraints, while
777 C<isl_set> and C<isl_map> represent unions of
778 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
779 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
780 to live in the same space. C<isl_union_set>s and C<isl_union_map>s
781 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
782 where spaces are considered different if they have a different number
783 of dimensions and/or different names (see L<"Spaces">).
784 The difference between sets and relations (maps) is that sets have
785 one set of variables, while relations have two sets of variables,
786 input variables and output variables.
788 =head2 Error Handling
790 C<isl> supports different ways to react in case a runtime error is triggered.
791 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
792 with two maps that have incompatible spaces. There are three possible ways
793 to react on error: to warn, to continue or to abort.
795 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
796 the last error in the corresponding C<isl_ctx> and the function in which the
797 error was triggered returns a value indicating that some error has
798 occurred. In case of functions returning a pointer, this value is
799 C<NULL>. In case of functions returning an C<isl_bool> or an
800 C<isl_stat>, this valus is C<isl_bool_error> or C<isl_stat_error>.
801 An error does not corrupt internal state,
802 such that isl can continue to be used. C<isl> also provides functions to
803 read the last error and to reset the memory that stores the last error. The
804 last error is only stored for information purposes. Its presence does not
805 change the behavior of C<isl>. Hence, resetting an error is not required to
806 continue to use isl, but only to observe new errors.
809 enum isl_error isl_ctx_last_error(isl_ctx *ctx);
810 void isl_ctx_reset_error(isl_ctx *ctx);
812 Another option is to continue on error. This is similar to warn on error mode,
813 except that C<isl> does not print any warning. This allows a program to
814 implement its own error reporting.
816 The last option is to directly abort the execution of the program from within
817 the isl library. This makes it obviously impossible to recover from an error,
818 but it allows to directly spot the error location. By aborting on error,
819 debuggers break at the location the error occurred and can provide a stack
820 trace. Other tools that automatically provide stack traces on abort or that do
821 not want to continue execution after an error was triggered may also prefer to
824 The on error behavior of isl can be specified by calling
825 C<isl_options_set_on_error> or by setting the command line option
826 C<--isl-on-error>. Valid arguments for the function call are
827 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
828 choices for the command line option are C<warn>, C<continue> and C<abort>.
829 It is also possible to query the current error mode.
831 #include <isl/options.h>
832 isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
833 int isl_options_get_on_error(isl_ctx *ctx);
837 Identifiers are used to identify both individual dimensions
838 and tuples of dimensions. They consist of an optional name and an optional
839 user pointer. The name and the user pointer cannot both be C<NULL>, however.
840 Identifiers with the same name but different pointer values
841 are considered to be distinct.
842 Similarly, identifiers with different names but the same pointer value
843 are also considered to be distinct.
844 Equal identifiers are represented using the same object.
845 Pairs of identifiers can therefore be tested for equality using the
847 Identifiers can be constructed, copied, freed, inspected and printed
848 using the following functions.
851 __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
852 __isl_keep const char *name, void *user);
853 __isl_give isl_id *isl_id_set_free_user(
854 __isl_take isl_id *id,
855 __isl_give void (*free_user)(void *user));
856 __isl_give isl_id *isl_id_copy(isl_id *id);
857 __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
859 void *isl_id_get_user(__isl_keep isl_id *id);
860 __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
862 __isl_give isl_printer *isl_printer_print_id(
863 __isl_take isl_printer *p, __isl_keep isl_id *id);
865 The callback set by C<isl_id_set_free_user> is called on the user
866 pointer when the last reference to the C<isl_id> is freed.
867 Note that C<isl_id_get_name> returns a pointer to some internal
868 data structure, so the result can only be used while the
869 corresponding C<isl_id> is alive.
873 Whenever a new set, relation or similar object is created from scratch,
874 the space in which it lives needs to be specified using an C<isl_space>.
875 Each space involves zero or more parameters and zero, one or two
876 tuples of set or input/output dimensions. The parameters and dimensions
877 are identified by an C<isl_dim_type> and a position.
878 The type C<isl_dim_param> refers to parameters,
879 the type C<isl_dim_set> refers to set dimensions (for spaces
880 with a single tuple of dimensions) and the types C<isl_dim_in>
881 and C<isl_dim_out> refer to input and output dimensions
882 (for spaces with two tuples of dimensions).
883 Local spaces (see L</"Local Spaces">) also contain dimensions
884 of type C<isl_dim_div>.
885 Note that parameters are only identified by their position within
886 a given object. Across different objects, parameters are (usually)
887 identified by their names or identifiers. Only unnamed parameters
888 are identified by their positions across objects. The use of unnamed
889 parameters is discouraged.
891 #include <isl/space.h>
892 __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
893 unsigned nparam, unsigned n_in, unsigned n_out);
894 __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
896 __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
897 unsigned nparam, unsigned dim);
898 __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
899 __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
901 The space used for creating a parameter domain
902 needs to be created using C<isl_space_params_alloc>.
903 For other sets, the space
904 needs to be created using C<isl_space_set_alloc>, while
905 for a relation, the space
906 needs to be created using C<isl_space_alloc>.
908 To check whether a given space is that of a set or a map
909 or whether it is a parameter space, use these functions:
911 #include <isl/space.h>
912 isl_bool isl_space_is_params(__isl_keep isl_space *space);
913 isl_bool isl_space_is_set(__isl_keep isl_space *space);
914 isl_bool isl_space_is_map(__isl_keep isl_space *space);
916 Spaces can be compared using the following functions:
918 #include <isl/space.h>
919 isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
920 __isl_keep isl_space *space2);
921 isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
922 __isl_keep isl_space *space2);
923 isl_bool isl_space_is_range(__isl_keep isl_space *space1,
924 __isl_keep isl_space *space2);
925 isl_bool isl_space_tuple_is_equal(
926 __isl_keep isl_space *space1,
927 enum isl_dim_type type1,
928 __isl_keep isl_space *space2,
929 enum isl_dim_type type2);
931 C<isl_space_is_domain> checks whether the first argument is equal
932 to the domain of the second argument. This requires in particular that
933 the first argument is a set space and that the second argument
934 is a map space. C<isl_space_tuple_is_equal> checks whether the given
935 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
936 spaces are the same. That is, it checks if they have the same
937 identifier (if any), the same dimension and the same internal structure
940 It is often useful to create objects that live in the
941 same space as some other object. This can be accomplished
942 by creating the new objects
943 (see L</"Creating New Sets and Relations"> or
944 L</"Functions">) based on the space
945 of the original object.
948 __isl_give isl_space *isl_basic_set_get_space(
949 __isl_keep isl_basic_set *bset);
950 __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
952 #include <isl/union_set.h>
953 __isl_give isl_space *isl_union_set_get_space(
954 __isl_keep isl_union_set *uset);
957 __isl_give isl_space *isl_basic_map_get_space(
958 __isl_keep isl_basic_map *bmap);
959 __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
961 #include <isl/union_map.h>
962 __isl_give isl_space *isl_union_map_get_space(
963 __isl_keep isl_union_map *umap);
965 #include <isl/constraint.h>
966 __isl_give isl_space *isl_constraint_get_space(
967 __isl_keep isl_constraint *constraint);
969 #include <isl/polynomial.h>
970 __isl_give isl_space *isl_qpolynomial_get_domain_space(
971 __isl_keep isl_qpolynomial *qp);
972 __isl_give isl_space *isl_qpolynomial_get_space(
973 __isl_keep isl_qpolynomial *qp);
974 __isl_give isl_space *isl_qpolynomial_fold_get_space(
975 __isl_keep isl_qpolynomial_fold *fold);
976 __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
977 __isl_keep isl_pw_qpolynomial *pwqp);
978 __isl_give isl_space *isl_pw_qpolynomial_get_space(
979 __isl_keep isl_pw_qpolynomial *pwqp);
980 __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
981 __isl_keep isl_pw_qpolynomial_fold *pwf);
982 __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
983 __isl_keep isl_pw_qpolynomial_fold *pwf);
984 __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
985 __isl_keep isl_union_pw_qpolynomial *upwqp);
986 __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
987 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
990 __isl_give isl_space *isl_multi_val_get_space(
991 __isl_keep isl_multi_val *mv);
994 __isl_give isl_space *isl_aff_get_domain_space(
995 __isl_keep isl_aff *aff);
996 __isl_give isl_space *isl_aff_get_space(
997 __isl_keep isl_aff *aff);
998 __isl_give isl_space *isl_pw_aff_get_domain_space(
999 __isl_keep isl_pw_aff *pwaff);
1000 __isl_give isl_space *isl_pw_aff_get_space(
1001 __isl_keep isl_pw_aff *pwaff);
1002 __isl_give isl_space *isl_multi_aff_get_domain_space(
1003 __isl_keep isl_multi_aff *maff);
1004 __isl_give isl_space *isl_multi_aff_get_space(
1005 __isl_keep isl_multi_aff *maff);
1006 __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1007 __isl_keep isl_pw_multi_aff *pma);
1008 __isl_give isl_space *isl_pw_multi_aff_get_space(
1009 __isl_keep isl_pw_multi_aff *pma);
1010 __isl_give isl_space *isl_union_pw_aff_get_space(
1011 __isl_keep isl_union_pw_aff *upa);
1012 __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1013 __isl_keep isl_union_pw_multi_aff *upma);
1014 __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1015 __isl_keep isl_multi_pw_aff *mpa);
1016 __isl_give isl_space *isl_multi_pw_aff_get_space(
1017 __isl_keep isl_multi_pw_aff *mpa);
1018 __isl_give isl_space *
1019 isl_multi_union_pw_aff_get_domain_space(
1020 __isl_keep isl_multi_union_pw_aff *mupa);
1021 __isl_give isl_space *
1022 isl_multi_union_pw_aff_get_space(
1023 __isl_keep isl_multi_union_pw_aff *mupa);
1025 #include <isl/point.h>
1026 __isl_give isl_space *isl_point_get_space(
1027 __isl_keep isl_point *pnt);
1029 The number of dimensions of a given type of space
1030 may be read off from a space or an object that lives
1031 in a space using the following functions.
1032 In case of C<isl_space_dim>, type may be
1033 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1034 C<isl_dim_out> (only for relations), C<isl_dim_set>
1035 (only for sets) or C<isl_dim_all>.
1037 #include <isl/space.h>
1038 unsigned isl_space_dim(__isl_keep isl_space *space,
1039 enum isl_dim_type type);
1041 #include <isl/local_space.h>
1042 int isl_local_space_dim(__isl_keep isl_local_space *ls,
1043 enum isl_dim_type type);
1045 #include <isl/set.h>
1046 unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1047 enum isl_dim_type type);
1048 unsigned isl_set_dim(__isl_keep isl_set *set,
1049 enum isl_dim_type type);
1051 #include <isl/union_set.h>
1052 unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1053 enum isl_dim_type type);
1055 #include <isl/map.h>
1056 unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1057 enum isl_dim_type type);
1058 unsigned isl_map_dim(__isl_keep isl_map *map,
1059 enum isl_dim_type type);
1061 #include <isl/union_map.h>
1062 unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1063 enum isl_dim_type type);
1065 #include <isl/val.h>
1066 unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1067 enum isl_dim_type type);
1069 #include <isl/aff.h>
1070 int isl_aff_dim(__isl_keep isl_aff *aff,
1071 enum isl_dim_type type);
1072 unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1073 enum isl_dim_type type);
1074 unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1075 enum isl_dim_type type);
1076 unsigned isl_pw_multi_aff_dim(
1077 __isl_keep isl_pw_multi_aff *pma,
1078 enum isl_dim_type type);
1079 unsigned isl_multi_pw_aff_dim(
1080 __isl_keep isl_multi_pw_aff *mpa,
1081 enum isl_dim_type type);
1082 unsigned isl_union_pw_aff_dim(
1083 __isl_keep isl_union_pw_aff *upa,
1084 enum isl_dim_type type);
1085 unsigned isl_union_pw_multi_aff_dim(
1086 __isl_keep isl_union_pw_multi_aff *upma,
1087 enum isl_dim_type type);
1088 unsigned isl_multi_union_pw_aff_dim(
1089 __isl_keep isl_multi_union_pw_aff *mupa,
1090 enum isl_dim_type type);
1092 #include <isl/polynomial.h>
1093 unsigned isl_union_pw_qpolynomial_dim(
1094 __isl_keep isl_union_pw_qpolynomial *upwqp,
1095 enum isl_dim_type type);
1096 unsigned isl_union_pw_qpolynomial_fold_dim(
1097 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1098 enum isl_dim_type type);
1100 Note that an C<isl_union_set>, an C<isl_union_map>,
1101 an C<isl_union_pw_multi_aff>,
1102 an C<isl_union_pw_qpolynomial> and
1103 an C<isl_union_pw_qpolynomial_fold>
1104 only have parameters.
1106 The identifiers or names of the individual dimensions of spaces
1107 may be set or read off using the following functions on spaces
1108 or objects that live in spaces.
1109 These functions are mostly useful to obtain the identifiers, positions
1110 or names of the parameters. Identifiers of individual dimensions are
1111 essentially only useful for printing. They are ignored by all other
1112 operations and may not be preserved across those operations.
1114 #include <isl/space.h>
1115 __isl_give isl_space *isl_space_set_dim_id(
1116 __isl_take isl_space *space,
1117 enum isl_dim_type type, unsigned pos,
1118 __isl_take isl_id *id);
1119 isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1120 enum isl_dim_type type, unsigned pos);
1121 __isl_give isl_id *isl_space_get_dim_id(
1122 __isl_keep isl_space *space,
1123 enum isl_dim_type type, unsigned pos);
1124 __isl_give isl_space *isl_space_set_dim_name(
1125 __isl_take isl_space *space,
1126 enum isl_dim_type type, unsigned pos,
1127 __isl_keep const char *name);
1128 isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1129 enum isl_dim_type type, unsigned pos);
1130 __isl_keep const char *isl_space_get_dim_name(
1131 __isl_keep isl_space *space,
1132 enum isl_dim_type type, unsigned pos);
1134 #include <isl/local_space.h>
1135 __isl_give isl_local_space *isl_local_space_set_dim_id(
1136 __isl_take isl_local_space *ls,
1137 enum isl_dim_type type, unsigned pos,
1138 __isl_take isl_id *id);
1139 isl_bool isl_local_space_has_dim_id(
1140 __isl_keep isl_local_space *ls,
1141 enum isl_dim_type type, unsigned pos);
1142 __isl_give isl_id *isl_local_space_get_dim_id(
1143 __isl_keep isl_local_space *ls,
1144 enum isl_dim_type type, unsigned pos);
1145 __isl_give isl_local_space *isl_local_space_set_dim_name(
1146 __isl_take isl_local_space *ls,
1147 enum isl_dim_type type, unsigned pos, const char *s);
1148 isl_bool isl_local_space_has_dim_name(
1149 __isl_keep isl_local_space *ls,
1150 enum isl_dim_type type, unsigned pos)
1151 const char *isl_local_space_get_dim_name(
1152 __isl_keep isl_local_space *ls,
1153 enum isl_dim_type type, unsigned pos);
1155 #include <isl/constraint.h>
1156 const char *isl_constraint_get_dim_name(
1157 __isl_keep isl_constraint *constraint,
1158 enum isl_dim_type type, unsigned pos);
1160 #include <isl/set.h>
1161 __isl_give isl_id *isl_basic_set_get_dim_id(
1162 __isl_keep isl_basic_set *bset,
1163 enum isl_dim_type type, unsigned pos);
1164 __isl_give isl_set *isl_set_set_dim_id(
1165 __isl_take isl_set *set, enum isl_dim_type type,
1166 unsigned pos, __isl_take isl_id *id);
1167 isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1168 enum isl_dim_type type, unsigned pos);
1169 __isl_give isl_id *isl_set_get_dim_id(
1170 __isl_keep isl_set *set, enum isl_dim_type type,
1172 const char *isl_basic_set_get_dim_name(
1173 __isl_keep isl_basic_set *bset,
1174 enum isl_dim_type type, unsigned pos);
1175 isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1176 enum isl_dim_type type, unsigned pos);
1177 const char *isl_set_get_dim_name(
1178 __isl_keep isl_set *set,
1179 enum isl_dim_type type, unsigned pos);
1181 #include <isl/map.h>
1182 __isl_give isl_map *isl_map_set_dim_id(
1183 __isl_take isl_map *map, enum isl_dim_type type,
1184 unsigned pos, __isl_take isl_id *id);
1185 isl_bool isl_basic_map_has_dim_id(
1186 __isl_keep isl_basic_map *bmap,
1187 enum isl_dim_type type, unsigned pos);
1188 isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1189 enum isl_dim_type type, unsigned pos);
1190 __isl_give isl_id *isl_map_get_dim_id(
1191 __isl_keep isl_map *map, enum isl_dim_type type,
1193 __isl_give isl_id *isl_union_map_get_dim_id(
1194 __isl_keep isl_union_map *umap,
1195 enum isl_dim_type type, unsigned pos);
1196 const char *isl_basic_map_get_dim_name(
1197 __isl_keep isl_basic_map *bmap,
1198 enum isl_dim_type type, unsigned pos);
1199 isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1200 enum isl_dim_type type, unsigned pos);
1201 const char *isl_map_get_dim_name(
1202 __isl_keep isl_map *map,
1203 enum isl_dim_type type, unsigned pos);
1205 #include <isl/val.h>
1206 __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1207 __isl_take isl_multi_val *mv,
1208 enum isl_dim_type type, unsigned pos,
1209 __isl_take isl_id *id);
1210 __isl_give isl_id *isl_multi_val_get_dim_id(
1211 __isl_keep isl_multi_val *mv,
1212 enum isl_dim_type type, unsigned pos);
1213 __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1214 __isl_take isl_multi_val *mv,
1215 enum isl_dim_type type, unsigned pos, const char *s);
1217 #include <isl/aff.h>
1218 __isl_give isl_aff *isl_aff_set_dim_id(
1219 __isl_take isl_aff *aff, enum isl_dim_type type,
1220 unsigned pos, __isl_take isl_id *id);
1221 __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1222 __isl_take isl_multi_aff *maff,
1223 enum isl_dim_type type, unsigned pos,
1224 __isl_take isl_id *id);
1225 __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1226 __isl_take isl_pw_aff *pma,
1227 enum isl_dim_type type, unsigned pos,
1228 __isl_take isl_id *id);
1229 __isl_give isl_multi_pw_aff *
1230 isl_multi_pw_aff_set_dim_id(
1231 __isl_take isl_multi_pw_aff *mpa,
1232 enum isl_dim_type type, unsigned pos,
1233 __isl_take isl_id *id);
1234 __isl_give isl_multi_union_pw_aff *
1235 isl_multi_union_pw_aff_set_dim_id(
1236 __isl_take isl_multi_union_pw_aff *mupa,
1237 enum isl_dim_type type, unsigned pos,
1238 __isl_take isl_id *id);
1239 __isl_give isl_id *isl_multi_aff_get_dim_id(
1240 __isl_keep isl_multi_aff *ma,
1241 enum isl_dim_type type, unsigned pos);
1242 isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1243 enum isl_dim_type type, unsigned pos);
1244 __isl_give isl_id *isl_pw_aff_get_dim_id(
1245 __isl_keep isl_pw_aff *pa,
1246 enum isl_dim_type type, unsigned pos);
1247 __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1248 __isl_keep isl_pw_multi_aff *pma,
1249 enum isl_dim_type type, unsigned pos);
1250 __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1251 __isl_keep isl_multi_pw_aff *mpa,
1252 enum isl_dim_type type, unsigned pos);
1253 __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1254 __isl_keep isl_multi_union_pw_aff *mupa,
1255 enum isl_dim_type type, unsigned pos);
1256 __isl_give isl_aff *isl_aff_set_dim_name(
1257 __isl_take isl_aff *aff, enum isl_dim_type type,
1258 unsigned pos, const char *s);
1259 __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1260 __isl_take isl_multi_aff *maff,
1261 enum isl_dim_type type, unsigned pos, const char *s);
1262 __isl_give isl_multi_pw_aff *
1263 isl_multi_pw_aff_set_dim_name(
1264 __isl_take isl_multi_pw_aff *mpa,
1265 enum isl_dim_type type, unsigned pos, const char *s);
1266 __isl_give isl_union_pw_aff *
1267 isl_union_pw_aff_set_dim_name(
1268 __isl_take isl_union_pw_aff *upa,
1269 enum isl_dim_type type, unsigned pos,
1271 __isl_give isl_union_pw_multi_aff *
1272 isl_union_pw_multi_aff_set_dim_name(
1273 __isl_take isl_union_pw_multi_aff *upma,
1274 enum isl_dim_type type, unsigned pos,
1276 __isl_give isl_multi_union_pw_aff *
1277 isl_multi_union_pw_aff_set_dim_name(
1278 __isl_take isl_multi_union_pw_aff *mupa,
1279 enum isl_dim_type type, unsigned pos,
1280 const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1281 enum isl_dim_type type, unsigned pos);
1282 const char *isl_pw_aff_get_dim_name(
1283 __isl_keep isl_pw_aff *pa,
1284 enum isl_dim_type type, unsigned pos);
1285 const char *isl_pw_multi_aff_get_dim_name(
1286 __isl_keep isl_pw_multi_aff *pma,
1287 enum isl_dim_type type, unsigned pos);
1289 #include <isl/polynomial.h>
1290 __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1291 __isl_take isl_qpolynomial *qp,
1292 enum isl_dim_type type, unsigned pos,
1294 __isl_give isl_pw_qpolynomial *
1295 isl_pw_qpolynomial_set_dim_name(
1296 __isl_take isl_pw_qpolynomial *pwqp,
1297 enum isl_dim_type type, unsigned pos,
1299 __isl_give isl_pw_qpolynomial_fold *
1300 isl_pw_qpolynomial_fold_set_dim_name(
1301 __isl_take isl_pw_qpolynomial_fold *pwf,
1302 enum isl_dim_type type, unsigned pos,
1304 __isl_give isl_union_pw_qpolynomial *
1305 isl_union_pw_qpolynomial_set_dim_name(
1306 __isl_take isl_union_pw_qpolynomial *upwqp,
1307 enum isl_dim_type type, unsigned pos,
1309 __isl_give isl_union_pw_qpolynomial_fold *
1310 isl_union_pw_qpolynomial_fold_set_dim_name(
1311 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1312 enum isl_dim_type type, unsigned pos,
1315 Note that C<isl_space_get_name> returns a pointer to some internal
1316 data structure, so the result can only be used while the
1317 corresponding C<isl_space> is alive.
1318 Also note that every function that operates on two sets or relations
1319 requires that both arguments have the same parameters. This also
1320 means that if one of the arguments has named parameters, then the
1321 other needs to have named parameters too and the names need to match.
1322 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1323 arguments may have different parameters (as long as they are named),
1324 in which case the result will have as parameters the union of the parameters of
1327 Given the identifier or name of a dimension (typically a parameter),
1328 its position can be obtained from the following functions.
1330 #include <isl/space.h>
1331 int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1332 enum isl_dim_type type, __isl_keep isl_id *id);
1333 int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1334 enum isl_dim_type type, const char *name);
1336 #include <isl/local_space.h>
1337 int isl_local_space_find_dim_by_name(
1338 __isl_keep isl_local_space *ls,
1339 enum isl_dim_type type, const char *name);
1341 #include <isl/val.h>
1342 int isl_multi_val_find_dim_by_id(
1343 __isl_keep isl_multi_val *mv,
1344 enum isl_dim_type type, __isl_keep isl_id *id);
1345 int isl_multi_val_find_dim_by_name(
1346 __isl_keep isl_multi_val *mv,
1347 enum isl_dim_type type, const char *name);
1349 #include <isl/set.h>
1350 int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1351 enum isl_dim_type type, __isl_keep isl_id *id);
1352 int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1353 enum isl_dim_type type, const char *name);
1355 #include <isl/map.h>
1356 int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1357 enum isl_dim_type type, __isl_keep isl_id *id);
1358 int isl_basic_map_find_dim_by_name(
1359 __isl_keep isl_basic_map *bmap,
1360 enum isl_dim_type type, const char *name);
1361 int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1362 enum isl_dim_type type, const char *name);
1363 int isl_union_map_find_dim_by_name(
1364 __isl_keep isl_union_map *umap,
1365 enum isl_dim_type type, const char *name);
1367 #include <isl/aff.h>
1368 int isl_multi_aff_find_dim_by_id(
1369 __isl_keep isl_multi_aff *ma,
1370 enum isl_dim_type type, __isl_keep isl_id *id);
1371 int isl_multi_pw_aff_find_dim_by_id(
1372 __isl_keep isl_multi_pw_aff *mpa,
1373 enum isl_dim_type type, __isl_keep isl_id *id);
1374 int isl_multi_union_pw_aff_find_dim_by_id(
1375 __isl_keep isl_union_multi_pw_aff *mupa,
1376 enum isl_dim_type type, __isl_keep isl_id *id);
1377 int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1378 enum isl_dim_type type, const char *name);
1379 int isl_multi_aff_find_dim_by_name(
1380 __isl_keep isl_multi_aff *ma,
1381 enum isl_dim_type type, const char *name);
1382 int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1383 enum isl_dim_type type, const char *name);
1384 int isl_multi_pw_aff_find_dim_by_name(
1385 __isl_keep isl_multi_pw_aff *mpa,
1386 enum isl_dim_type type, const char *name);
1387 int isl_pw_multi_aff_find_dim_by_name(
1388 __isl_keep isl_pw_multi_aff *pma,
1389 enum isl_dim_type type, const char *name);
1390 int isl_union_pw_aff_find_dim_by_name(
1391 __isl_keep isl_union_pw_aff *upa,
1392 enum isl_dim_type type, const char *name);
1393 int isl_union_pw_multi_aff_find_dim_by_name(
1394 __isl_keep isl_union_pw_multi_aff *upma,
1395 enum isl_dim_type type, const char *name);
1396 int isl_multi_union_pw_aff_find_dim_by_name(
1397 __isl_keep isl_multi_union_pw_aff *mupa,
1398 enum isl_dim_type type, const char *name);
1400 #include <isl/polynomial.h>
1401 int isl_pw_qpolynomial_find_dim_by_name(
1402 __isl_keep isl_pw_qpolynomial *pwqp,
1403 enum isl_dim_type type, const char *name);
1404 int isl_pw_qpolynomial_fold_find_dim_by_name(
1405 __isl_keep isl_pw_qpolynomial_fold *pwf,
1406 enum isl_dim_type type, const char *name);
1407 int isl_union_pw_qpolynomial_find_dim_by_name(
1408 __isl_keep isl_union_pw_qpolynomial *upwqp,
1409 enum isl_dim_type type, const char *name);
1410 int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1411 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1412 enum isl_dim_type type, const char *name);
1414 The identifiers or names of entire spaces may be set or read off
1415 using the following functions.
1417 #include <isl/space.h>
1418 __isl_give isl_space *isl_space_set_tuple_id(
1419 __isl_take isl_space *space,
1420 enum isl_dim_type type, __isl_take isl_id *id);
1421 __isl_give isl_space *isl_space_reset_tuple_id(
1422 __isl_take isl_space *space, enum isl_dim_type type);
1423 isl_bool isl_space_has_tuple_id(
1424 __isl_keep isl_space *space,
1425 enum isl_dim_type type);
1426 __isl_give isl_id *isl_space_get_tuple_id(
1427 __isl_keep isl_space *space, enum isl_dim_type type);
1428 __isl_give isl_space *isl_space_set_tuple_name(
1429 __isl_take isl_space *space,
1430 enum isl_dim_type type, const char *s);
1431 isl_bool isl_space_has_tuple_name(
1432 __isl_keep isl_space *space,
1433 enum isl_dim_type type);
1434 const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1435 enum isl_dim_type type);
1437 #include <isl/local_space.h>
1438 __isl_give isl_local_space *isl_local_space_set_tuple_id(
1439 __isl_take isl_local_space *ls,
1440 enum isl_dim_type type, __isl_take isl_id *id);
1442 #include <isl/set.h>
1443 __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1444 __isl_take isl_basic_set *bset,
1445 __isl_take isl_id *id);
1446 __isl_give isl_set *isl_set_set_tuple_id(
1447 __isl_take isl_set *set, __isl_take isl_id *id);
1448 __isl_give isl_set *isl_set_reset_tuple_id(
1449 __isl_take isl_set *set);
1450 isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1451 __isl_give isl_id *isl_set_get_tuple_id(
1452 __isl_keep isl_set *set);
1453 __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1454 __isl_take isl_basic_set *set, const char *s);
1455 __isl_give isl_set *isl_set_set_tuple_name(
1456 __isl_take isl_set *set, const char *s);
1457 const char *isl_basic_set_get_tuple_name(
1458 __isl_keep isl_basic_set *bset);
1459 isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1460 const char *isl_set_get_tuple_name(
1461 __isl_keep isl_set *set);
1463 #include <isl/map.h>
1464 __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1465 __isl_take isl_basic_map *bmap,
1466 enum isl_dim_type type, __isl_take isl_id *id);
1467 __isl_give isl_map *isl_map_set_tuple_id(
1468 __isl_take isl_map *map, enum isl_dim_type type,
1469 __isl_take isl_id *id);
1470 __isl_give isl_map *isl_map_reset_tuple_id(
1471 __isl_take isl_map *map, enum isl_dim_type type);
1472 isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1473 enum isl_dim_type type);
1474 __isl_give isl_id *isl_map_get_tuple_id(
1475 __isl_keep isl_map *map, enum isl_dim_type type);
1476 __isl_give isl_map *isl_map_set_tuple_name(
1477 __isl_take isl_map *map,
1478 enum isl_dim_type type, const char *s);
1479 const char *isl_basic_map_get_tuple_name(
1480 __isl_keep isl_basic_map *bmap,
1481 enum isl_dim_type type);
1482 __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1483 __isl_take isl_basic_map *bmap,
1484 enum isl_dim_type type, const char *s);
1485 isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1486 enum isl_dim_type type);
1487 const char *isl_map_get_tuple_name(
1488 __isl_keep isl_map *map,
1489 enum isl_dim_type type);
1491 #include <isl/val.h>
1492 __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1493 __isl_take isl_multi_val *mv,
1494 enum isl_dim_type type, __isl_take isl_id *id);
1495 __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1496 __isl_take isl_multi_val *mv,
1497 enum isl_dim_type type);
1498 isl_bool isl_multi_val_has_tuple_id(
1499 __isl_keep isl_multi_val *mv,
1500 enum isl_dim_type type);
1501 __isl_give isl_id *isl_multi_val_get_tuple_id(
1502 __isl_keep isl_multi_val *mv,
1503 enum isl_dim_type type);
1504 __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1505 __isl_take isl_multi_val *mv,
1506 enum isl_dim_type type, const char *s);
1507 const char *isl_multi_val_get_tuple_name(
1508 __isl_keep isl_multi_val *mv,
1509 enum isl_dim_type type);
1511 #include <isl/aff.h>
1512 __isl_give isl_aff *isl_aff_set_tuple_id(
1513 __isl_take isl_aff *aff,
1514 enum isl_dim_type type, __isl_take isl_id *id);
1515 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1516 __isl_take isl_multi_aff *maff,
1517 enum isl_dim_type type, __isl_take isl_id *id);
1518 __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1519 __isl_take isl_pw_aff *pwaff,
1520 enum isl_dim_type type, __isl_take isl_id *id);
1521 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1522 __isl_take isl_pw_multi_aff *pma,
1523 enum isl_dim_type type, __isl_take isl_id *id);
1524 __isl_give isl_multi_union_pw_aff *
1525 isl_multi_union_pw_aff_set_tuple_id(
1526 __isl_take isl_multi_union_pw_aff *mupa,
1527 enum isl_dim_type type, __isl_take isl_id *id);
1528 __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1529 __isl_take isl_multi_aff *ma,
1530 enum isl_dim_type type);
1531 __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1532 __isl_take isl_pw_aff *pa,
1533 enum isl_dim_type type);
1534 __isl_give isl_multi_pw_aff *
1535 isl_multi_pw_aff_reset_tuple_id(
1536 __isl_take isl_multi_pw_aff *mpa,
1537 enum isl_dim_type type);
1538 __isl_give isl_pw_multi_aff *
1539 isl_pw_multi_aff_reset_tuple_id(
1540 __isl_take isl_pw_multi_aff *pma,
1541 enum isl_dim_type type);
1542 __isl_give isl_multi_union_pw_aff *
1543 isl_multi_union_pw_aff_reset_tuple_id(
1544 __isl_take isl_multi_union_pw_aff *mupa,
1545 enum isl_dim_type type);
1546 isl_bool isl_multi_aff_has_tuple_id(
1547 __isl_keep isl_multi_aff *ma,
1548 enum isl_dim_type type);
1549 __isl_give isl_id *isl_multi_aff_get_tuple_id(
1550 __isl_keep isl_multi_aff *ma,
1551 enum isl_dim_type type);
1552 isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1553 enum isl_dim_type type);
1554 __isl_give isl_id *isl_pw_aff_get_tuple_id(
1555 __isl_keep isl_pw_aff *pa,
1556 enum isl_dim_type type);
1557 isl_bool isl_pw_multi_aff_has_tuple_id(
1558 __isl_keep isl_pw_multi_aff *pma,
1559 enum isl_dim_type type);
1560 __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1561 __isl_keep isl_pw_multi_aff *pma,
1562 enum isl_dim_type type);
1563 isl_bool isl_multi_pw_aff_has_tuple_id(
1564 __isl_keep isl_multi_pw_aff *mpa,
1565 enum isl_dim_type type);
1566 __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1567 __isl_keep isl_multi_pw_aff *mpa,
1568 enum isl_dim_type type);
1569 isl_bool isl_multi_union_pw_aff_has_tuple_id(
1570 __isl_keep isl_multi_union_pw_aff *mupa,
1571 enum isl_dim_type type);
1572 __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1573 __isl_keep isl_multi_union_pw_aff *mupa,
1574 enum isl_dim_type type);
1575 __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1576 __isl_take isl_multi_aff *maff,
1577 enum isl_dim_type type, const char *s);
1578 __isl_give isl_multi_pw_aff *
1579 isl_multi_pw_aff_set_tuple_name(
1580 __isl_take isl_multi_pw_aff *mpa,
1581 enum isl_dim_type type, const char *s);
1582 __isl_give isl_multi_union_pw_aff *
1583 isl_multi_union_pw_aff_set_tuple_name(
1584 __isl_take isl_multi_union_pw_aff *mupa,
1585 enum isl_dim_type type, const char *s);
1586 const char *isl_multi_aff_get_tuple_name(
1587 __isl_keep isl_multi_aff *multi,
1588 enum isl_dim_type type);
1589 isl_bool isl_pw_multi_aff_has_tuple_name(
1590 __isl_keep isl_pw_multi_aff *pma,
1591 enum isl_dim_type type);
1592 const char *isl_pw_multi_aff_get_tuple_name(
1593 __isl_keep isl_pw_multi_aff *pma,
1594 enum isl_dim_type type);
1595 const char *isl_multi_union_pw_aff_get_tuple_name(
1596 __isl_keep isl_multi_union_pw_aff *mupa,
1597 enum isl_dim_type type);
1599 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1600 or C<isl_dim_set>. As with C<isl_space_get_name>,
1601 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1603 Binary operations require the corresponding spaces of their arguments
1604 to have the same name.
1606 To keep the names of all parameters and tuples, but reset the user pointers
1607 of all the corresponding identifiers, use the following function.
1609 #include <isl/space.h>
1610 __isl_give isl_space *isl_space_reset_user(
1611 __isl_take isl_space *space);
1613 #include <isl/set.h>
1614 __isl_give isl_set *isl_set_reset_user(
1615 __isl_take isl_set *set);
1617 #include <isl/map.h>
1618 __isl_give isl_map *isl_map_reset_user(
1619 __isl_take isl_map *map);
1621 #include <isl/union_set.h>
1622 __isl_give isl_union_set *isl_union_set_reset_user(
1623 __isl_take isl_union_set *uset);
1625 #include <isl/union_map.h>
1626 __isl_give isl_union_map *isl_union_map_reset_user(
1627 __isl_take isl_union_map *umap);
1629 #include <isl/val.h>
1630 __isl_give isl_multi_val *isl_multi_val_reset_user(
1631 __isl_take isl_multi_val *mv);
1633 #include <isl/aff.h>
1634 __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1635 __isl_take isl_multi_aff *ma);
1636 __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1637 __isl_take isl_pw_aff *pa);
1638 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1639 __isl_take isl_multi_pw_aff *mpa);
1640 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1641 __isl_take isl_pw_multi_aff *pma);
1642 __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1643 __isl_take isl_union_pw_aff *upa);
1644 __isl_give isl_multi_union_pw_aff *
1645 isl_multi_union_pw_aff_reset_user(
1646 __isl_take isl_multi_union_pw_aff *mupa);
1647 __isl_give isl_union_pw_multi_aff *
1648 isl_union_pw_multi_aff_reset_user(
1649 __isl_take isl_union_pw_multi_aff *upma);
1651 #include <isl/polynomial.h>
1652 __isl_give isl_pw_qpolynomial *
1653 isl_pw_qpolynomial_reset_user(
1654 __isl_take isl_pw_qpolynomial *pwqp);
1655 __isl_give isl_union_pw_qpolynomial *
1656 isl_union_pw_qpolynomial_reset_user(
1657 __isl_take isl_union_pw_qpolynomial *upwqp);
1658 __isl_give isl_pw_qpolynomial_fold *
1659 isl_pw_qpolynomial_fold_reset_user(
1660 __isl_take isl_pw_qpolynomial_fold *pwf);
1661 __isl_give isl_union_pw_qpolynomial_fold *
1662 isl_union_pw_qpolynomial_fold_reset_user(
1663 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1665 Spaces can be nested. In particular, the domain of a set or
1666 the domain or range of a relation can be a nested relation.
1667 This process is also called I<wrapping>.
1668 The functions for detecting, constructing and deconstructing
1669 such nested spaces can be found in the wrapping properties
1670 of L</"Unary Properties">, the wrapping operations
1671 of L</"Unary Operations"> and the Cartesian product operations
1672 of L</"Basic Operations">.
1674 Spaces can be created from other spaces
1675 using the functions described in L</"Unary Operations">
1676 and L</"Binary Operations">.
1680 A local space is essentially a space with
1681 zero or more existentially quantified variables.
1682 The local space of various objects can be obtained
1683 using the following functions.
1685 #include <isl/constraint.h>
1686 __isl_give isl_local_space *isl_constraint_get_local_space(
1687 __isl_keep isl_constraint *constraint);
1689 #include <isl/set.h>
1690 __isl_give isl_local_space *isl_basic_set_get_local_space(
1691 __isl_keep isl_basic_set *bset);
1693 #include <isl/map.h>
1694 __isl_give isl_local_space *isl_basic_map_get_local_space(
1695 __isl_keep isl_basic_map *bmap);
1697 #include <isl/aff.h>
1698 __isl_give isl_local_space *isl_aff_get_domain_local_space(
1699 __isl_keep isl_aff *aff);
1700 __isl_give isl_local_space *isl_aff_get_local_space(
1701 __isl_keep isl_aff *aff);
1703 A new local space can be created from a space using
1705 #include <isl/local_space.h>
1706 __isl_give isl_local_space *isl_local_space_from_space(
1707 __isl_take isl_space *space);
1709 They can be inspected, modified, copied and freed using the following functions.
1711 #include <isl/local_space.h>
1712 isl_bool isl_local_space_is_params(
1713 __isl_keep isl_local_space *ls);
1714 isl_bool isl_local_space_is_set(
1715 __isl_keep isl_local_space *ls);
1716 __isl_give isl_space *isl_local_space_get_space(
1717 __isl_keep isl_local_space *ls);
1718 __isl_give isl_aff *isl_local_space_get_div(
1719 __isl_keep isl_local_space *ls, int pos);
1720 __isl_give isl_local_space *isl_local_space_copy(
1721 __isl_keep isl_local_space *ls);
1722 __isl_null isl_local_space *isl_local_space_free(
1723 __isl_take isl_local_space *ls);
1725 Note that C<isl_local_space_get_div> can only be used on local spaces
1728 Two local spaces can be compared using
1730 isl_bool isl_local_space_is_equal(
1731 __isl_keep isl_local_space *ls1,
1732 __isl_keep isl_local_space *ls2);
1734 Local spaces can be created from other local spaces
1735 using the functions described in L</"Unary Operations">
1736 and L</"Binary Operations">.
1738 =head2 Creating New Sets and Relations
1740 C<isl> has functions for creating some standard sets and relations.
1744 =item * Empty sets and relations
1746 __isl_give isl_basic_set *isl_basic_set_empty(
1747 __isl_take isl_space *space);
1748 __isl_give isl_basic_map *isl_basic_map_empty(
1749 __isl_take isl_space *space);
1750 __isl_give isl_set *isl_set_empty(
1751 __isl_take isl_space *space);
1752 __isl_give isl_map *isl_map_empty(
1753 __isl_take isl_space *space);
1754 __isl_give isl_union_set *isl_union_set_empty(
1755 __isl_take isl_space *space);
1756 __isl_give isl_union_map *isl_union_map_empty(
1757 __isl_take isl_space *space);
1759 For C<isl_union_set>s and C<isl_union_map>s, the space
1760 is only used to specify the parameters.
1762 =item * Universe sets and relations
1764 __isl_give isl_basic_set *isl_basic_set_universe(
1765 __isl_take isl_space *space);
1766 __isl_give isl_basic_map *isl_basic_map_universe(
1767 __isl_take isl_space *space);
1768 __isl_give isl_set *isl_set_universe(
1769 __isl_take isl_space *space);
1770 __isl_give isl_map *isl_map_universe(
1771 __isl_take isl_space *space);
1772 __isl_give isl_union_set *isl_union_set_universe(
1773 __isl_take isl_union_set *uset);
1774 __isl_give isl_union_map *isl_union_map_universe(
1775 __isl_take isl_union_map *umap);
1777 The sets and relations constructed by the functions above
1778 contain all integer values, while those constructed by the
1779 functions below only contain non-negative values.
1781 __isl_give isl_basic_set *isl_basic_set_nat_universe(
1782 __isl_take isl_space *space);
1783 __isl_give isl_basic_map *isl_basic_map_nat_universe(
1784 __isl_take isl_space *space);
1785 __isl_give isl_set *isl_set_nat_universe(
1786 __isl_take isl_space *space);
1787 __isl_give isl_map *isl_map_nat_universe(
1788 __isl_take isl_space *space);
1790 =item * Identity relations
1792 __isl_give isl_basic_map *isl_basic_map_identity(
1793 __isl_take isl_space *space);
1794 __isl_give isl_map *isl_map_identity(
1795 __isl_take isl_space *space);
1797 The number of input and output dimensions in C<space> needs
1800 =item * Lexicographic order
1802 __isl_give isl_map *isl_map_lex_lt(
1803 __isl_take isl_space *set_space);
1804 __isl_give isl_map *isl_map_lex_le(
1805 __isl_take isl_space *set_space);
1806 __isl_give isl_map *isl_map_lex_gt(
1807 __isl_take isl_space *set_space);
1808 __isl_give isl_map *isl_map_lex_ge(
1809 __isl_take isl_space *set_space);
1810 __isl_give isl_map *isl_map_lex_lt_first(
1811 __isl_take isl_space *space, unsigned n);
1812 __isl_give isl_map *isl_map_lex_le_first(
1813 __isl_take isl_space *space, unsigned n);
1814 __isl_give isl_map *isl_map_lex_gt_first(
1815 __isl_take isl_space *space, unsigned n);
1816 __isl_give isl_map *isl_map_lex_ge_first(
1817 __isl_take isl_space *space, unsigned n);
1819 The first four functions take a space for a B<set>
1820 and return relations that express that the elements in the domain
1821 are lexicographically less
1822 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1823 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1824 than the elements in the range.
1825 The last four functions take a space for a map
1826 and return relations that express that the first C<n> dimensions
1827 in the domain are lexicographically less
1828 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1829 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1830 than the first C<n> dimensions in the range.
1834 A basic set or relation can be converted to a set or relation
1835 using the following functions.
1837 __isl_give isl_set *isl_set_from_basic_set(
1838 __isl_take isl_basic_set *bset);
1839 __isl_give isl_map *isl_map_from_basic_map(
1840 __isl_take isl_basic_map *bmap);
1842 Sets and relations can be converted to union sets and relations
1843 using the following functions.
1845 __isl_give isl_union_set *isl_union_set_from_basic_set(
1846 __isl_take isl_basic_set *bset);
1847 __isl_give isl_union_map *isl_union_map_from_basic_map(
1848 __isl_take isl_basic_map *bmap);
1849 __isl_give isl_union_set *isl_union_set_from_set(
1850 __isl_take isl_set *set);
1851 __isl_give isl_union_map *isl_union_map_from_map(
1852 __isl_take isl_map *map);
1854 The inverse conversions below can only be used if the input
1855 union set or relation is known to contain elements in exactly one
1858 __isl_give isl_set *isl_set_from_union_set(
1859 __isl_take isl_union_set *uset);
1860 __isl_give isl_map *isl_map_from_union_map(
1861 __isl_take isl_union_map *umap);
1863 Sets and relations can be copied and freed again using the following
1866 __isl_give isl_basic_set *isl_basic_set_copy(
1867 __isl_keep isl_basic_set *bset);
1868 __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1869 __isl_give isl_union_set *isl_union_set_copy(
1870 __isl_keep isl_union_set *uset);
1871 __isl_give isl_basic_map *isl_basic_map_copy(
1872 __isl_keep isl_basic_map *bmap);
1873 __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1874 __isl_give isl_union_map *isl_union_map_copy(
1875 __isl_keep isl_union_map *umap);
1876 __isl_null isl_basic_set *isl_basic_set_free(
1877 __isl_take isl_basic_set *bset);
1878 __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1879 __isl_null isl_union_set *isl_union_set_free(
1880 __isl_take isl_union_set *uset);
1881 __isl_null isl_basic_map *isl_basic_map_free(
1882 __isl_take isl_basic_map *bmap);
1883 __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1884 __isl_null isl_union_map *isl_union_map_free(
1885 __isl_take isl_union_map *umap);
1887 Other sets and relations can be constructed by starting
1888 from a universe set or relation, adding equality and/or
1889 inequality constraints and then projecting out the
1890 existentially quantified variables, if any.
1891 Constraints can be constructed, manipulated and
1892 added to (or removed from) (basic) sets and relations
1893 using the following functions.
1895 #include <isl/constraint.h>
1896 __isl_give isl_constraint *isl_equality_alloc(
1897 __isl_take isl_local_space *ls);
1898 __isl_give isl_constraint *isl_inequality_alloc(
1899 __isl_take isl_local_space *ls);
1900 __isl_give isl_constraint *isl_constraint_set_constant_si(
1901 __isl_take isl_constraint *constraint, int v);
1902 __isl_give isl_constraint *isl_constraint_set_constant_val(
1903 __isl_take isl_constraint *constraint,
1904 __isl_take isl_val *v);
1905 __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1906 __isl_take isl_constraint *constraint,
1907 enum isl_dim_type type, int pos, int v);
1908 __isl_give isl_constraint *
1909 isl_constraint_set_coefficient_val(
1910 __isl_take isl_constraint *constraint,
1911 enum isl_dim_type type, int pos,
1912 __isl_take isl_val *v);
1913 __isl_give isl_basic_map *isl_basic_map_add_constraint(
1914 __isl_take isl_basic_map *bmap,
1915 __isl_take isl_constraint *constraint);
1916 __isl_give isl_basic_set *isl_basic_set_add_constraint(
1917 __isl_take isl_basic_set *bset,
1918 __isl_take isl_constraint *constraint);
1919 __isl_give isl_map *isl_map_add_constraint(
1920 __isl_take isl_map *map,
1921 __isl_take isl_constraint *constraint);
1922 __isl_give isl_set *isl_set_add_constraint(
1923 __isl_take isl_set *set,
1924 __isl_take isl_constraint *constraint);
1926 For example, to create a set containing the even integers
1927 between 10 and 42, you would use the following code.
1930 isl_local_space *ls;
1932 isl_basic_set *bset;
1934 space = isl_space_set_alloc(ctx, 0, 2);
1935 bset = isl_basic_set_universe(isl_space_copy(space));
1936 ls = isl_local_space_from_space(space);
1938 c = isl_equality_alloc(isl_local_space_copy(ls));
1939 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1940 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1941 bset = isl_basic_set_add_constraint(bset, c);
1943 c = isl_inequality_alloc(isl_local_space_copy(ls));
1944 c = isl_constraint_set_constant_si(c, -10);
1945 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1946 bset = isl_basic_set_add_constraint(bset, c);
1948 c = isl_inequality_alloc(ls);
1949 c = isl_constraint_set_constant_si(c, 42);
1950 c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1951 bset = isl_basic_set_add_constraint(bset, c);
1953 bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1957 isl_basic_set *bset;
1958 bset = isl_basic_set_read_from_str(ctx,
1959 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1961 A basic set or relation can also be constructed from two matrices
1962 describing the equalities and the inequalities.
1964 __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1965 __isl_take isl_space *space,
1966 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1967 enum isl_dim_type c1,
1968 enum isl_dim_type c2, enum isl_dim_type c3,
1969 enum isl_dim_type c4);
1970 __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1971 __isl_take isl_space *space,
1972 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1973 enum isl_dim_type c1,
1974 enum isl_dim_type c2, enum isl_dim_type c3,
1975 enum isl_dim_type c4, enum isl_dim_type c5);
1977 The C<isl_dim_type> arguments indicate the order in which
1978 different kinds of variables appear in the input matrices
1979 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
1980 C<isl_dim_set> and C<isl_dim_div> for sets and
1981 of C<isl_dim_cst>, C<isl_dim_param>,
1982 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
1984 A (basic or union) set or relation can also be constructed from a
1985 (union) (piecewise) (multiple) affine expression
1986 or a list of affine expressions
1987 (See L</"Functions">).
1989 __isl_give isl_basic_map *isl_basic_map_from_aff(
1990 __isl_take isl_aff *aff);
1991 __isl_give isl_map *isl_map_from_aff(
1992 __isl_take isl_aff *aff);
1993 __isl_give isl_set *isl_set_from_pw_aff(
1994 __isl_take isl_pw_aff *pwaff);
1995 __isl_give isl_map *isl_map_from_pw_aff(
1996 __isl_take isl_pw_aff *pwaff);
1997 __isl_give isl_basic_map *isl_basic_map_from_aff_list(
1998 __isl_take isl_space *domain_space,
1999 __isl_take isl_aff_list *list);
2000 __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2001 __isl_take isl_multi_aff *maff)
2002 __isl_give isl_map *isl_map_from_multi_aff(
2003 __isl_take isl_multi_aff *maff)
2004 __isl_give isl_set *isl_set_from_pw_multi_aff(
2005 __isl_take isl_pw_multi_aff *pma);
2006 __isl_give isl_map *isl_map_from_pw_multi_aff(
2007 __isl_take isl_pw_multi_aff *pma);
2008 __isl_give isl_set *isl_set_from_multi_pw_aff(
2009 __isl_take isl_multi_pw_aff *mpa);
2010 __isl_give isl_map *isl_map_from_multi_pw_aff(
2011 __isl_take isl_multi_pw_aff *mpa);
2012 __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2013 __isl_take isl_union_pw_aff *upa);
2014 __isl_give isl_union_map *
2015 isl_union_map_from_union_pw_multi_aff(
2016 __isl_take isl_union_pw_multi_aff *upma);
2017 __isl_give isl_union_map *
2018 isl_union_map_from_multi_union_pw_aff(
2019 __isl_take isl_multi_union_pw_aff *mupa);
2021 The C<domain_space> argument describes the domain of the resulting
2022 basic relation. It is required because the C<list> may consist
2023 of zero affine expressions.
2024 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2025 is not allowed to be zero-dimensional. The domain of the result
2026 is the shared domain of the union piecewise affine elements.
2028 =head2 Inspecting Sets and Relations
2030 Usually, the user should not have to care about the actual constraints
2031 of the sets and maps, but should instead apply the abstract operations
2032 explained in the following sections.
2033 Occasionally, however, it may be required to inspect the individual
2034 coefficients of the constraints. This section explains how to do so.
2035 In these cases, it may also be useful to have C<isl> compute
2036 an explicit representation of the existentially quantified variables.
2038 __isl_give isl_set *isl_set_compute_divs(
2039 __isl_take isl_set *set);
2040 __isl_give isl_map *isl_map_compute_divs(
2041 __isl_take isl_map *map);
2042 __isl_give isl_union_set *isl_union_set_compute_divs(
2043 __isl_take isl_union_set *uset);
2044 __isl_give isl_union_map *isl_union_map_compute_divs(
2045 __isl_take isl_union_map *umap);
2047 This explicit representation defines the existentially quantified
2048 variables as integer divisions of the other variables, possibly
2049 including earlier existentially quantified variables.
2050 An explicitly represented existentially quantified variable therefore
2051 has a unique value when the values of the other variables are known.
2052 If, furthermore, the same existentials, i.e., existentials
2053 with the same explicit representations, should appear in the
2054 same order in each of the disjuncts of a set or map, then the user should call
2055 either of the following functions.
2057 __isl_give isl_set *isl_set_align_divs(
2058 __isl_take isl_set *set);
2059 __isl_give isl_map *isl_map_align_divs(
2060 __isl_take isl_map *map);
2062 Alternatively, the existentially quantified variables can be removed
2063 using the following functions, which compute an overapproximation.
2065 __isl_give isl_basic_set *isl_basic_set_remove_divs(
2066 __isl_take isl_basic_set *bset);
2067 __isl_give isl_basic_map *isl_basic_map_remove_divs(
2068 __isl_take isl_basic_map *bmap);
2069 __isl_give isl_set *isl_set_remove_divs(
2070 __isl_take isl_set *set);
2071 __isl_give isl_map *isl_map_remove_divs(
2072 __isl_take isl_map *map);
2074 It is also possible to only remove those divs that are defined
2075 in terms of a given range of dimensions or only those for which
2076 no explicit representation is known.
2078 __isl_give isl_basic_set *
2079 isl_basic_set_remove_divs_involving_dims(
2080 __isl_take isl_basic_set *bset,
2081 enum isl_dim_type type,
2082 unsigned first, unsigned n);
2083 __isl_give isl_basic_map *
2084 isl_basic_map_remove_divs_involving_dims(
2085 __isl_take isl_basic_map *bmap,
2086 enum isl_dim_type type,
2087 unsigned first, unsigned n);
2088 __isl_give isl_set *isl_set_remove_divs_involving_dims(
2089 __isl_take isl_set *set, enum isl_dim_type type,
2090 unsigned first, unsigned n);
2091 __isl_give isl_map *isl_map_remove_divs_involving_dims(
2092 __isl_take isl_map *map, enum isl_dim_type type,
2093 unsigned first, unsigned n);
2095 __isl_give isl_basic_set *
2096 isl_basic_set_remove_unknown_divs(
2097 __isl_take isl_basic_set *bset);
2098 __isl_give isl_set *isl_set_remove_unknown_divs(
2099 __isl_take isl_set *set);
2100 __isl_give isl_map *isl_map_remove_unknown_divs(
2101 __isl_take isl_map *map);
2103 To iterate over all the sets or maps in a union set or map, use
2105 isl_stat isl_union_set_foreach_set(
2106 __isl_keep isl_union_set *uset,
2107 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2109 isl_stat isl_union_map_foreach_map(
2110 __isl_keep isl_union_map *umap,
2111 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2114 The number of sets or maps in a union set or map can be obtained
2117 int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2118 int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2120 To extract the set or map in a given space from a union, use
2122 __isl_give isl_set *isl_union_set_extract_set(
2123 __isl_keep isl_union_set *uset,
2124 __isl_take isl_space *space);
2125 __isl_give isl_map *isl_union_map_extract_map(
2126 __isl_keep isl_union_map *umap,
2127 __isl_take isl_space *space);
2129 To iterate over all the basic sets or maps in a set or map, use
2131 isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2132 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2135 isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2136 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2140 The callback function C<fn> should return 0 if successful and
2141 -1 if an error occurs. In the latter case, or if any other error
2142 occurs, the above functions will return -1.
2144 It should be noted that C<isl> does not guarantee that
2145 the basic sets or maps passed to C<fn> are disjoint.
2146 If this is required, then the user should call one of
2147 the following functions first.
2149 __isl_give isl_set *isl_set_make_disjoint(
2150 __isl_take isl_set *set);
2151 __isl_give isl_map *isl_map_make_disjoint(
2152 __isl_take isl_map *map);
2154 The number of basic sets in a set can be obtained
2155 or the number of basic maps in a map can be obtained
2158 #include <isl/set.h>
2159 int isl_set_n_basic_set(__isl_keep isl_set *set);
2161 #include <isl/map.h>
2162 int isl_map_n_basic_map(__isl_keep isl_map *map);
2164 To iterate over the constraints of a basic set or map, use
2166 #include <isl/constraint.h>
2168 int isl_basic_set_n_constraint(
2169 __isl_keep isl_basic_set *bset);
2170 isl_stat isl_basic_set_foreach_constraint(
2171 __isl_keep isl_basic_set *bset,
2172 isl_stat (*fn)(__isl_take isl_constraint *c,
2175 int isl_basic_map_n_constraint(
2176 __isl_keep isl_basic_map *bmap);
2177 isl_stat isl_basic_map_foreach_constraint(
2178 __isl_keep isl_basic_map *bmap,
2179 isl_stat (*fn)(__isl_take isl_constraint *c,
2182 __isl_null isl_constraint *isl_constraint_free(
2183 __isl_take isl_constraint *c);
2185 Again, the callback function C<fn> should return 0 if successful and
2186 -1 if an error occurs. In the latter case, or if any other error
2187 occurs, the above functions will return -1.
2188 The constraint C<c> represents either an equality or an inequality.
2189 Use the following function to find out whether a constraint
2190 represents an equality. If not, it represents an inequality.
2192 isl_bool isl_constraint_is_equality(
2193 __isl_keep isl_constraint *constraint);
2195 It is also possible to obtain a list of constraints from a basic
2198 #include <isl/constraint.h>
2199 __isl_give isl_constraint_list *
2200 isl_basic_map_get_constraint_list(
2201 __isl_keep isl_basic_map *bmap);
2202 __isl_give isl_constraint_list *
2203 isl_basic_set_get_constraint_list(
2204 __isl_keep isl_basic_set *bset);
2206 These functions require that all existentially quantified variables
2207 have an explicit representation.
2208 The returned list can be manipulated using the functions in L<"Lists">.
2210 The coefficients of the constraints can be inspected using
2211 the following functions.
2213 isl_bool isl_constraint_is_lower_bound(
2214 __isl_keep isl_constraint *constraint,
2215 enum isl_dim_type type, unsigned pos);
2216 isl_bool isl_constraint_is_upper_bound(
2217 __isl_keep isl_constraint *constraint,
2218 enum isl_dim_type type, unsigned pos);
2219 __isl_give isl_val *isl_constraint_get_constant_val(
2220 __isl_keep isl_constraint *constraint);
2221 __isl_give isl_val *isl_constraint_get_coefficient_val(
2222 __isl_keep isl_constraint *constraint,
2223 enum isl_dim_type type, int pos);
2225 The explicit representations of the existentially quantified
2226 variables can be inspected using the following function.
2227 Note that the user is only allowed to use this function
2228 if the inspected set or map is the result of a call
2229 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2230 The existentially quantified variable is equal to the floor
2231 of the returned affine expression. The affine expression
2232 itself can be inspected using the functions in
2235 __isl_give isl_aff *isl_constraint_get_div(
2236 __isl_keep isl_constraint *constraint, int pos);
2238 To obtain the constraints of a basic set or map in matrix
2239 form, use the following functions.
2241 __isl_give isl_mat *isl_basic_set_equalities_matrix(
2242 __isl_keep isl_basic_set *bset,
2243 enum isl_dim_type c1, enum isl_dim_type c2,
2244 enum isl_dim_type c3, enum isl_dim_type c4);
2245 __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2246 __isl_keep isl_basic_set *bset,
2247 enum isl_dim_type c1, enum isl_dim_type c2,
2248 enum isl_dim_type c3, enum isl_dim_type c4);
2249 __isl_give isl_mat *isl_basic_map_equalities_matrix(
2250 __isl_keep isl_basic_map *bmap,
2251 enum isl_dim_type c1,
2252 enum isl_dim_type c2, enum isl_dim_type c3,
2253 enum isl_dim_type c4, enum isl_dim_type c5);
2254 __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2255 __isl_keep isl_basic_map *bmap,
2256 enum isl_dim_type c1,
2257 enum isl_dim_type c2, enum isl_dim_type c3,
2258 enum isl_dim_type c4, enum isl_dim_type c5);
2260 The C<isl_dim_type> arguments dictate the order in which
2261 different kinds of variables appear in the resulting matrix.
2262 For set inputs, they should be a permutation of
2263 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2264 For map inputs, they should be a permutation of
2265 C<isl_dim_cst>, C<isl_dim_param>,
2266 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2270 Points are elements of a set. They can be used to construct
2271 simple sets (boxes) or they can be used to represent the
2272 individual elements of a set.
2273 The zero point (the origin) can be created using
2275 __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2277 The coordinates of a point can be inspected, set and changed
2280 __isl_give isl_val *isl_point_get_coordinate_val(
2281 __isl_keep isl_point *pnt,
2282 enum isl_dim_type type, int pos);
2283 __isl_give isl_point *isl_point_set_coordinate_val(
2284 __isl_take isl_point *pnt,
2285 enum isl_dim_type type, int pos,
2286 __isl_take isl_val *v);
2288 __isl_give isl_point *isl_point_add_ui(
2289 __isl_take isl_point *pnt,
2290 enum isl_dim_type type, int pos, unsigned val);
2291 __isl_give isl_point *isl_point_sub_ui(
2292 __isl_take isl_point *pnt,
2293 enum isl_dim_type type, int pos, unsigned val);
2295 Points can be copied or freed using
2297 __isl_give isl_point *isl_point_copy(
2298 __isl_keep isl_point *pnt);
2299 void isl_point_free(__isl_take isl_point *pnt);
2301 A singleton set can be created from a point using
2303 __isl_give isl_basic_set *isl_basic_set_from_point(
2304 __isl_take isl_point *pnt);
2305 __isl_give isl_set *isl_set_from_point(
2306 __isl_take isl_point *pnt);
2308 and a box can be created from two opposite extremal points using
2310 __isl_give isl_basic_set *isl_basic_set_box_from_points(
2311 __isl_take isl_point *pnt1,
2312 __isl_take isl_point *pnt2);
2313 __isl_give isl_set *isl_set_box_from_points(
2314 __isl_take isl_point *pnt1,
2315 __isl_take isl_point *pnt2);
2317 All elements of a B<bounded> (union) set can be enumerated using
2318 the following functions.
2320 isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2321 isl_stat (*fn)(__isl_take isl_point *pnt,
2324 isl_stat isl_union_set_foreach_point(
2325 __isl_keep isl_union_set *uset,
2326 isl_stat (*fn)(__isl_take isl_point *pnt,
2330 The function C<fn> is called for each integer point in
2331 C<set> with as second argument the last argument of
2332 the C<isl_set_foreach_point> call. The function C<fn>
2333 should return C<0> on success and C<-1> on failure.
2334 In the latter case, C<isl_set_foreach_point> will stop
2335 enumerating and return C<-1> as well.
2336 If the enumeration is performed successfully and to completion,
2337 then C<isl_set_foreach_point> returns C<0>.
2339 To obtain a single point of a (basic) set, use
2341 __isl_give isl_point *isl_basic_set_sample_point(
2342 __isl_take isl_basic_set *bset);
2343 __isl_give isl_point *isl_set_sample_point(
2344 __isl_take isl_set *set);
2346 If C<set> does not contain any (integer) points, then the
2347 resulting point will be ``void'', a property that can be
2350 isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2354 Besides sets and relation, C<isl> also supports various types of functions.
2355 Each of these types is derived from the value type (see L</"Values">)
2356 or from one of two primitive function types
2357 through the application of zero or more type constructors.
2358 We first describe the primitive type and then we describe
2359 the types derived from these primitive types.
2361 =head3 Primitive Functions
2363 C<isl> support two primitive function types, quasi-affine
2364 expressions and quasipolynomials.
2365 A quasi-affine expression is defined either over a parameter
2366 space or over a set and is composed of integer constants,
2367 parameters and set variables, addition, subtraction and
2368 integer division by an integer constant.
2369 For example, the quasi-affine expression
2371 [n] -> { [x] -> [2*floor((4 n + x)/9] }
2373 maps C<x> to C<2*floor((4 n + x)/9>.
2374 A quasipolynomial is a polynomial expression in quasi-affine
2375 expression. That is, it additionally allows for multiplication.
2376 Note, though, that it is not allowed to construct an integer
2377 division of an expression involving multiplications.
2378 Here is an example of a quasipolynomial that is not
2379 quasi-affine expression
2381 [n] -> { [x] -> (n*floor((4 n + x)/9) }
2383 Note that the external representations of quasi-affine expressions
2384 and quasipolynomials are different. Quasi-affine expressions
2385 use a notation with square brackets just like binary relations,
2386 while quasipolynomials do not. This might change at some point.
2388 If a primitive function is defined over a parameter space,
2389 then the space of the function itself is that of a set.
2390 If it is defined over a set, then the space of the function
2391 is that of a relation. In both cases, the set space (or
2392 the output space) is single-dimensional, anonymous and unstructured.
2393 To create functions with multiple dimensions or with other kinds
2394 of set or output spaces, use multiple expressions
2395 (see L</"Multiple Expressions">).
2399 =item * Quasi-affine Expressions
2401 Besides the expressions described above, a quasi-affine
2402 expression can also be set to NaN. Such expressions
2403 typically represent a failure to represent a result
2404 as a quasi-affine expression.
2406 The zero quasi affine expression or the quasi affine expression
2407 that is equal to a given value or
2408 a specified dimension on a given domain can be created using
2410 #include <isl/aff.h>
2411 __isl_give isl_aff *isl_aff_zero_on_domain(
2412 __isl_take isl_local_space *ls);
2413 __isl_give isl_aff *isl_aff_val_on_domain(
2414 __isl_take isl_local_space *ls,
2415 __isl_take isl_val *val);
2416 __isl_give isl_aff *isl_aff_var_on_domain(
2417 __isl_take isl_local_space *ls,
2418 enum isl_dim_type type, unsigned pos);
2419 __isl_give isl_aff *isl_aff_nan_on_domain(
2420 __isl_take isl_local_space *ls);
2422 Quasi affine expressions can be copied and freed using
2424 #include <isl/aff.h>
2425 __isl_give isl_aff *isl_aff_copy(
2426 __isl_keep isl_aff *aff);
2427 __isl_null isl_aff *isl_aff_free(
2428 __isl_take isl_aff *aff);
2430 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2431 using the following function. The constraint is required to have
2432 a non-zero coefficient for the specified dimension.
2434 #include <isl/constraint.h>
2435 __isl_give isl_aff *isl_constraint_get_bound(
2436 __isl_keep isl_constraint *constraint,
2437 enum isl_dim_type type, int pos);
2439 The entire affine expression of the constraint can also be extracted
2440 using the following function.
2442 #include <isl/constraint.h>
2443 __isl_give isl_aff *isl_constraint_get_aff(
2444 __isl_keep isl_constraint *constraint);
2446 Conversely, an equality constraint equating
2447 the affine expression to zero or an inequality constraint enforcing
2448 the affine expression to be non-negative, can be constructed using
2450 __isl_give isl_constraint *isl_equality_from_aff(
2451 __isl_take isl_aff *aff);
2452 __isl_give isl_constraint *isl_inequality_from_aff(
2453 __isl_take isl_aff *aff);
2455 The coefficients and the integer divisions of an affine expression
2456 can be inspected using the following functions.
2458 #include <isl/aff.h>
2459 __isl_give isl_val *isl_aff_get_constant_val(
2460 __isl_keep isl_aff *aff);
2461 __isl_give isl_val *isl_aff_get_coefficient_val(
2462 __isl_keep isl_aff *aff,
2463 enum isl_dim_type type, int pos);
2464 int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2465 enum isl_dim_type type, int pos);
2466 __isl_give isl_val *isl_aff_get_denominator_val(
2467 __isl_keep isl_aff *aff);
2468 __isl_give isl_aff *isl_aff_get_div(
2469 __isl_keep isl_aff *aff, int pos);
2471 They can be modified using the following functions.
2473 #include <isl/aff.h>
2474 __isl_give isl_aff *isl_aff_set_constant_si(
2475 __isl_take isl_aff *aff, int v);
2476 __isl_give isl_aff *isl_aff_set_constant_val(
2477 __isl_take isl_aff *aff, __isl_take isl_val *v);
2478 __isl_give isl_aff *isl_aff_set_coefficient_si(
2479 __isl_take isl_aff *aff,
2480 enum isl_dim_type type, int pos, int v);
2481 __isl_give isl_aff *isl_aff_set_coefficient_val(
2482 __isl_take isl_aff *aff,
2483 enum isl_dim_type type, int pos,
2484 __isl_take isl_val *v);
2486 __isl_give isl_aff *isl_aff_add_constant_si(
2487 __isl_take isl_aff *aff, int v);
2488 __isl_give isl_aff *isl_aff_add_constant_val(
2489 __isl_take isl_aff *aff, __isl_take isl_val *v);
2490 __isl_give isl_aff *isl_aff_add_constant_num_si(
2491 __isl_take isl_aff *aff, int v);
2492 __isl_give isl_aff *isl_aff_add_coefficient_si(
2493 __isl_take isl_aff *aff,
2494 enum isl_dim_type type, int pos, int v);
2495 __isl_give isl_aff *isl_aff_add_coefficient_val(
2496 __isl_take isl_aff *aff,
2497 enum isl_dim_type type, int pos,
2498 __isl_take isl_val *v);
2500 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2501 set the I<numerator> of the constant or coefficient, while
2502 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2503 the constant or coefficient as a whole.
2504 The C<add_constant> and C<add_coefficient> functions add an integer
2505 or rational value to
2506 the possibly rational constant or coefficient.
2507 The C<add_constant_num> functions add an integer value to
2510 =item * Quasipolynomials
2512 Some simple quasipolynomials can be created using the following functions.
2514 #include <isl/polynomial.h>
2515 __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2516 __isl_take isl_space *domain);
2517 __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2518 __isl_take isl_space *domain);
2519 __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2520 __isl_take isl_space *domain);
2521 __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2522 __isl_take isl_space *domain);
2523 __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2524 __isl_take isl_space *domain);
2525 __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2526 __isl_take isl_space *domain,
2527 __isl_take isl_val *val);
2528 __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2529 __isl_take isl_space *domain,
2530 enum isl_dim_type type, unsigned pos);
2531 __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2532 __isl_take isl_aff *aff);
2534 Recall that the space in which a quasipolynomial lives is a map space
2535 with a one-dimensional range. The C<domain> argument in some of
2536 the functions above corresponds to the domain of this map space.
2538 Quasipolynomials can be copied and freed again using the following
2541 #include <isl/polynomial.h>
2542 __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2543 __isl_keep isl_qpolynomial *qp);
2544 __isl_null isl_qpolynomial *isl_qpolynomial_free(
2545 __isl_take isl_qpolynomial *qp);
2547 The constant term of a quasipolynomial can be extracted using
2549 __isl_give isl_val *isl_qpolynomial_get_constant_val(
2550 __isl_keep isl_qpolynomial *qp);
2552 To iterate over all terms in a quasipolynomial,
2555 isl_stat isl_qpolynomial_foreach_term(
2556 __isl_keep isl_qpolynomial *qp,
2557 isl_stat (*fn)(__isl_take isl_term *term,
2558 void *user), void *user);
2560 The terms themselves can be inspected and freed using
2563 unsigned isl_term_dim(__isl_keep isl_term *term,
2564 enum isl_dim_type type);
2565 __isl_give isl_val *isl_term_get_coefficient_val(
2566 __isl_keep isl_term *term);
2567 int isl_term_get_exp(__isl_keep isl_term *term,
2568 enum isl_dim_type type, unsigned pos);
2569 __isl_give isl_aff *isl_term_get_div(
2570 __isl_keep isl_term *term, unsigned pos);
2571 void isl_term_free(__isl_take isl_term *term);
2573 Each term is a product of parameters, set variables and
2574 integer divisions. The function C<isl_term_get_exp>
2575 returns the exponent of a given dimensions in the given term.
2581 A reduction represents a maximum or a minimum of its
2583 The only reduction type defined by C<isl> is
2584 C<isl_qpolynomial_fold>.
2586 There are currently no functions to directly create such
2587 objects, but they do appear in the piecewise quasipolynomial
2588 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2590 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2592 Reductions can be copied and freed using
2593 the following functions.
2595 #include <isl/polynomial.h>
2596 __isl_give isl_qpolynomial_fold *
2597 isl_qpolynomial_fold_copy(
2598 __isl_keep isl_qpolynomial_fold *fold);
2599 void isl_qpolynomial_fold_free(
2600 __isl_take isl_qpolynomial_fold *fold);
2602 To iterate over all quasipolynomials in a reduction, use
2604 isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2605 __isl_keep isl_qpolynomial_fold *fold,
2606 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2607 void *user), void *user);
2609 =head3 Multiple Expressions
2611 A multiple expression represents a sequence of zero or
2612 more base expressions, all defined on the same domain space.
2613 The domain space of the multiple expression is the same
2614 as that of the base expressions, but the range space
2615 can be any space. In case the base expressions have
2616 a set space, the corresponding multiple expression
2617 also has a set space.
2618 Objects of the value type do not have an associated space.
2619 The space of a multiple value is therefore always a set space.
2620 Similarly, the space of a multiple union piecewise
2621 affine expression is always a set space.
2623 The multiple expression types defined by C<isl>
2624 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2625 C<isl_multi_union_pw_aff>.
2627 A multiple expression with the value zero for
2628 each output (or set) dimension can be created
2629 using the following functions.
2631 #include <isl/val.h>
2632 __isl_give isl_multi_val *isl_multi_val_zero(
2633 __isl_take isl_space *space);
2635 #include <isl/aff.h>
2636 __isl_give isl_multi_aff *isl_multi_aff_zero(
2637 __isl_take isl_space *space);
2638 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2639 __isl_take isl_space *space);
2640 __isl_give isl_multi_union_pw_aff *
2641 isl_multi_union_pw_aff_zero(
2642 __isl_take isl_space *space);
2644 Since there is no canonical way of representing a zero
2645 value of type C<isl_union_pw_aff>, the space passed
2646 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2648 An identity function can be created using the following
2649 functions. The space needs to be that of a relation
2650 with the same number of input and output dimensions.
2652 #include <isl/aff.h>
2653 __isl_give isl_multi_aff *isl_multi_aff_identity(
2654 __isl_take isl_space *space);
2655 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2656 __isl_take isl_space *space);
2658 A function that performs a projection on a universe
2659 relation or set can be created using the following functions.
2660 See also the corresponding
2661 projection operations in L</"Unary Operations">.
2663 #include <isl/aff.h>
2664 __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2665 __isl_take isl_space *space);
2666 __isl_give isl_multi_aff *isl_multi_aff_range_map(
2667 __isl_take isl_space *space);
2668 __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2669 __isl_take isl_space *space,
2670 enum isl_dim_type type,
2671 unsigned first, unsigned n);
2673 A multiple expression can be created from a single
2674 base expression using the following functions.
2675 The space of the created multiple expression is the same
2676 as that of the base expression, except for
2677 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2678 lives in a parameter space and the output lives
2679 in a single-dimensional set space.
2681 #include <isl/aff.h>
2682 __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2683 __isl_take isl_aff *aff);
2684 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2685 __isl_take isl_pw_aff *pa);
2686 __isl_give isl_multi_union_pw_aff *
2687 isl_multi_union_pw_aff_from_union_pw_aff(
2688 __isl_take isl_union_pw_aff *upa);
2690 A multiple expression can be created from a list
2691 of base expression in a specified space.
2692 The domain of this space needs to be the same
2693 as the domains of the base expressions in the list.
2694 If the base expressions have a set space (or no associated space),
2695 then this space also needs to be a set space.
2697 #include <isl/val.h>
2698 __isl_give isl_multi_val *isl_multi_val_from_val_list(
2699 __isl_take isl_space *space,
2700 __isl_take isl_val_list *list);
2702 #include <isl/aff.h>
2703 __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2704 __isl_take isl_space *space,
2705 __isl_take isl_aff_list *list);
2706 __isl_give isl_multi_union_pw_aff *
2707 isl_multi_union_pw_aff_from_union_pw_aff_list(
2708 __isl_take isl_space *space,
2709 __isl_take isl_union_pw_aff_list *list);
2711 As a convenience, a multiple piecewise expression can
2712 also be created from a multiple expression.
2713 Each piecewise expression in the result has a single
2716 #include <isl/aff.h>
2717 __isl_give isl_multi_pw_aff *
2718 isl_multi_pw_aff_from_multi_aff(
2719 __isl_take isl_multi_aff *ma);
2721 Similarly, a multiple union expression can be
2722 created from a multiple expression.
2724 #include <isl/aff.h>
2725 __isl_give isl_multi_union_pw_aff *
2726 isl_multi_union_pw_aff_from_multi_aff(
2727 __isl_take isl_multi_aff *ma);
2728 __isl_give isl_multi_union_pw_aff *
2729 isl_multi_union_pw_aff_from_multi_pw_aff(
2730 __isl_take isl_multi_pw_aff *mpa);
2732 A multiple quasi-affine expression can be created from
2733 a multiple value with a given domain space using the following
2736 #include <isl/aff.h>
2737 __isl_give isl_multi_aff *
2738 isl_multi_aff_multi_val_on_space(
2739 __isl_take isl_space *space,
2740 __isl_take isl_multi_val *mv);
2743 a multiple union piecewise affine expression can be created from
2744 a multiple value with a given domain or
2745 a multiple affine expression with a given domain
2746 using the following functions.
2748 #include <isl/aff.h>
2749 __isl_give isl_multi_union_pw_aff *
2750 isl_multi_union_pw_aff_multi_val_on_domain(
2751 __isl_take isl_union_set *domain,
2752 __isl_take isl_multi_val *mv);
2753 __isl_give isl_multi_union_pw_aff *
2754 isl_multi_union_pw_aff_multi_aff_on_domain(
2755 __isl_take isl_union_set *domain,
2756 __isl_take isl_multi_aff *ma);
2758 Multiple expressions can be copied and freed using
2759 the following functions.
2761 #include <isl/val.h>
2762 __isl_give isl_multi_val *isl_multi_val_copy(
2763 __isl_keep isl_multi_val *mv);
2764 __isl_null isl_multi_val *isl_multi_val_free(
2765 __isl_take isl_multi_val *mv);
2767 #include <isl/aff.h>
2768 __isl_give isl_multi_aff *isl_multi_aff_copy(
2769 __isl_keep isl_multi_aff *maff);
2770 __isl_null isl_multi_aff *isl_multi_aff_free(
2771 __isl_take isl_multi_aff *maff);
2772 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2773 __isl_keep isl_multi_pw_aff *mpa);
2774 __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2775 __isl_take isl_multi_pw_aff *mpa);
2776 __isl_give isl_multi_union_pw_aff *
2777 isl_multi_union_pw_aff_copy(
2778 __isl_keep isl_multi_union_pw_aff *mupa);
2779 __isl_null isl_multi_union_pw_aff *
2780 isl_multi_union_pw_aff_free(
2781 __isl_take isl_multi_union_pw_aff *mupa);
2783 The base expression at a given position of a multiple
2784 expression can be extracted using the following functions.
2786 #include <isl/val.h>
2787 __isl_give isl_val *isl_multi_val_get_val(
2788 __isl_keep isl_multi_val *mv, int pos);
2790 #include <isl/aff.h>
2791 __isl_give isl_aff *isl_multi_aff_get_aff(
2792 __isl_keep isl_multi_aff *multi, int pos);
2793 __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2794 __isl_keep isl_multi_pw_aff *mpa, int pos);
2795 __isl_give isl_union_pw_aff *
2796 isl_multi_union_pw_aff_get_union_pw_aff(
2797 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2799 It can be replaced using the following functions.
2801 #include <isl/val.h>
2802 __isl_give isl_multi_val *isl_multi_val_set_val(
2803 __isl_take isl_multi_val *mv, int pos,
2804 __isl_take isl_val *val);
2806 #include <isl/aff.h>
2807 __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2808 __isl_take isl_multi_aff *multi, int pos,
2809 __isl_take isl_aff *aff);
2810 __isl_give isl_multi_union_pw_aff *
2811 isl_multi_union_pw_aff_set_union_pw_aff(
2812 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2813 __isl_take isl_union_pw_aff *upa);
2815 As a convenience, a sequence of base expressions that have
2816 their domains in a given space can be extracted from a sequence
2817 of union expressions using the following function.
2819 #include <isl/aff.h>
2820 __isl_give isl_multi_pw_aff *
2821 isl_multi_union_pw_aff_extract_multi_pw_aff(
2822 __isl_keep isl_multi_union_pw_aff *mupa,
2823 __isl_take isl_space *space);
2825 Note that there is a difference between C<isl_multi_union_pw_aff>
2826 and C<isl_union_pw_multi_aff> objects. The first is a sequence
2827 of unions of piecewise expressions, while the second is a union
2828 of piecewise sequences. In particular, multiple affine expressions
2829 in an C<isl_union_pw_multi_aff> may live in different spaces,
2830 while there is only a single multiple expression in
2831 an C<isl_multi_union_pw_aff>, which can therefore only live
2832 in a single space. This means that not every
2833 C<isl_union_pw_multi_aff> can be converted to
2834 an C<isl_multi_union_pw_aff>. Conversely, a zero-dimensional
2835 C<isl_multi_union_pw_aff> carries no information
2836 about any possible domain and therefore cannot be converted
2837 to an C<isl_union_pw_multi_aff>. Moreover, the elements
2838 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2839 while each multiple expression inside an C<isl_union_pw_multi_aff>
2840 has a single domain. The conversion of an C<isl_union_pw_multi_aff>
2841 of dimension greater than one may therefore not be exact.
2842 The following functions can
2843 be used to perform these conversions when they are possible.
2845 #include <isl/aff.h>
2846 __isl_give isl_multi_union_pw_aff *
2847 isl_multi_union_pw_aff_from_union_pw_multi_aff(
2848 __isl_take isl_union_pw_multi_aff *upma);
2849 __isl_give isl_union_pw_multi_aff *
2850 isl_union_pw_multi_aff_from_multi_union_pw_aff(
2851 __isl_take isl_multi_union_pw_aff *mupa);
2853 =head3 Piecewise Expressions
2855 A piecewise expression is an expression that is described
2856 using zero or more base expression defined over the same
2857 number of cells in the domain space of the base expressions.
2858 All base expressions are defined over the same
2859 domain space and the cells are disjoint.
2860 The space of a piecewise expression is the same as
2861 that of the base expressions.
2862 If the union of the cells is a strict subset of the domain
2863 space, then the value of the piecewise expression outside
2864 this union is different for types derived from quasi-affine
2865 expressions and those derived from quasipolynomials.
2866 Piecewise expressions derived from quasi-affine expressions
2867 are considered to be undefined outside the union of their cells.
2868 Piecewise expressions derived from quasipolynomials
2869 are considered to be zero outside the union of their cells.
2871 Piecewise quasipolynomials are mainly used by the C<barvinok>
2872 library for representing the number of elements in a parametric set or map.
2873 For example, the piecewise quasipolynomial
2875 [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2877 represents the number of points in the map
2879 [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2881 The piecewise expression types defined by C<isl>
2882 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2883 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2885 A piecewise expression with no cells can be created using
2886 the following functions.
2888 #include <isl/aff.h>
2889 __isl_give isl_pw_aff *isl_pw_aff_empty(
2890 __isl_take isl_space *space);
2891 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2892 __isl_take isl_space *space);
2894 A piecewise expression with a single universe cell can be
2895 created using the following functions.
2897 #include <isl/aff.h>
2898 __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2899 __isl_take isl_aff *aff);
2900 __isl_give isl_pw_multi_aff *
2901 isl_pw_multi_aff_from_multi_aff(
2902 __isl_take isl_multi_aff *ma);
2904 #include <isl/polynomial.h>
2905 __isl_give isl_pw_qpolynomial *
2906 isl_pw_qpolynomial_from_qpolynomial(
2907 __isl_take isl_qpolynomial *qp);
2909 A piecewise expression with a single specified cell can be
2910 created using the following functions.
2912 #include <isl/aff.h>
2913 __isl_give isl_pw_aff *isl_pw_aff_alloc(
2914 __isl_take isl_set *set, __isl_take isl_aff *aff);
2915 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2916 __isl_take isl_set *set,
2917 __isl_take isl_multi_aff *maff);
2919 #include <isl/polynomial.h>
2920 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2921 __isl_take isl_set *set,
2922 __isl_take isl_qpolynomial *qp);
2924 The following convenience functions first create a base expression and
2925 then create a piecewise expression over a universe domain.
2927 #include <isl/aff.h>
2928 __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2929 __isl_take isl_local_space *ls);
2930 __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2931 __isl_take isl_local_space *ls,
2932 enum isl_dim_type type, unsigned pos);
2933 __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2934 __isl_take isl_local_space *ls);
2935 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2936 __isl_take isl_space *space);
2937 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2938 __isl_take isl_space *space);
2939 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2940 __isl_take isl_space *space);
2941 __isl_give isl_pw_multi_aff *
2942 isl_pw_multi_aff_project_out_map(
2943 __isl_take isl_space *space,
2944 enum isl_dim_type type,
2945 unsigned first, unsigned n);
2947 #include <isl/polynomial.h>
2948 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2949 __isl_take isl_space *space);
2951 The following convenience functions first create a base expression and
2952 then create a piecewise expression over a given domain.
2954 #include <isl/aff.h>
2955 __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
2956 __isl_take isl_set *domain,
2957 __isl_take isl_val *v);
2958 __isl_give isl_pw_multi_aff *
2959 isl_pw_multi_aff_multi_val_on_domain(
2960 __isl_take isl_set *domain,
2961 __isl_take isl_multi_val *mv);
2963 As a convenience, a piecewise multiple expression can
2964 also be created from a piecewise expression.
2965 Each multiple expression in the result is derived
2966 from the corresponding base expression.
2968 #include <isl/aff.h>
2969 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
2970 __isl_take isl_pw_aff *pa);
2972 Similarly, a piecewise quasipolynomial can be
2973 created from a piecewise quasi-affine expression using
2974 the following function.
2976 #include <isl/polynomial.h>
2977 __isl_give isl_pw_qpolynomial *
2978 isl_pw_qpolynomial_from_pw_aff(
2979 __isl_take isl_pw_aff *pwaff);
2981 Piecewise expressions can be copied and freed using the following functions.
2983 #include <isl/aff.h>
2984 __isl_give isl_pw_aff *isl_pw_aff_copy(
2985 __isl_keep isl_pw_aff *pwaff);
2986 __isl_null isl_pw_aff *isl_pw_aff_free(
2987 __isl_take isl_pw_aff *pwaff);
2988 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
2989 __isl_keep isl_pw_multi_aff *pma);
2990 __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
2991 __isl_take isl_pw_multi_aff *pma);
2993 #include <isl/polynomial.h>
2994 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
2995 __isl_keep isl_pw_qpolynomial *pwqp);
2996 __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
2997 __isl_take isl_pw_qpolynomial *pwqp);
2998 __isl_give isl_pw_qpolynomial_fold *
2999 isl_pw_qpolynomial_fold_copy(
3000 __isl_keep isl_pw_qpolynomial_fold *pwf);
3001 __isl_null isl_pw_qpolynomial_fold *
3002 isl_pw_qpolynomial_fold_free(
3003 __isl_take isl_pw_qpolynomial_fold *pwf);
3005 To iterate over the different cells of a piecewise expression,
3006 use the following functions.
3008 #include <isl/aff.h>
3009 isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3010 int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3011 isl_stat isl_pw_aff_foreach_piece(
3012 __isl_keep isl_pw_aff *pwaff,
3013 isl_stat (*fn)(__isl_take isl_set *set,
3014 __isl_take isl_aff *aff,
3015 void *user), void *user);
3016 isl_stat isl_pw_multi_aff_foreach_piece(
3017 __isl_keep isl_pw_multi_aff *pma,
3018 isl_stat (*fn)(__isl_take isl_set *set,
3019 __isl_take isl_multi_aff *maff,
3020 void *user), void *user);
3022 #include <isl/polynomial.h>
3023 isl_stat isl_pw_qpolynomial_foreach_piece(
3024 __isl_keep isl_pw_qpolynomial *pwqp,
3025 isl_stat (*fn)(__isl_take isl_set *set,
3026 __isl_take isl_qpolynomial *qp,
3027 void *user), void *user);
3028 isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3029 __isl_keep isl_pw_qpolynomial *pwqp,
3030 isl_stat (*fn)(__isl_take isl_set *set,
3031 __isl_take isl_qpolynomial *qp,
3032 void *user), void *user);
3033 isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3034 __isl_keep isl_pw_qpolynomial_fold *pwf,
3035 isl_stat (*fn)(__isl_take isl_set *set,
3036 __isl_take isl_qpolynomial_fold *fold,
3037 void *user), void *user);
3038 isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3039 __isl_keep isl_pw_qpolynomial_fold *pwf,
3040 isl_stat (*fn)(__isl_take isl_set *set,
3041 __isl_take isl_qpolynomial_fold *fold,
3042 void *user), void *user);
3044 As usual, the function C<fn> should return C<0> on success
3045 and C<-1> on failure. The difference between
3046 C<isl_pw_qpolynomial_foreach_piece> and
3047 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3048 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3049 compute unique representations for all existentially quantified
3050 variables and then turn these existentially quantified variables
3051 into extra set variables, adapting the associated quasipolynomial
3052 accordingly. This means that the C<set> passed to C<fn>
3053 will not have any existentially quantified variables, but that
3054 the dimensions of the sets may be different for different
3055 invocations of C<fn>.
3056 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3057 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3059 A piecewise expression consisting of the expressions at a given
3060 position of a piecewise multiple expression can be extracted
3061 using the following function.
3063 #include <isl/aff.h>
3064 __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3065 __isl_keep isl_pw_multi_aff *pma, int pos);
3067 These expressions can be replaced using the following function.
3069 #include <isl/aff.h>
3070 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3071 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3072 __isl_take isl_pw_aff *pa);
3074 Note that there is a difference between C<isl_multi_pw_aff> and
3075 C<isl_pw_multi_aff> objects. The first is a sequence of piecewise
3076 affine expressions, while the second is a piecewise sequence
3077 of affine expressions. In particular, each of the piecewise
3078 affine expressions in an C<isl_multi_pw_aff> may have a different
3079 domain, while all multiple expressions associated to a cell
3080 in an C<isl_pw_multi_aff> have the same domain.
3081 It is possible to convert between the two, but when converting
3082 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3083 of the result is the intersection of the domains of the input.
3084 The reverse conversion is exact.
3086 #include <isl/aff.h>
3087 __isl_give isl_pw_multi_aff *
3088 isl_pw_multi_aff_from_multi_pw_aff(
3089 __isl_take isl_multi_pw_aff *mpa);
3090 __isl_give isl_multi_pw_aff *
3091 isl_multi_pw_aff_from_pw_multi_aff(
3092 __isl_take isl_pw_multi_aff *pma);
3094 =head3 Union Expressions
3096 A union expression collects base expressions defined
3097 over different domains. The space of a union expression
3098 is that of the shared parameter space.
3100 The union expression types defined by C<isl>
3101 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3102 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3104 An empty union expression can be created using the following functions.
3106 #include <isl/aff.h>
3107 __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3108 __isl_take isl_space *space);
3109 __isl_give isl_union_pw_multi_aff *
3110 isl_union_pw_multi_aff_empty(
3111 __isl_take isl_space *space);
3113 #include <isl/polynomial.h>
3114 __isl_give isl_union_pw_qpolynomial *
3115 isl_union_pw_qpolynomial_zero(
3116 __isl_take isl_space *space);
3118 A union expression containing a single base expression
3119 can be created using the following functions.
3121 #include <isl/aff.h>
3122 __isl_give isl_union_pw_aff *
3123 isl_union_pw_aff_from_pw_aff(
3124 __isl_take isl_pw_aff *pa);
3125 __isl_give isl_union_pw_multi_aff *
3126 isl_union_pw_multi_aff_from_aff(
3127 __isl_take isl_aff *aff);
3128 __isl_give isl_union_pw_multi_aff *
3129 isl_union_pw_multi_aff_from_pw_multi_aff(
3130 __isl_take isl_pw_multi_aff *pma);
3132 #include <isl/polynomial.h>
3133 __isl_give isl_union_pw_qpolynomial *
3134 isl_union_pw_qpolynomial_from_pw_qpolynomial(
3135 __isl_take isl_pw_qpolynomial *pwqp);
3137 The following functions create a base expression on each
3138 of the sets in the union set and collect the results.
3140 #include <isl/aff.h>
3141 __isl_give isl_union_pw_multi_aff *
3142 isl_union_pw_multi_aff_from_union_pw_aff(
3143 __isl_take isl_union_pw_aff *upa);
3144 __isl_give isl_union_pw_aff *
3145 isl_union_pw_multi_aff_get_union_pw_aff(
3146 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3147 __isl_give isl_union_pw_aff *
3148 isl_union_pw_aff_val_on_domain(
3149 __isl_take isl_union_set *domain,
3150 __isl_take isl_val *v);
3151 __isl_give isl_union_pw_multi_aff *
3152 isl_union_pw_multi_aff_multi_val_on_domain(
3153 __isl_take isl_union_set *domain,
3154 __isl_take isl_multi_val *mv);
3156 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3157 expression on a given domain can be created using the following
3160 #include <isl/aff.h>
3161 __isl_give isl_union_pw_aff *
3162 isl_union_pw_aff_aff_on_domain(
3163 __isl_take isl_union_set *domain,
3164 __isl_take isl_aff *aff);
3166 A base expression can be added to a union expression using
3167 the following functions.
3169 #include <isl/aff.h>
3170 __isl_give isl_union_pw_aff *
3171 isl_union_pw_aff_add_pw_aff(
3172 __isl_take isl_union_pw_aff *upa,
3173 __isl_take isl_pw_aff *pa);
3174 __isl_give isl_union_pw_multi_aff *
3175 isl_union_pw_multi_aff_add_pw_multi_aff(
3176 __isl_take isl_union_pw_multi_aff *upma,
3177 __isl_take isl_pw_multi_aff *pma);
3179 #include <isl/polynomial.h>
3180 __isl_give isl_union_pw_qpolynomial *
3181 isl_union_pw_qpolynomial_add_pw_qpolynomial(
3182 __isl_take isl_union_pw_qpolynomial *upwqp,
3183 __isl_take isl_pw_qpolynomial *pwqp);
3185 Union expressions can be copied and freed using
3186 the following functions.
3188 #include <isl/aff.h>
3189 __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3190 __isl_keep isl_union_pw_aff *upa);
3191 __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3192 __isl_take isl_union_pw_aff *upa);
3193 __isl_give isl_union_pw_multi_aff *
3194 isl_union_pw_multi_aff_copy(
3195 __isl_keep isl_union_pw_multi_aff *upma);
3196 __isl_null isl_union_pw_multi_aff *
3197 isl_union_pw_multi_aff_free(
3198 __isl_take isl_union_pw_multi_aff *upma);
3200 #include <isl/polynomial.h>
3201 __isl_give isl_union_pw_qpolynomial *
3202 isl_union_pw_qpolynomial_copy(
3203 __isl_keep isl_union_pw_qpolynomial *upwqp);
3204 __isl_null isl_union_pw_qpolynomial *
3205 isl_union_pw_qpolynomial_free(
3206 __isl_take isl_union_pw_qpolynomial *upwqp);
3207 __isl_give isl_union_pw_qpolynomial_fold *
3208 isl_union_pw_qpolynomial_fold_copy(
3209 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3210 __isl_null isl_union_pw_qpolynomial_fold *
3211 isl_union_pw_qpolynomial_fold_free(
3212 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3214 To iterate over the base expressions in a union expression,
3215 use the following functions.
3217 #include <isl/aff.h>
3218 int isl_union_pw_aff_n_pw_aff(
3219 __isl_keep isl_union_pw_aff *upa);
3220 isl_stat isl_union_pw_aff_foreach_pw_aff(
3221 __isl_keep isl_union_pw_aff *upa,
3222 isl_stat (*fn)(__isl_take isl_pw_aff *ma,
3223 void *user), void *user);
3224 int isl_union_pw_multi_aff_n_pw_multi_aff(
3225 __isl_keep isl_union_pw_multi_aff *upma);
3226 isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3227 __isl_keep isl_union_pw_multi_aff *upma,
3228 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3229 void *user), void *user);
3231 #include <isl/polynomial.h>
3232 int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3233 __isl_keep isl_union_pw_qpolynomial *upwqp);
3234 isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3235 __isl_keep isl_union_pw_qpolynomial *upwqp,
3236 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3237 void *user), void *user);
3238 int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3239 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3240 isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3241 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3242 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3243 void *user), void *user);
3245 To extract the base expression in a given space from a union, use
3246 the following functions.
3248 #include <isl/aff.h>
3249 __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3250 __isl_keep isl_union_pw_aff *upa,
3251 __isl_take isl_space *space);
3252 __isl_give isl_pw_multi_aff *
3253 isl_union_pw_multi_aff_extract_pw_multi_aff(
3254 __isl_keep isl_union_pw_multi_aff *upma,
3255 __isl_take isl_space *space);
3257 #include <isl/polynomial.h>
3258 __isl_give isl_pw_qpolynomial *
3259 isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3260 __isl_keep isl_union_pw_qpolynomial *upwqp,
3261 __isl_take isl_space *space);
3263 =head2 Input and Output
3265 For set and relation,
3266 C<isl> supports its own input/output format, which is similar
3267 to the C<Omega> format, but also supports the C<PolyLib> format
3269 For other object types, typically only an C<isl> format is supported.
3271 =head3 C<isl> format
3273 The C<isl> format is similar to that of C<Omega>, but has a different
3274 syntax for describing the parameters and allows for the definition
3275 of an existentially quantified variable as the integer division
3276 of an affine expression.
3277 For example, the set of integers C<i> between C<0> and C<n>
3278 such that C<i % 10 <= 6> can be described as
3280 [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3283 A set or relation can have several disjuncts, separated
3284 by the keyword C<or>. Each disjunct is either a conjunction
3285 of constraints or a projection (C<exists>) of a conjunction
3286 of constraints. The constraints are separated by the keyword
3289 =head3 C<PolyLib> format
3291 If the represented set is a union, then the first line
3292 contains a single number representing the number of disjuncts.
3293 Otherwise, a line containing the number C<1> is optional.
3295 Each disjunct is represented by a matrix of constraints.
3296 The first line contains two numbers representing
3297 the number of rows and columns,
3298 where the number of rows is equal to the number of constraints
3299 and the number of columns is equal to two plus the number of variables.
3300 The following lines contain the actual rows of the constraint matrix.
3301 In each row, the first column indicates whether the constraint
3302 is an equality (C<0>) or inequality (C<1>). The final column
3303 corresponds to the constant term.
3305 If the set is parametric, then the coefficients of the parameters
3306 appear in the last columns before the constant column.
3307 The coefficients of any existentially quantified variables appear
3308 between those of the set variables and those of the parameters.
3310 =head3 Extended C<PolyLib> format
3312 The extended C<PolyLib> format is nearly identical to the
3313 C<PolyLib> format. The only difference is that the line
3314 containing the number of rows and columns of a constraint matrix
3315 also contains four additional numbers:
3316 the number of output dimensions, the number of input dimensions,
3317 the number of local dimensions (i.e., the number of existentially
3318 quantified variables) and the number of parameters.
3319 For sets, the number of ``output'' dimensions is equal
3320 to the number of set dimensions, while the number of ``input''
3325 Objects can be read from input using the following functions.
3327 #include <isl/val.h>
3328 __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3330 __isl_give isl_multi_val *isl_multi_val_read_from_str(
3331 isl_ctx *ctx, const char *str);
3333 #include <isl/set.h>
3334 __isl_give isl_basic_set *isl_basic_set_read_from_file(
3335 isl_ctx *ctx, FILE *input);
3336 __isl_give isl_basic_set *isl_basic_set_read_from_str(
3337 isl_ctx *ctx, const char *str);
3338 __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3340 __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3343 #include <isl/map.h>
3344 __isl_give isl_basic_map *isl_basic_map_read_from_file(
3345 isl_ctx *ctx, FILE *input);
3346 __isl_give isl_basic_map *isl_basic_map_read_from_str(
3347 isl_ctx *ctx, const char *str);
3348 __isl_give isl_map *isl_map_read_from_file(
3349 isl_ctx *ctx, FILE *input);
3350 __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3353 #include <isl/union_set.h>
3354 __isl_give isl_union_set *isl_union_set_read_from_file(
3355 isl_ctx *ctx, FILE *input);
3356 __isl_give isl_union_set *isl_union_set_read_from_str(
3357 isl_ctx *ctx, const char *str);
3359 #include <isl/union_map.h>
3360 __isl_give isl_union_map *isl_union_map_read_from_file(
3361 isl_ctx *ctx, FILE *input);
3362 __isl_give isl_union_map *isl_union_map_read_from_str(
3363 isl_ctx *ctx, const char *str);
3365 #include <isl/aff.h>
3366 __isl_give isl_aff *isl_aff_read_from_str(
3367 isl_ctx *ctx, const char *str);
3368 __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3369 isl_ctx *ctx, const char *str);
3370 __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3371 isl_ctx *ctx, const char *str);
3372 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3373 isl_ctx *ctx, const char *str);
3374 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3375 isl_ctx *ctx, const char *str);
3376 __isl_give isl_union_pw_multi_aff *
3377 isl_union_pw_multi_aff_read_from_str(
3378 isl_ctx *ctx, const char *str);
3379 __isl_give isl_multi_union_pw_aff *
3380 isl_multi_union_pw_aff_read_from_str(
3381 isl_ctx *ctx, const char *str);
3383 #include <isl/polynomial.h>
3384 __isl_give isl_union_pw_qpolynomial *
3385 isl_union_pw_qpolynomial_read_from_str(
3386 isl_ctx *ctx, const char *str);
3388 For sets and relations,
3389 the input format is autodetected and may be either the C<PolyLib> format
3390 or the C<isl> format.
3394 Before anything can be printed, an C<isl_printer> needs to
3397 __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3399 __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3400 __isl_null isl_printer *isl_printer_free(
3401 __isl_take isl_printer *printer);
3402 __isl_give char *isl_printer_get_str(
3403 __isl_keep isl_printer *printer);
3405 The printer can be inspected using the following functions.
3407 FILE *isl_printer_get_file(
3408 __isl_keep isl_printer *printer);
3409 int isl_printer_get_output_format(
3410 __isl_keep isl_printer *p);
3411 int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3413 The behavior of the printer can be modified in various ways
3415 __isl_give isl_printer *isl_printer_set_output_format(
3416 __isl_take isl_printer *p, int output_format);
3417 __isl_give isl_printer *isl_printer_set_indent(
3418 __isl_take isl_printer *p, int indent);
3419 __isl_give isl_printer *isl_printer_set_indent_prefix(
3420 __isl_take isl_printer *p, const char *prefix);
3421 __isl_give isl_printer *isl_printer_indent(
3422 __isl_take isl_printer *p, int indent);
3423 __isl_give isl_printer *isl_printer_set_prefix(
3424 __isl_take isl_printer *p, const char *prefix);
3425 __isl_give isl_printer *isl_printer_set_suffix(
3426 __isl_take isl_printer *p, const char *suffix);
3427 __isl_give isl_printer *isl_printer_set_yaml_style(
3428 __isl_take isl_printer *p, int yaml_style);
3430 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3431 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3432 and defaults to C<ISL_FORMAT_ISL>.
3433 Each line in the output is prefixed by C<indent_prefix>,
3434 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3435 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3436 In the C<PolyLib> format output,
3437 the coefficients of the existentially quantified variables
3438 appear between those of the set variables and those
3440 The function C<isl_printer_indent> increases the indentation
3441 by the specified amount (which may be negative).
3442 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3443 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3446 To actually print something, use
3448 #include <isl/printer.h>
3449 __isl_give isl_printer *isl_printer_print_double(
3450 __isl_take isl_printer *p, double d);
3452 #include <isl/val.h>
3453 __isl_give isl_printer *isl_printer_print_val(
3454 __isl_take isl_printer *p, __isl_keep isl_val *v);
3456 #include <isl/set.h>
3457 __isl_give isl_printer *isl_printer_print_basic_set(
3458 __isl_take isl_printer *printer,
3459 __isl_keep isl_basic_set *bset);
3460 __isl_give isl_printer *isl_printer_print_set(
3461 __isl_take isl_printer *printer,
3462 __isl_keep isl_set *set);
3464 #include <isl/map.h>
3465 __isl_give isl_printer *isl_printer_print_basic_map(
3466 __isl_take isl_printer *printer,
3467 __isl_keep isl_basic_map *bmap);
3468 __isl_give isl_printer *isl_printer_print_map(
3469 __isl_take isl_printer *printer,
3470 __isl_keep isl_map *map);
3472 #include <isl/union_set.h>
3473 __isl_give isl_printer *isl_printer_print_union_set(
3474 __isl_take isl_printer *p,
3475 __isl_keep isl_union_set *uset);
3477 #include <isl/union_map.h>
3478 __isl_give isl_printer *isl_printer_print_union_map(
3479 __isl_take isl_printer *p,
3480 __isl_keep isl_union_map *umap);
3482 #include <isl/val.h>
3483 __isl_give isl_printer *isl_printer_print_multi_val(
3484 __isl_take isl_printer *p,
3485 __isl_keep isl_multi_val *mv);
3487 #include <isl/aff.h>
3488 __isl_give isl_printer *isl_printer_print_aff(
3489 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3490 __isl_give isl_printer *isl_printer_print_multi_aff(
3491 __isl_take isl_printer *p,
3492 __isl_keep isl_multi_aff *maff);
3493 __isl_give isl_printer *isl_printer_print_pw_aff(
3494 __isl_take isl_printer *p,
3495 __isl_keep isl_pw_aff *pwaff);
3496 __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3497 __isl_take isl_printer *p,
3498 __isl_keep isl_pw_multi_aff *pma);
3499 __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3500 __isl_take isl_printer *p,
3501 __isl_keep isl_multi_pw_aff *mpa);
3502 __isl_give isl_printer *isl_printer_print_union_pw_aff(
3503 __isl_take isl_printer *p,
3504 __isl_keep isl_union_pw_aff *upa);
3505 __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3506 __isl_take isl_printer *p,
3507 __isl_keep isl_union_pw_multi_aff *upma);
3508 __isl_give isl_printer *
3509 isl_printer_print_multi_union_pw_aff(
3510 __isl_take isl_printer *p,
3511 __isl_keep isl_multi_union_pw_aff *mupa);
3513 #include <isl/polynomial.h>
3514 __isl_give isl_printer *isl_printer_print_qpolynomial(
3515 __isl_take isl_printer *p,
3516 __isl_keep isl_qpolynomial *qp);
3517 __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3518 __isl_take isl_printer *p,
3519 __isl_keep isl_pw_qpolynomial *pwqp);
3520 __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3521 __isl_take isl_printer *p,
3522 __isl_keep isl_union_pw_qpolynomial *upwqp);
3524 __isl_give isl_printer *
3525 isl_printer_print_pw_qpolynomial_fold(
3526 __isl_take isl_printer *p,
3527 __isl_keep isl_pw_qpolynomial_fold *pwf);
3528 __isl_give isl_printer *
3529 isl_printer_print_union_pw_qpolynomial_fold(
3530 __isl_take isl_printer *p,
3531 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3533 For C<isl_printer_print_qpolynomial>,
3534 C<isl_printer_print_pw_qpolynomial> and
3535 C<isl_printer_print_pw_qpolynomial_fold>,
3536 the output format of the printer
3537 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3538 For C<isl_printer_print_union_pw_qpolynomial> and
3539 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3541 In case of printing in C<ISL_FORMAT_C>, the user may want
3542 to set the names of all dimensions first.
3544 C<isl> also provides limited support for printing YAML documents,
3545 just enough for the internal use for printing such documents.
3547 #include <isl/printer.h>
3548 __isl_give isl_printer *isl_printer_yaml_start_mapping(
3549 __isl_take isl_printer *p);
3550 __isl_give isl_printer *isl_printer_yaml_end_mapping(
3551 __isl_take isl_printer *p);
3552 __isl_give isl_printer *isl_printer_yaml_start_sequence(
3553 __isl_take isl_printer *p);
3554 __isl_give isl_printer *isl_printer_yaml_end_sequence(
3555 __isl_take isl_printer *p);
3556 __isl_give isl_printer *isl_printer_yaml_next(
3557 __isl_take isl_printer *p);
3559 A document is started by a call to either
3560 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3561 Anything printed to the printer after such a call belong to the
3562 first key of the mapping or the first element in the sequence.
3563 The function C<isl_printer_yaml_next> moves to the value if
3564 we are currently printing a mapping key, the next key if we
3565 are printing a value or the next element if we are printing
3566 an element in a sequence.
3567 Nested mappings and sequences are initiated by the same
3568 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3569 Each call to these functions needs to have a corresponding call to
3570 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3572 When called on a file printer, the following function flushes
3573 the file. When called on a string printer, the buffer is cleared.
3575 __isl_give isl_printer *isl_printer_flush(
3576 __isl_take isl_printer *p);
3578 Alternatively, a string representation can be obtained
3579 directly using the following functions, which always print
3582 #include <isl/space.h>
3583 __isl_give char *isl_space_to_str(
3584 __isl_keep isl_space *space);
3586 #include <isl/val.h>
3587 __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3588 __isl_give char *isl_multi_val_to_str(
3589 __isl_keep isl_multi_val *mv);
3591 #include <isl/set.h>
3592 __isl_give char *isl_set_to_str(
3593 __isl_keep isl_set *set);
3595 #include <isl/union_set.h>
3596 __isl_give char *isl_union_set_to_str(
3597 __isl_keep isl_union_set *uset);
3599 #include <isl/map.h>
3600 __isl_give char *isl_map_to_str(
3601 __isl_keep isl_map *map);
3603 #include <isl/union_map.h>
3604 __isl_give char *isl_union_map_to_str(
3605 __isl_keep isl_union_map *umap);
3607 #include <isl/aff.h>
3608 __isl_give char *isl_multi_aff_to_str(
3609 __isl_keep isl_multi_aff *aff);
3610 __isl_give char *isl_union_pw_aff_to_str(
3611 __isl_keep isl_union_pw_aff *upa);
3612 __isl_give char *isl_union_pw_multi_aff_to_str(
3613 __isl_keep isl_union_pw_multi_aff *upma);
3614 __isl_give char *isl_multi_union_pw_aff_to_str(
3615 __isl_keep isl_multi_union_pw_aff *mupa);
3619 =head3 Unary Properties
3625 The following functions test whether the given set or relation
3626 contains any integer points. The ``plain'' variants do not perform
3627 any computations, but simply check if the given set or relation
3628 is already known to be empty.
3630 isl_bool isl_basic_set_plain_is_empty(
3631 __isl_keep isl_basic_set *bset);
3632 isl_bool isl_basic_set_is_empty(
3633 __isl_keep isl_basic_set *bset);
3634 isl_bool isl_set_plain_is_empty(
3635 __isl_keep isl_set *set);
3636 isl_bool isl_set_is_empty(__isl_keep isl_set *set);
3637 isl_bool isl_union_set_is_empty(
3638 __isl_keep isl_union_set *uset);
3639 isl_bool isl_basic_map_plain_is_empty(
3640 __isl_keep isl_basic_map *bmap);
3641 isl_bool isl_basic_map_is_empty(
3642 __isl_keep isl_basic_map *bmap);
3643 isl_bool isl_map_plain_is_empty(
3644 __isl_keep isl_map *map);
3645 isl_bool isl_map_is_empty(__isl_keep isl_map *map);
3646 isl_bool isl_union_map_is_empty(
3647 __isl_keep isl_union_map *umap);
3649 =item * Universality
3651 isl_bool isl_basic_set_is_universe(
3652 __isl_keep isl_basic_set *bset);
3653 isl_bool isl_basic_map_is_universe(
3654 __isl_keep isl_basic_map *bmap);
3655 isl_bool isl_set_plain_is_universe(
3656 __isl_keep isl_set *set);
3657 isl_bool isl_map_plain_is_universe(
3658 __isl_keep isl_map *map);
3660 =item * Single-valuedness
3662 #include <isl/set.h>
3663 isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
3665 #include <isl/map.h>
3666 isl_bool isl_basic_map_is_single_valued(
3667 __isl_keep isl_basic_map *bmap);
3668 isl_bool isl_map_plain_is_single_valued(
3669 __isl_keep isl_map *map);
3670 isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
3672 #include <isl/union_map.h>
3673 isl_bool isl_union_map_is_single_valued(
3674 __isl_keep isl_union_map *umap);
3678 isl_bool isl_map_plain_is_injective(
3679 __isl_keep isl_map *map);
3680 isl_bool isl_map_is_injective(
3681 __isl_keep isl_map *map);
3682 isl_bool isl_union_map_plain_is_injective(
3683 __isl_keep isl_union_map *umap);
3684 isl_bool isl_union_map_is_injective(
3685 __isl_keep isl_union_map *umap);
3689 isl_bool isl_map_is_bijective(
3690 __isl_keep isl_map *map);
3691 isl_bool isl_union_map_is_bijective(
3692 __isl_keep isl_union_map *umap);
3696 __isl_give isl_val *
3697 isl_basic_map_plain_get_val_if_fixed(
3698 __isl_keep isl_basic_map *bmap,
3699 enum isl_dim_type type, unsigned pos);
3700 __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3701 __isl_keep isl_set *set,
3702 enum isl_dim_type type, unsigned pos);
3703 __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3704 __isl_keep isl_map *map,
3705 enum isl_dim_type type, unsigned pos);
3707 If the set or relation obviously lies on a hyperplane where the given dimension
3708 has a fixed value, then return that value.
3709 Otherwise return NaN.
3713 isl_stat isl_set_dim_residue_class_val(
3714 __isl_keep isl_set *set,
3715 int pos, __isl_give isl_val **modulo,
3716 __isl_give isl_val **residue);
3718 Check if the values of the given set dimension are equal to a fixed
3719 value modulo some integer value. If so, assign the modulo to C<*modulo>
3720 and the fixed value to C<*residue>. If the given dimension attains only
3721 a single value, then assign C<0> to C<*modulo> and the fixed value to
3723 If the dimension does not attain only a single value and if no modulo
3724 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3728 To check whether the description of a set, relation or function depends
3729 on one or more given dimensions,
3730 the following functions can be used.
3732 #include <isl/constraint.h>
3733 isl_bool isl_constraint_involves_dims(
3734 __isl_keep isl_constraint *constraint,
3735 enum isl_dim_type type, unsigned first, unsigned n);
3737 #include <isl/set.h>
3738 isl_bool isl_basic_set_involves_dims(
3739 __isl_keep isl_basic_set *bset,
3740 enum isl_dim_type type, unsigned first, unsigned n);
3741 isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
3742 enum isl_dim_type type, unsigned first, unsigned n);
3744 #include <isl/map.h>
3745 isl_bool isl_basic_map_involves_dims(
3746 __isl_keep isl_basic_map *bmap,
3747 enum isl_dim_type type, unsigned first, unsigned n);
3748 isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
3749 enum isl_dim_type type, unsigned first, unsigned n);
3751 #include <isl/union_map.h>
3752 isl_bool isl_union_map_involves_dims(
3753 __isl_keep isl_union_map *umap,
3754 enum isl_dim_type type, unsigned first, unsigned n);
3756 #include <isl/aff.h>
3757 isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
3758 enum isl_dim_type type, unsigned first, unsigned n);
3759 isl_bool isl_pw_aff_involves_dims(
3760 __isl_keep isl_pw_aff *pwaff,
3761 enum isl_dim_type type, unsigned first, unsigned n);
3762 isl_bool isl_multi_aff_involves_dims(
3763 __isl_keep isl_multi_aff *ma,
3764 enum isl_dim_type type, unsigned first, unsigned n);
3765 isl_bool isl_multi_pw_aff_involves_dims(
3766 __isl_keep isl_multi_pw_aff *mpa,
3767 enum isl_dim_type type, unsigned first, unsigned n);
3769 Similarly, the following functions can be used to check whether
3770 a given dimension is involved in any lower or upper bound.
3772 #include <isl/set.h>
3773 isl_bool isl_set_dim_has_any_lower_bound(
3774 __isl_keep isl_set *set,
3775 enum isl_dim_type type, unsigned pos);
3776 isl_bool isl_set_dim_has_any_upper_bound(
3777 __isl_keep isl_set *set,
3778 enum isl_dim_type type, unsigned pos);
3780 Note that these functions return true even if there is a bound on
3781 the dimension on only some of the basic sets of C<set>.
3782 To check if they have a bound for all of the basic sets in C<set>,
3783 use the following functions instead.
3785 #include <isl/set.h>
3786 isl_bool isl_set_dim_has_lower_bound(
3787 __isl_keep isl_set *set,
3788 enum isl_dim_type type, unsigned pos);
3789 isl_bool isl_set_dim_has_upper_bound(
3790 __isl_keep isl_set *set,
3791 enum isl_dim_type type, unsigned pos);
3795 To check whether a set is a parameter domain, use this function:
3797 isl_bool isl_set_is_params(__isl_keep isl_set *set);
3798 isl_bool isl_union_set_is_params(
3799 __isl_keep isl_union_set *uset);
3803 The following functions check whether the space of the given
3804 (basic) set or relation range is a wrapped relation.
3806 #include <isl/space.h>
3807 isl_bool isl_space_is_wrapping(
3808 __isl_keep isl_space *space);
3809 isl_bool isl_space_domain_is_wrapping(
3810 __isl_keep isl_space *space);
3811 isl_bool isl_space_range_is_wrapping(
3812 __isl_keep isl_space *space);
3814 #include <isl/set.h>
3815 isl_bool isl_basic_set_is_wrapping(
3816 __isl_keep isl_basic_set *bset);
3817 isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
3819 #include <isl/map.h>
3820 isl_bool isl_map_domain_is_wrapping(
3821 __isl_keep isl_map *map);
3822 isl_bool isl_map_range_is_wrapping(
3823 __isl_keep isl_map *map);
3825 #include <isl/val.h>
3826 isl_bool isl_multi_val_range_is_wrapping(
3827 __isl_keep isl_multi_val *mv);
3829 #include <isl/aff.h>
3830 isl_bool isl_multi_aff_range_is_wrapping(
3831 __isl_keep isl_multi_aff *ma);
3832 isl_bool isl_multi_pw_aff_range_is_wrapping(
3833 __isl_keep isl_multi_pw_aff *mpa);
3834 isl_bool isl_multi_union_pw_aff_range_is_wrapping(
3835 __isl_keep isl_multi_union_pw_aff *mupa);
3837 The input to C<isl_space_is_wrapping> should
3838 be the space of a set, while that of
3839 C<isl_space_domain_is_wrapping> and
3840 C<isl_space_range_is_wrapping> should be the space of a relation.
3842 =item * Internal Product
3844 isl_bool isl_basic_map_can_zip(
3845 __isl_keep isl_basic_map *bmap);
3846 isl_bool isl_map_can_zip(__isl_keep isl_map *map);
3848 Check whether the product of domain and range of the given relation
3850 i.e., whether both domain and range are nested relations.
3854 isl_bool isl_basic_map_can_curry(
3855 __isl_keep isl_basic_map *bmap);
3856 isl_bool isl_map_can_curry(__isl_keep isl_map *map);
3858 Check whether the domain of the (basic) relation is a wrapped relation.
3860 isl_bool isl_basic_map_can_uncurry(
3861 __isl_keep isl_basic_map *bmap);
3862 isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
3864 Check whether the range of the (basic) relation is a wrapped relation.
3866 =item * Special Values
3868 #include <isl/aff.h>
3869 isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
3870 isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
3872 Check whether the given expression is a constant.
3874 #include <isl/aff.h>
3875 isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
3876 isl_bool isl_pw_aff_involves_nan(
3877 __isl_keep isl_pw_aff *pa);
3879 #include <isl/polynomial.h>
3880 isl_bool isl_qpolynomial_fold_is_nan(
3881 __isl_keep isl_qpolynomial_fold *fold);
3883 Check whether the given expression is equal to or involves NaN.
3885 #include <isl/aff.h>
3886 isl_bool isl_aff_plain_is_zero(
3887 __isl_keep isl_aff *aff);
3889 Check whether the affine expression is obviously zero.
3893 =head3 Binary Properties
3899 The following functions check whether two objects
3900 represent the same set, relation or function.
3901 The C<plain> variants only return true if the objects
3902 are obviously the same. That is, they may return false
3903 even if the objects are the same, but they will never
3904 return true if the objects are not the same.
3906 #include <isl/set.h>
3907 isl_bool isl_basic_set_plain_is_equal(
3908 __isl_keep isl_basic_set *bset1,
3909 __isl_keep isl_basic_set *bset2);
3910 isl_bool isl_basic_set_is_equal(
3911 __isl_keep isl_basic_set *bset1,
3912 __isl_keep isl_basic_set *bset2);
3913 isl_bool isl_set_plain_is_equal(
3914 __isl_keep isl_set *set1,
3915 __isl_keep isl_set *set2);
3916 isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
3917 __isl_keep isl_set *set2);
3919 #include <isl/map.h>
3920 isl_bool isl_basic_map_is_equal(
3921 __isl_keep isl_basic_map *bmap1,
3922 __isl_keep isl_basic_map *bmap2);
3923 isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
3924 __isl_keep isl_map *map2);
3925 isl_bool isl_map_plain_is_equal(
3926 __isl_keep isl_map *map1,
3927 __isl_keep isl_map *map2);
3929 #include <isl/union_set.h>
3930 isl_bool isl_union_set_is_equal(
3931 __isl_keep isl_union_set *uset1,
3932 __isl_keep isl_union_set *uset2);
3934 #include <isl/union_map.h>
3935 isl_bool isl_union_map_is_equal(
3936 __isl_keep isl_union_map *umap1,
3937 __isl_keep isl_union_map *umap2);
3939 #include <isl/aff.h>
3940 isl_bool isl_aff_plain_is_equal(
3941 __isl_keep isl_aff *aff1,
3942 __isl_keep isl_aff *aff2);
3943 isl_bool isl_multi_aff_plain_is_equal(
3944 __isl_keep isl_multi_aff *maff1,
3945 __isl_keep isl_multi_aff *maff2);
3946 isl_bool isl_pw_aff_plain_is_equal(
3947 __isl_keep isl_pw_aff *pwaff1,
3948 __isl_keep isl_pw_aff *pwaff2);
3949 isl_bool isl_pw_multi_aff_plain_is_equal(
3950 __isl_keep isl_pw_multi_aff *pma1,
3951 __isl_keep isl_pw_multi_aff *pma2);
3952 isl_bool isl_multi_pw_aff_plain_is_equal(
3953 __isl_keep isl_multi_pw_aff *mpa1,
3954 __isl_keep isl_multi_pw_aff *mpa2);
3955 isl_bool isl_multi_pw_aff_is_equal(
3956 __isl_keep isl_multi_pw_aff *mpa1,
3957 __isl_keep isl_multi_pw_aff *mpa2);
3958 isl_bool isl_union_pw_aff_plain_is_equal(
3959 __isl_keep isl_union_pw_aff *upa1,
3960 __isl_keep isl_union_pw_aff *upa2);
3961 isl_bool isl_union_pw_multi_aff_plain_is_equal(
3962 __isl_keep isl_union_pw_multi_aff *upma1,
3963 __isl_keep isl_union_pw_multi_aff *upma2);
3964 isl_bool isl_multi_union_pw_aff_plain_is_equal(
3965 __isl_keep isl_multi_union_pw_aff *mupa1,
3966 __isl_keep isl_multi_union_pw_aff *mupa2);
3968 #include <isl/polynomial.h>
3969 isl_bool isl_union_pw_qpolynomial_plain_is_equal(
3970 __isl_keep isl_union_pw_qpolynomial *upwqp1,
3971 __isl_keep isl_union_pw_qpolynomial *upwqp2);
3972 isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
3973 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
3974 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
3976 =item * Disjointness
3978 #include <isl/set.h>
3979 isl_bool isl_basic_set_is_disjoint(
3980 __isl_keep isl_basic_set *bset1,
3981 __isl_keep isl_basic_set *bset2);
3982 isl_bool isl_set_plain_is_disjoint(
3983 __isl_keep isl_set *set1,
3984 __isl_keep isl_set *set2);
3985 isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
3986 __isl_keep isl_set *set2);
3988 #include <isl/map.h>
3989 isl_bool isl_basic_map_is_disjoint(
3990 __isl_keep isl_basic_map *bmap1,
3991 __isl_keep isl_basic_map *bmap2);
3992 isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
3993 __isl_keep isl_map *map2);
3995 #include <isl/union_set.h>
3996 isl_bool isl_union_set_is_disjoint(
3997 __isl_keep isl_union_set *uset1,
3998 __isl_keep isl_union_set *uset2);
4000 #include <isl/union_map.h>
4001 isl_bool isl_union_map_is_disjoint(
4002 __isl_keep isl_union_map *umap1,
4003 __isl_keep isl_union_map *umap2);
4007 isl_bool isl_basic_set_is_subset(
4008 __isl_keep isl_basic_set *bset1,
4009 __isl_keep isl_basic_set *bset2);
4010 isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4011 __isl_keep isl_set *set2);
4012 isl_bool isl_set_is_strict_subset(
4013 __isl_keep isl_set *set1,
4014 __isl_keep isl_set *set2);
4015 isl_bool isl_union_set_is_subset(
4016 __isl_keep isl_union_set *uset1,
4017 __isl_keep isl_union_set *uset2);
4018 isl_bool isl_union_set_is_strict_subset(
4019 __isl_keep isl_union_set *uset1,
4020 __isl_keep isl_union_set *uset2);
4021 isl_bool isl_basic_map_is_subset(
4022 __isl_keep isl_basic_map *bmap1,
4023 __isl_keep isl_basic_map *bmap2);
4024 isl_bool isl_basic_map_is_strict_subset(
4025 __isl_keep isl_basic_map *bmap1,
4026 __isl_keep isl_basic_map *bmap2);
4027 isl_bool isl_map_is_subset(
4028 __isl_keep isl_map *map1,
4029 __isl_keep isl_map *map2);
4030 isl_bool isl_map_is_strict_subset(
4031 __isl_keep isl_map *map1,
4032 __isl_keep isl_map *map2);
4033 isl_bool isl_union_map_is_subset(
4034 __isl_keep isl_union_map *umap1,
4035 __isl_keep isl_union_map *umap2);
4036 isl_bool isl_union_map_is_strict_subset(
4037 __isl_keep isl_union_map *umap1,
4038 __isl_keep isl_union_map *umap2);
4040 Check whether the first argument is a (strict) subset of the
4045 Every comparison function returns a negative value if the first
4046 argument is considered smaller than the second, a positive value
4047 if the first argument is considered greater and zero if the two
4048 constraints are considered the same by the comparison criterion.
4050 #include <isl/constraint.h>
4051 int isl_constraint_plain_cmp(
4052 __isl_keep isl_constraint *c1,
4053 __isl_keep isl_constraint *c2);
4055 This function is useful for sorting C<isl_constraint>s.
4056 The order depends on the internal representation of the inputs.
4057 The order is fixed over different calls to the function (assuming
4058 the internal representation of the inputs has not changed), but may
4059 change over different versions of C<isl>.
4061 #include <isl/constraint.h>
4062 int isl_constraint_cmp_last_non_zero(
4063 __isl_keep isl_constraint *c1,
4064 __isl_keep isl_constraint *c2);
4066 This function can be used to sort constraints that live in the same
4067 local space. Constraints that involve ``earlier'' dimensions or
4068 that have a smaller coefficient for the shared latest dimension
4069 are considered smaller than other constraints.
4070 This function only defines a B<partial> order.
4072 #include <isl/set.h>
4073 int isl_set_plain_cmp(__isl_keep isl_set *set1,
4074 __isl_keep isl_set *set2);
4076 This function is useful for sorting C<isl_set>s.
4077 The order depends on the internal representation of the inputs.
4078 The order is fixed over different calls to the function (assuming
4079 the internal representation of the inputs has not changed), but may
4080 change over different versions of C<isl>.
4082 #include <isl/aff.h>
4083 int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4084 __isl_keep isl_pw_aff *pa2);
4086 The function C<isl_pw_aff_plain_cmp> can be used to sort
4087 C<isl_pw_aff>s. The order is not strictly defined.
4088 The current order sorts expressions that only involve
4089 earlier dimensions before those that involve later dimensions.
4093 =head2 Unary Operations
4099 __isl_give isl_set *isl_set_complement(
4100 __isl_take isl_set *set);
4101 __isl_give isl_map *isl_map_complement(
4102 __isl_take isl_map *map);
4106 #include <isl/space.h>
4107 __isl_give isl_space *isl_space_reverse(
4108 __isl_take isl_space *space);
4110 #include <isl/map.h>
4111 __isl_give isl_basic_map *isl_basic_map_reverse(
4112 __isl_take isl_basic_map *bmap);
4113 __isl_give isl_map *isl_map_reverse(
4114 __isl_take isl_map *map);
4116 #include <isl/union_map.h>
4117 __isl_give isl_union_map *isl_union_map_reverse(
4118 __isl_take isl_union_map *umap);
4122 #include <isl/space.h>
4123 __isl_give isl_space *isl_space_domain(
4124 __isl_take isl_space *space);
4125 __isl_give isl_space *isl_space_range(
4126 __isl_take isl_space *space);
4127 __isl_give isl_space *isl_space_params(
4128 __isl_take isl_space *space);
4130 #include <isl/local_space.h>
4131 __isl_give isl_local_space *isl_local_space_domain(
4132 __isl_take isl_local_space *ls);
4133 __isl_give isl_local_space *isl_local_space_range(
4134 __isl_take isl_local_space *ls);
4136 #include <isl/set.h>
4137 __isl_give isl_basic_set *isl_basic_set_project_out(
4138 __isl_take isl_basic_set *bset,
4139 enum isl_dim_type type, unsigned first, unsigned n);
4140 __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4141 enum isl_dim_type type, unsigned first, unsigned n);
4142 __isl_give isl_basic_set *isl_basic_set_params(
4143 __isl_take isl_basic_set *bset);
4144 __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4146 #include <isl/map.h>
4147 __isl_give isl_basic_map *isl_basic_map_project_out(
4148 __isl_take isl_basic_map *bmap,
4149 enum isl_dim_type type, unsigned first, unsigned n);
4150 __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4151 enum isl_dim_type type, unsigned first, unsigned n);
4152 __isl_give isl_basic_set *isl_basic_map_domain(
4153 __isl_take isl_basic_map *bmap);
4154 __isl_give isl_basic_set *isl_basic_map_range(
4155 __isl_take isl_basic_map *bmap);
4156 __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4157 __isl_give isl_set *isl_map_domain(
4158 __isl_take isl_map *bmap);
4159 __isl_give isl_set *isl_map_range(
4160 __isl_take isl_map *map);
4162 #include <isl/union_set.h>
4163 __isl_give isl_union_set *isl_union_set_project_out(
4164 __isl_take isl_union_set *uset,
4165 enum isl_dim_type type,
4166 unsigned first, unsigned n);
4167 __isl_give isl_set *isl_union_set_params(
4168 __isl_take isl_union_set *uset);
4170 The function C<isl_union_set_project_out> can only project out
4173 #include <isl/union_map.h>
4174 __isl_give isl_union_map *isl_union_map_project_out(
4175 __isl_take isl_union_map *umap,
4176 enum isl_dim_type type, unsigned first, unsigned n);
4177 __isl_give isl_set *isl_union_map_params(
4178 __isl_take isl_union_map *umap);
4179 __isl_give isl_union_set *isl_union_map_domain(
4180 __isl_take isl_union_map *umap);
4181 __isl_give isl_union_set *isl_union_map_range(
4182 __isl_take isl_union_map *umap);
4184 The function C<isl_union_map_project_out> can only project out
4187 #include <isl/aff.h>
4188 __isl_give isl_aff *isl_aff_project_domain_on_params(
4189 __isl_take isl_aff *aff);
4190 __isl_give isl_pw_multi_aff *
4191 isl_pw_multi_aff_project_domain_on_params(
4192 __isl_take isl_pw_multi_aff *pma);
4193 __isl_give isl_set *isl_pw_aff_domain(
4194 __isl_take isl_pw_aff *pwaff);
4195 __isl_give isl_set *isl_pw_multi_aff_domain(
4196 __isl_take isl_pw_multi_aff *pma);
4197 __isl_give isl_set *isl_multi_pw_aff_domain(
4198 __isl_take isl_multi_pw_aff *mpa);
4199 __isl_give isl_union_set *isl_union_pw_aff_domain(
4200 __isl_take isl_union_pw_aff *upa);
4201 __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4202 __isl_take isl_union_pw_multi_aff *upma);
4203 __isl_give isl_union_set *
4204 isl_multi_union_pw_aff_domain(
4205 __isl_take isl_multi_union_pw_aff *mupa);
4206 __isl_give isl_set *isl_pw_aff_params(
4207 __isl_take isl_pw_aff *pwa);
4209 The function C<isl_multi_union_pw_aff_domain> requires its
4210 input to have at least one set dimension.
4212 #include <isl/polynomial.h>
4213 __isl_give isl_qpolynomial *
4214 isl_qpolynomial_project_domain_on_params(
4215 __isl_take isl_qpolynomial *qp);
4216 __isl_give isl_pw_qpolynomial *
4217 isl_pw_qpolynomial_project_domain_on_params(
4218 __isl_take isl_pw_qpolynomial *pwqp);
4219 __isl_give isl_pw_qpolynomial_fold *
4220 isl_pw_qpolynomial_fold_project_domain_on_params(
4221 __isl_take isl_pw_qpolynomial_fold *pwf);
4222 __isl_give isl_set *isl_pw_qpolynomial_domain(
4223 __isl_take isl_pw_qpolynomial *pwqp);
4224 __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4225 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4226 __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4227 __isl_take isl_union_pw_qpolynomial *upwqp);
4229 #include <isl/space.h>
4230 __isl_give isl_space *isl_space_domain_map(
4231 __isl_take isl_space *space);
4232 __isl_give isl_space *isl_space_range_map(
4233 __isl_take isl_space *space);
4235 #include <isl/map.h>
4236 __isl_give isl_map *isl_set_wrapped_domain_map(
4237 __isl_take isl_set *set);
4238 __isl_give isl_basic_map *isl_basic_map_domain_map(
4239 __isl_take isl_basic_map *bmap);
4240 __isl_give isl_basic_map *isl_basic_map_range_map(
4241 __isl_take isl_basic_map *bmap);
4242 __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4243 __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4245 #include <isl/union_map.h>
4246 __isl_give isl_union_map *isl_union_map_domain_map(
4247 __isl_take isl_union_map *umap);
4248 __isl_give isl_union_pw_multi_aff *
4249 isl_union_map_domain_map_union_pw_multi_aff(
4250 __isl_take isl_union_map *umap);
4251 __isl_give isl_union_map *isl_union_map_range_map(
4252 __isl_take isl_union_map *umap);
4253 __isl_give isl_union_map *
4254 isl_union_set_wrapped_domain_map(
4255 __isl_take isl_union_set *uset);
4257 The functions above construct a (basic, regular or union) relation
4258 that maps (a wrapped version of) the input relation to its domain or range.
4259 C<isl_set_wrapped_domain_map> maps the input set to the domain
4260 of its wrapped relation.
4264 __isl_give isl_basic_set *isl_basic_set_eliminate(
4265 __isl_take isl_basic_set *bset,
4266 enum isl_dim_type type,
4267 unsigned first, unsigned n);
4268 __isl_give isl_set *isl_set_eliminate(
4269 __isl_take isl_set *set, enum isl_dim_type type,
4270 unsigned first, unsigned n);
4271 __isl_give isl_basic_map *isl_basic_map_eliminate(
4272 __isl_take isl_basic_map *bmap,
4273 enum isl_dim_type type,
4274 unsigned first, unsigned n);
4275 __isl_give isl_map *isl_map_eliminate(
4276 __isl_take isl_map *map, enum isl_dim_type type,
4277 unsigned first, unsigned n);
4279 Eliminate the coefficients for the given dimensions from the constraints,
4280 without removing the dimensions.
4282 =item * Constructing a set from a parameter domain
4284 A zero-dimensional space or (basic) set can be constructed
4285 on a given parameter domain using the following functions.
4287 #include <isl/space.h>
4288 __isl_give isl_space *isl_space_set_from_params(
4289 __isl_take isl_space *space);
4291 #include <isl/set.h>
4292 __isl_give isl_basic_set *isl_basic_set_from_params(
4293 __isl_take isl_basic_set *bset);
4294 __isl_give isl_set *isl_set_from_params(
4295 __isl_take isl_set *set);
4297 =item * Constructing a relation from a set
4299 Create a relation with the given set as domain or range.
4300 The range or domain of the created relation is a zero-dimensional
4301 flat anonymous space.
4303 #include <isl/space.h>
4304 __isl_give isl_space *isl_space_from_domain(
4305 __isl_take isl_space *space);
4306 __isl_give isl_space *isl_space_from_range(
4307 __isl_take isl_space *space);
4308 __isl_give isl_space *isl_space_map_from_set(
4309 __isl_take isl_space *space);
4310 __isl_give isl_space *isl_space_map_from_domain_and_range(
4311 __isl_take isl_space *domain,
4312 __isl_take isl_space *range);
4314 #include <isl/local_space.h>
4315 __isl_give isl_local_space *isl_local_space_from_domain(
4316 __isl_take isl_local_space *ls);
4318 #include <isl/map.h>
4319 __isl_give isl_map *isl_map_from_domain(
4320 __isl_take isl_set *set);
4321 __isl_give isl_map *isl_map_from_range(
4322 __isl_take isl_set *set);
4324 #include <isl/val.h>
4325 __isl_give isl_multi_val *isl_multi_val_from_range(
4326 __isl_take isl_multi_val *mv);
4328 #include <isl/aff.h>
4329 __isl_give isl_multi_aff *isl_multi_aff_from_range(
4330 __isl_take isl_multi_aff *ma);
4331 __isl_give isl_pw_aff *isl_pw_aff_from_range(
4332 __isl_take isl_pw_aff *pwa);
4333 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4334 __isl_take isl_multi_pw_aff *mpa);
4335 __isl_give isl_multi_union_pw_aff *
4336 isl_multi_union_pw_aff_from_range(
4337 __isl_take isl_multi_union_pw_aff *mupa);
4338 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4339 __isl_take isl_set *set);
4340 __isl_give isl_union_pw_multi_aff *
4341 isl_union_pw_multi_aff_from_domain(
4342 __isl_take isl_union_set *uset);
4346 #include <isl/set.h>
4347 __isl_give isl_basic_set *isl_basic_set_fix_si(
4348 __isl_take isl_basic_set *bset,
4349 enum isl_dim_type type, unsigned pos, int value);
4350 __isl_give isl_basic_set *isl_basic_set_fix_val(
4351 __isl_take isl_basic_set *bset,
4352 enum isl_dim_type type, unsigned pos,
4353 __isl_take isl_val *v);
4354 __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4355 enum isl_dim_type type, unsigned pos, int value);
4356 __isl_give isl_set *isl_set_fix_val(
4357 __isl_take isl_set *set,
4358 enum isl_dim_type type, unsigned pos,
4359 __isl_take isl_val *v);
4361 #include <isl/map.h>
4362 __isl_give isl_basic_map *isl_basic_map_fix_si(
4363 __isl_take isl_basic_map *bmap,
4364 enum isl_dim_type type, unsigned pos, int value);
4365 __isl_give isl_basic_map *isl_basic_map_fix_val(
4366 __isl_take isl_basic_map *bmap,
4367 enum isl_dim_type type, unsigned pos,
4368 __isl_take isl_val *v);
4369 __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4370 enum isl_dim_type type, unsigned pos, int value);
4371 __isl_give isl_map *isl_map_fix_val(
4372 __isl_take isl_map *map,
4373 enum isl_dim_type type, unsigned pos,
4374 __isl_take isl_val *v);
4376 #include <isl/aff.h>
4377 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4378 __isl_take isl_pw_multi_aff *pma,
4379 enum isl_dim_type type, unsigned pos, int value);
4381 #include <isl/polynomial.h>
4382 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4383 __isl_take isl_pw_qpolynomial *pwqp,
4384 enum isl_dim_type type, unsigned n,
4385 __isl_take isl_val *v);
4387 Intersect the set, relation or function domain
4388 with the hyperplane where the given
4389 dimension has the fixed given value.
4391 __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4392 __isl_take isl_basic_map *bmap,
4393 enum isl_dim_type type, unsigned pos, int value);
4394 __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4395 __isl_take isl_basic_map *bmap,
4396 enum isl_dim_type type, unsigned pos, int value);
4397 __isl_give isl_set *isl_set_lower_bound_si(
4398 __isl_take isl_set *set,
4399 enum isl_dim_type type, unsigned pos, int value);
4400 __isl_give isl_set *isl_set_lower_bound_val(
4401 __isl_take isl_set *set,
4402 enum isl_dim_type type, unsigned pos,
4403 __isl_take isl_val *value);
4404 __isl_give isl_map *isl_map_lower_bound_si(
4405 __isl_take isl_map *map,
4406 enum isl_dim_type type, unsigned pos, int value);
4407 __isl_give isl_set *isl_set_upper_bound_si(
4408 __isl_take isl_set *set,
4409 enum isl_dim_type type, unsigned pos, int value);
4410 __isl_give isl_set *isl_set_upper_bound_val(
4411 __isl_take isl_set *set,
4412 enum isl_dim_type type, unsigned pos,
4413 __isl_take isl_val *value);
4414 __isl_give isl_map *isl_map_upper_bound_si(
4415 __isl_take isl_map *map,
4416 enum isl_dim_type type, unsigned pos, int value);
4418 Intersect the set or relation with the half-space where the given
4419 dimension has a value bounded by the fixed given integer value.
4421 __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4422 enum isl_dim_type type1, int pos1,
4423 enum isl_dim_type type2, int pos2);
4424 __isl_give isl_basic_map *isl_basic_map_equate(
4425 __isl_take isl_basic_map *bmap,
4426 enum isl_dim_type type1, int pos1,
4427 enum isl_dim_type type2, int pos2);
4428 __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4429 enum isl_dim_type type1, int pos1,
4430 enum isl_dim_type type2, int pos2);
4432 Intersect the set or relation with the hyperplane where the given
4433 dimensions are equal to each other.
4435 __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4436 enum isl_dim_type type1, int pos1,
4437 enum isl_dim_type type2, int pos2);
4439 Intersect the relation with the hyperplane where the given
4440 dimensions have opposite values.
4442 __isl_give isl_map *isl_map_order_le(
4443 __isl_take isl_map *map,
4444 enum isl_dim_type type1, int pos1,
4445 enum isl_dim_type type2, int pos2);
4446 __isl_give isl_basic_map *isl_basic_map_order_ge(
4447 __isl_take isl_basic_map *bmap,
4448 enum isl_dim_type type1, int pos1,
4449 enum isl_dim_type type2, int pos2);
4450 __isl_give isl_map *isl_map_order_ge(
4451 __isl_take isl_map *map,
4452 enum isl_dim_type type1, int pos1,
4453 enum isl_dim_type type2, int pos2);
4454 __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4455 enum isl_dim_type type1, int pos1,
4456 enum isl_dim_type type2, int pos2);
4457 __isl_give isl_basic_map *isl_basic_map_order_gt(
4458 __isl_take isl_basic_map *bmap,
4459 enum isl_dim_type type1, int pos1,
4460 enum isl_dim_type type2, int pos2);
4461 __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4462 enum isl_dim_type type1, int pos1,
4463 enum isl_dim_type type2, int pos2);
4465 Intersect the relation with the half-space where the given
4466 dimensions satisfy the given ordering.
4470 #include <isl/aff.h>
4471 __isl_give isl_basic_set *isl_aff_zero_basic_set(
4472 __isl_take isl_aff *aff);
4473 __isl_give isl_basic_set *isl_aff_neg_basic_set(
4474 __isl_take isl_aff *aff);
4475 __isl_give isl_set *isl_pw_aff_pos_set(
4476 __isl_take isl_pw_aff *pa);
4477 __isl_give isl_set *isl_pw_aff_nonneg_set(
4478 __isl_take isl_pw_aff *pwaff);
4479 __isl_give isl_set *isl_pw_aff_zero_set(
4480 __isl_take isl_pw_aff *pwaff);
4481 __isl_give isl_set *isl_pw_aff_non_zero_set(
4482 __isl_take isl_pw_aff *pwaff);
4483 __isl_give isl_union_set *
4484 isl_union_pw_aff_zero_union_set(
4485 __isl_take isl_union_pw_aff *upa);
4486 __isl_give isl_union_set *
4487 isl_multi_union_pw_aff_zero_union_set(
4488 __isl_take isl_multi_union_pw_aff *mupa);
4490 The function C<isl_aff_neg_basic_set> returns a basic set
4491 containing those elements in the domain space
4492 of C<aff> where C<aff> is negative.
4493 The function C<isl_pw_aff_nonneg_set> returns a set
4494 containing those elements in the domain
4495 of C<pwaff> where C<pwaff> is non-negative.
4496 The function C<isl_multi_union_pw_aff_zero_union_set>
4497 returns a union set containing those elements
4498 in the domains of its elements where they are all zero.
4502 __isl_give isl_map *isl_set_identity(
4503 __isl_take isl_set *set);
4504 __isl_give isl_union_map *isl_union_set_identity(
4505 __isl_take isl_union_set *uset);
4506 __isl_give isl_union_pw_multi_aff *
4507 isl_union_set_identity_union_pw_multi_aff(
4508 __isl_take isl_union_set *uset);
4510 Construct an identity relation on the given (union) set.
4512 =item * Function Extraction
4514 A piecewise quasi affine expression that is equal to 1 on a set
4515 and 0 outside the set can be created using the following function.
4517 #include <isl/aff.h>
4518 __isl_give isl_pw_aff *isl_set_indicator_function(
4519 __isl_take isl_set *set);
4521 A piecewise multiple quasi affine expression can be extracted
4522 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4523 and the C<isl_map> is single-valued.
4524 In case of a conversion from an C<isl_union_map>
4525 to an C<isl_union_pw_multi_aff>, these properties need to hold
4526 in each domain space.
4527 A conversion to a C<isl_multi_union_pw_aff> additionally
4528 requires that the input is non-empty and involves only a single
4531 #include <isl/aff.h>
4532 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4533 __isl_take isl_set *set);
4534 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4535 __isl_take isl_map *map);
4537 __isl_give isl_union_pw_multi_aff *
4538 isl_union_pw_multi_aff_from_union_set(
4539 __isl_take isl_union_set *uset);
4540 __isl_give isl_union_pw_multi_aff *
4541 isl_union_pw_multi_aff_from_union_map(
4542 __isl_take isl_union_map *umap);
4544 __isl_give isl_multi_union_pw_aff *
4545 isl_multi_union_pw_aff_from_union_map(
4546 __isl_take isl_union_map *umap);
4550 __isl_give isl_basic_set *isl_basic_map_deltas(
4551 __isl_take isl_basic_map *bmap);
4552 __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4553 __isl_give isl_union_set *isl_union_map_deltas(
4554 __isl_take isl_union_map *umap);
4556 These functions return a (basic) set containing the differences
4557 between image elements and corresponding domain elements in the input.
4559 __isl_give isl_basic_map *isl_basic_map_deltas_map(
4560 __isl_take isl_basic_map *bmap);
4561 __isl_give isl_map *isl_map_deltas_map(
4562 __isl_take isl_map *map);
4563 __isl_give isl_union_map *isl_union_map_deltas_map(
4564 __isl_take isl_union_map *umap);
4566 The functions above construct a (basic, regular or union) relation
4567 that maps (a wrapped version of) the input relation to its delta set.
4571 Simplify the representation of a set, relation or functions by trying
4572 to combine pairs of basic sets or relations into a single
4573 basic set or relation.
4575 #include <isl/set.h>
4576 __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4578 #include <isl/map.h>
4579 __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4581 #include <isl/union_set.h>
4582 __isl_give isl_union_set *isl_union_set_coalesce(
4583 __isl_take isl_union_set *uset);
4585 #include <isl/union_map.h>
4586 __isl_give isl_union_map *isl_union_map_coalesce(
4587 __isl_take isl_union_map *umap);
4589 #include <isl/aff.h>
4590 __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4591 __isl_take isl_pw_aff *pwqp);
4592 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4593 __isl_take isl_pw_multi_aff *pma);
4594 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4595 __isl_take isl_multi_pw_aff *mpa);
4596 __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4597 __isl_take isl_union_pw_aff *upa);
4598 __isl_give isl_union_pw_multi_aff *
4599 isl_union_pw_multi_aff_coalesce(
4600 __isl_take isl_union_pw_multi_aff *upma);
4602 #include <isl/polynomial.h>
4603 __isl_give isl_pw_qpolynomial_fold *
4604 isl_pw_qpolynomial_fold_coalesce(
4605 __isl_take isl_pw_qpolynomial_fold *pwf);
4606 __isl_give isl_union_pw_qpolynomial *
4607 isl_union_pw_qpolynomial_coalesce(
4608 __isl_take isl_union_pw_qpolynomial *upwqp);
4609 __isl_give isl_union_pw_qpolynomial_fold *
4610 isl_union_pw_qpolynomial_fold_coalesce(
4611 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4613 One of the methods for combining pairs of basic sets or relations
4614 can result in coefficients that are much larger than those that appear
4615 in the constraints of the input. By default, the coefficients are
4616 not allowed to grow larger, but this can be changed by unsetting
4617 the following option.
4619 isl_stat isl_options_set_coalesce_bounded_wrapping(
4620 isl_ctx *ctx, int val);
4621 int isl_options_get_coalesce_bounded_wrapping(
4624 =item * Detecting equalities
4626 __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4627 __isl_take isl_basic_set *bset);
4628 __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4629 __isl_take isl_basic_map *bmap);
4630 __isl_give isl_set *isl_set_detect_equalities(
4631 __isl_take isl_set *set);
4632 __isl_give isl_map *isl_map_detect_equalities(
4633 __isl_take isl_map *map);
4634 __isl_give isl_union_set *isl_union_set_detect_equalities(
4635 __isl_take isl_union_set *uset);
4636 __isl_give isl_union_map *isl_union_map_detect_equalities(
4637 __isl_take isl_union_map *umap);
4639 Simplify the representation of a set or relation by detecting implicit
4642 =item * Removing redundant constraints
4644 #include <isl/set.h>
4645 __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4646 __isl_take isl_basic_set *bset);
4647 __isl_give isl_set *isl_set_remove_redundancies(
4648 __isl_take isl_set *set);
4650 #include <isl/union_set.h>
4651 __isl_give isl_union_set *
4652 isl_union_set_remove_redundancies(
4653 __isl_take isl_union_set *uset);
4655 #include <isl/map.h>
4656 __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4657 __isl_take isl_basic_map *bmap);
4658 __isl_give isl_map *isl_map_remove_redundancies(
4659 __isl_take isl_map *map);
4661 #include <isl/union_map.h>
4662 __isl_give isl_union_map *
4663 isl_union_map_remove_redundancies(
4664 __isl_take isl_union_map *umap);
4668 __isl_give isl_basic_set *isl_set_convex_hull(
4669 __isl_take isl_set *set);
4670 __isl_give isl_basic_map *isl_map_convex_hull(
4671 __isl_take isl_map *map);
4673 If the input set or relation has any existentially quantified
4674 variables, then the result of these operations is currently undefined.
4678 #include <isl/set.h>
4679 __isl_give isl_basic_set *
4680 isl_set_unshifted_simple_hull(
4681 __isl_take isl_set *set);
4682 __isl_give isl_basic_set *isl_set_simple_hull(
4683 __isl_take isl_set *set);
4684 __isl_give isl_basic_set *
4685 isl_set_unshifted_simple_hull_from_set_list(
4686 __isl_take isl_set *set,
4687 __isl_take isl_set_list *list);
4689 #include <isl/map.h>
4690 __isl_give isl_basic_map *
4691 isl_map_unshifted_simple_hull(
4692 __isl_take isl_map *map);
4693 __isl_give isl_basic_map *isl_map_simple_hull(
4694 __isl_take isl_map *map);
4695 __isl_give isl_basic_map *
4696 isl_map_unshifted_simple_hull_from_map_list(
4697 __isl_take isl_map *map,
4698 __isl_take isl_map_list *list);
4700 #include <isl/union_map.h>
4701 __isl_give isl_union_map *isl_union_map_simple_hull(
4702 __isl_take isl_union_map *umap);
4704 These functions compute a single basic set or relation
4705 that contains the whole input set or relation.
4706 In particular, the output is described by translates
4707 of the constraints describing the basic sets or relations in the input.
4708 In case of C<isl_set_unshifted_simple_hull>, only the original
4709 constraints are used, without any translation.
4710 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4711 C<isl_map_unshifted_simple_hull_from_map_list>, the
4712 constraints are taken from the elements of the second argument.
4716 (See \autoref{s:simple hull}.)
4722 __isl_give isl_basic_set *isl_basic_set_affine_hull(
4723 __isl_take isl_basic_set *bset);
4724 __isl_give isl_basic_set *isl_set_affine_hull(
4725 __isl_take isl_set *set);
4726 __isl_give isl_union_set *isl_union_set_affine_hull(
4727 __isl_take isl_union_set *uset);
4728 __isl_give isl_basic_map *isl_basic_map_affine_hull(
4729 __isl_take isl_basic_map *bmap);
4730 __isl_give isl_basic_map *isl_map_affine_hull(
4731 __isl_take isl_map *map);
4732 __isl_give isl_union_map *isl_union_map_affine_hull(
4733 __isl_take isl_union_map *umap);
4735 In case of union sets and relations, the affine hull is computed
4738 =item * Polyhedral hull
4740 __isl_give isl_basic_set *isl_set_polyhedral_hull(
4741 __isl_take isl_set *set);
4742 __isl_give isl_basic_map *isl_map_polyhedral_hull(
4743 __isl_take isl_map *map);
4744 __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4745 __isl_take isl_union_set *uset);
4746 __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4747 __isl_take isl_union_map *umap);
4749 These functions compute a single basic set or relation
4750 not involving any existentially quantified variables
4751 that contains the whole input set or relation.
4752 In case of union sets and relations, the polyhedral hull is computed
4755 =item * Other approximations
4757 #include <isl/set.h>
4758 __isl_give isl_basic_set *
4759 isl_basic_set_drop_constraints_involving_dims(
4760 __isl_take isl_basic_set *bset,
4761 enum isl_dim_type type,
4762 unsigned first, unsigned n);
4763 __isl_give isl_basic_set *
4764 isl_basic_set_drop_constraints_not_involving_dims(
4765 __isl_take isl_basic_set *bset,
4766 enum isl_dim_type type,
4767 unsigned first, unsigned n);
4768 __isl_give isl_set *
4769 isl_set_drop_constraints_involving_dims(
4770 __isl_take isl_set *set,
4771 enum isl_dim_type type,
4772 unsigned first, unsigned n);
4774 #include <isl/map.h>
4775 __isl_give isl_basic_map *
4776 isl_basic_map_drop_constraints_involving_dims(
4777 __isl_take isl_basic_map *bmap,
4778 enum isl_dim_type type,
4779 unsigned first, unsigned n);
4780 __isl_give isl_map *
4781 isl_map_drop_constraints_involving_dims(
4782 __isl_take isl_map *map,
4783 enum isl_dim_type type,
4784 unsigned first, unsigned n);
4786 These functions drop any constraints (not) involving the specified dimensions.
4787 Note that the result depends on the representation of the input.
4789 #include <isl/polynomial.h>
4790 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4791 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4792 __isl_give isl_union_pw_qpolynomial *
4793 isl_union_pw_qpolynomial_to_polynomial(
4794 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4796 Approximate each quasipolynomial by a polynomial. If C<sign> is positive,
4797 the polynomial will be an overapproximation. If C<sign> is negative,
4798 it will be an underapproximation. If C<sign> is zero, the approximation
4799 will lie somewhere in between.
4803 __isl_give isl_basic_set *isl_basic_set_sample(
4804 __isl_take isl_basic_set *bset);
4805 __isl_give isl_basic_set *isl_set_sample(
4806 __isl_take isl_set *set);
4807 __isl_give isl_basic_map *isl_basic_map_sample(
4808 __isl_take isl_basic_map *bmap);
4809 __isl_give isl_basic_map *isl_map_sample(
4810 __isl_take isl_map *map);
4812 If the input (basic) set or relation is non-empty, then return
4813 a singleton subset of the input. Otherwise, return an empty set.
4815 =item * Optimization
4817 #include <isl/ilp.h>
4818 __isl_give isl_val *isl_basic_set_max_val(
4819 __isl_keep isl_basic_set *bset,
4820 __isl_keep isl_aff *obj);
4821 __isl_give isl_val *isl_set_min_val(
4822 __isl_keep isl_set *set,
4823 __isl_keep isl_aff *obj);
4824 __isl_give isl_val *isl_set_max_val(
4825 __isl_keep isl_set *set,
4826 __isl_keep isl_aff *obj);
4828 Compute the minimum or maximum of the integer affine expression C<obj>
4829 over the points in C<set>, returning the result in C<opt>.
4830 The result is C<NULL> in case of an error, the optimal value in case
4831 there is one, negative infinity or infinity if the problem is unbounded and
4832 NaN if the problem is empty.
4834 =item * Parametric optimization
4836 __isl_give isl_pw_aff *isl_set_dim_min(
4837 __isl_take isl_set *set, int pos);
4838 __isl_give isl_pw_aff *isl_set_dim_max(
4839 __isl_take isl_set *set, int pos);
4840 __isl_give isl_pw_aff *isl_map_dim_max(
4841 __isl_take isl_map *map, int pos);
4843 Compute the minimum or maximum of the given set or output dimension
4844 as a function of the parameters (and input dimensions), but independently
4845 of the other set or output dimensions.
4846 For lexicographic optimization, see L<"Lexicographic Optimization">.
4850 The following functions compute either the set of (rational) coefficient
4851 values of valid constraints for the given set or the set of (rational)
4852 values satisfying the constraints with coefficients from the given set.
4853 Internally, these two sets of functions perform essentially the
4854 same operations, except that the set of coefficients is assumed to
4855 be a cone, while the set of values may be any polyhedron.
4856 The current implementation is based on the Farkas lemma and
4857 Fourier-Motzkin elimination, but this may change or be made optional
4858 in future. In particular, future implementations may use different
4859 dualization algorithms or skip the elimination step.
4861 __isl_give isl_basic_set *isl_basic_set_coefficients(
4862 __isl_take isl_basic_set *bset);
4863 __isl_give isl_basic_set *isl_set_coefficients(
4864 __isl_take isl_set *set);
4865 __isl_give isl_union_set *isl_union_set_coefficients(
4866 __isl_take isl_union_set *bset);
4867 __isl_give isl_basic_set *isl_basic_set_solutions(
4868 __isl_take isl_basic_set *bset);
4869 __isl_give isl_basic_set *isl_set_solutions(
4870 __isl_take isl_set *set);
4871 __isl_give isl_union_set *isl_union_set_solutions(
4872 __isl_take isl_union_set *bset);
4876 __isl_give isl_map *isl_map_fixed_power_val(
4877 __isl_take isl_map *map,
4878 __isl_take isl_val *exp);
4879 __isl_give isl_union_map *
4880 isl_union_map_fixed_power_val(
4881 __isl_take isl_union_map *umap,
4882 __isl_take isl_val *exp);
4884 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
4885 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
4886 of C<map> is computed.
4888 __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
4890 __isl_give isl_union_map *isl_union_map_power(
4891 __isl_take isl_union_map *umap, int *exact);
4893 Compute a parametric representation for all positive powers I<k> of C<map>.
4894 The result maps I<k> to a nested relation corresponding to the
4895 I<k>th power of C<map>.
4896 The result may be an overapproximation. If the result is known to be exact,
4897 then C<*exact> is set to C<1>.
4899 =item * Transitive closure
4901 __isl_give isl_map *isl_map_transitive_closure(
4902 __isl_take isl_map *map, int *exact);
4903 __isl_give isl_union_map *isl_union_map_transitive_closure(
4904 __isl_take isl_union_map *umap, int *exact);
4906 Compute the transitive closure of C<map>.
4907 The result may be an overapproximation. If the result is known to be exact,
4908 then C<*exact> is set to C<1>.
4910 =item * Reaching path lengths
4912 __isl_give isl_map *isl_map_reaching_path_lengths(
4913 __isl_take isl_map *map, int *exact);
4915 Compute a relation that maps each element in the range of C<map>
4916 to the lengths of all paths composed of edges in C<map> that
4917 end up in the given element.
4918 The result may be an overapproximation. If the result is known to be exact,
4919 then C<*exact> is set to C<1>.
4920 To compute the I<maximal> path length, the resulting relation
4921 should be postprocessed by C<isl_map_lexmax>.
4922 In particular, if the input relation is a dependence relation
4923 (mapping sources to sinks), then the maximal path length corresponds
4924 to the free schedule.
4925 Note, however, that C<isl_map_lexmax> expects the maximum to be
4926 finite, so if the path lengths are unbounded (possibly due to
4927 the overapproximation), then you will get an error message.
4931 #include <isl/space.h>
4932 __isl_give isl_space *isl_space_wrap(
4933 __isl_take isl_space *space);
4934 __isl_give isl_space *isl_space_unwrap(
4935 __isl_take isl_space *space);
4937 #include <isl/local_space.h>
4938 __isl_give isl_local_space *isl_local_space_wrap(
4939 __isl_take isl_local_space *ls);
4941 #include <isl/set.h>
4942 __isl_give isl_basic_map *isl_basic_set_unwrap(
4943 __isl_take isl_basic_set *bset);
4944 __isl_give isl_map *isl_set_unwrap(
4945 __isl_take isl_set *set);
4947 #include <isl/map.h>
4948 __isl_give isl_basic_set *isl_basic_map_wrap(
4949 __isl_take isl_basic_map *bmap);
4950 __isl_give isl_set *isl_map_wrap(
4951 __isl_take isl_map *map);
4953 #include <isl/union_set.h>
4954 __isl_give isl_union_map *isl_union_set_unwrap(
4955 __isl_take isl_union_set *uset);
4957 #include <isl/union_map.h>
4958 __isl_give isl_union_set *isl_union_map_wrap(
4959 __isl_take isl_union_map *umap);
4961 The input to C<isl_space_unwrap> should
4962 be the space of a set, while that of
4963 C<isl_space_wrap> should be the space of a relation.
4964 Conversely, the output of C<isl_space_unwrap> is the space
4965 of a relation, while that of C<isl_space_wrap> is the space of a set.
4969 Remove any internal structure of domain (and range) of the given
4970 set or relation. If there is any such internal structure in the input,
4971 then the name of the space is also removed.
4973 #include <isl/local_space.h>
4974 __isl_give isl_local_space *
4975 isl_local_space_flatten_domain(
4976 __isl_take isl_local_space *ls);
4977 __isl_give isl_local_space *
4978 isl_local_space_flatten_range(
4979 __isl_take isl_local_space *ls);
4981 #include <isl/set.h>
4982 __isl_give isl_basic_set *isl_basic_set_flatten(
4983 __isl_take isl_basic_set *bset);
4984 __isl_give isl_set *isl_set_flatten(
4985 __isl_take isl_set *set);
4987 #include <isl/map.h>
4988 __isl_give isl_basic_map *isl_basic_map_flatten_domain(
4989 __isl_take isl_basic_map *bmap);
4990 __isl_give isl_basic_map *isl_basic_map_flatten_range(
4991 __isl_take isl_basic_map *bmap);
4992 __isl_give isl_map *isl_map_flatten_range(
4993 __isl_take isl_map *map);
4994 __isl_give isl_map *isl_map_flatten_domain(
4995 __isl_take isl_map *map);
4996 __isl_give isl_basic_map *isl_basic_map_flatten(
4997 __isl_take isl_basic_map *bmap);
4998 __isl_give isl_map *isl_map_flatten(
4999 __isl_take isl_map *map);
5001 #include <isl/val.h>
5002 __isl_give isl_multi_val *isl_multi_val_flatten_range(
5003 __isl_take isl_multi_val *mv);
5005 #include <isl/aff.h>
5006 __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5007 __isl_take isl_multi_aff *ma);
5008 __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5009 __isl_take isl_multi_aff *ma);
5010 __isl_give isl_multi_pw_aff *
5011 isl_multi_pw_aff_flatten_range(
5012 __isl_take isl_multi_pw_aff *mpa);
5013 __isl_give isl_multi_union_pw_aff *
5014 isl_multi_union_pw_aff_flatten_range(
5015 __isl_take isl_multi_union_pw_aff *mupa);
5017 #include <isl/map.h>
5018 __isl_give isl_map *isl_set_flatten_map(
5019 __isl_take isl_set *set);
5021 The function above constructs a relation
5022 that maps the input set to a flattened version of the set.
5026 Lift the input set to a space with extra dimensions corresponding
5027 to the existentially quantified variables in the input.
5028 In particular, the result lives in a wrapped map where the domain
5029 is the original space and the range corresponds to the original
5030 existentially quantified variables.
5032 #include <isl/set.h>
5033 __isl_give isl_basic_set *isl_basic_set_lift(
5034 __isl_take isl_basic_set *bset);
5035 __isl_give isl_set *isl_set_lift(
5036 __isl_take isl_set *set);
5037 __isl_give isl_union_set *isl_union_set_lift(
5038 __isl_take isl_union_set *uset);
5040 Given a local space that contains the existentially quantified
5041 variables of a set, a basic relation that, when applied to
5042 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
5043 can be constructed using the following function.
5045 #include <isl/local_space.h>
5046 __isl_give isl_basic_map *isl_local_space_lifting(
5047 __isl_take isl_local_space *ls);
5049 #include <isl/aff.h>
5050 __isl_give isl_multi_aff *isl_multi_aff_lift(
5051 __isl_take isl_multi_aff *maff,
5052 __isl_give isl_local_space **ls);
5054 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
5055 then it is assigned the local space that lies at the basis of
5056 the lifting applied.
5058 =item * Internal Product
5060 #include <isl/space.h>
5061 __isl_give isl_space *isl_space_zip(
5062 __isl_take isl_space *space);
5064 #include <isl/map.h>
5065 __isl_give isl_basic_map *isl_basic_map_zip(
5066 __isl_take isl_basic_map *bmap);
5067 __isl_give isl_map *isl_map_zip(
5068 __isl_take isl_map *map);
5070 #include <isl/union_map.h>
5071 __isl_give isl_union_map *isl_union_map_zip(
5072 __isl_take isl_union_map *umap);
5074 Given a relation with nested relations for domain and range,
5075 interchange the range of the domain with the domain of the range.
5079 #include <isl/space.h>
5080 __isl_give isl_space *isl_space_curry(
5081 __isl_take isl_space *space);
5082 __isl_give isl_space *isl_space_uncurry(
5083 __isl_take isl_space *space);
5085 #include <isl/map.h>
5086 __isl_give isl_basic_map *isl_basic_map_curry(
5087 __isl_take isl_basic_map *bmap);
5088 __isl_give isl_basic_map *isl_basic_map_uncurry(
5089 __isl_take isl_basic_map *bmap);
5090 __isl_give isl_map *isl_map_curry(
5091 __isl_take isl_map *map);
5092 __isl_give isl_map *isl_map_uncurry(
5093 __isl_take isl_map *map);
5095 #include <isl/union_map.h>
5096 __isl_give isl_union_map *isl_union_map_curry(
5097 __isl_take isl_union_map *umap);
5098 __isl_give isl_union_map *isl_union_map_uncurry(
5099 __isl_take isl_union_map *umap);
5101 Given a relation with a nested relation for domain,
5102 the C<curry> functions
5103 move the range of the nested relation out of the domain
5104 and use it as the domain of a nested relation in the range,
5105 with the original range as range of this nested relation.
5106 The C<uncurry> functions perform the inverse operation.
5108 =item * Aligning parameters
5110 Change the order of the parameters of the given set, relation
5112 such that the first parameters match those of C<model>.
5113 This may involve the introduction of extra parameters.
5114 All parameters need to be named.
5116 #include <isl/space.h>
5117 __isl_give isl_space *isl_space_align_params(
5118 __isl_take isl_space *space1,
5119 __isl_take isl_space *space2)
5121 #include <isl/set.h>
5122 __isl_give isl_basic_set *isl_basic_set_align_params(
5123 __isl_take isl_basic_set *bset,
5124 __isl_take isl_space *model);
5125 __isl_give isl_set *isl_set_align_params(
5126 __isl_take isl_set *set,
5127 __isl_take isl_space *model);
5129 #include <isl/map.h>
5130 __isl_give isl_basic_map *isl_basic_map_align_params(
5131 __isl_take isl_basic_map *bmap,
5132 __isl_take isl_space *model);
5133 __isl_give isl_map *isl_map_align_params(
5134 __isl_take isl_map *map,
5135 __isl_take isl_space *model);
5137 #include <isl/val.h>
5138 __isl_give isl_multi_val *isl_multi_val_align_params(
5139 __isl_take isl_multi_val *mv,
5140 __isl_take isl_space *model);
5142 #include <isl/aff.h>
5143 __isl_give isl_aff *isl_aff_align_params(
5144 __isl_take isl_aff *aff,
5145 __isl_take isl_space *model);
5146 __isl_give isl_multi_aff *isl_multi_aff_align_params(
5147 __isl_take isl_multi_aff *multi,
5148 __isl_take isl_space *model);
5149 __isl_give isl_pw_aff *isl_pw_aff_align_params(
5150 __isl_take isl_pw_aff *pwaff,
5151 __isl_take isl_space *model);
5152 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5153 __isl_take isl_pw_multi_aff *pma,
5154 __isl_take isl_space *model);
5155 __isl_give isl_union_pw_aff *
5156 isl_union_pw_aff_align_params(
5157 __isl_take isl_union_pw_aff *upa,
5158 __isl_take isl_space *model);
5159 __isl_give isl_union_pw_multi_aff *
5160 isl_union_pw_multi_aff_align_params(
5161 __isl_take isl_union_pw_multi_aff *upma,
5162 __isl_take isl_space *model);
5163 __isl_give isl_multi_union_pw_aff *
5164 isl_multi_union_pw_aff_align_params(
5165 __isl_take isl_multi_union_pw_aff *mupa,
5166 __isl_take isl_space *model);
5168 #include <isl/polynomial.h>
5169 __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5170 __isl_take isl_qpolynomial *qp,
5171 __isl_take isl_space *model);
5173 =item * Unary Arithmethic Operations
5175 #include <isl/val.h>
5176 __isl_give isl_multi_val *isl_multi_val_neg(
5177 __isl_take isl_multi_val *mv);
5179 #include <isl/aff.h>
5180 __isl_give isl_aff *isl_aff_neg(
5181 __isl_take isl_aff *aff);
5182 __isl_give isl_multi_aff *isl_multi_aff_neg(
5183 __isl_take isl_multi_aff *ma);
5184 __isl_give isl_pw_aff *isl_pw_aff_neg(
5185 __isl_take isl_pw_aff *pwaff);
5186 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5187 __isl_take isl_pw_multi_aff *pma);
5188 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5189 __isl_take isl_multi_pw_aff *mpa);
5190 __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5191 __isl_take isl_union_pw_aff *upa);
5192 __isl_give isl_union_pw_multi_aff *
5193 isl_union_pw_multi_aff_neg(
5194 __isl_take isl_union_pw_multi_aff *upma);
5195 __isl_give isl_multi_union_pw_aff *
5196 isl_multi_union_pw_aff_neg(
5197 __isl_take isl_multi_union_pw_aff *mupa);
5198 __isl_give isl_aff *isl_aff_ceil(
5199 __isl_take isl_aff *aff);
5200 __isl_give isl_pw_aff *isl_pw_aff_ceil(
5201 __isl_take isl_pw_aff *pwaff);
5202 __isl_give isl_aff *isl_aff_floor(
5203 __isl_take isl_aff *aff);
5204 __isl_give isl_multi_aff *isl_multi_aff_floor(
5205 __isl_take isl_multi_aff *ma);
5206 __isl_give isl_pw_aff *isl_pw_aff_floor(
5207 __isl_take isl_pw_aff *pwaff);
5208 __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5209 __isl_take isl_union_pw_aff *upa);
5210 __isl_give isl_multi_union_pw_aff *
5211 isl_multi_union_pw_aff_floor(
5212 __isl_take isl_multi_union_pw_aff *mupa);
5214 #include <isl/aff.h>
5215 __isl_give isl_pw_aff *isl_pw_aff_list_min(
5216 __isl_take isl_pw_aff_list *list);
5217 __isl_give isl_pw_aff *isl_pw_aff_list_max(
5218 __isl_take isl_pw_aff_list *list);
5220 #include <isl/polynomial.h>
5221 __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5222 __isl_take isl_qpolynomial *qp);
5223 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5224 __isl_take isl_pw_qpolynomial *pwqp);
5225 __isl_give isl_union_pw_qpolynomial *
5226 isl_union_pw_qpolynomial_neg(
5227 __isl_take isl_union_pw_qpolynomial *upwqp);
5228 __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5229 __isl_take isl_qpolynomial *qp,
5231 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5232 __isl_take isl_pw_qpolynomial *pwqp,
5237 The following functions evaluate a function in a point.
5239 #include <isl/polynomial.h>
5240 __isl_give isl_val *isl_pw_qpolynomial_eval(
5241 __isl_take isl_pw_qpolynomial *pwqp,
5242 __isl_take isl_point *pnt);
5243 __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5244 __isl_take isl_pw_qpolynomial_fold *pwf,
5245 __isl_take isl_point *pnt);
5246 __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5247 __isl_take isl_union_pw_qpolynomial *upwqp,
5248 __isl_take isl_point *pnt);
5249 __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5250 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5251 __isl_take isl_point *pnt);
5253 =item * Dimension manipulation
5255 It is usually not advisable to directly change the (input or output)
5256 space of a set or a relation as this removes the name and the internal
5257 structure of the space. However, the functions below can be useful
5258 to add new parameters, assuming
5259 C<isl_set_align_params> and C<isl_map_align_params>
5262 #include <isl/space.h>
5263 __isl_give isl_space *isl_space_add_dims(
5264 __isl_take isl_space *space,
5265 enum isl_dim_type type, unsigned n);
5266 __isl_give isl_space *isl_space_insert_dims(
5267 __isl_take isl_space *space,
5268 enum isl_dim_type type, unsigned pos, unsigned n);
5269 __isl_give isl_space *isl_space_drop_dims(
5270 __isl_take isl_space *space,
5271 enum isl_dim_type type, unsigned first, unsigned n);
5272 __isl_give isl_space *isl_space_move_dims(
5273 __isl_take isl_space *space,
5274 enum isl_dim_type dst_type, unsigned dst_pos,
5275 enum isl_dim_type src_type, unsigned src_pos,
5278 #include <isl/local_space.h>
5279 __isl_give isl_local_space *isl_local_space_add_dims(
5280 __isl_take isl_local_space *ls,
5281 enum isl_dim_type type, unsigned n);
5282 __isl_give isl_local_space *isl_local_space_insert_dims(
5283 __isl_take isl_local_space *ls,
5284 enum isl_dim_type type, unsigned first, unsigned n);
5285 __isl_give isl_local_space *isl_local_space_drop_dims(
5286 __isl_take isl_local_space *ls,
5287 enum isl_dim_type type, unsigned first, unsigned n);
5289 #include <isl/set.h>
5290 __isl_give isl_basic_set *isl_basic_set_add_dims(
5291 __isl_take isl_basic_set *bset,
5292 enum isl_dim_type type, unsigned n);
5293 __isl_give isl_set *isl_set_add_dims(
5294 __isl_take isl_set *set,
5295 enum isl_dim_type type, unsigned n);
5296 __isl_give isl_basic_set *isl_basic_set_insert_dims(
5297 __isl_take isl_basic_set *bset,
5298 enum isl_dim_type type, unsigned pos,
5300 __isl_give isl_set *isl_set_insert_dims(
5301 __isl_take isl_set *set,
5302 enum isl_dim_type type, unsigned pos, unsigned n);
5303 __isl_give isl_basic_set *isl_basic_set_move_dims(
5304 __isl_take isl_basic_set *bset,
5305 enum isl_dim_type dst_type, unsigned dst_pos,
5306 enum isl_dim_type src_type, unsigned src_pos,
5308 __isl_give isl_set *isl_set_move_dims(
5309 __isl_take isl_set *set,
5310 enum isl_dim_type dst_type, unsigned dst_pos,
5311 enum isl_dim_type src_type, unsigned src_pos,
5314 #include <isl/map.h>
5315 __isl_give isl_basic_map *isl_basic_map_add_dims(
5316 __isl_take isl_basic_map *bmap,
5317 enum isl_dim_type type, unsigned n);
5318 __isl_give isl_map *isl_map_add_dims(
5319 __isl_take isl_map *map,
5320 enum isl_dim_type type, unsigned n);
5321 __isl_give isl_basic_map *isl_basic_map_insert_dims(
5322 __isl_take isl_basic_map *bmap,
5323 enum isl_dim_type type, unsigned pos,
5325 __isl_give isl_map *isl_map_insert_dims(
5326 __isl_take isl_map *map,
5327 enum isl_dim_type type, unsigned pos, unsigned n);
5328 __isl_give isl_basic_map *isl_basic_map_move_dims(
5329 __isl_take isl_basic_map *bmap,
5330 enum isl_dim_type dst_type, unsigned dst_pos,
5331 enum isl_dim_type src_type, unsigned src_pos,
5333 __isl_give isl_map *isl_map_move_dims(
5334 __isl_take isl_map *map,
5335 enum isl_dim_type dst_type, unsigned dst_pos,
5336 enum isl_dim_type src_type, unsigned src_pos,
5339 #include <isl/val.h>
5340 __isl_give isl_multi_val *isl_multi_val_insert_dims(
5341 __isl_take isl_multi_val *mv,
5342 enum isl_dim_type type, unsigned first, unsigned n);
5343 __isl_give isl_multi_val *isl_multi_val_add_dims(
5344 __isl_take isl_multi_val *mv,
5345 enum isl_dim_type type, unsigned n);
5346 __isl_give isl_multi_val *isl_multi_val_drop_dims(
5347 __isl_take isl_multi_val *mv,
5348 enum isl_dim_type type, unsigned first, unsigned n);
5350 #include <isl/aff.h>
5351 __isl_give isl_aff *isl_aff_insert_dims(
5352 __isl_take isl_aff *aff,
5353 enum isl_dim_type type, unsigned first, unsigned n);
5354 __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5355 __isl_take isl_multi_aff *ma,
5356 enum isl_dim_type type, unsigned first, unsigned n);
5357 __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5358 __isl_take isl_pw_aff *pwaff,
5359 enum isl_dim_type type, unsigned first, unsigned n);
5360 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5361 __isl_take isl_multi_pw_aff *mpa,
5362 enum isl_dim_type type, unsigned first, unsigned n);
5363 __isl_give isl_aff *isl_aff_add_dims(
5364 __isl_take isl_aff *aff,
5365 enum isl_dim_type type, unsigned n);
5366 __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5367 __isl_take isl_multi_aff *ma,
5368 enum isl_dim_type type, unsigned n);
5369 __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5370 __isl_take isl_pw_aff *pwaff,
5371 enum isl_dim_type type, unsigned n);
5372 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5373 __isl_take isl_multi_pw_aff *mpa,
5374 enum isl_dim_type type, unsigned n);
5375 __isl_give isl_aff *isl_aff_drop_dims(
5376 __isl_take isl_aff *aff,
5377 enum isl_dim_type type, unsigned first, unsigned n);
5378 __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5379 __isl_take isl_multi_aff *maff,
5380 enum isl_dim_type type, unsigned first, unsigned n);
5381 __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5382 __isl_take isl_pw_aff *pwaff,
5383 enum isl_dim_type type, unsigned first, unsigned n);
5384 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5385 __isl_take isl_pw_multi_aff *pma,
5386 enum isl_dim_type type, unsigned first, unsigned n);
5387 __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5388 __isl_take isl_union_pw_aff *upa,
5389 enum isl_dim_type type, unsigned first, unsigned n);
5390 __isl_give isl_union_pw_multi_aff *
5391 isl_union_pw_multi_aff_drop_dims(
5392 __isl_take isl_union_pw_multi_aff *upma,
5393 enum isl_dim_type type,
5394 unsigned first, unsigned n);
5395 __isl_give isl_multi_union_pw_aff *
5396 isl_multi_union_pw_aff_drop_dims(
5397 __isl_take isl_multi_union_pw_aff *mupa,
5398 enum isl_dim_type type, unsigned first,
5400 __isl_give isl_aff *isl_aff_move_dims(
5401 __isl_take isl_aff *aff,
5402 enum isl_dim_type dst_type, unsigned dst_pos,
5403 enum isl_dim_type src_type, unsigned src_pos,
5405 __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5406 __isl_take isl_multi_aff *ma,
5407 enum isl_dim_type dst_type, unsigned dst_pos,
5408 enum isl_dim_type src_type, unsigned src_pos,
5410 __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5411 __isl_take isl_pw_aff *pa,
5412 enum isl_dim_type dst_type, unsigned dst_pos,
5413 enum isl_dim_type src_type, unsigned src_pos,
5415 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5416 __isl_take isl_multi_pw_aff *pma,
5417 enum isl_dim_type dst_type, unsigned dst_pos,
5418 enum isl_dim_type src_type, unsigned src_pos,
5421 #include <isl/polynomial.h>
5422 __isl_give isl_union_pw_qpolynomial *
5423 isl_union_pw_qpolynomial_drop_dims(
5424 __isl_take isl_union_pw_qpolynomial *upwqp,
5425 enum isl_dim_type type,
5426 unsigned first, unsigned n);
5427 __isl_give isl_union_pw_qpolynomial_fold *
5428 isl_union_pw_qpolynomial_fold_drop_dims(
5429 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5430 enum isl_dim_type type,
5431 unsigned first, unsigned n);
5433 The operations on union expressions can only manipulate parameters.
5437 =head2 Binary Operations
5439 The two arguments of a binary operation not only need to live
5440 in the same C<isl_ctx>, they currently also need to have
5441 the same (number of) parameters.
5443 =head3 Basic Operations
5447 =item * Intersection
5449 #include <isl/local_space.h>
5450 __isl_give isl_local_space *isl_local_space_intersect(
5451 __isl_take isl_local_space *ls1,
5452 __isl_take isl_local_space *ls2);
5454 #include <isl/set.h>
5455 __isl_give isl_basic_set *isl_basic_set_intersect_params(
5456 __isl_take isl_basic_set *bset1,
5457 __isl_take isl_basic_set *bset2);
5458 __isl_give isl_basic_set *isl_basic_set_intersect(
5459 __isl_take isl_basic_set *bset1,
5460 __isl_take isl_basic_set *bset2);
5461 __isl_give isl_basic_set *isl_basic_set_list_intersect(
5462 __isl_take struct isl_basic_set_list *list);
5463 __isl_give isl_set *isl_set_intersect_params(
5464 __isl_take isl_set *set,
5465 __isl_take isl_set *params);
5466 __isl_give isl_set *isl_set_intersect(
5467 __isl_take isl_set *set1,
5468 __isl_take isl_set *set2);
5470 #include <isl/map.h>
5471 __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5472 __isl_take isl_basic_map *bmap,
5473 __isl_take isl_basic_set *bset);
5474 __isl_give isl_basic_map *isl_basic_map_intersect_range(
5475 __isl_take isl_basic_map *bmap,
5476 __isl_take isl_basic_set *bset);
5477 __isl_give isl_basic_map *isl_basic_map_intersect(
5478 __isl_take isl_basic_map *bmap1,
5479 __isl_take isl_basic_map *bmap2);
5480 __isl_give isl_basic_map *isl_basic_map_list_intersect(
5481 __isl_take isl_basic_map_list *list);
5482 __isl_give isl_map *isl_map_intersect_params(
5483 __isl_take isl_map *map,
5484 __isl_take isl_set *params);
5485 __isl_give isl_map *isl_map_intersect_domain(
5486 __isl_take isl_map *map,
5487 __isl_take isl_set *set);
5488 __isl_give isl_map *isl_map_intersect_range(
5489 __isl_take isl_map *map,
5490 __isl_take isl_set *set);
5491 __isl_give isl_map *isl_map_intersect(
5492 __isl_take isl_map *map1,
5493 __isl_take isl_map *map2);
5495 #include <isl/union_set.h>
5496 __isl_give isl_union_set *isl_union_set_intersect_params(
5497 __isl_take isl_union_set *uset,
5498 __isl_take isl_set *set);
5499 __isl_give isl_union_set *isl_union_set_intersect(
5500 __isl_take isl_union_set *uset1,
5501 __isl_take isl_union_set *uset2);
5503 #include <isl/union_map.h>
5504 __isl_give isl_union_map *isl_union_map_intersect_params(
5505 __isl_take isl_union_map *umap,
5506 __isl_take isl_set *set);
5507 __isl_give isl_union_map *isl_union_map_intersect_domain(
5508 __isl_take isl_union_map *umap,
5509 __isl_take isl_union_set *uset);
5510 __isl_give isl_union_map *isl_union_map_intersect_range(
5511 __isl_take isl_union_map *umap,
5512 __isl_take isl_union_set *uset);
5513 __isl_give isl_union_map *isl_union_map_intersect(
5514 __isl_take isl_union_map *umap1,
5515 __isl_take isl_union_map *umap2);
5517 #include <isl/aff.h>
5518 __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5519 __isl_take isl_pw_aff *pa,
5520 __isl_take isl_set *set);
5521 __isl_give isl_multi_pw_aff *
5522 isl_multi_pw_aff_intersect_domain(
5523 __isl_take isl_multi_pw_aff *mpa,
5524 __isl_take isl_set *domain);
5525 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5526 __isl_take isl_pw_multi_aff *pma,
5527 __isl_take isl_set *set);
5528 __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5529 __isl_take isl_union_pw_aff *upa,
5530 __isl_take isl_union_set *uset);
5531 __isl_give isl_union_pw_multi_aff *
5532 isl_union_pw_multi_aff_intersect_domain(
5533 __isl_take isl_union_pw_multi_aff *upma,
5534 __isl_take isl_union_set *uset);
5535 __isl_give isl_multi_union_pw_aff *
5536 isl_multi_union_pw_aff_intersect_domain(
5537 __isl_take isl_multi_union_pw_aff *mupa,
5538 __isl_take isl_union_set *uset);
5539 __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5540 __isl_take isl_pw_aff *pa,
5541 __isl_take isl_set *set);
5542 __isl_give isl_multi_pw_aff *
5543 isl_multi_pw_aff_intersect_params(
5544 __isl_take isl_multi_pw_aff *mpa,
5545 __isl_take isl_set *set);
5546 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5547 __isl_take isl_pw_multi_aff *pma,
5548 __isl_take isl_set *set);
5549 __isl_give isl_union_pw_aff *
5550 isl_union_pw_aff_intersect_params(
5551 __isl_take isl_union_pw_aff *upa,
5552 __isl_give isl_union_pw_multi_aff *
5553 isl_union_pw_multi_aff_intersect_params(
5554 __isl_take isl_union_pw_multi_aff *upma,
5555 __isl_take isl_set *set);
5556 __isl_give isl_multi_union_pw_aff *
5557 isl_multi_union_pw_aff_intersect_params(
5558 __isl_take isl_multi_union_pw_aff *mupa,
5559 __isl_take isl_set *params);
5560 isl_multi_union_pw_aff_intersect_range(
5561 __isl_take isl_multi_union_pw_aff *mupa,
5562 __isl_take isl_set *set);
5564 #include <isl/polynomial.h>
5565 __isl_give isl_pw_qpolynomial *
5566 isl_pw_qpolynomial_intersect_domain(
5567 __isl_take isl_pw_qpolynomial *pwpq,
5568 __isl_take isl_set *set);
5569 __isl_give isl_union_pw_qpolynomial *
5570 isl_union_pw_qpolynomial_intersect_domain(
5571 __isl_take isl_union_pw_qpolynomial *upwpq,
5572 __isl_take isl_union_set *uset);
5573 __isl_give isl_union_pw_qpolynomial_fold *
5574 isl_union_pw_qpolynomial_fold_intersect_domain(
5575 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5576 __isl_take isl_union_set *uset);
5577 __isl_give isl_pw_qpolynomial *
5578 isl_pw_qpolynomial_intersect_params(
5579 __isl_take isl_pw_qpolynomial *pwpq,
5580 __isl_take isl_set *set);
5581 __isl_give isl_pw_qpolynomial_fold *
5582 isl_pw_qpolynomial_fold_intersect_params(
5583 __isl_take isl_pw_qpolynomial_fold *pwf,
5584 __isl_take isl_set *set);
5585 __isl_give isl_union_pw_qpolynomial *
5586 isl_union_pw_qpolynomial_intersect_params(
5587 __isl_take isl_union_pw_qpolynomial *upwpq,
5588 __isl_take isl_set *set);
5589 __isl_give isl_union_pw_qpolynomial_fold *
5590 isl_union_pw_qpolynomial_fold_intersect_params(
5591 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5592 __isl_take isl_set *set);
5594 The second argument to the C<_params> functions needs to be
5595 a parametric (basic) set. For the other functions, a parametric set
5596 for either argument is only allowed if the other argument is
5597 a parametric set as well.
5598 The list passed to C<isl_basic_set_list_intersect> needs to have
5599 at least one element and all elements need to live in the same space.
5600 The function C<isl_multi_union_pw_aff_intersect_range>
5601 restricts the input function to those shared domain elements
5602 that map to the specified range.
5606 #include <isl/set.h>
5607 __isl_give isl_set *isl_basic_set_union(
5608 __isl_take isl_basic_set *bset1,
5609 __isl_take isl_basic_set *bset2);
5610 __isl_give isl_set *isl_set_union(
5611 __isl_take isl_set *set1,
5612 __isl_take isl_set *set2);
5614 #include <isl/map.h>
5615 __isl_give isl_map *isl_basic_map_union(
5616 __isl_take isl_basic_map *bmap1,
5617 __isl_take isl_basic_map *bmap2);
5618 __isl_give isl_map *isl_map_union(
5619 __isl_take isl_map *map1,
5620 __isl_take isl_map *map2);
5622 #include <isl/union_set.h>
5623 __isl_give isl_union_set *isl_union_set_union(
5624 __isl_take isl_union_set *uset1,
5625 __isl_take isl_union_set *uset2);
5626 __isl_give isl_union_set *isl_union_set_list_union(
5627 __isl_take isl_union_set_list *list);
5629 #include <isl/union_map.h>
5630 __isl_give isl_union_map *isl_union_map_union(
5631 __isl_take isl_union_map *umap1,
5632 __isl_take isl_union_map *umap2);
5634 =item * Set difference
5636 #include <isl/set.h>
5637 __isl_give isl_set *isl_set_subtract(
5638 __isl_take isl_set *set1,
5639 __isl_take isl_set *set2);
5641 #include <isl/map.h>
5642 __isl_give isl_map *isl_map_subtract(
5643 __isl_take isl_map *map1,
5644 __isl_take isl_map *map2);
5645 __isl_give isl_map *isl_map_subtract_domain(
5646 __isl_take isl_map *map,
5647 __isl_take isl_set *dom);
5648 __isl_give isl_map *isl_map_subtract_range(
5649 __isl_take isl_map *map,
5650 __isl_take isl_set *dom);
5652 #include <isl/union_set.h>
5653 __isl_give isl_union_set *isl_union_set_subtract(
5654 __isl_take isl_union_set *uset1,
5655 __isl_take isl_union_set *uset2);
5657 #include <isl/union_map.h>
5658 __isl_give isl_union_map *isl_union_map_subtract(
5659 __isl_take isl_union_map *umap1,
5660 __isl_take isl_union_map *umap2);
5661 __isl_give isl_union_map *isl_union_map_subtract_domain(
5662 __isl_take isl_union_map *umap,
5663 __isl_take isl_union_set *dom);
5664 __isl_give isl_union_map *isl_union_map_subtract_range(
5665 __isl_take isl_union_map *umap,
5666 __isl_take isl_union_set *dom);
5668 #include <isl/aff.h>
5669 __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5670 __isl_take isl_pw_aff *pa,
5671 __isl_take isl_set *set);
5672 __isl_give isl_pw_multi_aff *
5673 isl_pw_multi_aff_subtract_domain(
5674 __isl_take isl_pw_multi_aff *pma,
5675 __isl_take isl_set *set);
5676 __isl_give isl_union_pw_aff *
5677 isl_union_pw_aff_subtract_domain(
5678 __isl_take isl_union_pw_aff *upa,
5679 __isl_take isl_union_set *uset);
5680 __isl_give isl_union_pw_multi_aff *
5681 isl_union_pw_multi_aff_subtract_domain(
5682 __isl_take isl_union_pw_multi_aff *upma,
5683 __isl_take isl_set *set);
5685 #include <isl/polynomial.h>
5686 __isl_give isl_pw_qpolynomial *
5687 isl_pw_qpolynomial_subtract_domain(
5688 __isl_take isl_pw_qpolynomial *pwpq,
5689 __isl_take isl_set *set);
5690 __isl_give isl_pw_qpolynomial_fold *
5691 isl_pw_qpolynomial_fold_subtract_domain(
5692 __isl_take isl_pw_qpolynomial_fold *pwf,
5693 __isl_take isl_set *set);
5694 __isl_give isl_union_pw_qpolynomial *
5695 isl_union_pw_qpolynomial_subtract_domain(
5696 __isl_take isl_union_pw_qpolynomial *upwpq,
5697 __isl_take isl_union_set *uset);
5698 __isl_give isl_union_pw_qpolynomial_fold *
5699 isl_union_pw_qpolynomial_fold_subtract_domain(
5700 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5701 __isl_take isl_union_set *uset);
5705 #include <isl/space.h>
5706 __isl_give isl_space *isl_space_join(
5707 __isl_take isl_space *left,
5708 __isl_take isl_space *right);
5710 #include <isl/map.h>
5711 __isl_give isl_basic_set *isl_basic_set_apply(
5712 __isl_take isl_basic_set *bset,
5713 __isl_take isl_basic_map *bmap);
5714 __isl_give isl_set *isl_set_apply(
5715 __isl_take isl_set *set,
5716 __isl_take isl_map *map);
5717 __isl_give isl_union_set *isl_union_set_apply(
5718 __isl_take isl_union_set *uset,
5719 __isl_take isl_union_map *umap);
5720 __isl_give isl_basic_map *isl_basic_map_apply_domain(
5721 __isl_take isl_basic_map *bmap1,
5722 __isl_take isl_basic_map *bmap2);
5723 __isl_give isl_basic_map *isl_basic_map_apply_range(
5724 __isl_take isl_basic_map *bmap1,
5725 __isl_take isl_basic_map *bmap2);
5726 __isl_give isl_map *isl_map_apply_domain(
5727 __isl_take isl_map *map1,
5728 __isl_take isl_map *map2);
5729 __isl_give isl_map *isl_map_apply_range(
5730 __isl_take isl_map *map1,
5731 __isl_take isl_map *map2);
5733 #include <isl/union_map.h>
5734 __isl_give isl_union_map *isl_union_map_apply_domain(
5735 __isl_take isl_union_map *umap1,
5736 __isl_take isl_union_map *umap2);
5737 __isl_give isl_union_map *isl_union_map_apply_range(
5738 __isl_take isl_union_map *umap1,
5739 __isl_take isl_union_map *umap2);
5741 #include <isl/aff.h>
5742 __isl_give isl_union_pw_aff *
5743 isl_multi_union_pw_aff_apply_aff(
5744 __isl_take isl_multi_union_pw_aff *mupa,
5745 __isl_take isl_aff *aff);
5746 __isl_give isl_union_pw_aff *
5747 isl_multi_union_pw_aff_apply_pw_aff(
5748 __isl_take isl_multi_union_pw_aff *mupa,
5749 __isl_take isl_pw_aff *pa);
5750 __isl_give isl_multi_union_pw_aff *
5751 isl_multi_union_pw_aff_apply_multi_aff(
5752 __isl_take isl_multi_union_pw_aff *mupa,
5753 __isl_take isl_multi_aff *ma);
5754 __isl_give isl_multi_union_pw_aff *
5755 isl_multi_union_pw_aff_apply_pw_multi_aff(
5756 __isl_take isl_multi_union_pw_aff *mupa,
5757 __isl_take isl_pw_multi_aff *pma);
5759 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
5760 over the shared domain of the elements of the input. The dimension is
5761 required to be greater than zero.
5762 The C<isl_multi_union_pw_aff> argument of
5763 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
5764 but only if the range of the C<isl_multi_aff> argument
5765 is also zero-dimensional.
5766 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
5768 #include <isl/polynomial.h>
5769 __isl_give isl_pw_qpolynomial_fold *
5770 isl_set_apply_pw_qpolynomial_fold(
5771 __isl_take isl_set *set,
5772 __isl_take isl_pw_qpolynomial_fold *pwf,
5774 __isl_give isl_pw_qpolynomial_fold *
5775 isl_map_apply_pw_qpolynomial_fold(
5776 __isl_take isl_map *map,
5777 __isl_take isl_pw_qpolynomial_fold *pwf,
5779 __isl_give isl_union_pw_qpolynomial_fold *
5780 isl_union_set_apply_union_pw_qpolynomial_fold(
5781 __isl_take isl_union_set *uset,
5782 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5784 __isl_give isl_union_pw_qpolynomial_fold *
5785 isl_union_map_apply_union_pw_qpolynomial_fold(
5786 __isl_take isl_union_map *umap,
5787 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5790 The functions taking a map
5791 compose the given map with the given piecewise quasipolynomial reduction.
5792 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
5793 over all elements in the intersection of the range of the map
5794 and the domain of the piecewise quasipolynomial reduction
5795 as a function of an element in the domain of the map.
5796 The functions taking a set compute a bound over all elements in the
5797 intersection of the set and the domain of the
5798 piecewise quasipolynomial reduction.
5802 #include <isl/set.h>
5803 __isl_give isl_basic_set *
5804 isl_basic_set_preimage_multi_aff(
5805 __isl_take isl_basic_set *bset,
5806 __isl_take isl_multi_aff *ma);
5807 __isl_give isl_set *isl_set_preimage_multi_aff(
5808 __isl_take isl_set *set,
5809 __isl_take isl_multi_aff *ma);
5810 __isl_give isl_set *isl_set_preimage_pw_multi_aff(
5811 __isl_take isl_set *set,
5812 __isl_take isl_pw_multi_aff *pma);
5813 __isl_give isl_set *isl_set_preimage_multi_pw_aff(
5814 __isl_take isl_set *set,
5815 __isl_take isl_multi_pw_aff *mpa);
5817 #include <isl/union_set.h>
5818 __isl_give isl_union_set *
5819 isl_union_set_preimage_multi_aff(
5820 __isl_take isl_union_set *uset,
5821 __isl_take isl_multi_aff *ma);
5822 __isl_give isl_union_set *
5823 isl_union_set_preimage_pw_multi_aff(
5824 __isl_take isl_union_set *uset,
5825 __isl_take isl_pw_multi_aff *pma);
5826 __isl_give isl_union_set *
5827 isl_union_set_preimage_union_pw_multi_aff(
5828 __isl_take isl_union_set *uset,
5829 __isl_take isl_union_pw_multi_aff *upma);
5831 #include <isl/map.h>
5832 __isl_give isl_basic_map *
5833 isl_basic_map_preimage_domain_multi_aff(
5834 __isl_take isl_basic_map *bmap,
5835 __isl_take isl_multi_aff *ma);
5836 __isl_give isl_map *isl_map_preimage_domain_multi_aff(
5837 __isl_take isl_map *map,
5838 __isl_take isl_multi_aff *ma);
5839 __isl_give isl_map *isl_map_preimage_range_multi_aff(
5840 __isl_take isl_map *map,
5841 __isl_take isl_multi_aff *ma);
5842 __isl_give isl_map *
5843 isl_map_preimage_domain_pw_multi_aff(
5844 __isl_take isl_map *map,
5845 __isl_take isl_pw_multi_aff *pma);
5846 __isl_give isl_map *
5847 isl_map_preimage_range_pw_multi_aff(
5848 __isl_take isl_map *map,
5849 __isl_take isl_pw_multi_aff *pma);
5850 __isl_give isl_map *
5851 isl_map_preimage_domain_multi_pw_aff(
5852 __isl_take isl_map *map,
5853 __isl_take isl_multi_pw_aff *mpa);
5854 __isl_give isl_basic_map *
5855 isl_basic_map_preimage_range_multi_aff(
5856 __isl_take isl_basic_map *bmap,
5857 __isl_take isl_multi_aff *ma);
5859 #include <isl/union_map.h>
5860 __isl_give isl_union_map *
5861 isl_union_map_preimage_domain_multi_aff(
5862 __isl_take isl_union_map *umap,
5863 __isl_take isl_multi_aff *ma);
5864 __isl_give isl_union_map *
5865 isl_union_map_preimage_range_multi_aff(
5866 __isl_take isl_union_map *umap,
5867 __isl_take isl_multi_aff *ma);
5868 __isl_give isl_union_map *
5869 isl_union_map_preimage_domain_pw_multi_aff(
5870 __isl_take isl_union_map *umap,
5871 __isl_take isl_pw_multi_aff *pma);
5872 __isl_give isl_union_map *
5873 isl_union_map_preimage_range_pw_multi_aff(
5874 __isl_take isl_union_map *umap,
5875 __isl_take isl_pw_multi_aff *pma);
5876 __isl_give isl_union_map *
5877 isl_union_map_preimage_domain_union_pw_multi_aff(
5878 __isl_take isl_union_map *umap,
5879 __isl_take isl_union_pw_multi_aff *upma);
5880 __isl_give isl_union_map *
5881 isl_union_map_preimage_range_union_pw_multi_aff(
5882 __isl_take isl_union_map *umap,
5883 __isl_take isl_union_pw_multi_aff *upma);
5885 These functions compute the preimage of the given set or map domain/range under
5886 the given function. In other words, the expression is plugged
5887 into the set description or into the domain/range of the map.
5891 #include <isl/aff.h>
5892 __isl_give isl_aff *isl_aff_pullback_aff(
5893 __isl_take isl_aff *aff1,
5894 __isl_take isl_aff *aff2);
5895 __isl_give isl_aff *isl_aff_pullback_multi_aff(
5896 __isl_take isl_aff *aff,
5897 __isl_take isl_multi_aff *ma);
5898 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
5899 __isl_take isl_pw_aff *pa,
5900 __isl_take isl_multi_aff *ma);
5901 __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
5902 __isl_take isl_pw_aff *pa,
5903 __isl_take isl_pw_multi_aff *pma);
5904 __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
5905 __isl_take isl_pw_aff *pa,
5906 __isl_take isl_multi_pw_aff *mpa);
5907 __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
5908 __isl_take isl_multi_aff *ma1,
5909 __isl_take isl_multi_aff *ma2);
5910 __isl_give isl_pw_multi_aff *
5911 isl_pw_multi_aff_pullback_multi_aff(
5912 __isl_take isl_pw_multi_aff *pma,
5913 __isl_take isl_multi_aff *ma);
5914 __isl_give isl_multi_pw_aff *
5915 isl_multi_pw_aff_pullback_multi_aff(
5916 __isl_take isl_multi_pw_aff *mpa,
5917 __isl_take isl_multi_aff *ma);
5918 __isl_give isl_pw_multi_aff *
5919 isl_pw_multi_aff_pullback_pw_multi_aff(
5920 __isl_take isl_pw_multi_aff *pma1,
5921 __isl_take isl_pw_multi_aff *pma2);
5922 __isl_give isl_multi_pw_aff *
5923 isl_multi_pw_aff_pullback_pw_multi_aff(
5924 __isl_take isl_multi_pw_aff *mpa,
5925 __isl_take isl_pw_multi_aff *pma);
5926 __isl_give isl_multi_pw_aff *
5927 isl_multi_pw_aff_pullback_multi_pw_aff(
5928 __isl_take isl_multi_pw_aff *mpa1,
5929 __isl_take isl_multi_pw_aff *mpa2);
5930 __isl_give isl_union_pw_aff *
5931 isl_union_pw_aff_pullback_union_pw_multi_aff(
5932 __isl_take isl_union_pw_aff *upa,
5933 __isl_take isl_union_pw_multi_aff *upma);
5934 __isl_give isl_union_pw_multi_aff *
5935 isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
5936 __isl_take isl_union_pw_multi_aff *upma1,
5937 __isl_take isl_union_pw_multi_aff *upma2);
5938 __isl_give isl_multi_union_pw_aff *
5939 isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
5940 __isl_take isl_multi_union_pw_aff *mupa,
5941 __isl_take isl_union_pw_multi_aff *upma);
5943 These functions precompose the first expression by the second function.
5944 In other words, the second function is plugged
5945 into the first expression.
5949 #include <isl/aff.h>
5950 __isl_give isl_basic_set *isl_aff_le_basic_set(
5951 __isl_take isl_aff *aff1,
5952 __isl_take isl_aff *aff2);
5953 __isl_give isl_basic_set *isl_aff_ge_basic_set(
5954 __isl_take isl_aff *aff1,
5955 __isl_take isl_aff *aff2);
5956 __isl_give isl_set *isl_pw_aff_eq_set(
5957 __isl_take isl_pw_aff *pwaff1,
5958 __isl_take isl_pw_aff *pwaff2);
5959 __isl_give isl_set *isl_pw_aff_ne_set(
5960 __isl_take isl_pw_aff *pwaff1,
5961 __isl_take isl_pw_aff *pwaff2);
5962 __isl_give isl_set *isl_pw_aff_le_set(
5963 __isl_take isl_pw_aff *pwaff1,
5964 __isl_take isl_pw_aff *pwaff2);
5965 __isl_give isl_set *isl_pw_aff_lt_set(
5966 __isl_take isl_pw_aff *pwaff1,
5967 __isl_take isl_pw_aff *pwaff2);
5968 __isl_give isl_set *isl_pw_aff_ge_set(
5969 __isl_take isl_pw_aff *pwaff1,
5970 __isl_take isl_pw_aff *pwaff2);
5971 __isl_give isl_set *isl_pw_aff_gt_set(
5972 __isl_take isl_pw_aff *pwaff1,
5973 __isl_take isl_pw_aff *pwaff2);
5975 __isl_give isl_set *isl_multi_aff_lex_le_set(
5976 __isl_take isl_multi_aff *ma1,
5977 __isl_take isl_multi_aff *ma2);
5978 __isl_give isl_set *isl_multi_aff_lex_ge_set(
5979 __isl_take isl_multi_aff *ma1,
5980 __isl_take isl_multi_aff *ma2);
5982 __isl_give isl_set *isl_pw_aff_list_eq_set(
5983 __isl_take isl_pw_aff_list *list1,
5984 __isl_take isl_pw_aff_list *list2);
5985 __isl_give isl_set *isl_pw_aff_list_ne_set(
5986 __isl_take isl_pw_aff_list *list1,
5987 __isl_take isl_pw_aff_list *list2);
5988 __isl_give isl_set *isl_pw_aff_list_le_set(
5989 __isl_take isl_pw_aff_list *list1,
5990 __isl_take isl_pw_aff_list *list2);
5991 __isl_give isl_set *isl_pw_aff_list_lt_set(
5992 __isl_take isl_pw_aff_list *list1,
5993 __isl_take isl_pw_aff_list *list2);
5994 __isl_give isl_set *isl_pw_aff_list_ge_set(
5995 __isl_take isl_pw_aff_list *list1,
5996 __isl_take isl_pw_aff_list *list2);
5997 __isl_give isl_set *isl_pw_aff_list_gt_set(
5998 __isl_take isl_pw_aff_list *list1,
5999 __isl_take isl_pw_aff_list *list2);
6001 The function C<isl_aff_ge_basic_set> returns a basic set
6002 containing those elements in the shared space
6003 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
6004 The function C<isl_pw_aff_ge_set> returns a set
6005 containing those elements in the shared domain
6006 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
6007 greater than or equal to C<pwaff2>.
6008 The function C<isl_multi_aff_lex_le_set> returns a set
6009 containing those elements in the shared domain space
6010 where C<ma1> is lexicographically smaller than or
6012 The functions operating on C<isl_pw_aff_list> apply the corresponding
6013 C<isl_pw_aff> function to each pair of elements in the two lists.
6015 #include <isl/aff.h>
6016 __isl_give isl_map *isl_pw_aff_eq_map(
6017 __isl_take isl_pw_aff *pa1,
6018 __isl_take isl_pw_aff *pa2);
6019 __isl_give isl_map *isl_pw_aff_lt_map(
6020 __isl_take isl_pw_aff *pa1,
6021 __isl_take isl_pw_aff *pa2);
6022 __isl_give isl_map *isl_pw_aff_gt_map(
6023 __isl_take isl_pw_aff *pa1,
6024 __isl_take isl_pw_aff *pa2);
6026 __isl_give isl_map *isl_multi_pw_aff_eq_map(
6027 __isl_take isl_multi_pw_aff *mpa1,
6028 __isl_take isl_multi_pw_aff *mpa2);
6029 __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
6030 __isl_take isl_multi_pw_aff *mpa1,
6031 __isl_take isl_multi_pw_aff *mpa2);
6032 __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
6033 __isl_take isl_multi_pw_aff *mpa1,
6034 __isl_take isl_multi_pw_aff *mpa2);
6036 These functions return a map between domain elements of the arguments
6037 where the function values satisfy the given relation.
6039 #include <isl/union_map.h>
6040 __isl_give isl_union_map *
6041 isl_union_map_eq_at_multi_union_pw_aff(
6042 __isl_take isl_union_map *umap,
6043 __isl_take isl_multi_union_pw_aff *mupa);
6044 __isl_give isl_union_map *
6045 isl_union_map_lex_lt_at_multi_union_pw_aff(
6046 __isl_take isl_union_map *umap,
6047 __isl_take isl_multi_union_pw_aff *mupa);
6048 __isl_give isl_union_map *
6049 isl_union_map_lex_gt_at_multi_union_pw_aff(
6050 __isl_take isl_union_map *umap,
6051 __isl_take isl_multi_union_pw_aff *mupa);
6053 These functions select the subset of elements in the union map
6054 that have an equal or lexicographically smaller function value.
6056 =item * Cartesian Product
6058 #include <isl/space.h>
6059 __isl_give isl_space *isl_space_product(
6060 __isl_take isl_space *space1,
6061 __isl_take isl_space *space2);
6062 __isl_give isl_space *isl_space_domain_product(
6063 __isl_take isl_space *space1,
6064 __isl_take isl_space *space2);
6065 __isl_give isl_space *isl_space_range_product(
6066 __isl_take isl_space *space1,
6067 __isl_take isl_space *space2);
6070 C<isl_space_product>, C<isl_space_domain_product>
6071 and C<isl_space_range_product> take pairs or relation spaces and
6072 produce a single relations space, where either the domain, the range
6073 or both domain and range are wrapped spaces of relations between
6074 the domains and/or ranges of the input spaces.
6075 If the product is only constructed over the domain or the range
6076 then the ranges or the domains of the inputs should be the same.
6077 The function C<isl_space_product> also accepts a pair of set spaces,
6078 in which case it returns a wrapped space of a relation between the
6081 #include <isl/set.h>
6082 __isl_give isl_set *isl_set_product(
6083 __isl_take isl_set *set1,
6084 __isl_take isl_set *set2);
6086 #include <isl/map.h>
6087 __isl_give isl_basic_map *isl_basic_map_domain_product(
6088 __isl_take isl_basic_map *bmap1,
6089 __isl_take isl_basic_map *bmap2);
6090 __isl_give isl_basic_map *isl_basic_map_range_product(
6091 __isl_take isl_basic_map *bmap1,
6092 __isl_take isl_basic_map *bmap2);
6093 __isl_give isl_basic_map *isl_basic_map_product(
6094 __isl_take isl_basic_map *bmap1,
6095 __isl_take isl_basic_map *bmap2);
6096 __isl_give isl_map *isl_map_domain_product(
6097 __isl_take isl_map *map1,
6098 __isl_take isl_map *map2);
6099 __isl_give isl_map *isl_map_range_product(
6100 __isl_take isl_map *map1,
6101 __isl_take isl_map *map2);
6102 __isl_give isl_map *isl_map_product(
6103 __isl_take isl_map *map1,
6104 __isl_take isl_map *map2);
6106 #include <isl/union_set.h>
6107 __isl_give isl_union_set *isl_union_set_product(
6108 __isl_take isl_union_set *uset1,
6109 __isl_take isl_union_set *uset2);
6111 #include <isl/union_map.h>
6112 __isl_give isl_union_map *isl_union_map_domain_product(
6113 __isl_take isl_union_map *umap1,
6114 __isl_take isl_union_map *umap2);
6115 __isl_give isl_union_map *isl_union_map_range_product(
6116 __isl_take isl_union_map *umap1,
6117 __isl_take isl_union_map *umap2);
6118 __isl_give isl_union_map *isl_union_map_product(
6119 __isl_take isl_union_map *umap1,
6120 __isl_take isl_union_map *umap2);
6122 #include <isl/val.h>
6123 __isl_give isl_multi_val *isl_multi_val_range_product(
6124 __isl_take isl_multi_val *mv1,
6125 __isl_take isl_multi_val *mv2);
6126 __isl_give isl_multi_val *isl_multi_val_product(
6127 __isl_take isl_multi_val *mv1,
6128 __isl_take isl_multi_val *mv2);
6130 #include <isl/aff.h>
6131 __isl_give isl_multi_aff *isl_multi_aff_range_product(
6132 __isl_take isl_multi_aff *ma1,
6133 __isl_take isl_multi_aff *ma2);
6134 __isl_give isl_multi_aff *isl_multi_aff_product(
6135 __isl_take isl_multi_aff *ma1,
6136 __isl_take isl_multi_aff *ma2);
6137 __isl_give isl_multi_pw_aff *
6138 isl_multi_pw_aff_range_product(
6139 __isl_take isl_multi_pw_aff *mpa1,
6140 __isl_take isl_multi_pw_aff *mpa2);
6141 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6142 __isl_take isl_multi_pw_aff *mpa1,
6143 __isl_take isl_multi_pw_aff *mpa2);
6144 __isl_give isl_pw_multi_aff *
6145 isl_pw_multi_aff_range_product(
6146 __isl_take isl_pw_multi_aff *pma1,
6147 __isl_take isl_pw_multi_aff *pma2);
6148 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6149 __isl_take isl_pw_multi_aff *pma1,
6150 __isl_take isl_pw_multi_aff *pma2);
6151 __isl_give isl_multi_union_pw_aff *
6152 isl_multi_union_pw_aff_range_product(
6153 __isl_take isl_multi_union_pw_aff *mupa1,
6154 __isl_take isl_multi_union_pw_aff *mupa2);
6156 The above functions compute the cross product of the given
6157 sets, relations or functions. The domains and ranges of the results
6158 are wrapped maps between domains and ranges of the inputs.
6159 To obtain a ``flat'' product, use the following functions
6162 #include <isl/set.h>
6163 __isl_give isl_basic_set *isl_basic_set_flat_product(
6164 __isl_take isl_basic_set *bset1,
6165 __isl_take isl_basic_set *bset2);
6166 __isl_give isl_set *isl_set_flat_product(
6167 __isl_take isl_set *set1,
6168 __isl_take isl_set *set2);
6170 #include <isl/map.h>
6171 __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6172 __isl_take isl_basic_map *bmap1,
6173 __isl_take isl_basic_map *bmap2);
6174 __isl_give isl_map *isl_map_flat_domain_product(
6175 __isl_take isl_map *map1,
6176 __isl_take isl_map *map2);
6177 __isl_give isl_map *isl_map_flat_range_product(
6178 __isl_take isl_map *map1,
6179 __isl_take isl_map *map2);
6180 __isl_give isl_basic_map *isl_basic_map_flat_product(
6181 __isl_take isl_basic_map *bmap1,
6182 __isl_take isl_basic_map *bmap2);
6183 __isl_give isl_map *isl_map_flat_product(
6184 __isl_take isl_map *map1,
6185 __isl_take isl_map *map2);
6187 #include <isl/union_map.h>
6188 __isl_give isl_union_map *
6189 isl_union_map_flat_domain_product(
6190 __isl_take isl_union_map *umap1,
6191 __isl_take isl_union_map *umap2);
6192 __isl_give isl_union_map *
6193 isl_union_map_flat_range_product(
6194 __isl_take isl_union_map *umap1,
6195 __isl_take isl_union_map *umap2);
6197 #include <isl/val.h>
6198 __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6199 __isl_take isl_multi_val *mv1,
6200 __isl_take isl_multi_aff *mv2);
6202 #include <isl/aff.h>
6203 __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6204 __isl_take isl_multi_aff *ma1,
6205 __isl_take isl_multi_aff *ma2);
6206 __isl_give isl_pw_multi_aff *
6207 isl_pw_multi_aff_flat_range_product(
6208 __isl_take isl_pw_multi_aff *pma1,
6209 __isl_take isl_pw_multi_aff *pma2);
6210 __isl_give isl_multi_pw_aff *
6211 isl_multi_pw_aff_flat_range_product(
6212 __isl_take isl_multi_pw_aff *mpa1,
6213 __isl_take isl_multi_pw_aff *mpa2);
6214 __isl_give isl_union_pw_multi_aff *
6215 isl_union_pw_multi_aff_flat_range_product(
6216 __isl_take isl_union_pw_multi_aff *upma1,
6217 __isl_take isl_union_pw_multi_aff *upma2);
6218 __isl_give isl_multi_union_pw_aff *
6219 isl_multi_union_pw_aff_flat_range_product(
6220 __isl_take isl_multi_union_pw_aff *mupa1,
6221 __isl_take isl_multi_union_pw_aff *mupa2);
6223 #include <isl/space.h>
6224 __isl_give isl_space *isl_space_factor_domain(
6225 __isl_take isl_space *space);
6226 __isl_give isl_space *isl_space_factor_range(
6227 __isl_take isl_space *space);
6228 __isl_give isl_space *isl_space_domain_factor_domain(
6229 __isl_take isl_space *space);
6230 __isl_give isl_space *isl_space_domain_factor_range(
6231 __isl_take isl_space *space);
6232 __isl_give isl_space *isl_space_range_factor_domain(
6233 __isl_take isl_space *space);
6234 __isl_give isl_space *isl_space_range_factor_range(
6235 __isl_take isl_space *space);
6237 The functions C<isl_space_range_factor_domain> and
6238 C<isl_space_range_factor_range> extract the two arguments from
6239 the result of a call to C<isl_space_range_product>.
6241 The arguments of a call to C<isl_map_range_product> can be extracted
6242 from the result using the following functions.
6244 #include <isl/map.h>
6245 __isl_give isl_map *isl_map_factor_domain(
6246 __isl_take isl_map *map);
6247 __isl_give isl_map *isl_map_factor_range(
6248 __isl_take isl_map *map);
6249 __isl_give isl_map *isl_map_domain_factor_domain(
6250 __isl_take isl_map *map);
6251 __isl_give isl_map *isl_map_domain_factor_range(
6252 __isl_take isl_map *map);
6253 __isl_give isl_map *isl_map_range_factor_domain(
6254 __isl_take isl_map *map);
6255 __isl_give isl_map *isl_map_range_factor_range(
6256 __isl_take isl_map *map);
6258 #include <isl/union_map.h>
6259 __isl_give isl_union_map *isl_union_map_factor_domain(
6260 __isl_take isl_union_map *umap);
6261 __isl_give isl_union_map *isl_union_map_factor_range(
6262 __isl_take isl_union_map *umap);
6263 __isl_give isl_union_map *
6264 isl_union_map_domain_factor_domain(
6265 __isl_take isl_union_map *umap);
6266 __isl_give isl_union_map *
6267 isl_union_map_domain_factor_range(
6268 __isl_take isl_union_map *umap);
6269 __isl_give isl_union_map *
6270 isl_union_map_range_factor_range(
6271 __isl_take isl_union_map *umap);
6273 #include <isl/val.h>
6274 __isl_give isl_multi_val *
6275 isl_multi_val_range_factor_domain(
6276 __isl_take isl_multi_val *mv);
6277 __isl_give isl_multi_val *
6278 isl_multi_val_range_factor_range(
6279 __isl_take isl_multi_val *mv);
6281 #include <isl/aff.h>
6282 __isl_give isl_multi_aff *
6283 isl_multi_aff_range_factor_domain(
6284 __isl_take isl_multi_aff *ma);
6285 __isl_give isl_multi_aff *
6286 isl_multi_aff_range_factor_range(
6287 __isl_take isl_multi_aff *ma);
6288 __isl_give isl_multi_pw_aff *
6289 isl_multi_pw_aff_range_factor_domain(
6290 __isl_take isl_multi_pw_aff *mpa);
6291 __isl_give isl_multi_pw_aff *
6292 isl_multi_pw_aff_range_factor_range(
6293 __isl_take isl_multi_pw_aff *mpa);
6294 __isl_give isl_multi_union_pw_aff *
6295 isl_multi_union_pw_aff_range_factor_domain(
6296 __isl_take isl_multi_union_pw_aff *mupa);
6297 __isl_give isl_multi_union_pw_aff *
6298 isl_multi_union_pw_aff_range_factor_range(
6299 __isl_take isl_multi_union_pw_aff *mupa);
6301 The splice functions are a generalization of the flat product functions,
6302 where the second argument may be inserted at any position inside
6303 the first argument rather than being placed at the end.
6305 #include <isl/val.h>
6306 __isl_give isl_multi_val *isl_multi_val_range_splice(
6307 __isl_take isl_multi_val *mv1, unsigned pos,
6308 __isl_take isl_multi_val *mv2);
6310 #include <isl/aff.h>
6311 __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6312 __isl_take isl_multi_aff *ma1, unsigned pos,
6313 __isl_take isl_multi_aff *ma2);
6314 __isl_give isl_multi_aff *isl_multi_aff_splice(
6315 __isl_take isl_multi_aff *ma1,
6316 unsigned in_pos, unsigned out_pos,
6317 __isl_take isl_multi_aff *ma2);
6318 __isl_give isl_multi_pw_aff *
6319 isl_multi_pw_aff_range_splice(
6320 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6321 __isl_take isl_multi_pw_aff *mpa2);
6322 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6323 __isl_take isl_multi_pw_aff *mpa1,
6324 unsigned in_pos, unsigned out_pos,
6325 __isl_take isl_multi_pw_aff *mpa2);
6326 __isl_give isl_multi_union_pw_aff *
6327 isl_multi_union_pw_aff_range_splice(
6328 __isl_take isl_multi_union_pw_aff *mupa1,
6330 __isl_take isl_multi_union_pw_aff *mupa2);
6332 =item * Simplification
6334 When applied to a set or relation,
6335 the gist operation returns a set or relation that has the
6336 same intersection with the context as the input set or relation.
6337 Any implicit equality in the intersection is made explicit in the result,
6338 while all inequalities that are redundant with respect to the intersection
6340 In case of union sets and relations, the gist operation is performed
6343 When applied to a function,
6344 the gist operation applies the set gist operation to each of
6345 the cells in the domain of the input piecewise expression.
6346 The context is also exploited
6347 to simplify the expression associated to each cell.
6349 #include <isl/set.h>
6350 __isl_give isl_basic_set *isl_basic_set_gist(
6351 __isl_take isl_basic_set *bset,
6352 __isl_take isl_basic_set *context);
6353 __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6354 __isl_take isl_set *context);
6355 __isl_give isl_set *isl_set_gist_params(
6356 __isl_take isl_set *set,
6357 __isl_take isl_set *context);
6359 #include <isl/map.h>
6360 __isl_give isl_basic_map *isl_basic_map_gist(
6361 __isl_take isl_basic_map *bmap,
6362 __isl_take isl_basic_map *context);
6363 __isl_give isl_basic_map *isl_basic_map_gist_domain(
6364 __isl_take isl_basic_map *bmap,
6365 __isl_take isl_basic_set *context);
6366 __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6367 __isl_take isl_map *context);
6368 __isl_give isl_map *isl_map_gist_params(
6369 __isl_take isl_map *map,
6370 __isl_take isl_set *context);
6371 __isl_give isl_map *isl_map_gist_domain(
6372 __isl_take isl_map *map,
6373 __isl_take isl_set *context);
6374 __isl_give isl_map *isl_map_gist_range(
6375 __isl_take isl_map *map,
6376 __isl_take isl_set *context);
6378 #include <isl/union_set.h>
6379 __isl_give isl_union_set *isl_union_set_gist(
6380 __isl_take isl_union_set *uset,
6381 __isl_take isl_union_set *context);
6382 __isl_give isl_union_set *isl_union_set_gist_params(
6383 __isl_take isl_union_set *uset,
6384 __isl_take isl_set *set);
6386 #include <isl/union_map.h>
6387 __isl_give isl_union_map *isl_union_map_gist(
6388 __isl_take isl_union_map *umap,
6389 __isl_take isl_union_map *context);
6390 __isl_give isl_union_map *isl_union_map_gist_params(
6391 __isl_take isl_union_map *umap,
6392 __isl_take isl_set *set);
6393 __isl_give isl_union_map *isl_union_map_gist_domain(
6394 __isl_take isl_union_map *umap,
6395 __isl_take isl_union_set *uset);
6396 __isl_give isl_union_map *isl_union_map_gist_range(
6397 __isl_take isl_union_map *umap,
6398 __isl_take isl_union_set *uset);
6400 #include <isl/aff.h>
6401 __isl_give isl_aff *isl_aff_gist_params(
6402 __isl_take isl_aff *aff,
6403 __isl_take isl_set *context);
6404 __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6405 __isl_take isl_set *context);
6406 __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6407 __isl_take isl_multi_aff *maff,
6408 __isl_take isl_set *context);
6409 __isl_give isl_multi_aff *isl_multi_aff_gist(
6410 __isl_take isl_multi_aff *maff,
6411 __isl_take isl_set *context);
6412 __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6413 __isl_take isl_pw_aff *pwaff,
6414 __isl_take isl_set *context);
6415 __isl_give isl_pw_aff *isl_pw_aff_gist(
6416 __isl_take isl_pw_aff *pwaff,
6417 __isl_take isl_set *context);
6418 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6419 __isl_take isl_pw_multi_aff *pma,
6420 __isl_take isl_set *set);
6421 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6422 __isl_take isl_pw_multi_aff *pma,
6423 __isl_take isl_set *set);
6424 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6425 __isl_take isl_multi_pw_aff *mpa,
6426 __isl_take isl_set *set);
6427 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6428 __isl_take isl_multi_pw_aff *mpa,
6429 __isl_take isl_set *set);
6430 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6431 __isl_take isl_union_pw_aff *upa,
6432 __isl_take isl_union_set *context);
6433 __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6434 __isl_take isl_union_pw_aff *upa,
6435 __isl_take isl_set *context);
6436 __isl_give isl_union_pw_multi_aff *
6437 isl_union_pw_multi_aff_gist_params(
6438 __isl_take isl_union_pw_multi_aff *upma,
6439 __isl_take isl_set *context);
6440 __isl_give isl_union_pw_multi_aff *
6441 isl_union_pw_multi_aff_gist(
6442 __isl_take isl_union_pw_multi_aff *upma,
6443 __isl_take isl_union_set *context);
6444 __isl_give isl_multi_union_pw_aff *
6445 isl_multi_union_pw_aff_gist_params(
6446 __isl_take isl_multi_union_pw_aff *aff,
6447 __isl_take isl_set *context);
6448 __isl_give isl_multi_union_pw_aff *
6449 isl_multi_union_pw_aff_gist(
6450 __isl_take isl_multi_union_pw_aff *aff,
6451 __isl_take isl_union_set *context);
6453 #include <isl/polynomial.h>
6454 __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6455 __isl_take isl_qpolynomial *qp,
6456 __isl_take isl_set *context);
6457 __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6458 __isl_take isl_qpolynomial *qp,
6459 __isl_take isl_set *context);
6460 __isl_give isl_qpolynomial_fold *
6461 isl_qpolynomial_fold_gist_params(
6462 __isl_take isl_qpolynomial_fold *fold,
6463 __isl_take isl_set *context);
6464 __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6465 __isl_take isl_qpolynomial_fold *fold,
6466 __isl_take isl_set *context);
6467 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6468 __isl_take isl_pw_qpolynomial *pwqp,
6469 __isl_take isl_set *context);
6470 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6471 __isl_take isl_pw_qpolynomial *pwqp,
6472 __isl_take isl_set *context);
6473 __isl_give isl_pw_qpolynomial_fold *
6474 isl_pw_qpolynomial_fold_gist(
6475 __isl_take isl_pw_qpolynomial_fold *pwf,
6476 __isl_take isl_set *context);
6477 __isl_give isl_pw_qpolynomial_fold *
6478 isl_pw_qpolynomial_fold_gist_params(
6479 __isl_take isl_pw_qpolynomial_fold *pwf,
6480 __isl_take isl_set *context);
6481 __isl_give isl_union_pw_qpolynomial *
6482 isl_union_pw_qpolynomial_gist_params(
6483 __isl_take isl_union_pw_qpolynomial *upwqp,
6484 __isl_take isl_set *context);
6485 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6486 __isl_take isl_union_pw_qpolynomial *upwqp,
6487 __isl_take isl_union_set *context);
6488 __isl_give isl_union_pw_qpolynomial_fold *
6489 isl_union_pw_qpolynomial_fold_gist(
6490 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6491 __isl_take isl_union_set *context);
6492 __isl_give isl_union_pw_qpolynomial_fold *
6493 isl_union_pw_qpolynomial_fold_gist_params(
6494 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6495 __isl_take isl_set *context);
6497 =item * Binary Arithmethic Operations
6499 #include <isl/val.h>
6500 __isl_give isl_multi_val *isl_multi_val_sub(
6501 __isl_take isl_multi_val *mv1,
6502 __isl_take isl_multi_val *mv2);
6504 #include <isl/aff.h>
6505 __isl_give isl_aff *isl_aff_add(
6506 __isl_take isl_aff *aff1,
6507 __isl_take isl_aff *aff2);
6508 __isl_give isl_multi_aff *isl_multi_aff_add(
6509 __isl_take isl_multi_aff *maff1,
6510 __isl_take isl_multi_aff *maff2);
6511 __isl_give isl_pw_aff *isl_pw_aff_add(
6512 __isl_take isl_pw_aff *pwaff1,
6513 __isl_take isl_pw_aff *pwaff2);
6514 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6515 __isl_take isl_pw_multi_aff *pma1,
6516 __isl_take isl_pw_multi_aff *pma2);
6517 __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6518 __isl_take isl_union_pw_aff *upa1,
6519 __isl_take isl_union_pw_aff *upa2);
6520 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6521 __isl_take isl_union_pw_multi_aff *upma1,
6522 __isl_take isl_union_pw_multi_aff *upma2);
6523 __isl_give isl_pw_aff *isl_pw_aff_min(
6524 __isl_take isl_pw_aff *pwaff1,
6525 __isl_take isl_pw_aff *pwaff2);
6526 __isl_give isl_pw_aff *isl_pw_aff_max(
6527 __isl_take isl_pw_aff *pwaff1,
6528 __isl_take isl_pw_aff *pwaff2);
6529 __isl_give isl_aff *isl_aff_sub(
6530 __isl_take isl_aff *aff1,
6531 __isl_take isl_aff *aff2);
6532 __isl_give isl_multi_aff *isl_multi_aff_sub(
6533 __isl_take isl_multi_aff *ma1,
6534 __isl_take isl_multi_aff *ma2);
6535 __isl_give isl_pw_aff *isl_pw_aff_sub(
6536 __isl_take isl_pw_aff *pwaff1,
6537 __isl_take isl_pw_aff *pwaff2);
6538 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6539 __isl_take isl_multi_pw_aff *mpa1,
6540 __isl_take isl_multi_pw_aff *mpa2);
6541 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6542 __isl_take isl_pw_multi_aff *pma1,
6543 __isl_take isl_pw_multi_aff *pma2);
6544 __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6545 __isl_take isl_union_pw_aff *upa1,
6546 __isl_take isl_union_pw_aff *upa2);
6547 __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6548 __isl_take isl_union_pw_multi_aff *upma1,
6549 __isl_take isl_union_pw_multi_aff *upma2);
6550 __isl_give isl_multi_union_pw_aff *
6551 isl_multi_union_pw_aff_sub(
6552 __isl_take isl_multi_union_pw_aff *mupa1,
6553 __isl_take isl_multi_union_pw_aff *mupa2);
6555 C<isl_aff_sub> subtracts the second argument from the first.
6557 #include <isl/polynomial.h>
6558 __isl_give isl_qpolynomial *isl_qpolynomial_add(
6559 __isl_take isl_qpolynomial *qp1,
6560 __isl_take isl_qpolynomial *qp2);
6561 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6562 __isl_take isl_pw_qpolynomial *pwqp1,
6563 __isl_take isl_pw_qpolynomial *pwqp2);
6564 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6565 __isl_take isl_pw_qpolynomial *pwqp1,
6566 __isl_take isl_pw_qpolynomial *pwqp2);
6567 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6568 __isl_take isl_pw_qpolynomial_fold *pwf1,
6569 __isl_take isl_pw_qpolynomial_fold *pwf2);
6570 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6571 __isl_take isl_union_pw_qpolynomial *upwqp1,
6572 __isl_take isl_union_pw_qpolynomial *upwqp2);
6573 __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6574 __isl_take isl_qpolynomial *qp1,
6575 __isl_take isl_qpolynomial *qp2);
6576 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6577 __isl_take isl_pw_qpolynomial *pwqp1,
6578 __isl_take isl_pw_qpolynomial *pwqp2);
6579 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6580 __isl_take isl_union_pw_qpolynomial *upwqp1,
6581 __isl_take isl_union_pw_qpolynomial *upwqp2);
6582 __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6583 __isl_take isl_pw_qpolynomial_fold *pwf1,
6584 __isl_take isl_pw_qpolynomial_fold *pwf2);
6585 __isl_give isl_union_pw_qpolynomial_fold *
6586 isl_union_pw_qpolynomial_fold_fold(
6587 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6588 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6590 #include <isl/aff.h>
6591 __isl_give isl_pw_aff *isl_pw_aff_union_add(
6592 __isl_take isl_pw_aff *pwaff1,
6593 __isl_take isl_pw_aff *pwaff2);
6594 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6595 __isl_take isl_pw_multi_aff *pma1,
6596 __isl_take isl_pw_multi_aff *pma2);
6597 __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6598 __isl_take isl_union_pw_aff *upa1,
6599 __isl_take isl_union_pw_aff *upa2);
6600 __isl_give isl_union_pw_multi_aff *
6601 isl_union_pw_multi_aff_union_add(
6602 __isl_take isl_union_pw_multi_aff *upma1,
6603 __isl_take isl_union_pw_multi_aff *upma2);
6604 __isl_give isl_multi_union_pw_aff *
6605 isl_multi_union_pw_aff_union_add(
6606 __isl_take isl_multi_union_pw_aff *mupa1,
6607 __isl_take isl_multi_union_pw_aff *mupa2);
6608 __isl_give isl_pw_aff *isl_pw_aff_union_min(
6609 __isl_take isl_pw_aff *pwaff1,
6610 __isl_take isl_pw_aff *pwaff2);
6611 __isl_give isl_pw_aff *isl_pw_aff_union_max(
6612 __isl_take isl_pw_aff *pwaff1,
6613 __isl_take isl_pw_aff *pwaff2);
6615 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6616 expression with a domain that is the union of those of C<pwaff1> and
6617 C<pwaff2> and such that on each cell, the quasi-affine expression is
6618 the maximum of those of C<pwaff1> and C<pwaff2>. If only one of
6619 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6620 associated expression is the defined one.
6621 This in contrast to the C<isl_pw_aff_max> function, which is
6622 only defined on the shared definition domain of the arguments.
6624 #include <isl/val.h>
6625 __isl_give isl_multi_val *isl_multi_val_add_val(
6626 __isl_take isl_multi_val *mv,
6627 __isl_take isl_val *v);
6628 __isl_give isl_multi_val *isl_multi_val_mod_val(
6629 __isl_take isl_multi_val *mv,
6630 __isl_take isl_val *v);
6631 __isl_give isl_multi_val *isl_multi_val_scale_val(
6632 __isl_take isl_multi_val *mv,
6633 __isl_take isl_val *v);
6634 __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6635 __isl_take isl_multi_val *mv,
6636 __isl_take isl_val *v);
6638 #include <isl/aff.h>
6639 __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6640 __isl_take isl_val *mod);
6641 __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6642 __isl_take isl_pw_aff *pa,
6643 __isl_take isl_val *mod);
6644 __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6645 __isl_take isl_union_pw_aff *upa,
6646 __isl_take isl_val *f);
6647 __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6648 __isl_take isl_val *v);
6649 __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6650 __isl_take isl_multi_aff *ma,
6651 __isl_take isl_val *v);
6652 __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6653 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6654 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6655 __isl_take isl_multi_pw_aff *mpa,
6656 __isl_take isl_val *v);
6657 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6658 __isl_take isl_pw_multi_aff *pma,
6659 __isl_take isl_val *v);
6660 __isl_give isl_union_pw_multi_aff *
6661 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6662 __isl_take isl_union_pw_aff *upa,
6663 __isl_take isl_val *f);
6664 isl_union_pw_multi_aff_scale_val(
6665 __isl_take isl_union_pw_multi_aff *upma,
6666 __isl_take isl_val *val);
6667 __isl_give isl_multi_union_pw_aff *
6668 isl_multi_union_pw_aff_scale_val(
6669 __isl_take isl_multi_union_pw_aff *mupa,
6670 __isl_take isl_val *v);
6671 __isl_give isl_aff *isl_aff_scale_down_ui(
6672 __isl_take isl_aff *aff, unsigned f);
6673 __isl_give isl_aff *isl_aff_scale_down_val(
6674 __isl_take isl_aff *aff, __isl_take isl_val *v);
6675 __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6676 __isl_take isl_multi_aff *ma,
6677 __isl_take isl_val *v);
6678 __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6679 __isl_take isl_pw_aff *pa,
6680 __isl_take isl_val *f);
6681 __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6682 __isl_take isl_multi_pw_aff *mpa,
6683 __isl_take isl_val *v);
6684 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6685 __isl_take isl_pw_multi_aff *pma,
6686 __isl_take isl_val *v);
6687 __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6688 __isl_take isl_union_pw_aff *upa,
6689 __isl_take isl_val *v);
6690 __isl_give isl_union_pw_multi_aff *
6691 isl_union_pw_multi_aff_scale_down_val(
6692 __isl_take isl_union_pw_multi_aff *upma,
6693 __isl_take isl_val *val);
6694 __isl_give isl_multi_union_pw_aff *
6695 isl_multi_union_pw_aff_scale_down_val(
6696 __isl_take isl_multi_union_pw_aff *mupa,
6697 __isl_take isl_val *v);
6699 #include <isl/polynomial.h>
6700 __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6701 __isl_take isl_qpolynomial *qp,
6702 __isl_take isl_val *v);
6703 __isl_give isl_qpolynomial_fold *
6704 isl_qpolynomial_fold_scale_val(
6705 __isl_take isl_qpolynomial_fold *fold,
6706 __isl_take isl_val *v);
6707 __isl_give isl_pw_qpolynomial *
6708 isl_pw_qpolynomial_scale_val(
6709 __isl_take isl_pw_qpolynomial *pwqp,
6710 __isl_take isl_val *v);
6711 __isl_give isl_pw_qpolynomial_fold *
6712 isl_pw_qpolynomial_fold_scale_val(
6713 __isl_take isl_pw_qpolynomial_fold *pwf,
6714 __isl_take isl_val *v);
6715 __isl_give isl_union_pw_qpolynomial *
6716 isl_union_pw_qpolynomial_scale_val(
6717 __isl_take isl_union_pw_qpolynomial *upwqp,
6718 __isl_take isl_val *v);
6719 __isl_give isl_union_pw_qpolynomial_fold *
6720 isl_union_pw_qpolynomial_fold_scale_val(
6721 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6722 __isl_take isl_val *v);
6723 __isl_give isl_qpolynomial *
6724 isl_qpolynomial_scale_down_val(
6725 __isl_take isl_qpolynomial *qp,
6726 __isl_take isl_val *v);
6727 __isl_give isl_qpolynomial_fold *
6728 isl_qpolynomial_fold_scale_down_val(
6729 __isl_take isl_qpolynomial_fold *fold,
6730 __isl_take isl_val *v);
6731 __isl_give isl_pw_qpolynomial *
6732 isl_pw_qpolynomial_scale_down_val(
6733 __isl_take isl_pw_qpolynomial *pwqp,
6734 __isl_take isl_val *v);
6735 __isl_give isl_pw_qpolynomial_fold *
6736 isl_pw_qpolynomial_fold_scale_down_val(
6737 __isl_take isl_pw_qpolynomial_fold *pwf,
6738 __isl_take isl_val *v);
6739 __isl_give isl_union_pw_qpolynomial *
6740 isl_union_pw_qpolynomial_scale_down_val(
6741 __isl_take isl_union_pw_qpolynomial *upwqp,
6742 __isl_take isl_val *v);
6743 __isl_give isl_union_pw_qpolynomial_fold *
6744 isl_union_pw_qpolynomial_fold_scale_down_val(
6745 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6746 __isl_take isl_val *v);
6748 #include <isl/val.h>
6749 __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
6750 __isl_take isl_multi_val *mv1,
6751 __isl_take isl_multi_val *mv2);
6752 __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
6753 __isl_take isl_multi_val *mv1,
6754 __isl_take isl_multi_val *mv2);
6755 __isl_give isl_multi_val *
6756 isl_multi_val_scale_down_multi_val(
6757 __isl_take isl_multi_val *mv1,
6758 __isl_take isl_multi_val *mv2);
6760 #include <isl/aff.h>
6761 __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
6762 __isl_take isl_multi_aff *ma,
6763 __isl_take isl_multi_val *mv);
6764 __isl_give isl_multi_union_pw_aff *
6765 isl_multi_union_pw_aff_mod_multi_val(
6766 __isl_take isl_multi_union_pw_aff *upma,
6767 __isl_take isl_multi_val *mv);
6768 __isl_give isl_multi_pw_aff *
6769 isl_multi_pw_aff_mod_multi_val(
6770 __isl_take isl_multi_pw_aff *mpa,
6771 __isl_take isl_multi_val *mv);
6772 __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
6773 __isl_take isl_multi_aff *ma,
6774 __isl_take isl_multi_val *mv);
6775 __isl_give isl_pw_multi_aff *
6776 isl_pw_multi_aff_scale_multi_val(
6777 __isl_take isl_pw_multi_aff *pma,
6778 __isl_take isl_multi_val *mv);
6779 __isl_give isl_multi_pw_aff *
6780 isl_multi_pw_aff_scale_multi_val(
6781 __isl_take isl_multi_pw_aff *mpa,
6782 __isl_take isl_multi_val *mv);
6783 __isl_give isl_multi_union_pw_aff *
6784 isl_multi_union_pw_aff_scale_multi_val(
6785 __isl_take isl_multi_union_pw_aff *mupa,
6786 __isl_take isl_multi_val *mv);
6787 __isl_give isl_union_pw_multi_aff *
6788 isl_union_pw_multi_aff_scale_multi_val(
6789 __isl_take isl_union_pw_multi_aff *upma,
6790 __isl_take isl_multi_val *mv);
6791 __isl_give isl_multi_aff *
6792 isl_multi_aff_scale_down_multi_val(
6793 __isl_take isl_multi_aff *ma,
6794 __isl_take isl_multi_val *mv);
6795 __isl_give isl_multi_pw_aff *
6796 isl_multi_pw_aff_scale_down_multi_val(
6797 __isl_take isl_multi_pw_aff *mpa,
6798 __isl_take isl_multi_val *mv);
6799 __isl_give isl_multi_union_pw_aff *
6800 isl_multi_union_pw_aff_scale_down_multi_val(
6801 __isl_take isl_multi_union_pw_aff *mupa,
6802 __isl_take isl_multi_val *mv);
6804 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
6805 by the corresponding elements of C<mv>.
6807 #include <isl/aff.h>
6808 __isl_give isl_aff *isl_aff_mul(
6809 __isl_take isl_aff *aff1,
6810 __isl_take isl_aff *aff2);
6811 __isl_give isl_aff *isl_aff_div(
6812 __isl_take isl_aff *aff1,
6813 __isl_take isl_aff *aff2);
6814 __isl_give isl_pw_aff *isl_pw_aff_mul(
6815 __isl_take isl_pw_aff *pwaff1,
6816 __isl_take isl_pw_aff *pwaff2);
6817 __isl_give isl_pw_aff *isl_pw_aff_div(
6818 __isl_take isl_pw_aff *pa1,
6819 __isl_take isl_pw_aff *pa2);
6820 __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
6821 __isl_take isl_pw_aff *pa1,
6822 __isl_take isl_pw_aff *pa2);
6823 __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
6824 __isl_take isl_pw_aff *pa1,
6825 __isl_take isl_pw_aff *pa2);
6827 When multiplying two affine expressions, at least one of the two needs
6828 to be a constant. Similarly, when dividing an affine expression by another,
6829 the second expression needs to be a constant.
6830 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
6831 rounding towards zero. C<isl_pw_aff_tdiv_r> computes the corresponding
6834 #include <isl/polynomial.h>
6835 __isl_give isl_qpolynomial *isl_qpolynomial_mul(
6836 __isl_take isl_qpolynomial *qp1,
6837 __isl_take isl_qpolynomial *qp2);
6838 __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
6839 __isl_take isl_pw_qpolynomial *pwqp1,
6840 __isl_take isl_pw_qpolynomial *pwqp2);
6841 __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
6842 __isl_take isl_union_pw_qpolynomial *upwqp1,
6843 __isl_take isl_union_pw_qpolynomial *upwqp2);
6847 =head3 Lexicographic Optimization
6849 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
6850 the following functions
6851 compute a set that contains the lexicographic minimum or maximum
6852 of the elements in C<set> (or C<bset>) for those values of the parameters
6853 that satisfy C<dom>.
6854 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6855 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
6857 In other words, the union of the parameter values
6858 for which the result is non-empty and of C<*empty>
6861 #include <isl/set.h>
6862 __isl_give isl_set *isl_basic_set_partial_lexmin(
6863 __isl_take isl_basic_set *bset,
6864 __isl_take isl_basic_set *dom,
6865 __isl_give isl_set **empty);
6866 __isl_give isl_set *isl_basic_set_partial_lexmax(
6867 __isl_take isl_basic_set *bset,
6868 __isl_take isl_basic_set *dom,
6869 __isl_give isl_set **empty);
6870 __isl_give isl_set *isl_set_partial_lexmin(
6871 __isl_take isl_set *set, __isl_take isl_set *dom,
6872 __isl_give isl_set **empty);
6873 __isl_give isl_set *isl_set_partial_lexmax(
6874 __isl_take isl_set *set, __isl_take isl_set *dom,
6875 __isl_give isl_set **empty);
6877 Given a (basic) set C<set> (or C<bset>), the following functions simply
6878 return a set containing the lexicographic minimum or maximum
6879 of the elements in C<set> (or C<bset>).
6880 In case of union sets, the optimum is computed per space.
6882 #include <isl/set.h>
6883 __isl_give isl_set *isl_basic_set_lexmin(
6884 __isl_take isl_basic_set *bset);
6885 __isl_give isl_set *isl_basic_set_lexmax(
6886 __isl_take isl_basic_set *bset);
6887 __isl_give isl_set *isl_set_lexmin(
6888 __isl_take isl_set *set);
6889 __isl_give isl_set *isl_set_lexmax(
6890 __isl_take isl_set *set);
6891 __isl_give isl_union_set *isl_union_set_lexmin(
6892 __isl_take isl_union_set *uset);
6893 __isl_give isl_union_set *isl_union_set_lexmax(
6894 __isl_take isl_union_set *uset);
6896 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
6897 the following functions
6898 compute a relation that maps each element of C<dom>
6899 to the single lexicographic minimum or maximum
6900 of the elements that are associated to that same
6901 element in C<map> (or C<bmap>).
6902 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
6903 that contains the elements in C<dom> that do not map
6904 to any elements in C<map> (or C<bmap>).
6905 In other words, the union of the domain of the result and of C<*empty>
6908 #include <isl/map.h>
6909 __isl_give isl_map *isl_basic_map_partial_lexmax(
6910 __isl_take isl_basic_map *bmap,
6911 __isl_take isl_basic_set *dom,
6912 __isl_give isl_set **empty);
6913 __isl_give isl_map *isl_basic_map_partial_lexmin(
6914 __isl_take isl_basic_map *bmap,
6915 __isl_take isl_basic_set *dom,
6916 __isl_give isl_set **empty);
6917 __isl_give isl_map *isl_map_partial_lexmax(
6918 __isl_take isl_map *map, __isl_take isl_set *dom,
6919 __isl_give isl_set **empty);
6920 __isl_give isl_map *isl_map_partial_lexmin(
6921 __isl_take isl_map *map, __isl_take isl_set *dom,
6922 __isl_give isl_set **empty);
6924 Given a (basic) map C<map> (or C<bmap>), the following functions simply
6925 return a map mapping each element in the domain of
6926 C<map> (or C<bmap>) to the lexicographic minimum or maximum
6927 of all elements associated to that element.
6928 In case of union relations, the optimum is computed per space.
6930 #include <isl/map.h>
6931 __isl_give isl_map *isl_basic_map_lexmin(
6932 __isl_take isl_basic_map *bmap);
6933 __isl_give isl_map *isl_basic_map_lexmax(
6934 __isl_take isl_basic_map *bmap);
6935 __isl_give isl_map *isl_map_lexmin(
6936 __isl_take isl_map *map);
6937 __isl_give isl_map *isl_map_lexmax(
6938 __isl_take isl_map *map);
6939 __isl_give isl_union_map *isl_union_map_lexmin(
6940 __isl_take isl_union_map *umap);
6941 __isl_give isl_union_map *isl_union_map_lexmax(
6942 __isl_take isl_union_map *umap);
6944 The following functions return their result in the form of
6945 a piecewise multi-affine expression,
6946 but are otherwise equivalent to the corresponding functions
6947 returning a basic set or relation.
6949 #include <isl/set.h>
6950 __isl_give isl_pw_multi_aff *
6951 isl_basic_set_partial_lexmin_pw_multi_aff(
6952 __isl_take isl_basic_set *bset,
6953 __isl_take isl_basic_set *dom,
6954 __isl_give isl_set **empty);
6955 __isl_give isl_pw_multi_aff *
6956 isl_basic_set_partial_lexmax_pw_multi_aff(
6957 __isl_take isl_basic_set *bset,
6958 __isl_take isl_basic_set *dom,
6959 __isl_give isl_set **empty);
6960 __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
6961 __isl_take isl_set *set);
6962 __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
6963 __isl_take isl_set *set);
6965 #include <isl/map.h>
6966 __isl_give isl_pw_multi_aff *
6967 isl_basic_map_lexmin_pw_multi_aff(
6968 __isl_take isl_basic_map *bmap);
6969 __isl_give isl_pw_multi_aff *
6970 isl_basic_map_partial_lexmin_pw_multi_aff(
6971 __isl_take isl_basic_map *bmap,
6972 __isl_take isl_basic_set *dom,
6973 __isl_give isl_set **empty);
6974 __isl_give isl_pw_multi_aff *
6975 isl_basic_map_partial_lexmax_pw_multi_aff(
6976 __isl_take isl_basic_map *bmap,
6977 __isl_take isl_basic_set *dom,
6978 __isl_give isl_set **empty);
6979 __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
6980 __isl_take isl_map *map);
6981 __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
6982 __isl_take isl_map *map);
6984 The following functions return the lexicographic minimum or maximum
6985 on the shared domain of the inputs and the single defined function
6986 on those parts of the domain where only a single function is defined.
6988 #include <isl/aff.h>
6989 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
6990 __isl_take isl_pw_multi_aff *pma1,
6991 __isl_take isl_pw_multi_aff *pma2);
6992 __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
6993 __isl_take isl_pw_multi_aff *pma1,
6994 __isl_take isl_pw_multi_aff *pma2);
6996 =head2 Ternary Operations
6998 #include <isl/aff.h>
6999 __isl_give isl_pw_aff *isl_pw_aff_cond(
7000 __isl_take isl_pw_aff *cond,
7001 __isl_take isl_pw_aff *pwaff_true,
7002 __isl_take isl_pw_aff *pwaff_false);
7004 The function C<isl_pw_aff_cond> performs a conditional operator
7005 and returns an expression that is equal to C<pwaff_true>
7006 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
7007 where C<cond> is zero.
7011 Lists are defined over several element types, including
7012 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
7013 C<isl_union_pw_multi_aff>, C<isl_constraint>,
7014 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
7015 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
7016 Here we take lists of C<isl_set>s as an example.
7017 Lists can be created, copied, modified and freed using the following functions.
7019 #include <isl/set.h>
7020 __isl_give isl_set_list *isl_set_list_from_set(
7021 __isl_take isl_set *el);
7022 __isl_give isl_set_list *isl_set_list_alloc(
7023 isl_ctx *ctx, int n);
7024 __isl_give isl_set_list *isl_set_list_copy(
7025 __isl_keep isl_set_list *list);
7026 __isl_give isl_set_list *isl_set_list_insert(
7027 __isl_take isl_set_list *list, unsigned pos,
7028 __isl_take isl_set *el);
7029 __isl_give isl_set_list *isl_set_list_add(
7030 __isl_take isl_set_list *list,
7031 __isl_take isl_set *el);
7032 __isl_give isl_set_list *isl_set_list_drop(
7033 __isl_take isl_set_list *list,
7034 unsigned first, unsigned n);
7035 __isl_give isl_set_list *isl_set_list_set_set(
7036 __isl_take isl_set_list *list, int index,
7037 __isl_take isl_set *set);
7038 __isl_give isl_set_list *isl_set_list_concat(
7039 __isl_take isl_set_list *list1,
7040 __isl_take isl_set_list *list2);
7041 __isl_give isl_set_list *isl_set_list_sort(
7042 __isl_take isl_set_list *list,
7043 int (*cmp)(__isl_keep isl_set *a,
7044 __isl_keep isl_set *b, void *user),
7046 __isl_null isl_set_list *isl_set_list_free(
7047 __isl_take isl_set_list *list);
7049 C<isl_set_list_alloc> creates an empty list with an initial capacity
7050 for C<n> elements. C<isl_set_list_insert> and C<isl_set_list_add>
7051 add elements to a list, increasing its capacity as needed.
7052 C<isl_set_list_from_set> creates a list with a single element.
7054 Lists can be inspected using the following functions.
7056 #include <isl/set.h>
7057 int isl_set_list_n_set(__isl_keep isl_set_list *list);
7058 __isl_give isl_set *isl_set_list_get_set(
7059 __isl_keep isl_set_list *list, int index);
7060 isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
7061 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7063 isl_stat isl_set_list_foreach_scc(
7064 __isl_keep isl_set_list *list,
7065 isl_bool (*follows)(__isl_keep isl_set *a,
7066 __isl_keep isl_set *b, void *user),
7068 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7071 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
7072 strongly connected components of the graph with as vertices the elements
7073 of C<list> and a directed edge from vertex C<b> to vertex C<a>
7074 iff C<follows(a, b)> returns C<1>. The callbacks C<follows> and C<fn>
7075 should return C<-1> on error.
7077 Lists can be printed using
7079 #include <isl/set.h>
7080 __isl_give isl_printer *isl_printer_print_set_list(
7081 __isl_take isl_printer *p,
7082 __isl_keep isl_set_list *list);
7084 =head2 Associative arrays
7086 Associative arrays map isl objects of a specific type to isl objects
7087 of some (other) specific type. They are defined for several pairs
7088 of types, including (C<isl_map>, C<isl_basic_set>),
7089 (C<isl_id>, C<isl_ast_expr>) and.
7090 (C<isl_id>, C<isl_pw_aff>).
7091 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7094 Associative arrays can be created, copied and freed using
7095 the following functions.
7097 #include <isl/id_to_ast_expr.h>
7098 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7099 isl_ctx *ctx, int min_size);
7100 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7101 __isl_keep isl_id_to_ast_expr *id2expr);
7102 __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7103 __isl_take isl_id_to_ast_expr *id2expr);
7105 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7106 to specify the expected size of the associative array.
7107 The associative array will be grown automatically as needed.
7109 Associative arrays can be inspected using the following functions.
7111 #include <isl/id_to_ast_expr.h>
7112 isl_bool isl_id_to_ast_expr_has(
7113 __isl_keep isl_id_to_ast_expr *id2expr,
7114 __isl_keep isl_id *key);
7115 __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7116 __isl_keep isl_id_to_ast_expr *id2expr,
7117 __isl_take isl_id *key);
7118 isl_stat isl_id_to_ast_expr_foreach(
7119 __isl_keep isl_id_to_ast_expr *id2expr,
7120 isl_stat (*fn)(__isl_take isl_id *key,
7121 __isl_take isl_ast_expr *val, void *user),
7124 They can be modified using the following function.
7126 #include <isl/id_to_ast_expr.h>
7127 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7128 __isl_take isl_id_to_ast_expr *id2expr,
7129 __isl_take isl_id *key,
7130 __isl_take isl_ast_expr *val);
7131 __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7132 __isl_take isl_id_to_ast_expr *id2expr,
7133 __isl_take isl_id *key);
7135 Associative arrays can be printed using the following function.
7137 #include <isl/id_to_ast_expr.h>
7138 __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7139 __isl_take isl_printer *p,
7140 __isl_keep isl_id_to_ast_expr *id2expr);
7144 Vectors can be created, copied and freed using the following functions.
7146 #include <isl/vec.h>
7147 __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7149 __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7150 __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7152 Note that the elements of a newly created vector may have arbitrary values.
7153 The elements can be changed and inspected using the following functions.
7155 int isl_vec_size(__isl_keep isl_vec *vec);
7156 __isl_give isl_val *isl_vec_get_element_val(
7157 __isl_keep isl_vec *vec, int pos);
7158 __isl_give isl_vec *isl_vec_set_element_si(
7159 __isl_take isl_vec *vec, int pos, int v);
7160 __isl_give isl_vec *isl_vec_set_element_val(
7161 __isl_take isl_vec *vec, int pos,
7162 __isl_take isl_val *v);
7163 __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7165 __isl_give isl_vec *isl_vec_set_val(
7166 __isl_take isl_vec *vec, __isl_take isl_val *v);
7167 int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7168 __isl_keep isl_vec *vec2, int pos);
7170 C<isl_vec_get_element> will return a negative value if anything went wrong.
7171 In that case, the value of C<*v> is undefined.
7173 The following function can be used to concatenate two vectors.
7175 __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7176 __isl_take isl_vec *vec2);
7180 Matrices can be created, copied and freed using the following functions.
7182 #include <isl/mat.h>
7183 __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7184 unsigned n_row, unsigned n_col);
7185 __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7186 __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7188 Note that the elements of a newly created matrix may have arbitrary values.
7189 The elements can be changed and inspected using the following functions.
7191 int isl_mat_rows(__isl_keep isl_mat *mat);
7192 int isl_mat_cols(__isl_keep isl_mat *mat);
7193 __isl_give isl_val *isl_mat_get_element_val(
7194 __isl_keep isl_mat *mat, int row, int col);
7195 __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7196 int row, int col, int v);
7197 __isl_give isl_mat *isl_mat_set_element_val(
7198 __isl_take isl_mat *mat, int row, int col,
7199 __isl_take isl_val *v);
7201 C<isl_mat_get_element> will return a negative value if anything went wrong.
7202 In that case, the value of C<*v> is undefined.
7204 The following function can be used to compute the (right) inverse
7205 of a matrix, i.e., a matrix such that the product of the original
7206 and the inverse (in that order) is a multiple of the identity matrix.
7207 The input matrix is assumed to be of full row-rank.
7209 __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7211 The following function can be used to compute the (right) kernel
7212 (or null space) of a matrix, i.e., a matrix such that the product of
7213 the original and the kernel (in that order) is the zero matrix.
7215 __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7217 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7219 The following functions determine
7220 an upper or lower bound on a quasipolynomial over its domain.
7222 __isl_give isl_pw_qpolynomial_fold *
7223 isl_pw_qpolynomial_bound(
7224 __isl_take isl_pw_qpolynomial *pwqp,
7225 enum isl_fold type, int *tight);
7227 __isl_give isl_union_pw_qpolynomial_fold *
7228 isl_union_pw_qpolynomial_bound(
7229 __isl_take isl_union_pw_qpolynomial *upwqp,
7230 enum isl_fold type, int *tight);
7232 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7233 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7234 is the returned bound is known be tight, i.e., for each value
7235 of the parameters there is at least
7236 one element in the domain that reaches the bound.
7237 If the domain of C<pwqp> is not wrapping, then the bound is computed
7238 over all elements in that domain and the result has a purely parametric
7239 domain. If the domain of C<pwqp> is wrapping, then the bound is
7240 computed over the range of the wrapped relation. The domain of the
7241 wrapped relation becomes the domain of the result.
7243 =head2 Parametric Vertex Enumeration
7245 The parametric vertex enumeration described in this section
7246 is mainly intended to be used internally and by the C<barvinok>
7249 #include <isl/vertices.h>
7250 __isl_give isl_vertices *isl_basic_set_compute_vertices(
7251 __isl_keep isl_basic_set *bset);
7253 The function C<isl_basic_set_compute_vertices> performs the
7254 actual computation of the parametric vertices and the chamber
7255 decomposition and store the result in an C<isl_vertices> object.
7256 This information can be queried by either iterating over all
7257 the vertices or iterating over all the chambers or cells
7258 and then iterating over all vertices that are active on the chamber.
7260 isl_stat isl_vertices_foreach_vertex(
7261 __isl_keep isl_vertices *vertices,
7262 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7263 void *user), void *user);
7265 isl_stat isl_vertices_foreach_cell(
7266 __isl_keep isl_vertices *vertices,
7267 isl_stat (*fn)(__isl_take isl_cell *cell,
7268 void *user), void *user);
7269 isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7270 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7271 void *user), void *user);
7273 Other operations that can be performed on an C<isl_vertices> object are
7276 int isl_vertices_get_n_vertices(
7277 __isl_keep isl_vertices *vertices);
7278 void isl_vertices_free(__isl_take isl_vertices *vertices);
7280 Vertices can be inspected and destroyed using the following functions.
7282 int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7283 __isl_give isl_basic_set *isl_vertex_get_domain(
7284 __isl_keep isl_vertex *vertex);
7285 __isl_give isl_multi_aff *isl_vertex_get_expr(
7286 __isl_keep isl_vertex *vertex);
7287 void isl_vertex_free(__isl_take isl_vertex *vertex);
7289 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7290 describing the vertex in terms of the parameters,
7291 while C<isl_vertex_get_domain> returns the activity domain
7294 Chambers can be inspected and destroyed using the following functions.
7296 __isl_give isl_basic_set *isl_cell_get_domain(
7297 __isl_keep isl_cell *cell);
7298 void isl_cell_free(__isl_take isl_cell *cell);
7300 =head1 Polyhedral Compilation Library
7302 This section collects functionality in C<isl> that has been specifically
7303 designed for use during polyhedral compilation.
7305 =head2 Schedule Trees
7307 A schedule tree is a structured representation of a schedule,
7308 assigning a relative order to a set of domain elements.
7309 The relative order expressed by the schedule tree is
7310 defined recursively. In particular, the order between
7311 two domain elements is determined by the node that is closest
7312 to the root that refers to both elements and that orders them apart.
7313 Each node in the tree is of one of several types.
7314 The root node is always of type C<isl_schedule_node_domain>
7315 (or C<isl_schedule_node_extension>)
7316 and it describes the (extra) domain elements to which the schedule applies.
7317 The other types of nodes are as follows.
7321 =item C<isl_schedule_node_band>
7323 A band of schedule dimensions. Each schedule dimension is represented
7324 by a union piecewise quasi-affine expression. If this expression
7325 assigns a different value to two domain elements, while all previous
7326 schedule dimensions in the same band assign them the same value,
7327 then the two domain elements are ordered according to these two
7330 =item C<isl_schedule_node_expansion>
7332 An expansion node maps each of the domain elements that reach the node
7333 to one or more domain elements. The image of this mapping forms
7334 the set of domain elements that reach the child of the expansion node.
7335 The function that maps each of the expanded domain elements
7336 to the original domain element from which it was expanded
7337 is called the contraction.
7339 =item C<isl_schedule_node_filter>
7341 A filter node does not impose any ordering, but rather intersects
7342 the set of domain elements that the current subtree refers to
7343 with a given union set. The subtree of the filter node only
7344 refers to domain elements in the intersection.
7345 A filter node is typically only used a child of a sequence or
7348 =item C<isl_schedule_node_leaf>
7350 A leaf of the schedule tree. Leaf nodes do not impose any ordering.
7352 =item C<isl_schedule_node_mark>
7354 A mark node can be used to attach any kind of information to a subtree
7355 of the schedule tree.
7357 =item C<isl_schedule_node_sequence>
7359 A sequence node has one or more children, each of which is a filter node.
7360 The filters on these filter nodes form a partition of
7361 the domain elements that the current subtree refers to.
7362 If two domain elements appear in distinct filters then the sequence
7363 node orders them according to the child positions of the corresponding
7366 =item C<isl_schedule_node_set>
7368 A set node is similar to a sequence node, except that
7369 it expresses that domain elements appearing in distinct filters
7370 may have any order. The order of the children of a set node
7371 is therefore also immaterial.
7375 The following node types are only supported by the AST generator.
7379 =item C<isl_schedule_node_context>
7381 The context describes constraints on the parameters and
7382 the schedule dimensions of outer
7383 bands that the AST generator may assume to hold. It is also the only
7384 kind of node that may introduce additional parameters.
7385 The space of the context is that of the flat product of the outer
7386 band nodes. In particular, if there are no outer band nodes, then
7387 this space is the unnamed zero-dimensional space.
7388 Since a context node references the outer band nodes, any tree
7389 containing a context node is considered to be anchored.
7391 =item C<isl_schedule_node_extension>
7393 An extension node instructs the AST generator to add additional
7394 domain elements that need to be scheduled.
7395 The additional domain elements are described by the range of
7396 the extension map in terms of the outer schedule dimensions,
7397 i.e., the flat product of the outer band nodes.
7398 Note that domain elements are added whenever the AST generator
7399 reaches the extension node, meaning that there are still some
7400 active domain elements for which an AST needs to be generated.
7401 The conditions under which some domain elements are still active
7402 may however not be completely described by the outer AST nodes
7403 generated at that point.
7405 An extension node may also appear as the root of a schedule tree,
7406 when it is intended to be inserted into another tree
7407 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
7408 In this case, the domain of the extension node should
7409 correspond to the flat product of the outer band nodes
7410 in this other schedule tree at the point where the extension tree
7413 =item C<isl_schedule_node_guard>
7415 The guard describes constraints on the parameters and
7416 the schedule dimensions of outer
7417 bands that need to be enforced by the outer nodes
7418 in the generated AST.
7419 The space of the guard is that of the flat product of the outer
7420 band nodes. In particular, if there are no outer band nodes, then
7421 this space is the unnamed zero-dimensional space.
7422 Since a guard node references the outer band nodes, any tree
7423 containing a guard node is considered to be anchored.
7427 Except for the C<isl_schedule_node_context> nodes,
7428 none of the nodes may introduce any parameters that were not
7429 already present in the root domain node.
7431 A schedule tree is encapsulated in an C<isl_schedule> object.
7432 The simplest such objects, those with a tree consisting of single domain node,
7433 can be created using the following functions with either an empty
7434 domain or a given domain.
7436 #include <isl/schedule.h>
7437 __isl_give isl_schedule *isl_schedule_empty(
7438 __isl_take isl_space *space);
7439 __isl_give isl_schedule *isl_schedule_from_domain(
7440 __isl_take isl_union_set *domain);
7442 The function C<isl_schedule_constraints_compute_schedule> described
7443 in L</"Scheduling"> can also be used to construct schedules.
7445 C<isl_schedule> objects may be copied and freed using the following functions.
7447 #include <isl/schedule.h>
7448 __isl_give isl_schedule *isl_schedule_copy(
7449 __isl_keep isl_schedule *sched);
7450 __isl_null isl_schedule *isl_schedule_free(
7451 __isl_take isl_schedule *sched);
7453 The following functions checks whether two C<isl_schedule> objects
7454 are obviously the same.
7456 #include <isl/schedule.h>
7457 isl_bool isl_schedule_plain_is_equal(
7458 __isl_keep isl_schedule *schedule1,
7459 __isl_keep isl_schedule *schedule2);
7461 The domain of the schedule, i.e., the domain described by the root node,
7462 can be obtained using the following function.
7464 #include <isl/schedule.h>
7465 __isl_give isl_union_set *isl_schedule_get_domain(
7466 __isl_keep isl_schedule *schedule);
7468 An extra top-level band node (right underneath the domain node) can
7469 be introduced into the schedule using the following function.
7470 The schedule tree is assumed not to have any anchored nodes.
7472 #include <isl/schedule.h>
7473 __isl_give isl_schedule *
7474 isl_schedule_insert_partial_schedule(
7475 __isl_take isl_schedule *schedule,
7476 __isl_take isl_multi_union_pw_aff *partial);
7478 A top-level context node (right underneath the domain node) can
7479 be introduced into the schedule using the following function.
7481 #include <isl/schedule.h>
7482 __isl_give isl_schedule *isl_schedule_insert_context(
7483 __isl_take isl_schedule *schedule,
7484 __isl_take isl_set *context)
7486 A top-level guard node (right underneath the domain node) can
7487 be introduced into the schedule using the following function.
7489 #include <isl/schedule.h>
7490 __isl_give isl_schedule *isl_schedule_insert_guard(
7491 __isl_take isl_schedule *schedule,
7492 __isl_take isl_set *guard)
7494 A schedule that combines two schedules either in the given
7495 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
7496 or an C<isl_schedule_node_set> node,
7497 can be created using the following functions.
7499 #include <isl/schedule.h>
7500 __isl_give isl_schedule *isl_schedule_sequence(
7501 __isl_take isl_schedule *schedule1,
7502 __isl_take isl_schedule *schedule2);
7503 __isl_give isl_schedule *isl_schedule_set(
7504 __isl_take isl_schedule *schedule1,
7505 __isl_take isl_schedule *schedule2);
7507 The domains of the two input schedules need to be disjoint.
7509 The following function can be used to restrict the domain
7510 of a schedule with a domain node as root to be a subset of the given union set.
7511 This operation may remove nodes in the tree that have become
7514 #include <isl/schedule.h>
7515 __isl_give isl_schedule *isl_schedule_intersect_domain(
7516 __isl_take isl_schedule *schedule,
7517 __isl_take isl_union_set *domain);
7519 The following function resets the user pointers on all parameter
7520 and tuple identifiers referenced by the nodes of the given schedule.
7522 #include <isl/schedule.h>
7523 __isl_give isl_schedule *isl_schedule_reset_user(
7524 __isl_take isl_schedule *schedule);
7526 The following function aligns the parameters of all nodes
7527 in the given schedule to the given space.
7529 #include <isl/schedule.h>
7530 __isl_give isl_schedule *isl_schedule_align_params(
7531 __isl_take isl_schedule *schedule,
7532 __isl_take isl_space *space);
7534 The following function allows the user to plug in a given function
7535 in the iteration domains. The input schedule is not allowed to contain
7536 any expansion nodes.
7538 #include <isl/schedule.h>
7539 __isl_give isl_schedule *
7540 isl_schedule_pullback_union_pw_multi_aff(
7541 __isl_take isl_schedule *schedule,
7542 __isl_take isl_union_pw_multi_aff *upma);
7544 An C<isl_union_map> representation of the schedule can be obtained
7545 from an C<isl_schedule> using the following function.
7547 #include <isl/schedule.h>
7548 __isl_give isl_union_map *isl_schedule_get_map(
7549 __isl_keep isl_schedule *sched);
7551 The resulting relation encodes the same relative ordering as
7552 the schedule by mapping the domain elements to a common schedule space.
7553 If the schedule_separate_components option is set, then the order
7554 of the children of a set node is explicitly encoded in the result.
7555 If the tree contains any expansion nodes, then the relation
7556 is formulated in terms of the expanded domain elements.
7558 Schedules can be read from input using the following functions.
7560 #include <isl/schedule.h>
7561 __isl_give isl_schedule *isl_schedule_read_from_file(
7562 isl_ctx *ctx, FILE *input);
7563 __isl_give isl_schedule *isl_schedule_read_from_str(
7564 isl_ctx *ctx, const char *str);
7566 A representation of the schedule can be printed using
7568 #include <isl/schedule.h>
7569 __isl_give isl_printer *isl_printer_print_schedule(
7570 __isl_take isl_printer *p,
7571 __isl_keep isl_schedule *schedule);
7573 The schedule tree can be traversed through the use of
7574 C<isl_schedule_node> objects that point to a particular
7575 position in the schedule tree. Whenever a C<isl_schedule_node>
7576 is use to modify a node in the schedule tree, the original schedule
7577 tree is left untouched and the modifications are performed to a copy
7578 of the tree. The returned C<isl_schedule_node> then points to
7579 this modified copy of the tree.
7581 The root of the schedule tree can be obtained using the following function.
7583 #include <isl/schedule.h>
7584 __isl_give isl_schedule_node *isl_schedule_get_root(
7585 __isl_keep isl_schedule *schedule);
7587 A pointer to a newly created schedule tree with a single domain
7588 node can be created using the following functions.
7590 #include <isl/schedule_node.h>
7591 __isl_give isl_schedule_node *
7592 isl_schedule_node_from_domain(
7593 __isl_take isl_union_set *domain);
7594 __isl_give isl_schedule_node *
7595 isl_schedule_node_from_extension(
7596 __isl_take isl_union_map *extension);
7598 C<isl_schedule_node_from_extension> creates a tree with an extension
7601 Schedule nodes can be copied and freed using the following functions.
7603 #include <isl/schedule_node.h>
7604 __isl_give isl_schedule_node *isl_schedule_node_copy(
7605 __isl_keep isl_schedule_node *node);
7606 __isl_null isl_schedule_node *isl_schedule_node_free(
7607 __isl_take isl_schedule_node *node);
7609 The following functions can be used to check if two schedule
7610 nodes point to the same position in the same schedule.
7612 #include <isl/schedule_node.h>
7613 isl_bool isl_schedule_node_is_equal(
7614 __isl_keep isl_schedule_node *node1,
7615 __isl_keep isl_schedule_node *node2);
7617 The following properties can be obtained from a schedule node.
7619 #include <isl/schedule_node.h>
7620 enum isl_schedule_node_type isl_schedule_node_get_type(
7621 __isl_keep isl_schedule_node *node);
7622 enum isl_schedule_node_type
7623 isl_schedule_node_get_parent_type(
7624 __isl_keep isl_schedule_node *node);
7625 __isl_give isl_schedule *isl_schedule_node_get_schedule(
7626 __isl_keep isl_schedule_node *node);
7628 The function C<isl_schedule_node_get_type> returns the type of
7629 the node, while C<isl_schedule_node_get_parent_type> returns
7630 type of the parent of the node, which is required to exist.
7631 The function C<isl_schedule_node_get_schedule> returns a copy
7632 to the schedule to which the node belongs.
7634 The following functions can be used to move the schedule node
7635 to a different position in the tree or to check if such a position
7638 #include <isl/schedule_node.h>
7639 isl_bool isl_schedule_node_has_parent(
7640 __isl_keep isl_schedule_node *node);
7641 __isl_give isl_schedule_node *isl_schedule_node_parent(
7642 __isl_take isl_schedule_node *node);
7643 __isl_give isl_schedule_node *isl_schedule_node_root(
7644 __isl_take isl_schedule_node *node);
7645 __isl_give isl_schedule_node *isl_schedule_node_ancestor(
7646 __isl_take isl_schedule_node *node,
7648 int isl_schedule_node_n_children(
7649 __isl_keep isl_schedule_node *node);
7650 __isl_give isl_schedule_node *isl_schedule_node_child(
7651 __isl_take isl_schedule_node *node, int pos);
7652 isl_bool isl_schedule_node_has_children(
7653 __isl_keep isl_schedule_node *node);
7654 __isl_give isl_schedule_node *isl_schedule_node_first_child(
7655 __isl_take isl_schedule_node *node);
7656 isl_bool isl_schedule_node_has_previous_sibling(
7657 __isl_keep isl_schedule_node *node);
7658 __isl_give isl_schedule_node *
7659 isl_schedule_node_previous_sibling(
7660 __isl_take isl_schedule_node *node);
7661 isl_bool isl_schedule_node_has_next_sibling(
7662 __isl_keep isl_schedule_node *node);
7663 __isl_give isl_schedule_node *
7664 isl_schedule_node_next_sibling(
7665 __isl_take isl_schedule_node *node);
7667 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
7668 is the node itself, the ancestor of generation 1 is its parent and so on.
7670 It is also possible to query the number of ancestors of a node,
7671 the position of the current node
7672 within the children of its parent, the position of the subtree
7673 containing a node within the children of an ancestor
7674 or to obtain a copy of a given
7675 child without destroying the current node.
7676 Given two nodes that point to the same schedule, their closest
7677 shared ancestor can be obtained using
7678 C<isl_schedule_node_get_shared_ancestor>.
7680 #include <isl/schedule_node.h>
7681 int isl_schedule_node_get_tree_depth(
7682 __isl_keep isl_schedule_node *node);
7683 int isl_schedule_node_get_child_position(
7684 __isl_keep isl_schedule_node *node);
7685 int isl_schedule_node_get_ancestor_child_position(
7686 __isl_keep isl_schedule_node *node,
7687 __isl_keep isl_schedule_node *ancestor);
7688 __isl_give isl_schedule_node *isl_schedule_node_get_child(
7689 __isl_keep isl_schedule_node *node, int pos);
7690 __isl_give isl_schedule_node *
7691 isl_schedule_node_get_shared_ancestor(
7692 __isl_keep isl_schedule_node *node1,
7693 __isl_keep isl_schedule_node *node2);
7695 All nodes in a schedule tree or
7696 all descendants of a specific node (including the node) can be visited
7697 in depth-first pre-order using the following functions.
7699 #include <isl/schedule.h>
7700 isl_stat isl_schedule_foreach_schedule_node(
7701 __isl_keep isl_schedule *sched,
7702 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
7703 void *user), void *user);
7705 #include <isl/schedule_node.h>
7706 isl_stat isl_schedule_node_foreach_descendant(
7707 __isl_keep isl_schedule_node *node,
7708 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
7709 void *user), void *user);
7711 The callback function is slightly different from the usual
7712 callbacks in that it not only indicates success (non-negative result)
7713 or failure (negative result), but also indicates whether the children
7714 of the given node should be visited. In particular, if the callback
7715 returns a positive value, then the children are visited, but if
7716 the callback returns zero, then the children are not visited.
7718 The ancestors of a node in a schedule tree can be visited from
7719 the root down to and including the parent of the node using
7720 the following function.
7722 #include <isl/schedule_node.h>
7723 isl_stat isl_schedule_node_foreach_ancestor_top_down(
7724 __isl_keep isl_schedule_node *node,
7725 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
7726 void *user), void *user);
7728 The following functions allows for a depth-first post-order
7729 traversal of the nodes in a schedule tree or
7730 of the descendants of a specific node (including the node
7731 itself), where the user callback is allowed to modify the
7734 #include <isl/schedule.h>
7735 __isl_give isl_schedule *isl_schedule_map_schedule_node(
7736 __isl_take isl_schedule *schedule,
7737 __isl_give isl_schedule_node *(*fn)(
7738 __isl_take isl_schedule_node *node,
7739 void *user), void *user);
7741 #include <isl/schedule_node.h>
7742 __isl_give isl_schedule_node *
7743 isl_schedule_node_map_descendant(
7744 __isl_take isl_schedule_node *node,
7745 __isl_give isl_schedule_node *(*fn)(
7746 __isl_take isl_schedule_node *node,
7747 void *user), void *user);
7749 The traversal continues from the node returned by the callback function.
7750 It is the responsibility of the user to ensure that this does not
7751 lead to an infinite loop. It is safest to always return a pointer
7752 to the same position (same ancestors and child positions) as the input node.
7754 The following function removes a node (along with its descendants)
7755 from a schedule tree and returns a pointer to the leaf at the
7756 same position in the updated tree.
7757 It is not allowed to remove the root of a schedule tree or
7758 a child of a set or sequence node.
7760 #include <isl/schedule_node.h>
7761 __isl_give isl_schedule_node *isl_schedule_node_cut(
7762 __isl_take isl_schedule_node *node);
7764 The following function removes a single node
7765 from a schedule tree and returns a pointer to the child
7766 of the node, now located at the position of the original node
7767 or to a leaf node at that position if there was no child.
7768 It is not allowed to remove the root of a schedule tree,
7769 a set or sequence node, a child of a set or sequence node or
7770 a band node with an anchored subtree.
7772 #include <isl/schedule_node.h>
7773 __isl_give isl_schedule_node *isl_schedule_node_delete(
7774 __isl_take isl_schedule_node *node);
7776 Most nodes in a schedule tree only contain local information.
7777 In some cases, however, a node may also refer to outer band nodes.
7778 This means that the position of the node within the tree should
7779 not be changed, or at least that no changes are performed to the
7780 outer band nodes. The following function can be used to test
7781 whether the subtree rooted at a given node contains any such nodes.
7783 #include <isl/schedule_node.h>
7784 isl_bool isl_schedule_node_is_subtree_anchored(
7785 __isl_keep isl_schedule_node *node);
7787 The following function resets the user pointers on all parameter
7788 and tuple identifiers referenced by the given schedule node.
7790 #include <isl/schedule_node.h>
7791 __isl_give isl_schedule_node *isl_schedule_node_reset_user(
7792 __isl_take isl_schedule_node *node);
7794 The following function aligns the parameters of the given schedule
7795 node to the given space.
7797 #include <isl/schedule_node.h>
7798 __isl_give isl_schedule_node *
7799 isl_schedule_node_align_params(
7800 __isl_take isl_schedule_node *node,
7801 __isl_take isl_space *space);
7803 Several node types have their own functions for querying
7804 (and in some cases setting) some node type specific properties.
7806 #include <isl/schedule_node.h>
7807 __isl_give isl_space *isl_schedule_node_band_get_space(
7808 __isl_keep isl_schedule_node *node);
7809 __isl_give isl_multi_union_pw_aff *
7810 isl_schedule_node_band_get_partial_schedule(
7811 __isl_keep isl_schedule_node *node);
7812 __isl_give isl_union_map *
7813 isl_schedule_node_band_get_partial_schedule_union_map(
7814 __isl_keep isl_schedule_node *node);
7815 unsigned isl_schedule_node_band_n_member(
7816 __isl_keep isl_schedule_node *node);
7817 isl_bool isl_schedule_node_band_member_get_coincident(
7818 __isl_keep isl_schedule_node *node, int pos);
7819 __isl_give isl_schedule_node *
7820 isl_schedule_node_band_member_set_coincident(
7821 __isl_take isl_schedule_node *node, int pos,
7823 isl_bool isl_schedule_node_band_get_permutable(
7824 __isl_keep isl_schedule_node *node);
7825 __isl_give isl_schedule_node *
7826 isl_schedule_node_band_set_permutable(
7827 __isl_take isl_schedule_node *node, int permutable);
7828 enum isl_ast_loop_type
7829 isl_schedule_node_band_member_get_ast_loop_type(
7830 __isl_keep isl_schedule_node *node, int pos);
7831 __isl_give isl_schedule_node *
7832 isl_schedule_node_band_member_set_ast_loop_type(
7833 __isl_take isl_schedule_node *node, int pos,
7834 enum isl_ast_loop_type type);
7835 __isl_give isl_union_set *
7836 enum isl_ast_loop_type
7837 isl_schedule_node_band_member_get_isolate_ast_loop_type(
7838 __isl_keep isl_schedule_node *node, int pos);
7839 __isl_give isl_schedule_node *
7840 isl_schedule_node_band_member_set_isolate_ast_loop_type(
7841 __isl_take isl_schedule_node *node, int pos,
7842 enum isl_ast_loop_type type);
7843 isl_schedule_node_band_get_ast_build_options(
7844 __isl_keep isl_schedule_node *node);
7845 __isl_give isl_schedule_node *
7846 isl_schedule_node_band_set_ast_build_options(
7847 __isl_take isl_schedule_node *node,
7848 __isl_take isl_union_set *options);
7850 The function C<isl_schedule_node_band_get_space> returns the space
7851 of the partial schedule of the band.
7852 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
7853 returns a representation of the partial schedule of the band node
7854 in the form of an C<isl_union_map>.
7855 The coincident and permutable properties are set by
7856 C<isl_schedule_constraints_compute_schedule> on the schedule tree
7858 A scheduling dimension is considered to be ``coincident''
7859 if it satisfies the coincidence constraints within its band.
7860 That is, if the dependence distances of the coincidence
7861 constraints are all zero in that direction (for fixed
7862 iterations of outer bands).
7863 A band is marked permutable if it was produced using the Pluto-like scheduler.
7864 Note that the scheduler may have to resort to a Feautrier style scheduling
7865 step even if the default scheduler is used.
7866 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
7867 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
7868 For the meaning of these loop AST generation types and the difference
7869 between the regular loop AST generation type and the isolate
7870 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
7871 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
7872 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
7873 may return C<isl_ast_loop_error> if an error occurs.
7874 The AST build options govern how an AST is generated for
7875 the individual schedule dimensions during AST generation.
7876 See L</"AST Generation Options (Schedule Tree)">.
7878 #include <isl/schedule_node.h>
7879 __isl_give isl_set *
7880 isl_schedule_node_context_get_context(
7881 __isl_keep isl_schedule_node *node);
7883 #include <isl/schedule_node.h>
7884 __isl_give isl_union_set *
7885 isl_schedule_node_domain_get_domain(
7886 __isl_keep isl_schedule_node *node);
7888 #include <isl/schedule_node.h>
7889 __isl_give isl_union_map *
7890 isl_schedule_node_expansion_get_expansion(
7891 __isl_keep isl_schedule_node *node);
7892 __isl_give isl_union_pw_multi_aff *
7893 isl_schedule_node_expansion_get_contraction(
7894 __isl_keep isl_schedule_node *node);
7896 #include <isl/schedule_node.h>
7897 __isl_give isl_union_map *
7898 isl_schedule_node_extension_get_extension(
7899 __isl_keep isl_schedule_node *node);
7901 #include <isl/schedule_node.h>
7902 __isl_give isl_union_set *
7903 isl_schedule_node_filter_get_filter(
7904 __isl_keep isl_schedule_node *node);
7906 #include <isl/schedule_node.h>
7907 __isl_give isl_set *isl_schedule_node_guard_get_guard(
7908 __isl_keep isl_schedule_node *node);
7910 #include <isl/schedule_node.h>
7911 __isl_give isl_id *isl_schedule_node_mark_get_id(
7912 __isl_keep isl_schedule_node *node);
7914 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
7915 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
7916 partial schedules related to the node.
7918 #include <isl/schedule_node.h>
7919 __isl_give isl_multi_union_pw_aff *
7920 isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
7921 __isl_keep isl_schedule_node *node);
7922 __isl_give isl_union_pw_multi_aff *
7923 isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
7924 __isl_keep isl_schedule_node *node);
7925 __isl_give isl_union_map *
7926 isl_schedule_node_get_prefix_schedule_union_map(
7927 __isl_keep isl_schedule_node *node);
7928 __isl_give isl_union_map *
7929 isl_schedule_node_get_prefix_schedule_relation(
7930 __isl_keep isl_schedule_node *node);
7931 __isl_give isl_union_map *
7932 isl_schedule_node_get_subtree_schedule_union_map(
7933 __isl_keep isl_schedule_node *node);
7935 In particular, the functions
7936 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
7937 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
7938 and C<isl_schedule_node_get_prefix_schedule_union_map>
7939 return a relative ordering on the domain elements that reach the given
7940 node determined by its ancestors.
7941 The function C<isl_schedule_node_get_prefix_schedule_relation>
7942 additionally includes the domain constraints in the result.
7943 The function C<isl_schedule_node_get_subtree_schedule_union_map>
7944 returns a representation of the partial schedule defined by the
7945 subtree rooted at the given node.
7946 If the tree contains any expansion nodes, then the subtree schedule
7947 is formulated in terms of the expanded domain elements.
7948 The tree passed to functions returning a prefix schedule
7949 may only contain extension nodes if these would not affect
7950 the result of these functions. That is, if one of the ancestors
7951 is an extension node, then all of the domain elements that were
7952 added by the extension node need to have been filtered out
7953 by filter nodes between the extension node and the input node.
7954 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
7955 may not contain in extension nodes in the selected subtree.
7957 The expansion/contraction defined by an entire subtree, combining
7958 the expansions/contractions
7959 on the expansion nodes in the subtree, can be obtained using
7960 the following functions.
7962 #include <isl/schedule_node.h>
7963 __isl_give isl_union_map *
7964 isl_schedule_node_get_subtree_expansion(
7965 __isl_keep isl_schedule_node *node);
7966 __isl_give isl_union_pw_multi_aff *
7967 isl_schedule_node_get_subtree_contraction(
7968 __isl_keep isl_schedule_node *node);
7970 The total number of outer band members of given node, i.e.,
7971 the shared output dimension of the maps in the result
7972 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
7973 using the following function.
7975 #include <isl/schedule_node.h>
7976 int isl_schedule_node_get_schedule_depth(
7977 __isl_keep isl_schedule_node *node);
7979 The following functions return the elements that reach the given node
7980 or the union of universes in the spaces that contain these elements.
7982 #include <isl/schedule_node.h>
7983 __isl_give isl_union_set *
7984 isl_schedule_node_get_domain(
7985 __isl_keep isl_schedule_node *node);
7986 __isl_give isl_union_set *
7987 isl_schedule_node_get_universe_domain(
7988 __isl_keep isl_schedule_node *node);
7990 The input tree of C<isl_schedule_node_get_domain>
7991 may only contain extension nodes if these would not affect
7992 the result of this function. That is, if one of the ancestors
7993 is an extension node, then all of the domain elements that were
7994 added by the extension node need to have been filtered out
7995 by filter nodes between the extension node and the input node.
7997 The following functions can be used to introduce additional nodes
7998 in the schedule tree. The new node is introduced at the point
7999 in the tree where the C<isl_schedule_node> points to and
8000 the results points to the new node.
8002 #include <isl/schedule_node.h>
8003 __isl_give isl_schedule_node *
8004 isl_schedule_node_insert_partial_schedule(
8005 __isl_take isl_schedule_node *node,
8006 __isl_take isl_multi_union_pw_aff *schedule);
8008 This function inserts a new band node with (the greatest integer
8009 part of) the given partial schedule.
8010 The subtree rooted at the given node is assumed not to have
8013 #include <isl/schedule_node.h>
8014 __isl_give isl_schedule_node *
8015 isl_schedule_node_insert_context(
8016 __isl_take isl_schedule_node *node,
8017 __isl_take isl_set *context);
8019 This function inserts a new context node with the given context constraints.
8021 #include <isl/schedule_node.h>
8022 __isl_give isl_schedule_node *
8023 isl_schedule_node_insert_filter(
8024 __isl_take isl_schedule_node *node,
8025 __isl_take isl_union_set *filter);
8027 This function inserts a new filter node with the given filter.
8028 If the original node already pointed to a filter node, then the
8029 two filter nodes are merged into one.
8031 #include <isl/schedule_node.h>
8032 __isl_give isl_schedule_node *
8033 isl_schedule_node_insert_guard(
8034 __isl_take isl_schedule_node *node,
8035 __isl_take isl_set *guard);
8037 This function inserts a new guard node with the given guard constraints.
8039 #include <isl/schedule_node.h>
8040 __isl_give isl_schedule_node *
8041 isl_schedule_node_insert_mark(
8042 __isl_take isl_schedule_node *node,
8043 __isl_take isl_id *mark);
8045 This function inserts a new mark node with the give mark identifier.
8047 #include <isl/schedule_node.h>
8048 __isl_give isl_schedule_node *
8049 isl_schedule_node_insert_sequence(
8050 __isl_take isl_schedule_node *node,
8051 __isl_take isl_union_set_list *filters);
8052 __isl_give isl_schedule_node *
8053 isl_schedule_node_insert_set(
8054 __isl_take isl_schedule_node *node,
8055 __isl_take isl_union_set_list *filters);
8057 These functions insert a new sequence or set node with the given
8058 filters as children.
8060 #include <isl/schedule_node.h>
8061 __isl_give isl_schedule_node *isl_schedule_node_group(
8062 __isl_take isl_schedule_node *node,
8063 __isl_take isl_id *group_id);
8065 This function introduces an expansion node in between the current
8066 node and its parent that expands instances of a space with tuple
8067 identifier C<group_id> to the original domain elements that reach
8068 the node. The group instances are identified by the prefix schedule
8069 of those domain elements. The ancestors of the node are adjusted
8070 to refer to the group instances instead of the original domain
8071 elements. The return value points to the same node in the updated
8072 schedule tree as the input node, i.e., to the child of the newly
8073 introduced expansion node. Grouping instances of different statements
8074 ensures that they will be treated as a single statement by the
8075 AST generator up to the point of the expansion node.
8077 The partial schedule of a band node can be scaled (down) using
8078 the following functions.
8080 #include <isl/schedule_node.h>
8081 __isl_give isl_schedule_node *
8082 isl_schedule_node_band_scale(
8083 __isl_take isl_schedule_node *node,
8084 __isl_take isl_multi_val *mv);
8085 __isl_give isl_schedule_node *
8086 isl_schedule_node_band_scale_down(
8087 __isl_take isl_schedule_node *node,
8088 __isl_take isl_multi_val *mv);
8090 The spaces of the two arguments need to match.
8091 After scaling, the partial schedule is replaced by its greatest
8092 integer part to ensure that the schedule remains integral.
8094 A band node can be tiled using the following function.
8096 #include <isl/schedule_node.h>
8097 __isl_give isl_schedule_node *isl_schedule_node_band_tile(
8098 __isl_take isl_schedule_node *node,
8099 __isl_take isl_multi_val *sizes);
8101 isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8103 int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8104 isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8106 int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8108 The C<isl_schedule_node_band_tile> function tiles
8109 the band using the given tile sizes inside its schedule.
8110 A new child band node is created to represent the point loops and it is
8111 inserted between the modified band and its children.
8112 The subtree rooted at the given node is assumed not to have
8114 The C<tile_scale_tile_loops> option specifies whether the tile
8115 loops iterators should be scaled by the tile sizes.
8116 If the C<tile_shift_point_loops> option is set, then the point loops
8117 are shifted to start at zero.
8119 A band node can be split into two nested band nodes
8120 using the following function.
8122 #include <isl/schedule_node.h>
8123 __isl_give isl_schedule_node *isl_schedule_node_band_split(
8124 __isl_take isl_schedule_node *node, int pos);
8126 The resulting outer band node contains the first C<pos> dimensions of
8127 the schedule of C<node> while the inner band contains the remaining dimensions.
8128 The schedules of the two band nodes live in anonymous spaces.
8130 A band node can be moved down to the leaves of the subtree rooted
8131 at the band node using the following function.
8133 #include <isl/schedule_node.h>
8134 __isl_give isl_schedule_node *isl_schedule_node_band_sink(
8135 __isl_take isl_schedule_node *node);
8137 The subtree rooted at the given node is assumed not to have
8139 The result points to the node in the resulting tree that is in the same
8140 position as the node pointed to by C<node> in the original tree.
8142 #include <isl/schedule_node.h>
8143 __isl_give isl_schedule_node *
8144 isl_schedule_node_order_after(
8145 __isl_take isl_schedule_node *node,
8146 __isl_take isl_union_set *filter);
8148 This function splits the domain elements that reach C<node>
8149 into those that satisfy C<filter> and those that do not and
8150 arranges for the elements that do satisfy the filter to be
8151 executed after those that do not. The order is imposed by
8152 a sequence node, possibly reusing the grandparent of C<node>
8153 on two copies of the subtree attached to the original C<node>.
8154 Both copies are simplified with respect to their filter.
8156 Return a pointer to the copy of the subtree that does not
8157 satisfy C<filter>. If there is no such copy (because all
8158 reaching domain elements satisfy the filter), then return
8159 the original pointer.
8161 #include <isl/schedule_node.h>
8162 __isl_give isl_schedule_node *
8163 isl_schedule_node_graft_before(
8164 __isl_take isl_schedule_node *node,
8165 __isl_take isl_schedule_node *graft);
8166 __isl_give isl_schedule_node *
8167 isl_schedule_node_graft_after(
8168 __isl_take isl_schedule_node *node,
8169 __isl_take isl_schedule_node *graft);
8171 This function inserts the C<graft> tree into the tree containing C<node>
8172 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
8173 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
8174 The root node of C<graft>
8175 should be an extension node where the domain of the extension
8176 is the flat product of all outer band nodes of C<node>.
8177 The root node may also be a domain node.
8178 The elements of the domain or the range of the extension may not
8179 intersect with the domain elements that reach "node".
8180 The schedule tree of C<graft> may not be anchored.
8182 The schedule tree of C<node> is modified to include an extension node
8183 corresponding to the root node of C<graft> as a child of the original
8184 parent of C<node>. The original node that C<node> points to and the
8185 child of the root node of C<graft> are attached to this extension node
8186 through a sequence, with appropriate filters and with the child
8187 of C<graft> appearing before or after the original C<node>.
8189 If C<node> already appears inside a sequence that is the child of
8190 an extension node and if the spaces of the new domain elements
8191 do not overlap with those of the original domain elements,
8192 then that extension node is extended with the new extension
8193 rather than introducing a new segment of extension and sequence nodes.
8195 Return a pointer to the same node in the modified tree that
8196 C<node> pointed to in the original tree.
8198 A representation of the schedule node can be printed using
8200 #include <isl/schedule_node.h>
8201 __isl_give isl_printer *isl_printer_print_schedule_node(
8202 __isl_take isl_printer *p,
8203 __isl_keep isl_schedule_node *node);
8205 =head2 Dependence Analysis
8207 C<isl> contains specialized functionality for performing
8208 array dataflow analysis. That is, given a I<sink> access relation
8209 and a collection of possible I<source> access relations,
8210 C<isl> can compute relations that describe
8211 for each iteration of the sink access, which iteration
8212 of which of the source access relations was the last
8213 to access the same data element before the given iteration
8215 The resulting dependence relations map source iterations
8216 to the corresponding sink iterations.
8217 To compute standard flow dependences, the sink should be
8218 a read, while the sources should be writes.
8219 If any of the source accesses are marked as being I<may>
8220 accesses, then there will be a dependence from the last
8221 I<must> access B<and> from any I<may> access that follows
8222 this last I<must> access.
8223 In particular, if I<all> sources are I<may> accesses,
8224 then memory based dependence analysis is performed.
8225 If, on the other hand, all sources are I<must> accesses,
8226 then value based dependence analysis is performed.
8228 =head3 High-level Interface
8230 A high-level interface to dependence analysis is provided
8231 by the following function.
8233 #include <isl/flow.h>
8234 __isl_give isl_union_flow *
8235 isl_union_access_info_compute_flow(
8236 __isl_take isl_union_access_info *access);
8238 The input C<isl_union_access_info> object describes the sink
8239 access relations, the source access relations and a schedule,
8240 while the output C<isl_union_flow> object describes
8241 the resulting dependence relations and the subsets of the
8242 sink relations for which no source was found.
8244 An C<isl_union_access_info> is created, modified and freed using
8245 the following functions.
8247 #include <isl/flow.h>
8248 __isl_give isl_union_access_info *
8249 isl_union_access_info_from_sink(
8250 __isl_take isl_union_map *sink);
8251 __isl_give isl_union_access_info *
8252 isl_union_access_info_set_must_source(
8253 __isl_take isl_union_access_info *access,
8254 __isl_take isl_union_map *must_source);
8255 __isl_give isl_union_access_info *
8256 isl_union_access_info_set_may_source(
8257 __isl_take isl_union_access_info *access,
8258 __isl_take isl_union_map *may_source);
8259 __isl_give isl_union_access_info *
8260 isl_union_access_info_set_schedule(
8261 __isl_take isl_union_access_info *access,
8262 __isl_take isl_schedule *schedule);
8263 __isl_give isl_union_access_info *
8264 isl_union_access_info_set_schedule_map(
8265 __isl_take isl_union_access_info *access,
8266 __isl_take isl_union_map *schedule_map);
8267 __isl_null isl_union_access_info *
8268 isl_union_access_info_free(
8269 __isl_take isl_union_access_info *access);
8271 The may sources set by C<isl_union_access_info_set_may_source>
8272 do not need to include the must sources set by
8273 C<isl_union_access_info_set_must_source> as a subset.
8274 The user is free not to call one (or both) of these functions,
8275 in which case the corresponding set is kept to its empty default.
8276 Similarly, the default schedule initialized by
8277 C<isl_union_access_info_from_sink> is empty.
8278 The current schedule is determined by the last call to either
8279 C<isl_union_access_info_set_schedule> or
8280 C<isl_union_access_info_set_schedule_map>.
8281 The domain of the schedule corresponds to the domains of
8282 the access relations. In particular, the domains of the access
8283 relations are effectively intersected with the domain of the schedule
8284 and only the resulting accesses are considered by the dependence analysis.
8286 The output of C<isl_union_access_info_compute_flow> can be examined
8287 and freed using the following functions.
8289 #include <isl/flow.h>
8290 __isl_give isl_union_map *isl_union_flow_get_must_dependence(
8291 __isl_keep isl_union_flow *flow);
8292 __isl_give isl_union_map *isl_union_flow_get_may_dependence(
8293 __isl_keep isl_union_flow *flow);
8294 __isl_give isl_union_map *isl_union_flow_get_must_no_source(
8295 __isl_keep isl_union_flow *flow);
8296 __isl_give isl_union_map *isl_union_flow_get_may_no_source(
8297 __isl_keep isl_union_flow *flow);
8298 __isl_null isl_union_flow *isl_union_flow_free(
8299 __isl_take isl_union_flow *flow);
8301 The relation returned by C<isl_union_flow_get_must_dependence>
8302 relates domain elements of must sources to domain elements of the sink.
8303 The relation returned by C<isl_union_flow_get_may_dependence>
8304 relates domain elements of must or may sources to domain elements of the sink
8305 and includes the previous relation as a subset.
8306 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
8307 of the sink relation for which no dependences have been found.
8308 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
8309 of the sink relation for which no definite dependences have been found.
8310 That is, it contains those sink access that do not contribute to any
8311 of the elements in the relation returned
8312 by C<isl_union_flow_get_must_dependence>.
8314 =head3 Low-level Interface
8316 A lower-level interface is provided by the following functions.
8318 #include <isl/flow.h>
8320 typedef int (*isl_access_level_before)(void *first, void *second);
8322 __isl_give isl_access_info *isl_access_info_alloc(
8323 __isl_take isl_map *sink,
8324 void *sink_user, isl_access_level_before fn,
8326 __isl_give isl_access_info *isl_access_info_add_source(
8327 __isl_take isl_access_info *acc,
8328 __isl_take isl_map *source, int must,
8330 __isl_null isl_access_info *isl_access_info_free(
8331 __isl_take isl_access_info *acc);
8333 __isl_give isl_flow *isl_access_info_compute_flow(
8334 __isl_take isl_access_info *acc);
8336 isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
8337 isl_stat (*fn)(__isl_take isl_map *dep, int must,
8338 void *dep_user, void *user),
8340 __isl_give isl_map *isl_flow_get_no_source(
8341 __isl_keep isl_flow *deps, int must);
8342 void isl_flow_free(__isl_take isl_flow *deps);
8344 The function C<isl_access_info_compute_flow> performs the actual
8345 dependence analysis. The other functions are used to construct
8346 the input for this function or to read off the output.
8348 The input is collected in an C<isl_access_info>, which can
8349 be created through a call to C<isl_access_info_alloc>.
8350 The arguments to this functions are the sink access relation
8351 C<sink>, a token C<sink_user> used to identify the sink
8352 access to the user, a callback function for specifying the
8353 relative order of source and sink accesses, and the number
8354 of source access relations that will be added.
8355 The callback function has type C<int (*)(void *first, void *second)>.
8356 The function is called with two user supplied tokens identifying
8357 either a source or the sink and it should return the shared nesting
8358 level and the relative order of the two accesses.
8359 In particular, let I<n> be the number of loops shared by
8360 the two accesses. If C<first> precedes C<second> textually,
8361 then the function should return I<2 * n + 1>; otherwise,
8362 it should return I<2 * n>.
8363 The sources can be added to the C<isl_access_info> by performing
8364 (at most) C<max_source> calls to C<isl_access_info_add_source>.
8365 C<must> indicates whether the source is a I<must> access
8366 or a I<may> access. Note that a multi-valued access relation
8367 should only be marked I<must> if every iteration in the domain
8368 of the relation accesses I<all> elements in its image.
8369 The C<source_user> token is again used to identify
8370 the source access. The range of the source access relation
8371 C<source> should have the same dimension as the range
8372 of the sink access relation.
8373 The C<isl_access_info_free> function should usually not be
8374 called explicitly, because it is called implicitly by
8375 C<isl_access_info_compute_flow>.
8377 The result of the dependence analysis is collected in an
8378 C<isl_flow>. There may be elements of
8379 the sink access for which no preceding source access could be
8380 found or for which all preceding sources are I<may> accesses.
8381 The relations containing these elements can be obtained through
8382 calls to C<isl_flow_get_no_source>, the first with C<must> set
8383 and the second with C<must> unset.
8384 In the case of standard flow dependence analysis,
8385 with the sink a read and the sources I<must> writes,
8386 the first relation corresponds to the reads from uninitialized
8387 array elements and the second relation is empty.
8388 The actual flow dependences can be extracted using
8389 C<isl_flow_foreach>. This function will call the user-specified
8390 callback function C<fn> for each B<non-empty> dependence between
8391 a source and the sink. The callback function is called
8392 with four arguments, the actual flow dependence relation
8393 mapping source iterations to sink iterations, a boolean that
8394 indicates whether it is a I<must> or I<may> dependence, a token
8395 identifying the source and an additional C<void *> with value
8396 equal to the third argument of the C<isl_flow_foreach> call.
8397 A dependence is marked I<must> if it originates from a I<must>
8398 source and if it is not followed by any I<may> sources.
8400 After finishing with an C<isl_flow>, the user should call
8401 C<isl_flow_free> to free all associated memory.
8403 =head3 Interaction with the Low-level Interface
8405 During the dependence analysis, we frequently need to perform
8406 the following operation. Given a relation between sink iterations
8407 and potential source iterations from a particular source domain,
8408 what is the last potential source iteration corresponding to each
8409 sink iteration. It can sometimes be convenient to adjust
8410 the set of potential source iterations before or after each such operation.
8411 The prototypical example is fuzzy array dataflow analysis,
8412 where we need to analyze if, based on data-dependent constraints,
8413 the sink iteration can ever be executed without one or more of
8414 the corresponding potential source iterations being executed.
8415 If so, we can introduce extra parameters and select an unknown
8416 but fixed source iteration from the potential source iterations.
8417 To be able to perform such manipulations, C<isl> provides the following
8420 #include <isl/flow.h>
8422 typedef __isl_give isl_restriction *(*isl_access_restrict)(
8423 __isl_keep isl_map *source_map,
8424 __isl_keep isl_set *sink, void *source_user,
8426 __isl_give isl_access_info *isl_access_info_set_restrict(
8427 __isl_take isl_access_info *acc,
8428 isl_access_restrict fn, void *user);
8430 The function C<isl_access_info_set_restrict> should be called
8431 before calling C<isl_access_info_compute_flow> and registers a callback function
8432 that will be called any time C<isl> is about to compute the last
8433 potential source. The first argument is the (reverse) proto-dependence,
8434 mapping sink iterations to potential source iterations.
8435 The second argument represents the sink iterations for which
8436 we want to compute the last source iteration.
8437 The third argument is the token corresponding to the source
8438 and the final argument is the token passed to C<isl_access_info_set_restrict>.
8439 The callback is expected to return a restriction on either the input or
8440 the output of the operation computing the last potential source.
8441 If the input needs to be restricted then restrictions are needed
8442 for both the source and the sink iterations. The sink iterations
8443 and the potential source iterations will be intersected with these sets.
8444 If the output needs to be restricted then only a restriction on the source
8445 iterations is required.
8446 If any error occurs, the callback should return C<NULL>.
8447 An C<isl_restriction> object can be created, freed and inspected
8448 using the following functions.
8450 #include <isl/flow.h>
8452 __isl_give isl_restriction *isl_restriction_input(
8453 __isl_take isl_set *source_restr,
8454 __isl_take isl_set *sink_restr);
8455 __isl_give isl_restriction *isl_restriction_output(
8456 __isl_take isl_set *source_restr);
8457 __isl_give isl_restriction *isl_restriction_none(
8458 __isl_take isl_map *source_map);
8459 __isl_give isl_restriction *isl_restriction_empty(
8460 __isl_take isl_map *source_map);
8461 __isl_null isl_restriction *isl_restriction_free(
8462 __isl_take isl_restriction *restr);
8464 C<isl_restriction_none> and C<isl_restriction_empty> are special
8465 cases of C<isl_restriction_input>. C<isl_restriction_none>
8466 is essentially equivalent to
8468 isl_restriction_input(isl_set_universe(
8469 isl_space_range(isl_map_get_space(source_map))),
8471 isl_space_domain(isl_map_get_space(source_map))));
8473 whereas C<isl_restriction_empty> is essentially equivalent to
8475 isl_restriction_input(isl_set_empty(
8476 isl_space_range(isl_map_get_space(source_map))),
8478 isl_space_domain(isl_map_get_space(source_map))));
8482 B<The functionality described in this section is fairly new
8483 and may be subject to change.>
8485 #include <isl/schedule.h>
8486 __isl_give isl_schedule *
8487 isl_schedule_constraints_compute_schedule(
8488 __isl_take isl_schedule_constraints *sc);
8490 The function C<isl_schedule_constraints_compute_schedule> can be
8491 used to compute a schedule that satisfies the given schedule constraints.
8492 These schedule constraints include the iteration domain for which
8493 a schedule should be computed and dependences between pairs of
8494 iterations. In particular, these dependences include
8495 I<validity> dependences and I<proximity> dependences.
8496 By default, the algorithm used to construct the schedule is similar
8497 to that of C<Pluto>.
8498 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
8500 The generated schedule respects all validity dependences.
8501 That is, all dependence distances over these dependences in the
8502 scheduled space are lexicographically positive.
8504 The default algorithm tries to ensure that the dependence distances
8505 over coincidence constraints are zero and to minimize the
8506 dependence distances over proximity dependences.
8507 Moreover, it tries to obtain sequences (bands) of schedule dimensions
8508 for groups of domains where the dependence distances over validity
8509 dependences have only non-negative values.
8510 Note that when minimizing the maximal dependence distance
8511 over proximity dependences, a single affine expression in the parameters
8512 is constructed that bounds all dependence distances. If no such expression
8513 exists, then the algorithm will fail and resort to an alternative
8514 scheduling algorithm. In particular, this means that adding proximity
8515 dependences may eliminate valid solutions. A typical example where this
8516 phenomenon may occur is when some subset of the proximity dependences
8517 has no restriction on some parameter, forcing the coefficient of that
8518 parameter to be zero, while some other subset forces the dependence
8519 distance to depend on that parameter, requiring the same coefficient
8521 When using Feautrier's algorithm, the coincidence and proximity constraints
8522 are only taken into account during the extension to a
8523 full-dimensional schedule.
8525 An C<isl_schedule_constraints> object can be constructed
8526 and manipulated using the following functions.
8528 #include <isl/schedule.h>
8529 __isl_give isl_schedule_constraints *
8530 isl_schedule_constraints_copy(
8531 __isl_keep isl_schedule_constraints *sc);
8532 __isl_give isl_schedule_constraints *
8533 isl_schedule_constraints_on_domain(
8534 __isl_take isl_union_set *domain);
8535 __isl_give isl_schedule_constraints *
8536 isl_schedule_constraints_set_context(
8537 __isl_take isl_schedule_constraints *sc,
8538 __isl_take isl_set *context);
8539 __isl_give isl_schedule_constraints *
8540 isl_schedule_constraints_set_validity(
8541 __isl_take isl_schedule_constraints *sc,
8542 __isl_take isl_union_map *validity);
8543 __isl_give isl_schedule_constraints *
8544 isl_schedule_constraints_set_coincidence(
8545 __isl_take isl_schedule_constraints *sc,
8546 __isl_take isl_union_map *coincidence);
8547 __isl_give isl_schedule_constraints *
8548 isl_schedule_constraints_set_proximity(
8549 __isl_take isl_schedule_constraints *sc,
8550 __isl_take isl_union_map *proximity);
8551 __isl_give isl_schedule_constraints *
8552 isl_schedule_constraints_set_conditional_validity(
8553 __isl_take isl_schedule_constraints *sc,
8554 __isl_take isl_union_map *condition,
8555 __isl_take isl_union_map *validity);
8556 __isl_null isl_schedule_constraints *
8557 isl_schedule_constraints_free(
8558 __isl_take isl_schedule_constraints *sc);
8560 The initial C<isl_schedule_constraints> object created by
8561 C<isl_schedule_constraints_on_domain> does not impose any constraints.
8562 That is, it has an empty set of dependences.
8563 The function C<isl_schedule_constraints_set_context> allows the user
8564 to specify additional constraints on the parameters that may
8565 be assumed to hold during the construction of the schedule.
8566 The function C<isl_schedule_constraints_set_validity> replaces the
8567 validity dependences, mapping domain elements I<i> to domain
8568 elements that should be scheduled after I<i>.
8569 The function C<isl_schedule_constraints_set_coincidence> replaces the
8570 coincidence dependences, mapping domain elements I<i> to domain
8571 elements that should be scheduled together with I<I>, if possible.
8572 The function C<isl_schedule_constraints_set_proximity> replaces the
8573 proximity dependences, mapping domain elements I<i> to domain
8574 elements that should be scheduled either before I<I>
8575 or as early as possible after I<i>.
8577 The function C<isl_schedule_constraints_set_conditional_validity>
8578 replaces the conditional validity constraints.
8579 A conditional validity constraint is only imposed when any of the corresponding
8580 conditions is satisfied, i.e., when any of them is non-zero.
8581 That is, the scheduler ensures that within each band if the dependence
8582 distances over the condition constraints are not all zero
8583 then all corresponding conditional validity constraints are respected.
8584 A conditional validity constraint corresponds to a condition
8585 if the two are adjacent, i.e., if the domain of one relation intersect
8586 the range of the other relation.
8587 The typical use case of conditional validity constraints is
8588 to allow order constraints between live ranges to be violated
8589 as long as the live ranges themselves are local to the band.
8590 To allow more fine-grained control over which conditions correspond
8591 to which conditional validity constraints, the domains and ranges
8592 of these relations may include I<tags>. That is, the domains and
8593 ranges of those relation may themselves be wrapped relations
8594 where the iteration domain appears in the domain of those wrapped relations
8595 and the range of the wrapped relations can be arbitrarily chosen
8596 by the user. Conditions and conditional validity constraints are only
8597 considered adjacent to each other if the entire wrapped relation matches.
8598 In particular, a relation with a tag will never be considered adjacent
8599 to a relation without a tag.
8601 An C<isl_schedule_constraints> object can be inspected
8602 using the following functions.
8604 #include <isl/schedule.h>
8605 __isl_give isl_union_map *
8606 isl_schedule_constraints_get_validity(
8607 __isl_keep isl_schedule_constraints *sc);
8608 __isl_give isl_union_map *
8609 isl_schedule_constraints_get_coincidence(
8610 __isl_keep isl_schedule_constraints *sc);
8611 __isl_give isl_union_map *
8612 isl_schedule_constraints_get_conditional_validity(
8613 __isl_keep isl_schedule_constraints *sc);
8614 __isl_give isl_union_map *
8615 isl_schedule_constraints_get_conditional_validity_condition(
8616 __isl_keep isl_schedule_constraints *sc);
8618 The following function computes a schedule directly from
8619 an iteration domain and validity and proximity dependences
8620 and is implemented in terms of the functions described above.
8621 The use of C<isl_union_set_compute_schedule> is discouraged.
8623 #include <isl/schedule.h>
8624 __isl_give isl_schedule *isl_union_set_compute_schedule(
8625 __isl_take isl_union_set *domain,
8626 __isl_take isl_union_map *validity,
8627 __isl_take isl_union_map *proximity);
8629 The generated schedule represents a schedule tree.
8630 For more information on schedule trees, see
8631 L</"Schedule Trees">.
8635 #include <isl/schedule.h>
8636 isl_stat isl_options_set_schedule_max_coefficient(
8637 isl_ctx *ctx, int val);
8638 int isl_options_get_schedule_max_coefficient(
8640 isl_stat isl_options_set_schedule_max_constant_term(
8641 isl_ctx *ctx, int val);
8642 int isl_options_get_schedule_max_constant_term(
8644 isl_stat isl_options_set_schedule_fuse(isl_ctx *ctx, int val);
8645 int isl_options_get_schedule_fuse(isl_ctx *ctx);
8646 isl_stat isl_options_set_schedule_maximize_band_depth(
8647 isl_ctx *ctx, int val);
8648 int isl_options_get_schedule_maximize_band_depth(
8650 isl_stat isl_options_set_schedule_outer_coincidence(
8651 isl_ctx *ctx, int val);
8652 int isl_options_get_schedule_outer_coincidence(
8654 isl_stat isl_options_set_schedule_split_scaled(
8655 isl_ctx *ctx, int val);
8656 int isl_options_get_schedule_split_scaled(
8658 isl_stat isl_options_set_schedule_algorithm(
8659 isl_ctx *ctx, int val);
8660 int isl_options_get_schedule_algorithm(
8662 isl_stat isl_options_set_schedule_separate_components(
8663 isl_ctx *ctx, int val);
8664 int isl_options_get_schedule_separate_components(
8669 =item * schedule_max_coefficient
8671 This option enforces that the coefficients for variable and parameter
8672 dimensions in the calculated schedule are not larger than the specified value.
8673 This option can significantly increase the speed of the scheduling calculation
8674 and may also prevent fusing of unrelated dimensions. A value of -1 means that
8675 this option does not introduce bounds on the variable or parameter
8678 =item * schedule_max_constant_term
8680 This option enforces that the constant coefficients in the calculated schedule
8681 are not larger than the maximal constant term. This option can significantly
8682 increase the speed of the scheduling calculation and may also prevent fusing of
8683 unrelated dimensions. A value of -1 means that this option does not introduce
8684 bounds on the constant coefficients.
8686 =item * schedule_fuse
8688 This option controls the level of fusion.
8689 If this option is set to C<ISL_SCHEDULE_FUSE_MIN>, then loops in the
8690 resulting schedule will be distributed as much as possible.
8691 If this option is set to C<ISL_SCHEDULE_FUSE_MAX>, then C<isl> will
8692 try to fuse loops in the resulting schedule.
8694 =item * schedule_maximize_band_depth
8696 If this option is set, we do not split bands at the point
8697 where we detect splitting is necessary. Instead, we
8698 backtrack and split bands as early as possible. This
8699 reduces the number of splits and maximizes the width of
8700 the bands. Wider bands give more possibilities for tiling.
8701 Note that if the C<schedule_fuse> option is set to C<ISL_SCHEDULE_FUSE_MIN>,
8702 then bands will be split as early as possible, even if there is no need.
8703 The C<schedule_maximize_band_depth> option therefore has no effect in this case.
8705 =item * schedule_outer_coincidence
8707 If this option is set, then we try to construct schedules
8708 where the outermost scheduling dimension in each band
8709 satisfies the coincidence constraints.
8711 =item * schedule_split_scaled
8713 If this option is set, then we try to construct schedules in which the
8714 constant term is split off from the linear part if the linear parts of
8715 the scheduling rows for all nodes in the graphs have a common non-trivial
8717 The constant term is then placed in a separate band and the linear
8720 =item * schedule_algorithm
8722 Selects the scheduling algorithm to be used.
8723 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
8724 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
8726 =item * schedule_separate_components
8728 If this option is set then the function C<isl_schedule_get_map>
8729 will treat set nodes in the same way as sequence nodes.
8733 =head2 AST Generation
8735 This section describes the C<isl> functionality for generating
8736 ASTs that visit all the elements
8737 in a domain in an order specified by a schedule tree or
8739 In case the schedule given as a C<isl_union_map>, an AST is generated
8740 that visits all the elements in the domain of the C<isl_union_map>
8741 according to the lexicographic order of the corresponding image
8742 element(s). If the range of the C<isl_union_map> consists of
8743 elements in more than one space, then each of these spaces is handled
8744 separately in an arbitrary order.
8745 It should be noted that the schedule tree or the image elements
8746 in a schedule map only specify the I<order>
8747 in which the corresponding domain elements should be visited.
8748 No direct relation between the partial schedule values
8749 or the image elements on the one hand and the loop iterators
8750 in the generated AST on the other hand should be assumed.
8752 Each AST is generated within a build. The initial build
8753 simply specifies the constraints on the parameters (if any)
8754 and can be created, inspected, copied and freed using the following functions.
8756 #include <isl/ast_build.h>
8757 __isl_give isl_ast_build *isl_ast_build_alloc(
8759 __isl_give isl_ast_build *isl_ast_build_from_context(
8760 __isl_take isl_set *set);
8761 __isl_give isl_ast_build *isl_ast_build_copy(
8762 __isl_keep isl_ast_build *build);
8763 __isl_null isl_ast_build *isl_ast_build_free(
8764 __isl_take isl_ast_build *build);
8766 The C<set> argument is usually a parameter set with zero or more parameters.
8767 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
8768 this set is required to be a parameter set.
8769 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
8770 specify any parameter constraints.
8771 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
8772 and L</"Fine-grained Control over AST Generation">.
8773 Finally, the AST itself can be constructed using one of the following
8776 #include <isl/ast_build.h>
8777 __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
8778 __isl_keep isl_ast_build *build,
8779 __isl_take isl_schedule *schedule);
8780 __isl_give isl_ast_node *
8781 isl_ast_build_node_from_schedule_map(
8782 __isl_keep isl_ast_build *build,
8783 __isl_take isl_union_map *schedule);
8785 =head3 Inspecting the AST
8787 The basic properties of an AST node can be obtained as follows.
8789 #include <isl/ast.h>
8790 enum isl_ast_node_type isl_ast_node_get_type(
8791 __isl_keep isl_ast_node *node);
8793 The type of an AST node is one of
8794 C<isl_ast_node_for>,
8796 C<isl_ast_node_block>,
8797 C<isl_ast_node_mark> or
8798 C<isl_ast_node_user>.
8799 An C<isl_ast_node_for> represents a for node.
8800 An C<isl_ast_node_if> represents an if node.
8801 An C<isl_ast_node_block> represents a compound node.
8802 An C<isl_ast_node_mark> introduces a mark in the AST.
8803 An C<isl_ast_node_user> represents an expression statement.
8804 An expression statement typically corresponds to a domain element, i.e.,
8805 one of the elements that is visited by the AST.
8807 Each type of node has its own additional properties.
8809 #include <isl/ast.h>
8810 __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
8811 __isl_keep isl_ast_node *node);
8812 __isl_give isl_ast_expr *isl_ast_node_for_get_init(
8813 __isl_keep isl_ast_node *node);
8814 __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
8815 __isl_keep isl_ast_node *node);
8816 __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
8817 __isl_keep isl_ast_node *node);
8818 __isl_give isl_ast_node *isl_ast_node_for_get_body(
8819 __isl_keep isl_ast_node *node);
8820 isl_bool isl_ast_node_for_is_degenerate(
8821 __isl_keep isl_ast_node *node);
8823 An C<isl_ast_for> is considered degenerate if it is known to execute
8826 #include <isl/ast.h>
8827 __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
8828 __isl_keep isl_ast_node *node);
8829 __isl_give isl_ast_node *isl_ast_node_if_get_then(
8830 __isl_keep isl_ast_node *node);
8831 isl_bool isl_ast_node_if_has_else(
8832 __isl_keep isl_ast_node *node);
8833 __isl_give isl_ast_node *isl_ast_node_if_get_else(
8834 __isl_keep isl_ast_node *node);
8836 __isl_give isl_ast_node_list *
8837 isl_ast_node_block_get_children(
8838 __isl_keep isl_ast_node *node);
8840 __isl_give isl_id *isl_ast_node_mark_get_id(
8841 __isl_keep isl_ast_node *node);
8842 __isl_give isl_ast_node *isl_ast_node_mark_get_node(
8843 __isl_keep isl_ast_node *node);
8845 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
8846 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
8848 #include <isl/ast.h>
8849 __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
8850 __isl_keep isl_ast_node *node);
8852 Each of the returned C<isl_ast_expr>s can in turn be inspected using
8853 the following functions.
8855 #include <isl/ast.h>
8856 enum isl_ast_expr_type isl_ast_expr_get_type(
8857 __isl_keep isl_ast_expr *expr);
8859 The type of an AST expression is one of
8861 C<isl_ast_expr_id> or
8862 C<isl_ast_expr_int>.
8863 An C<isl_ast_expr_op> represents the result of an operation.
8864 An C<isl_ast_expr_id> represents an identifier.
8865 An C<isl_ast_expr_int> represents an integer value.
8867 Each type of expression has its own additional properties.
8869 #include <isl/ast.h>
8870 enum isl_ast_op_type isl_ast_expr_get_op_type(
8871 __isl_keep isl_ast_expr *expr);
8872 int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
8873 __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
8874 __isl_keep isl_ast_expr *expr, int pos);
8875 isl_stat isl_ast_node_foreach_ast_op_type(
8876 __isl_keep isl_ast_node *node,
8877 isl_stat (*fn)(enum isl_ast_op_type type,
8878 void *user), void *user);
8880 C<isl_ast_expr_get_op_type> returns the type of the operation
8881 performed. C<isl_ast_expr_get_op_n_arg> returns the number of
8882 arguments. C<isl_ast_expr_get_op_arg> returns the specified
8884 C<isl_ast_node_foreach_ast_op_type> calls C<fn> for each distinct
8885 C<isl_ast_op_type> that appears in C<node>.
8886 The operation type is one of the following.
8890 =item C<isl_ast_op_and>
8892 Logical I<and> of two arguments.
8893 Both arguments can be evaluated.
8895 =item C<isl_ast_op_and_then>
8897 Logical I<and> of two arguments.
8898 The second argument can only be evaluated if the first evaluates to true.
8900 =item C<isl_ast_op_or>
8902 Logical I<or> of two arguments.
8903 Both arguments can be evaluated.
8905 =item C<isl_ast_op_or_else>
8907 Logical I<or> of two arguments.
8908 The second argument can only be evaluated if the first evaluates to false.
8910 =item C<isl_ast_op_max>
8912 Maximum of two or more arguments.
8914 =item C<isl_ast_op_min>
8916 Minimum of two or more arguments.
8918 =item C<isl_ast_op_minus>
8922 =item C<isl_ast_op_add>
8924 Sum of two arguments.
8926 =item C<isl_ast_op_sub>
8928 Difference of two arguments.
8930 =item C<isl_ast_op_mul>
8932 Product of two arguments.
8934 =item C<isl_ast_op_div>
8936 Exact division. That is, the result is known to be an integer.
8938 =item C<isl_ast_op_fdiv_q>
8940 Result of integer division, rounded towards negative
8943 =item C<isl_ast_op_pdiv_q>
8945 Result of integer division, where dividend is known to be non-negative.
8947 =item C<isl_ast_op_pdiv_r>
8949 Remainder of integer division, where dividend is known to be non-negative.
8951 =item C<isl_ast_op_zdiv_r>
8953 Equal to zero iff the remainder on integer division is zero.
8955 =item C<isl_ast_op_cond>
8957 Conditional operator defined on three arguments.
8958 If the first argument evaluates to true, then the result
8959 is equal to the second argument. Otherwise, the result
8960 is equal to the third argument.
8961 The second and third argument may only be evaluated if
8962 the first argument evaluates to true and false, respectively.
8963 Corresponds to C<a ? b : c> in C.
8965 =item C<isl_ast_op_select>
8967 Conditional operator defined on three arguments.
8968 If the first argument evaluates to true, then the result
8969 is equal to the second argument. Otherwise, the result
8970 is equal to the third argument.
8971 The second and third argument may be evaluated independently
8972 of the value of the first argument.
8973 Corresponds to C<a * b + (1 - a) * c> in C.
8975 =item C<isl_ast_op_eq>
8979 =item C<isl_ast_op_le>
8981 Less than or equal relation.
8983 =item C<isl_ast_op_lt>
8987 =item C<isl_ast_op_ge>
8989 Greater than or equal relation.
8991 =item C<isl_ast_op_gt>
8993 Greater than relation.
8995 =item C<isl_ast_op_call>
8998 The number of arguments of the C<isl_ast_expr> is one more than
8999 the number of arguments in the function call, the first argument
9000 representing the function being called.
9002 =item C<isl_ast_op_access>
9005 The number of arguments of the C<isl_ast_expr> is one more than
9006 the number of index expressions in the array access, the first argument
9007 representing the array being accessed.
9009 =item C<isl_ast_op_member>
9012 This operation has two arguments, a structure and the name of
9013 the member of the structure being accessed.
9017 #include <isl/ast.h>
9018 __isl_give isl_id *isl_ast_expr_get_id(
9019 __isl_keep isl_ast_expr *expr);
9021 Return the identifier represented by the AST expression.
9023 #include <isl/ast.h>
9024 __isl_give isl_val *isl_ast_expr_get_val(
9025 __isl_keep isl_ast_expr *expr);
9027 Return the integer represented by the AST expression.
9029 =head3 Properties of ASTs
9031 #include <isl/ast.h>
9032 isl_bool isl_ast_expr_is_equal(
9033 __isl_keep isl_ast_expr *expr1,
9034 __isl_keep isl_ast_expr *expr2);
9036 Check if two C<isl_ast_expr>s are equal to each other.
9038 =head3 Manipulating and printing the AST
9040 AST nodes can be copied and freed using the following functions.
9042 #include <isl/ast.h>
9043 __isl_give isl_ast_node *isl_ast_node_copy(
9044 __isl_keep isl_ast_node *node);
9045 __isl_null isl_ast_node *isl_ast_node_free(
9046 __isl_take isl_ast_node *node);
9048 AST expressions can be copied and freed using the following functions.
9050 #include <isl/ast.h>
9051 __isl_give isl_ast_expr *isl_ast_expr_copy(
9052 __isl_keep isl_ast_expr *expr);
9053 __isl_null isl_ast_expr *isl_ast_expr_free(
9054 __isl_take isl_ast_expr *expr);
9056 New AST expressions can be created either directly or within
9057 the context of an C<isl_ast_build>.
9059 #include <isl/ast.h>
9060 __isl_give isl_ast_expr *isl_ast_expr_from_val(
9061 __isl_take isl_val *v);
9062 __isl_give isl_ast_expr *isl_ast_expr_from_id(
9063 __isl_take isl_id *id);
9064 __isl_give isl_ast_expr *isl_ast_expr_neg(
9065 __isl_take isl_ast_expr *expr);
9066 __isl_give isl_ast_expr *isl_ast_expr_address_of(
9067 __isl_take isl_ast_expr *expr);
9068 __isl_give isl_ast_expr *isl_ast_expr_add(
9069 __isl_take isl_ast_expr *expr1,
9070 __isl_take isl_ast_expr *expr2);
9071 __isl_give isl_ast_expr *isl_ast_expr_sub(
9072 __isl_take isl_ast_expr *expr1,
9073 __isl_take isl_ast_expr *expr2);
9074 __isl_give isl_ast_expr *isl_ast_expr_mul(
9075 __isl_take isl_ast_expr *expr1,
9076 __isl_take isl_ast_expr *expr2);
9077 __isl_give isl_ast_expr *isl_ast_expr_div(
9078 __isl_take isl_ast_expr *expr1,
9079 __isl_take isl_ast_expr *expr2);
9080 __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
9081 __isl_take isl_ast_expr *expr1,
9082 __isl_take isl_ast_expr *expr2);
9083 __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
9084 __isl_take isl_ast_expr *expr1,
9085 __isl_take isl_ast_expr *expr2);
9086 __isl_give isl_ast_expr *isl_ast_expr_and(
9087 __isl_take isl_ast_expr *expr1,
9088 __isl_take isl_ast_expr *expr2)
9089 __isl_give isl_ast_expr *isl_ast_expr_and_then(
9090 __isl_take isl_ast_expr *expr1,
9091 __isl_take isl_ast_expr *expr2)
9092 __isl_give isl_ast_expr *isl_ast_expr_or(
9093 __isl_take isl_ast_expr *expr1,
9094 __isl_take isl_ast_expr *expr2)
9095 __isl_give isl_ast_expr *isl_ast_expr_or_else(
9096 __isl_take isl_ast_expr *expr1,
9097 __isl_take isl_ast_expr *expr2)
9098 __isl_give isl_ast_expr *isl_ast_expr_eq(
9099 __isl_take isl_ast_expr *expr1,
9100 __isl_take isl_ast_expr *expr2);
9101 __isl_give isl_ast_expr *isl_ast_expr_le(
9102 __isl_take isl_ast_expr *expr1,
9103 __isl_take isl_ast_expr *expr2);
9104 __isl_give isl_ast_expr *isl_ast_expr_lt(
9105 __isl_take isl_ast_expr *expr1,
9106 __isl_take isl_ast_expr *expr2);
9107 __isl_give isl_ast_expr *isl_ast_expr_ge(
9108 __isl_take isl_ast_expr *expr1,
9109 __isl_take isl_ast_expr *expr2);
9110 __isl_give isl_ast_expr *isl_ast_expr_gt(
9111 __isl_take isl_ast_expr *expr1,
9112 __isl_take isl_ast_expr *expr2);
9113 __isl_give isl_ast_expr *isl_ast_expr_access(
9114 __isl_take isl_ast_expr *array,
9115 __isl_take isl_ast_expr_list *indices);
9116 __isl_give isl_ast_expr *isl_ast_expr_call(
9117 __isl_take isl_ast_expr *function,
9118 __isl_take isl_ast_expr_list *arguments);
9120 The function C<isl_ast_expr_address_of> can be applied to an
9121 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
9122 to represent the address of the C<isl_ast_expr_access>. The function
9123 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
9124 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
9126 #include <isl/ast_build.h>
9127 __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
9128 __isl_keep isl_ast_build *build,
9129 __isl_take isl_set *set);
9130 __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
9131 __isl_keep isl_ast_build *build,
9132 __isl_take isl_pw_aff *pa);
9133 __isl_give isl_ast_expr *
9134 isl_ast_build_access_from_pw_multi_aff(
9135 __isl_keep isl_ast_build *build,
9136 __isl_take isl_pw_multi_aff *pma);
9137 __isl_give isl_ast_expr *
9138 isl_ast_build_access_from_multi_pw_aff(
9139 __isl_keep isl_ast_build *build,
9140 __isl_take isl_multi_pw_aff *mpa);
9141 __isl_give isl_ast_expr *
9142 isl_ast_build_call_from_pw_multi_aff(
9143 __isl_keep isl_ast_build *build,
9144 __isl_take isl_pw_multi_aff *pma);
9145 __isl_give isl_ast_expr *
9146 isl_ast_build_call_from_multi_pw_aff(
9147 __isl_keep isl_ast_build *build,
9148 __isl_take isl_multi_pw_aff *mpa);
9151 the domains of C<pa>, C<mpa> and C<pma> should correspond
9152 to the schedule space of C<build>.
9153 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
9154 the function being called.
9155 If the accessed space is a nested relation, then it is taken
9156 to represent an access of the member specified by the range
9157 of this nested relation of the structure specified by the domain
9158 of the nested relation.
9160 The following functions can be used to modify an C<isl_ast_expr>.
9162 #include <isl/ast.h>
9163 __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
9164 __isl_take isl_ast_expr *expr, int pos,
9165 __isl_take isl_ast_expr *arg);
9167 Replace the argument of C<expr> at position C<pos> by C<arg>.
9169 #include <isl/ast.h>
9170 __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
9171 __isl_take isl_ast_expr *expr,
9172 __isl_take isl_id_to_ast_expr *id2expr);
9174 The function C<isl_ast_expr_substitute_ids> replaces the
9175 subexpressions of C<expr> of type C<isl_ast_expr_id>
9176 by the corresponding expression in C<id2expr>, if there is any.
9179 User specified data can be attached to an C<isl_ast_node> and obtained
9180 from the same C<isl_ast_node> using the following functions.
9182 #include <isl/ast.h>
9183 __isl_give isl_ast_node *isl_ast_node_set_annotation(
9184 __isl_take isl_ast_node *node,
9185 __isl_take isl_id *annotation);
9186 __isl_give isl_id *isl_ast_node_get_annotation(
9187 __isl_keep isl_ast_node *node);
9189 Basic printing can be performed using the following functions.
9191 #include <isl/ast.h>
9192 __isl_give isl_printer *isl_printer_print_ast_expr(
9193 __isl_take isl_printer *p,
9194 __isl_keep isl_ast_expr *expr);
9195 __isl_give isl_printer *isl_printer_print_ast_node(
9196 __isl_take isl_printer *p,
9197 __isl_keep isl_ast_node *node);
9198 __isl_give char *isl_ast_expr_to_str(
9199 __isl_keep isl_ast_expr *expr);
9201 More advanced printing can be performed using the following functions.
9203 #include <isl/ast.h>
9204 __isl_give isl_printer *isl_ast_op_type_print_macro(
9205 enum isl_ast_op_type type,
9206 __isl_take isl_printer *p);
9207 __isl_give isl_printer *isl_ast_node_print_macros(
9208 __isl_keep isl_ast_node *node,
9209 __isl_take isl_printer *p);
9210 __isl_give isl_printer *isl_ast_node_print(
9211 __isl_keep isl_ast_node *node,
9212 __isl_take isl_printer *p,
9213 __isl_take isl_ast_print_options *options);
9214 __isl_give isl_printer *isl_ast_node_for_print(
9215 __isl_keep isl_ast_node *node,
9216 __isl_take isl_printer *p,
9217 __isl_take isl_ast_print_options *options);
9218 __isl_give isl_printer *isl_ast_node_if_print(
9219 __isl_keep isl_ast_node *node,
9220 __isl_take isl_printer *p,
9221 __isl_take isl_ast_print_options *options);
9223 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
9224 C<isl> may print out an AST that makes use of macros such
9225 as C<floord>, C<min> and C<max>.
9226 C<isl_ast_op_type_print_macro> prints out the macro
9227 corresponding to a specific C<isl_ast_op_type>.
9228 C<isl_ast_node_print_macros> scans the C<isl_ast_node>
9229 for expressions where these macros would be used and prints
9230 out the required macro definitions.
9231 Essentially, C<isl_ast_node_print_macros> calls
9232 C<isl_ast_node_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
9233 as function argument.
9234 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
9235 C<isl_ast_node_if_print> print an C<isl_ast_node>
9236 in C<ISL_FORMAT_C>, but allow for some extra control
9237 through an C<isl_ast_print_options> object.
9238 This object can be created using the following functions.
9240 #include <isl/ast.h>
9241 __isl_give isl_ast_print_options *
9242 isl_ast_print_options_alloc(isl_ctx *ctx);
9243 __isl_give isl_ast_print_options *
9244 isl_ast_print_options_copy(
9245 __isl_keep isl_ast_print_options *options);
9246 __isl_null isl_ast_print_options *
9247 isl_ast_print_options_free(
9248 __isl_take isl_ast_print_options *options);
9250 __isl_give isl_ast_print_options *
9251 isl_ast_print_options_set_print_user(
9252 __isl_take isl_ast_print_options *options,
9253 __isl_give isl_printer *(*print_user)(
9254 __isl_take isl_printer *p,
9255 __isl_take isl_ast_print_options *options,
9256 __isl_keep isl_ast_node *node, void *user),
9258 __isl_give isl_ast_print_options *
9259 isl_ast_print_options_set_print_for(
9260 __isl_take isl_ast_print_options *options,
9261 __isl_give isl_printer *(*print_for)(
9262 __isl_take isl_printer *p,
9263 __isl_take isl_ast_print_options *options,
9264 __isl_keep isl_ast_node *node, void *user),
9267 The callback set by C<isl_ast_print_options_set_print_user>
9268 is called whenever a node of type C<isl_ast_node_user> needs to
9270 The callback set by C<isl_ast_print_options_set_print_for>
9271 is called whenever a node of type C<isl_ast_node_for> needs to
9273 Note that C<isl_ast_node_for_print> will I<not> call the
9274 callback set by C<isl_ast_print_options_set_print_for> on the node
9275 on which C<isl_ast_node_for_print> is called, but only on nested
9276 nodes of type C<isl_ast_node_for>. It is therefore safe to
9277 call C<isl_ast_node_for_print> from within the callback set by
9278 C<isl_ast_print_options_set_print_for>.
9280 The following option determines the type to be used for iterators
9281 while printing the AST.
9283 isl_stat isl_options_set_ast_iterator_type(
9284 isl_ctx *ctx, const char *val);
9285 const char *isl_options_get_ast_iterator_type(
9288 The AST printer only prints body nodes as blocks if these
9289 blocks cannot be safely omitted.
9290 For example, a C<for> node with one body node will not be
9291 surrounded with braces in C<ISL_FORMAT_C>.
9292 A block will always be printed by setting the following option.
9294 isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
9296 int isl_options_get_ast_always_print_block(isl_ctx *ctx);
9300 #include <isl/ast_build.h>
9301 isl_stat isl_options_set_ast_build_atomic_upper_bound(
9302 isl_ctx *ctx, int val);
9303 int isl_options_get_ast_build_atomic_upper_bound(
9305 isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
9307 int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
9308 isl_stat isl_options_set_ast_build_exploit_nested_bounds(
9309 isl_ctx *ctx, int val);
9310 int isl_options_get_ast_build_exploit_nested_bounds(
9312 isl_stat isl_options_set_ast_build_group_coscheduled(
9313 isl_ctx *ctx, int val);
9314 int isl_options_get_ast_build_group_coscheduled(
9316 isl_stat isl_options_set_ast_build_scale_strides(
9317 isl_ctx *ctx, int val);
9318 int isl_options_get_ast_build_scale_strides(
9320 isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
9322 int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
9323 isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
9325 int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
9329 =item * ast_build_atomic_upper_bound
9331 Generate loop upper bounds that consist of the current loop iterator,
9332 an operator and an expression not involving the iterator.
9333 If this option is not set, then the current loop iterator may appear
9334 several times in the upper bound.
9335 For example, when this option is turned off, AST generation
9338 [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
9342 for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
9345 When the option is turned on, the following AST is generated
9347 for (int c0 = 0; c0 <= min(100, n); c0 += 1)
9350 =item * ast_build_prefer_pdiv
9352 If this option is turned off, then the AST generation will
9353 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
9354 operators, but no C<isl_ast_op_pdiv_q> or
9355 C<isl_ast_op_pdiv_r> operators.
9356 If this options is turned on, then C<isl> will try to convert
9357 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
9358 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
9360 =item * ast_build_exploit_nested_bounds
9362 Simplify conditions based on bounds of nested for loops.
9363 In particular, remove conditions that are implied by the fact
9364 that one or more nested loops have at least one iteration,
9365 meaning that the upper bound is at least as large as the lower bound.
9366 For example, when this option is turned off, AST generation
9369 [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
9375 for (int c0 = 0; c0 <= N; c0 += 1)
9376 for (int c1 = 0; c1 <= M; c1 += 1)
9379 When the option is turned on, the following AST is generated
9381 for (int c0 = 0; c0 <= N; c0 += 1)
9382 for (int c1 = 0; c1 <= M; c1 += 1)
9385 =item * ast_build_group_coscheduled
9387 If two domain elements are assigned the same schedule point, then
9388 they may be executed in any order and they may even appear in different
9389 loops. If this options is set, then the AST generator will make
9390 sure that coscheduled domain elements do not appear in separate parts
9391 of the AST. This is useful in case of nested AST generation
9392 if the outer AST generation is given only part of a schedule
9393 and the inner AST generation should handle the domains that are
9394 coscheduled by this initial part of the schedule together.
9395 For example if an AST is generated for a schedule
9397 { A[i] -> [0]; B[i] -> [0] }
9399 then the C<isl_ast_build_set_create_leaf> callback described
9400 below may get called twice, once for each domain.
9401 Setting this option ensures that the callback is only called once
9402 on both domains together.
9404 =item * ast_build_separation_bounds
9406 This option specifies which bounds to use during separation.
9407 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
9408 then all (possibly implicit) bounds on the current dimension will
9409 be used during separation.
9410 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
9411 then only those bounds that are explicitly available will
9412 be used during separation.
9414 =item * ast_build_scale_strides
9416 This option specifies whether the AST generator is allowed
9417 to scale down iterators of strided loops.
9419 =item * ast_build_allow_else
9421 This option specifies whether the AST generator is allowed
9422 to construct if statements with else branches.
9424 =item * ast_build_allow_or
9426 This option specifies whether the AST generator is allowed
9427 to construct if conditions with disjunctions.
9431 =head3 AST Generation Options (Schedule Tree)
9433 In case of AST construction from a schedule tree, the options
9434 that control how an AST is created from the individual schedule
9435 dimensions are stored in the band nodes of the tree
9436 (see L</"Schedule Trees">).
9438 In particular, a schedule dimension can be handled in four
9439 different ways, atomic, separate, unroll or the default.
9440 This loop AST generation type can be set using
9441 C<isl_schedule_node_band_member_set_ast_loop_type>.
9443 the first three can be selected by including a one-dimensional
9444 element with as value the position of the schedule dimension
9445 within the band and as name one of C<atomic>, C<separate>
9446 or C<unroll> in the options
9447 set by C<isl_schedule_node_band_set_ast_build_options>.
9448 Only one of these three may be specified for
9449 any given schedule dimension within a band node.
9450 If none of these is specified, then the default
9451 is used. The meaning of the options is as follows.
9457 When this option is specified, the AST generator will make
9458 sure that a given domains space only appears in a single
9459 loop at the specified level.
9461 For example, for the schedule tree
9463 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
9465 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
9466 options: "{ atomic[x] }"
9468 the following AST will be generated
9470 for (int c0 = 0; c0 <= 10; c0 += 1) {
9477 On the other hand, for the schedule tree
9479 domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
9481 schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
9482 options: "{ separate[x] }"
9484 the following AST will be generated
9488 for (int c0 = 1; c0 <= 9; c0 += 1) {
9495 If neither C<atomic> nor C<separate> is specified, then the AST generator
9496 may produce either of these two results or some intermediate form.
9500 When this option is specified, the AST generator will
9501 split the domain of the specified schedule dimension
9502 into pieces with a fixed set of statements for which
9503 instances need to be executed by the iterations in
9504 the schedule domain part. This option tends to avoid
9505 the generation of guards inside the corresponding loops.
9506 See also the C<atomic> option.
9510 When this option is specified, the AST generator will
9511 I<completely> unroll the corresponding schedule dimension.
9512 It is the responsibility of the user to ensure that such
9513 unrolling is possible.
9514 To obtain a partial unrolling, the user should apply an additional
9515 strip-mining to the schedule and fully unroll the inner schedule
9520 The C<isolate> option is a bit more involved. It allows the user
9521 to isolate a range of schedule dimension values from smaller and
9522 greater values. Additionally, the user may specify a different
9523 atomic/separate/unroll choice for the isolated part and the remaining
9524 parts. The typical use case of the C<isolate> option is to isolate
9525 full tiles from partial tiles.
9526 The part that needs to be isolated may depend on outer schedule dimensions.
9527 The option therefore needs to be able to reference those outer schedule
9528 dimensions. In particular, the space of the C<isolate> option is that
9529 of a wrapped map with as domain the flat product of all outer band nodes
9530 and as range the space of the current band node.
9531 The atomic/separate/unroll choice for the isolated part is determined
9532 by an option that lives in an unnamed wrapped space with as domain
9533 a zero-dimensional C<isolate> space and as range the regular
9534 C<atomic>, C<separate> or C<unroll> space.
9535 This option may also be set directly using
9536 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
9537 The atomic/separate/unroll choice for the remaining part is determined
9538 by the regular C<atomic>, C<separate> or C<unroll> option.
9539 The use of the C<isolate> option causes any tree containing the node
9540 to be considered anchored.
9542 As an example, consider the isolation of full tiles from partial tiles
9543 in a tiling of a triangular domain. The original schedule is as follows.
9545 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9547 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9548 { A[i,j] -> [floor(j/10)] }, \
9549 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9553 for (int c0 = 0; c0 <= 10; c0 += 1)
9554 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9555 for (int c2 = 10 * c0;
9556 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9557 for (int c3 = 10 * c1;
9558 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9561 Isolating the full tiles, we have the following input
9563 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9565 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9566 { A[i,j] -> [floor(j/10)] }, \
9567 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9568 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
9569 10a+9+10b+9 <= 100 }"
9574 for (int c0 = 0; c0 <= 8; c0 += 1) {
9575 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9576 for (int c2 = 10 * c0;
9577 c2 <= 10 * c0 + 9; c2 += 1)
9578 for (int c3 = 10 * c1;
9579 c3 <= 10 * c1 + 9; c3 += 1)
9581 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9582 for (int c2 = 10 * c0;
9583 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9584 for (int c3 = 10 * c1;
9585 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9588 for (int c0 = 9; c0 <= 10; c0 += 1)
9589 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9590 for (int c2 = 10 * c0;
9591 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9592 for (int c3 = 10 * c1;
9593 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9597 We may then additionally unroll the innermost loop of the isolated part
9599 domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
9601 schedule: "[{ A[i,j] -> [floor(i/10)] }, \
9602 { A[i,j] -> [floor(j/10)] }, \
9603 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
9604 options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
9605 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
9610 for (int c0 = 0; c0 <= 8; c0 += 1) {
9611 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9612 for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
9624 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9625 for (int c2 = 10 * c0;
9626 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9627 for (int c3 = 10 * c1;
9628 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9631 for (int c0 = 9; c0 <= 10; c0 += 1)
9632 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9633 for (int c2 = 10 * c0;
9634 c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
9635 for (int c3 = 10 * c1;
9636 c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
9641 =head3 AST Generation Options (Schedule Map)
9643 In case of AST construction using
9644 C<isl_ast_build_node_from_schedule_map>, the options
9645 that control how an AST is created from the individual schedule
9646 dimensions are stored in the C<isl_ast_build>.
9647 They can be set using the following function.
9649 #include <isl/ast_build.h>
9650 __isl_give isl_ast_build *
9651 isl_ast_build_set_options(
9652 __isl_take isl_ast_build *control,
9653 __isl_take isl_union_map *options);
9655 The options are encoded in an C<isl_union_map>.
9656 The domain of this union relation refers to the schedule domain,
9657 i.e., the range of the schedule passed
9658 to C<isl_ast_build_node_from_schedule_map>.
9659 In the case of nested AST generation (see L</"Nested AST Generation">),
9660 the domain of C<options> should refer to the extra piece of the schedule.
9661 That is, it should be equal to the range of the wrapped relation in the
9662 range of the schedule.
9663 The range of the options can consist of elements in one or more spaces,
9664 the names of which determine the effect of the option.
9665 The values of the range typically also refer to the schedule dimension
9666 to which the option applies. In case of nested AST generation
9667 (see L</"Nested AST Generation">), these values refer to the position
9668 of the schedule dimension within the innermost AST generation.
9669 The constraints on the domain elements of
9670 the option should only refer to this dimension and earlier dimensions.
9671 We consider the following spaces.
9675 =item C<separation_class>
9677 B<This option has been deprecated. Use the isolate option on
9678 schedule trees instead.>
9680 This space is a wrapped relation between two one dimensional spaces.
9681 The input space represents the schedule dimension to which the option
9682 applies and the output space represents the separation class.
9683 While constructing a loop corresponding to the specified schedule
9684 dimension(s), the AST generator will try to generate separate loops
9685 for domain elements that are assigned different classes.
9686 If only some of the elements are assigned a class, then those elements
9687 that are not assigned any class will be treated as belonging to a class
9688 that is separate from the explicitly assigned classes.
9689 The typical use case for this option is to separate full tiles from
9691 The other options, described below, are applied after the separation
9694 As an example, consider the separation into full and partial tiles
9695 of a tiling of a triangular domain.
9696 Take, for example, the domain
9698 { A[i,j] : 0 <= i,j and i + j <= 100 }
9700 and a tiling into tiles of 10 by 10. The input to the AST generator
9701 is then the schedule
9703 { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
9706 Without any options, the following AST is generated
9708 for (int c0 = 0; c0 <= 10; c0 += 1)
9709 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9710 for (int c2 = 10 * c0;
9711 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9713 for (int c3 = 10 * c1;
9714 c3 <= min(10 * c1 + 9, -c2 + 100);
9718 Separation into full and partial tiles can be obtained by assigning
9719 a class, say C<0>, to the full tiles. The full tiles are represented by those
9720 values of the first and second schedule dimensions for which there are
9721 values of the third and fourth dimensions to cover an entire tile.
9722 That is, we need to specify the following option
9724 { [a,b,c,d] -> separation_class[[0]->[0]] :
9725 exists b': 0 <= 10a,10b' and
9726 10a+9+10b'+9 <= 100;
9727 [a,b,c,d] -> separation_class[[1]->[0]] :
9728 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
9732 { [a, b, c, d] -> separation_class[[1] -> [0]] :
9733 a >= 0 and b >= 0 and b <= 8 - a;
9734 [a, b, c, d] -> separation_class[[0] -> [0]] :
9737 With this option, the generated AST is as follows
9740 for (int c0 = 0; c0 <= 8; c0 += 1) {
9741 for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
9742 for (int c2 = 10 * c0;
9743 c2 <= 10 * c0 + 9; c2 += 1)
9744 for (int c3 = 10 * c1;
9745 c3 <= 10 * c1 + 9; c3 += 1)
9747 for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
9748 for (int c2 = 10 * c0;
9749 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9751 for (int c3 = 10 * c1;
9752 c3 <= min(-c2 + 100, 10 * c1 + 9);
9756 for (int c0 = 9; c0 <= 10; c0 += 1)
9757 for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
9758 for (int c2 = 10 * c0;
9759 c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
9761 for (int c3 = 10 * c1;
9762 c3 <= min(10 * c1 + 9, -c2 + 100);
9769 This is a single-dimensional space representing the schedule dimension(s)
9770 to which ``separation'' should be applied. Separation tries to split
9771 a loop into several pieces if this can avoid the generation of guards
9773 See also the C<atomic> option.
9777 This is a single-dimensional space representing the schedule dimension(s)
9778 for which the domains should be considered ``atomic''. That is, the
9779 AST generator will make sure that any given domain space will only appear
9780 in a single loop at the specified level.
9782 Consider the following schedule
9784 { a[i] -> [i] : 0 <= i < 10;
9785 b[i] -> [i+1] : 0 <= i < 10 }
9787 If the following option is specified
9789 { [i] -> separate[x] }
9791 then the following AST will be generated
9795 for (int c0 = 1; c0 <= 9; c0 += 1) {
9802 If, on the other hand, the following option is specified
9804 { [i] -> atomic[x] }
9806 then the following AST will be generated
9808 for (int c0 = 0; c0 <= 10; c0 += 1) {
9815 If neither C<atomic> nor C<separate> is specified, then the AST generator
9816 may produce either of these two results or some intermediate form.
9820 This is a single-dimensional space representing the schedule dimension(s)
9821 that should be I<completely> unrolled.
9822 To obtain a partial unrolling, the user should apply an additional
9823 strip-mining to the schedule and fully unroll the inner loop.
9827 =head3 Fine-grained Control over AST Generation
9829 Besides specifying the constraints on the parameters,
9830 an C<isl_ast_build> object can be used to control
9831 various aspects of the AST generation process.
9832 In case of AST construction using
9833 C<isl_ast_build_node_from_schedule_map>,
9834 the most prominent way of control is through ``options'',
9837 Additional control is available through the following functions.
9839 #include <isl/ast_build.h>
9840 __isl_give isl_ast_build *
9841 isl_ast_build_set_iterators(
9842 __isl_take isl_ast_build *control,
9843 __isl_take isl_id_list *iterators);
9845 The function C<isl_ast_build_set_iterators> allows the user to
9846 specify a list of iterator C<isl_id>s to be used as iterators.
9847 If the input schedule is injective, then
9848 the number of elements in this list should be as large as the dimension
9849 of the schedule space, but no direct correspondence should be assumed
9850 between dimensions and elements.
9851 If the input schedule is not injective, then an additional number
9852 of C<isl_id>s equal to the largest dimension of the input domains
9854 If the number of provided C<isl_id>s is insufficient, then additional
9855 names are automatically generated.
9857 #include <isl/ast_build.h>
9858 __isl_give isl_ast_build *
9859 isl_ast_build_set_create_leaf(
9860 __isl_take isl_ast_build *control,
9861 __isl_give isl_ast_node *(*fn)(
9862 __isl_take isl_ast_build *build,
9863 void *user), void *user);
9866 C<isl_ast_build_set_create_leaf> function allows for the
9867 specification of a callback that should be called whenever the AST
9868 generator arrives at an element of the schedule domain.
9869 The callback should return an AST node that should be inserted
9870 at the corresponding position of the AST. The default action (when
9871 the callback is not set) is to continue generating parts of the AST to scan
9872 all the domain elements associated to the schedule domain element
9873 and to insert user nodes, ``calling'' the domain element, for each of them.
9874 The C<build> argument contains the current state of the C<isl_ast_build>.
9875 To ease nested AST generation (see L</"Nested AST Generation">),
9876 all control information that is
9877 specific to the current AST generation such as the options and
9878 the callbacks has been removed from this C<isl_ast_build>.
9879 The callback would typically return the result of a nested
9881 user defined node created using the following function.
9883 #include <isl/ast.h>
9884 __isl_give isl_ast_node *isl_ast_node_alloc_user(
9885 __isl_take isl_ast_expr *expr);
9887 #include <isl/ast_build.h>
9888 __isl_give isl_ast_build *
9889 isl_ast_build_set_at_each_domain(
9890 __isl_take isl_ast_build *build,
9891 __isl_give isl_ast_node *(*fn)(
9892 __isl_take isl_ast_node *node,
9893 __isl_keep isl_ast_build *build,
9894 void *user), void *user);
9895 __isl_give isl_ast_build *
9896 isl_ast_build_set_before_each_for(
9897 __isl_take isl_ast_build *build,
9898 __isl_give isl_id *(*fn)(
9899 __isl_keep isl_ast_build *build,
9900 void *user), void *user);
9901 __isl_give isl_ast_build *
9902 isl_ast_build_set_after_each_for(
9903 __isl_take isl_ast_build *build,
9904 __isl_give isl_ast_node *(*fn)(
9905 __isl_take isl_ast_node *node,
9906 __isl_keep isl_ast_build *build,
9907 void *user), void *user);
9908 __isl_give isl_ast_build *
9909 isl_ast_build_set_before_each_mark(
9910 __isl_take isl_ast_build *build,
9911 isl_stat (*fn)(__isl_keep isl_id *mark,
9912 __isl_keep isl_ast_build *build,
9913 void *user), void *user);
9914 __isl_give isl_ast_build *
9915 isl_ast_build_set_after_each_mark(
9916 __isl_take isl_ast_build *build,
9917 __isl_give isl_ast_node *(*fn)(
9918 __isl_take isl_ast_node *node,
9919 __isl_keep isl_ast_build *build,
9920 void *user), void *user);
9922 The callback set by C<isl_ast_build_set_at_each_domain> will
9923 be called for each domain AST node.
9924 The callbacks set by C<isl_ast_build_set_before_each_for>
9925 and C<isl_ast_build_set_after_each_for> will be called
9926 for each for AST node. The first will be called in depth-first
9927 pre-order, while the second will be called in depth-first post-order.
9928 Since C<isl_ast_build_set_before_each_for> is called before the for
9929 node is actually constructed, it is only passed an C<isl_ast_build>.
9930 The returned C<isl_id> will be added as an annotation (using
9931 C<isl_ast_node_set_annotation>) to the constructed for node.
9932 In particular, if the user has also specified an C<after_each_for>
9933 callback, then the annotation can be retrieved from the node passed to
9934 that callback using C<isl_ast_node_get_annotation>.
9935 The callbacks set by C<isl_ast_build_set_before_each_mark>
9936 and C<isl_ast_build_set_after_each_mark> will be called for each
9937 mark AST node that is created, i.e., for each mark schedule node
9938 in the input schedule tree. The first will be called in depth-first
9939 pre-order, while the second will be called in depth-first post-order.
9940 Since the callback set by C<isl_ast_build_set_before_each_mark>
9941 is called before the mark AST node is actually constructed, it is passed
9942 the identifier of the mark node.
9943 All callbacks should C<NULL> (or -1) on failure.
9944 The given C<isl_ast_build> can be used to create new
9945 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
9946 or C<isl_ast_build_call_from_pw_multi_aff>.
9948 =head3 Nested AST Generation
9950 C<isl> allows the user to create an AST within the context
9951 of another AST. These nested ASTs are created using the
9952 same C<isl_ast_build_node_from_schedule_map> function that is used to create
9953 the outer AST. The C<build> argument should be an C<isl_ast_build>
9954 passed to a callback set by
9955 C<isl_ast_build_set_create_leaf>.
9956 The space of the range of the C<schedule> argument should refer
9957 to this build. In particular, the space should be a wrapped
9958 relation and the domain of this wrapped relation should be the
9959 same as that of the range of the schedule returned by
9960 C<isl_ast_build_get_schedule> below.
9961 In practice, the new schedule is typically
9962 created by calling C<isl_union_map_range_product> on the old schedule
9963 and some extra piece of the schedule.
9964 The space of the schedule domain is also available from
9965 the C<isl_ast_build>.
9967 #include <isl/ast_build.h>
9968 __isl_give isl_union_map *isl_ast_build_get_schedule(
9969 __isl_keep isl_ast_build *build);
9970 __isl_give isl_space *isl_ast_build_get_schedule_space(
9971 __isl_keep isl_ast_build *build);
9972 __isl_give isl_ast_build *isl_ast_build_restrict(
9973 __isl_take isl_ast_build *build,
9974 __isl_take isl_set *set);
9976 The C<isl_ast_build_get_schedule> function returns a (partial)
9977 schedule for the domains elements for which part of the AST still needs to
9978 be generated in the current build.
9979 In particular, the domain elements are mapped to those iterations of the loops
9980 enclosing the current point of the AST generation inside which
9981 the domain elements are executed.
9982 No direct correspondence between
9983 the input schedule and this schedule should be assumed.
9984 The space obtained from C<isl_ast_build_get_schedule_space> can be used
9985 to create a set for C<isl_ast_build_restrict> to intersect
9986 with the current build. In particular, the set passed to
9987 C<isl_ast_build_restrict> can have additional parameters.
9988 The ids of the set dimensions in the space returned by
9989 C<isl_ast_build_get_schedule_space> correspond to the
9990 iterators of the already generated loops.
9991 The user should not rely on the ids of the output dimensions
9992 of the relations in the union relation returned by
9993 C<isl_ast_build_get_schedule> having any particular value.
9997 Although C<isl> is mainly meant to be used as a library,
9998 it also contains some basic applications that use some
9999 of the functionality of C<isl>.
10000 The input may be specified in either the L<isl format>
10001 or the L<PolyLib format>.
10003 =head2 C<isl_polyhedron_sample>
10005 C<isl_polyhedron_sample> takes a polyhedron as input and prints
10006 an integer element of the polyhedron, if there is any.
10007 The first column in the output is the denominator and is always
10008 equal to 1. If the polyhedron contains no integer points,
10009 then a vector of length zero is printed.
10013 C<isl_pip> takes the same input as the C<example> program
10014 from the C<piplib> distribution, i.e., a set of constraints
10015 on the parameters, a line containing only -1 and finally a set
10016 of constraints on a parametric polyhedron.
10017 The coefficients of the parameters appear in the last columns
10018 (but before the final constant column).
10019 The output is the lexicographic minimum of the parametric polyhedron.
10020 As C<isl> currently does not have its own output format, the output
10021 is just a dump of the internal state.
10023 =head2 C<isl_polyhedron_minimize>
10025 C<isl_polyhedron_minimize> computes the minimum of some linear
10026 or affine objective function over the integer points in a polyhedron.
10027 If an affine objective function
10028 is given, then the constant should appear in the last column.
10030 =head2 C<isl_polytope_scan>
10032 Given a polytope, C<isl_polytope_scan> prints
10033 all integer points in the polytope.
10035 =head2 C<isl_codegen>
10037 Given a schedule, a context set and an options relation,
10038 C<isl_codegen> prints out an AST that scans the domain elements
10039 of the schedule in the order of their image(s) taking into account
10040 the constraints in the context set.