add isl_map_get_range_simple_fixed_box_hull
[isl.git] / doc / user.pod
blobddd0e2b6145f726e827f6b70820c4ba3d5daf595
1 =head1 Introduction
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
27 =over
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>.
36 =back
38 =head3 Changes since isl-0.03
40 =over
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>.
47 =back
49 =head3 Changes since isl-0.04
51 =over
53 =item * All header files have been renamed from C<isl_header.h>
54 to C<isl/header.h>.
56 =back
58 =head3 Changes since isl-0.05
60 =over
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.
79 =back
81 =head3 Changes since isl-0.06
83 =over
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.
93 =back
95 =head3 Changes since isl-0.07
97 =over
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
115 C<isl_space_params>.
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
138 to C<isl_aff_floor>.
139 A call to C<isl_qpolynomial_div(div)> call be replaced by
140 the nested call
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.
154 =back
156 =head3 Changes since isl-0.09
158 =over
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)
169 =back
171 =head3 Changes since isl-0.10
173 =over
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.
182 =back
184 =head3 Changes since isl-0.12
186 =over
188 =item * C<isl_int> has been replaced by C<isl_val>.
189 Some of the old functions are still available in C<isl/deprecated/*.h>
190 but they will be removed in the future.
192 =item * The functions C<isl_pw_qpolynomial_eval>,
193 C<isl_union_pw_qpolynomial_eval>, C<isl_pw_qpolynomial_fold_eval>
194 and C<isl_union_pw_qpolynomial_fold_eval> have been changed to return
195 an C<isl_val> instead of an C<isl_qpolynomial>.
197 =item * The function C<isl_band_member_is_zero_distance>
198 has been removed.  Essentially the same functionality is available
199 through C<isl_band_member_is_coincident>, except that it requires
200 setting up coincidence constraints.
201 The option C<schedule_outer_zero_distance> has accordingly been
202 replaced by the option C<schedule_outer_coincidence>.
204 =item * The function C<isl_vertex_get_expr> has been changed
205 to return an C<isl_multi_aff> instead of a rational C<isl_basic_set>.
206 The function C<isl_vertex_get_domain> has been changed to return
207 a regular basic set, rather than a rational basic set.
209 =back
211 =head3 Changes since isl-0.14
213 =over
215 =item * The function C<isl_union_pw_multi_aff_add> now consistently
216 computes the sum on the shared definition domain.
217 The function C<isl_union_pw_multi_aff_union_add> has been added
218 to compute the sum on the union of definition domains.
219 The original behavior of C<isl_union_pw_multi_aff_add> was
220 confused and is no longer available.
222 =item * Band forests have been replaced by schedule trees.
224 =item * The function C<isl_union_map_compute_flow> has been
225 replaced by the function C<isl_union_access_info_compute_flow>.
226 Note that the may dependence relation returned by
227 C<isl_union_flow_get_may_dependence> is the union of
228 the two dependence relations returned by
229 C<isl_union_map_compute_flow>.  Similarly for the no source relations.
230 The function C<isl_union_map_compute_flow> is still available
231 for backward compatibility, but it will be removed in the future.
233 =item * The function C<isl_basic_set_drop_constraint> has been
234 deprecated.
236 =item * The function C<isl_ast_build_ast_from_schedule> has been
237 renamed to C<isl_ast_build_node_from_schedule_map>.
238 The original name is still available
239 for backward compatibility, but it will be removed in the future.
241 =item * The C<separation_class> AST generation option has been
242 deprecated.
244 =item * The functions C<isl_equality_alloc> and C<isl_inequality_alloc>
245 have been renamed to C<isl_constraint_alloc_equality> and
246 C<isl_constraint_alloc_inequality>.  The original names have been
247 kept for backward compatibility, but they will be removed in the future.
249 =item * The C<schedule_fuse> option has been replaced
250 by the C<schedule_serialize_sccs> option.  The effect
251 of setting the C<schedule_fuse> option to C<ISL_SCHEDULE_FUSE_MIN>
252 is now obtained by turning on the C<schedule_serialize_sccs> option.
254 =back
256 =head3 Changes since isl-0.17
258 =over
260 =item * The function C<isl_printer_print_ast_expr> no longer prints
261 in C format by default.  To print in C format, the output format
262 of the printer needs to have been explicitly set to C<ISL_FORMAT_C>.
263 As a result, the function C<isl_ast_expr_to_str> no longer prints
264 the expression in C format.  Use C<isl_ast_expr_to_C_str> instead.
266 =item * The functions C<isl_set_align_divs> and C<isl_map_align_divs>
267 have been deprecated.  The function C<isl_set_lift> has an effect
268 that is similar to C<isl_set_align_divs> and could in some cases
269 be used as an alternative.
271 =back
273 =head3 Changes since isl-0.19
275 =over
277 =item * Zero-dimensional objects of type C<isl_multi_pw_aff> or
278 C<isl_multi_union_pw_aff> can now keep track of an explicit domain.
279 This explicit domain, if present, is taken into account
280 by various operations that take such objects as input.
282 =back
284 =head1 License
286 C<isl> is released under the MIT license.
288 =over
290 Permission is hereby granted, free of charge, to any person obtaining a copy of
291 this software and associated documentation files (the "Software"), to deal in
292 the Software without restriction, including without limitation the rights to
293 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
294 of the Software, and to permit persons to whom the Software is furnished to do
295 so, subject to the following conditions:
297 The above copyright notice and this permission notice shall be included in all
298 copies or substantial portions of the Software.
300 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
301 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
302 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
303 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
304 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
305 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
306 SOFTWARE.
308 =back
310 Note that by default C<isl> requires C<GMP>, which is released
311 under the GNU Lesser General Public License (LGPL).  This means
312 that code linked against C<isl> is also linked against LGPL code.
314 When configuring with C<--with-int=imath> or C<--with-int=imath-32>, C<isl>
315 will link against C<imath>, a library for exact integer arithmetic released
316 under the MIT license.
318 =head1 Installation
320 The source of C<isl> can be obtained either as a tarball
321 or from the git repository.  Both are available from
322 L<http://isl.gforge.inria.fr/>.
323 The installation process depends on how you obtained
324 the source.
326 =head2 Installation from the git repository
328 =over
330 =item 1 Clone or update the repository
332 The first time the source is obtained, you need to clone
333 the repository.
335         git clone git://repo.or.cz/isl.git
337 To obtain updates, you need to pull in the latest changes
339         git pull
341 =item 2 Optionally get C<imath> submodule
343 To build C<isl> with C<imath>, you need to obtain the C<imath>
344 submodule by running in the git source tree of C<isl>
346        git submodule init
347        git submodule update
349 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
351 =item 2 Generate C<configure>
353         ./autogen.sh
355 =back
357 After performing the above steps, continue
358 with the L<Common installation instructions>.
360 =head2 Common installation instructions
362 =over
364 =item 1 Obtain C<GMP>
366 By default, building C<isl> requires C<GMP>, including its headers files.
367 Your distribution may not provide these header files by default
368 and you may need to install a package called C<gmp-devel> or something
369 similar.  Alternatively, C<GMP> can be built from
370 source, available from L<http://gmplib.org/>.
371 C<GMP> is not needed if you build C<isl> with C<imath>.
373 =item 2 Configure
375 C<isl> uses the standard C<autoconf> C<configure> script.
376 To run it, just type
378         ./configure
380 optionally followed by some configure options.
381 A complete list of options can be obtained by running
383         ./configure --help
385 Below we discuss some of the more common options.
387 =over
389 =item C<--prefix>
391 Installation prefix for C<isl>
393 =item C<--with-int=[gmp|imath|imath-32]>
395 Select the integer library to be used by C<isl>, the default is C<gmp>.
396 With C<imath-32>, C<isl> will use 32 bit integers, but fall back to C<imath>
397 for values out of the 32 bit range. In most applications, C<isl> will run
398 fastest with the C<imath-32> option, followed by C<gmp> and C<imath>, the
399 slowest.
401 =item C<--with-gmp-prefix>
403 Installation prefix for C<GMP> (architecture-independent files).
405 =item C<--with-gmp-exec-prefix>
407 Installation prefix for C<GMP> (architecture-dependent files).
409 =back
411 =item 3 Compile
413         make
415 =item 4 Install (optional)
417         make install
419 =back
421 =head1 Integer Set Library
423 =head2 Memory Management
425 Since a high-level operation on isl objects usually involves
426 several substeps and since the user is usually not interested in
427 the intermediate results, most functions that return a new object
428 will also release all the objects passed as arguments.
429 If the user still wants to use one or more of these arguments
430 after the function call, she should pass along a copy of the
431 object rather than the object itself.
432 The user is then responsible for making sure that the original
433 object gets used somewhere else or is explicitly freed.
435 The arguments and return values of all documented functions are
436 annotated to make clear which arguments are released and which
437 arguments are preserved.  In particular, the following annotations
438 are used
440 =over
442 =item C<__isl_give>
444 C<__isl_give> means that a new object is returned.
445 The user should make sure that the returned pointer is
446 used exactly once as a value for an C<__isl_take> argument.
447 In between, it can be used as a value for as many
448 C<__isl_keep> arguments as the user likes.
449 There is one exception, and that is the case where the
450 pointer returned is C<NULL>.  Is this case, the user
451 is free to use it as an C<__isl_take> argument or not.
452 When applied to a C<char *>, the returned pointer needs to be
453 freed using C<free>.
455 =item C<__isl_null>
457 C<__isl_null> means that a C<NULL> value is returned.
459 =item C<__isl_take>
461 C<__isl_take> means that the object the argument points to
462 is taken over by the function and may no longer be used
463 by the user as an argument to any other function.
464 The pointer value must be one returned by a function
465 returning an C<__isl_give> pointer.
466 If the user passes in a C<NULL> value, then this will
467 be treated as an error in the sense that the function will
468 not perform its usual operation.  However, it will still
469 make sure that all the other C<__isl_take> arguments
470 are released.
472 =item C<__isl_keep>
474 C<__isl_keep> means that the function will only use the object
475 temporarily.  After the function has finished, the user
476 can still use it as an argument to other functions.
477 A C<NULL> value will be treated in the same way as
478 a C<NULL> value for an C<__isl_take> argument.
479 This annotation may also be used on return values of
480 type C<const char *>, in which case the returned pointer should
481 not be freed by the user and is only valid until the object
482 from which it was derived is updated or freed.
484 =back
486 =head2 Initialization
488 All manipulations of integer sets and relations occur within
489 the context of an C<isl_ctx>.
490 A given C<isl_ctx> can only be used within a single thread.
491 All arguments of a function are required to have been allocated
492 within the same context.
493 There are currently no functions available for moving an object
494 from one C<isl_ctx> to another C<isl_ctx>.  This means that
495 there is currently no way of safely moving an object from one
496 thread to another, unless the whole C<isl_ctx> is moved.
498 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
499 freed using C<isl_ctx_free>.
500 All objects allocated within an C<isl_ctx> should be freed
501 before the C<isl_ctx> itself is freed.
503         isl_ctx *isl_ctx_alloc();
504         void isl_ctx_free(isl_ctx *ctx);
506 The user can impose a bound on the number of low-level I<operations>
507 that can be performed by an C<isl_ctx>.  This bound can be set and
508 retrieved using the following functions.  A bound of zero means that
509 no bound is imposed.  The number of operations performed can be
510 reset using C<isl_ctx_reset_operations>.  Note that the number
511 of low-level operations needed to perform a high-level computation
512 may differ significantly across different versions
513 of C<isl>, but it should be the same across different platforms
514 for the same version of C<isl>.
516 Warning: This feature is experimental.  C<isl> has good support to abort and
517 bail out during the computation, but this feature may exercise error code paths
518 that are normally not used that much. Consequently, it is not unlikely that
519 hidden bugs will be exposed.
521         void isl_ctx_set_max_operations(isl_ctx *ctx,
522                 unsigned long max_operations);
523         unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
524         void isl_ctx_reset_operations(isl_ctx *ctx);
526 In order to be able to create an object in the same context
527 as another object, most object types (described later in
528 this document) provide a function to obtain the context
529 in which the object was created.
531         #include <isl/val.h>
532         isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
533         isl_ctx *isl_multi_val_get_ctx(
534                 __isl_keep isl_multi_val *mv);
536         #include <isl/id.h>
537         isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
539         #include <isl/local_space.h>
540         isl_ctx *isl_local_space_get_ctx(
541                 __isl_keep isl_local_space *ls);
543         #include <isl/set.h>
544         isl_ctx *isl_set_list_get_ctx(
545                 __isl_keep isl_set_list *list);
547         #include <isl/aff.h>
548         isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
549         isl_ctx *isl_multi_aff_get_ctx(
550                 __isl_keep isl_multi_aff *maff);
551         isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
552         isl_ctx *isl_pw_multi_aff_get_ctx(
553                 __isl_keep isl_pw_multi_aff *pma);
554         isl_ctx *isl_multi_pw_aff_get_ctx(
555                 __isl_keep isl_multi_pw_aff *mpa);
556         isl_ctx *isl_union_pw_aff_get_ctx(
557                 __isl_keep isl_union_pw_aff *upa);
558         isl_ctx *isl_union_pw_multi_aff_get_ctx(
559                 __isl_keep isl_union_pw_multi_aff *upma);
560         isl_ctx *isl_multi_union_pw_aff_get_ctx(
561                 __isl_keep isl_multi_union_pw_aff *mupa);
563         #include <isl/id_to_ast_expr.h>
564         isl_ctx *isl_id_to_ast_expr_get_ctx(
565                 __isl_keep isl_id_to_ast_expr *id2expr);
567         #include <isl/point.h>
568         isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
570         #include <isl/vec.h>
571         isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
573         #include <isl/mat.h>
574         isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
576         #include <isl/vertices.h>
577         isl_ctx *isl_vertices_get_ctx(
578                 __isl_keep isl_vertices *vertices);
579         isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
580         isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
582         #include <isl/flow.h>
583         isl_ctx *isl_restriction_get_ctx(
584                 __isl_keep isl_restriction *restr);
585         isl_ctx *isl_union_access_info_get_ctx(
586                 __isl_keep isl_union_access_info *access);
587         isl_ctx *isl_union_flow_get_ctx(
588                 __isl_keep isl_union_flow *flow);
590         #include <isl/schedule.h>
591         isl_ctx *isl_schedule_get_ctx(
592                 __isl_keep isl_schedule *sched);
593         isl_ctx *isl_schedule_constraints_get_ctx(
594                 __isl_keep isl_schedule_constraints *sc);
596         #include <isl/schedule_node.h>
597         isl_ctx *isl_schedule_node_get_ctx(
598                 __isl_keep isl_schedule_node *node);
600         #include <isl/ast_build.h>
601         isl_ctx *isl_ast_build_get_ctx(
602                 __isl_keep isl_ast_build *build);
604         #include <isl/ast.h>
605         isl_ctx *isl_ast_expr_get_ctx(
606                 __isl_keep isl_ast_expr *expr);
607         isl_ctx *isl_ast_node_get_ctx(
608                 __isl_keep isl_ast_node *node);
610         #include <isl/stride_info.h>
611         isl_ctx *isl_stride_info_get_ctx(
612                 __isl_keep isl_stride_info *si);
614         #include <isl/fixed_box.h>
615         isl_ctx *isl_fixed_box_get_ctx(
616                 __isl_keep isl_fixed_box *box);
618 =head2 Return Types
620 C<isl> uses two special return types for functions that either return
621 a boolean or that in principle do not return anything.
622 In particular, the C<isl_bool> type has three possible values:
623 C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
624 C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
625 C<isl_bool_error> (a negative integer value), indicating that something
626 went wrong.  The following function can be used to negate an C<isl_bool>,
627 where the negation of C<isl_bool_error> is C<isl_bool_error> again.
629         #include <isl/val.h>
630         isl_bool isl_bool_not(isl_bool b);
632 The C<isl_stat> type has two possible values:
633 C<isl_stat_ok> (the integer value zero), indicating a successful
634 operation; and
635 C<isl_stat_error> (a negative integer value), indicating that something
636 went wrong.
637 See L</"Error Handling"> for more information on
638 C<isl_bool_error> and C<isl_stat_error>.
640 =head2 Values
642 An C<isl_val> represents an integer value, a rational value
643 or one of three special values, infinity, negative infinity and NaN.
644 Some predefined values can be created using the following functions.
646         #include <isl/val.h>
647         __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
648         __isl_give isl_val *isl_val_one(isl_ctx *ctx);
649         __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
650         __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
651         __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
652         __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
654 Specific integer values can be created using the following functions.
656         #include <isl/val.h>
657         __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
658                 long i);
659         __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
660                 unsigned long u);
661         __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
662                 size_t n, size_t size, const void *chunks);
664 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
665 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
666 The least significant digit is assumed to be stored first.
668 Value objects can be copied and freed using the following functions.
670         #include <isl/val.h>
671         __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
672         __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
674 They can be inspected using the following functions.
676         #include <isl/val.h>
677         long isl_val_get_num_si(__isl_keep isl_val *v);
678         long isl_val_get_den_si(__isl_keep isl_val *v);
679         __isl_give isl_val *isl_val_get_den_val(
680                 __isl_keep isl_val *v);
681         double isl_val_get_d(__isl_keep isl_val *v);
682         size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
683                 size_t size);
684         int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
685                 size_t size, void *chunks);
687 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
688 of C<size> bytes needed to store the absolute value of the
689 numerator of C<v>.
690 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
691 which is assumed to have been preallocated by the caller.
692 The least significant digit is stored first.
693 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
694 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
695 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
697 An C<isl_val> can be modified using the following function.
699         #include <isl/val.h>
700         __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
701                 long i);
703 The following unary properties are defined on C<isl_val>s.
705         #include <isl/val.h>
706         int isl_val_sgn(__isl_keep isl_val *v);
707         isl_bool isl_val_is_zero(__isl_keep isl_val *v);
708         isl_bool isl_val_is_one(__isl_keep isl_val *v);
709         isl_bool isl_val_is_negone(__isl_keep isl_val *v);
710         isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
711         isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
712         isl_bool isl_val_is_pos(__isl_keep isl_val *v);
713         isl_bool isl_val_is_neg(__isl_keep isl_val *v);
714         isl_bool isl_val_is_int(__isl_keep isl_val *v);
715         isl_bool isl_val_is_rat(__isl_keep isl_val *v);
716         isl_bool isl_val_is_nan(__isl_keep isl_val *v);
717         isl_bool isl_val_is_infty(__isl_keep isl_val *v);
718         isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
720 Note that the sign of NaN is undefined.
722 The following binary properties are defined on pairs of C<isl_val>s.
724         #include <isl/val.h>
725         isl_bool isl_val_lt(__isl_keep isl_val *v1,
726                 __isl_keep isl_val *v2);
727         isl_bool isl_val_le(__isl_keep isl_val *v1,
728                 __isl_keep isl_val *v2);
729         isl_bool isl_val_gt(__isl_keep isl_val *v1,
730                 __isl_keep isl_val *v2);
731         isl_bool isl_val_ge(__isl_keep isl_val *v1,
732                 __isl_keep isl_val *v2);
733         isl_bool isl_val_eq(__isl_keep isl_val *v1,
734                 __isl_keep isl_val *v2);
735         isl_bool isl_val_ne(__isl_keep isl_val *v1,
736                 __isl_keep isl_val *v2);
737         isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
738                 __isl_keep isl_val *v2);
740 Comparisons to NaN always return false.
741 That is, a NaN is not considered to hold any relative position
742 with respect to any value.  In particular, a NaN
743 is neither considered to be equal to nor to be different from
744 any value (including another NaN).
745 The function C<isl_val_abs_eq> checks whether its two arguments
746 are equal in absolute value.
748 For integer C<isl_val>s we additionally have the following binary property.
750         #include <isl/val.h>
751         isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
752                 __isl_keep isl_val *v2);
754 An C<isl_val> can also be compared to an integer using the following
755 functions.  The result of C<isl_val_cmp_si> undefined for NaN.
757         #include <isl/val.h>
758         isl_bool isl_val_gt_si(__isl_keep isl_val *v, long i);
759         int isl_val_cmp_si(__isl_keep isl_val *v, long i);
761 The following unary operations are available on C<isl_val>s.
763         #include <isl/val.h>
764         __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
765         __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
766         __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
767         __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
768         __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
769         __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
770         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
772 The following binary operations are available on C<isl_val>s.
774         #include <isl/val.h>
775         __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
776                 __isl_take isl_val *v2);
777         __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
778                 __isl_take isl_val *v2);
779         __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
780                 __isl_take isl_val *v2);
781         __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
782                 unsigned long v2);
783         __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
784                 __isl_take isl_val *v2);
785         __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
786                 unsigned long v2);
787         __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
788                 __isl_take isl_val *v2);
789         __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
790                 unsigned long v2);
791         __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
792                 __isl_take isl_val *v2);
793         __isl_give isl_val *isl_val_div_ui(__isl_take isl_val *v1,
794                 unsigned long v2);
796 On integer values, we additionally have the following operations.
798         #include <isl/val.h>
799         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
800         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
801                 __isl_take isl_val *v2);
802         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
803                 __isl_take isl_val *v2);
804         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
805                 __isl_take isl_val *v2, __isl_give isl_val **x,
806                 __isl_give isl_val **y);
808 The function C<isl_val_gcdext> returns the greatest common divisor g
809 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
810 that C<*x> * C<v1> + C<*y> * C<v2> = g.
812 =head3 GMP specific functions
814 These functions are only available if C<isl> has been compiled with C<GMP>
815 support.
817 Specific integer and rational values can be created from C<GMP> values using
818 the following functions.
820         #include <isl/val_gmp.h>
821         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
822                 mpz_t z);
823         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
824                 const mpz_t n, const mpz_t d);
826 The numerator and denominator of a rational value can be extracted as
827 C<GMP> values using the following functions.
829         #include <isl/val_gmp.h>
830         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
831         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
833 =head2 Sets and Relations
835 C<isl> uses six types of objects for representing sets and relations,
836 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
837 C<isl_union_set> and C<isl_union_map>.
838 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
839 can be described as a conjunction of affine constraints, while
840 C<isl_set> and C<isl_map> represent unions of
841 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
842 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
843 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
844 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
845 where spaces are considered different if they have a different number
846 of dimensions and/or different names (see L<"Spaces">).
847 The difference between sets and relations (maps) is that sets have
848 one set of variables, while relations have two sets of variables,
849 input variables and output variables.
851 =head2 Error Handling
853 C<isl> supports different ways to react in case a runtime error is triggered.
854 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
855 with two maps that have incompatible spaces. There are three possible ways
856 to react on error: to warn, to continue or to abort.
858 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
859 the last error in the corresponding C<isl_ctx> and the function in which the
860 error was triggered returns a value indicating that some error has
861 occurred.  In case of functions returning a pointer, this value is
862 C<NULL>.  In case of functions returning an C<isl_bool> or an
863 C<isl_stat>, this value is C<isl_bool_error> or C<isl_stat_error>.
864 An error does not corrupt internal state,
865 such that isl can continue to be used. C<isl> also provides functions to
866 read the last error, including the specific error message,
867 the isl source file where the error occurred and the line number,
868 and to reset all information about the last error. The
869 last error is only stored for information purposes. Its presence does not
870 change the behavior of C<isl>. Hence, resetting an error is not required to
871 continue to use isl, but only to observe new errors.
873         #include <isl/ctx.h>
874         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
875         const char *isl_ctx_last_error_msg(isl_ctx *ctx);
876         const char *isl_ctx_last_error_file(isl_ctx *ctx);
877         int isl_ctx_last_error_line(isl_ctx *ctx);
878         void isl_ctx_reset_error(isl_ctx *ctx);
880 If no error has occurred since the last call to C<isl_ctx_reset_error>,
881 then the functions C<isl_ctx_last_error_msg> and
882 C<isl_ctx_last_error_file> return C<NULL>.
884 Another option is to continue on error. This is similar to warn on error mode,
885 except that C<isl> does not print any warning. This allows a program to
886 implement its own error reporting.
888 The last option is to directly abort the execution of the program from within
889 the isl library. This makes it obviously impossible to recover from an error,
890 but it allows to directly spot the error location. By aborting on error,
891 debuggers break at the location the error occurred and can provide a stack
892 trace. Other tools that automatically provide stack traces on abort or that do
893 not want to continue execution after an error was triggered may also prefer to
894 abort on error.
896 The on error behavior of isl can be specified by calling
897 C<isl_options_set_on_error> or by setting the command line option
898 C<--isl-on-error>. Valid arguments for the function call are
899 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
900 choices for the command line option are C<warn>, C<continue> and C<abort>.
901 It is also possible to query the current error mode.
903         #include <isl/options.h>
904         isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
905         int isl_options_get_on_error(isl_ctx *ctx);
907 =head2 Identifiers
909 Identifiers are used to identify both individual dimensions
910 and tuples of dimensions.  They consist of an optional name and an optional
911 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
912 Identifiers with the same name but different pointer values
913 are considered to be distinct.
914 Similarly, identifiers with different names but the same pointer value
915 are also considered to be distinct.
916 Equal identifiers are represented using the same object.
917 Pairs of identifiers can therefore be tested for equality using the
918 C<==> operator.
919 Identifiers can be constructed, copied, freed, inspected and printed
920 using the following functions.
922         #include <isl/id.h>
923         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
924                 __isl_keep const char *name, void *user);
925         __isl_give isl_id *isl_id_set_free_user(
926                 __isl_take isl_id *id,
927                 void (*free_user)(void *user));
928         __isl_give isl_id *isl_id_copy(isl_id *id);
929         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
931         void *isl_id_get_user(__isl_keep isl_id *id);
932         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
934         __isl_give isl_printer *isl_printer_print_id(
935                 __isl_take isl_printer *p, __isl_keep isl_id *id);
937 The callback set by C<isl_id_set_free_user> is called on the user
938 pointer when the last reference to the C<isl_id> is freed.
939 Note that C<isl_id_get_name> returns a pointer to some internal
940 data structure, so the result can only be used while the
941 corresponding C<isl_id> is alive.
943 =head2 Spaces
945 Whenever a new set, relation or similar object is created from scratch,
946 the space in which it lives needs to be specified using an C<isl_space>.
947 Each space involves zero or more parameters and zero, one or two
948 tuples of set or input/output dimensions.  The parameters and dimensions
949 are identified by an C<isl_dim_type> and a position.
950 The type C<isl_dim_param> refers to parameters,
951 the type C<isl_dim_set> refers to set dimensions (for spaces
952 with a single tuple of dimensions) and the types C<isl_dim_in>
953 and C<isl_dim_out> refer to input and output dimensions
954 (for spaces with two tuples of dimensions).
955 Local spaces (see L</"Local Spaces">) also contain dimensions
956 of type C<isl_dim_div>.
957 Note that parameters are only identified by their position within
958 a given object.  Across different objects, parameters are (usually)
959 identified by their names or identifiers.  Only unnamed parameters
960 are identified by their positions across objects.  The use of unnamed
961 parameters is discouraged.
963         #include <isl/space.h>
964         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
965                 unsigned nparam, unsigned n_in, unsigned n_out);
966         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
967                 unsigned nparam);
968         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
969                 unsigned nparam, unsigned dim);
970         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
971         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
973 The space used for creating a parameter domain
974 needs to be created using C<isl_space_params_alloc>.
975 For other sets, the space
976 needs to be created using C<isl_space_set_alloc>, while
977 for a relation, the space
978 needs to be created using C<isl_space_alloc>.
980 To check whether a given space is that of a set or a map
981 or whether it is a parameter space, use these functions:
983         #include <isl/space.h>
984         isl_bool isl_space_is_params(__isl_keep isl_space *space);
985         isl_bool isl_space_is_set(__isl_keep isl_space *space);
986         isl_bool isl_space_is_map(__isl_keep isl_space *space);
988 Spaces can be compared using the following functions:
990         #include <isl/space.h>
991         isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
992                 __isl_keep isl_space *space2);
993         isl_bool isl_space_has_equal_params(
994                 __isl_keep isl_space *space1,
995                 __isl_keep isl_space *space2);
996         isl_bool isl_space_has_equal_tuples(
997                 __isl_keep isl_space *space1,
998                 __isl_keep isl_space *space2);
999         isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
1000                 __isl_keep isl_space *space2);
1001         isl_bool isl_space_is_range(__isl_keep isl_space *space1,
1002                 __isl_keep isl_space *space2);
1003         isl_bool isl_space_tuple_is_equal(
1004                 __isl_keep isl_space *space1,
1005                 enum isl_dim_type type1,
1006                 __isl_keep isl_space *space2,
1007                 enum isl_dim_type type2);
1009 C<isl_space_is_domain> checks whether the first argument is equal
1010 to the domain of the second argument.  This requires in particular that
1011 the first argument is a set space and that the second argument
1012 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
1013 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
1014 spaces are the same.  That is, it checks if they have the same
1015 identifier (if any), the same dimension and the same internal structure
1016 (if any).
1017 The function
1018 C<isl_space_has_equal_params> checks whether two spaces
1019 have the same parameters in the same order.
1020 C<isl_space_has_equal_tuples> check whether two spaces have
1021 the same tuples.  In contrast to C<isl_space_is_equal> below,
1022 it does not check the
1023 parameters.  This is useful because many C<isl> functions align the
1024 parameters before they perform their operations, such that equivalence
1025 is not necessary.
1026 C<isl_space_is_equal> checks whether two spaces are identical,
1027 meaning that they have the same parameters and the same tuples.
1028 That is, it checks whether both C<isl_space_has_equal_params> and
1029 C<isl_space_has_equal_tuples> hold.
1031 It is often useful to create objects that live in the
1032 same space as some other object.  This can be accomplished
1033 by creating the new objects
1034 (see L</"Creating New Sets and Relations"> or
1035 L</"Functions">) based on the space
1036 of the original object.
1038         #include <isl/set.h>
1039         __isl_give isl_space *isl_basic_set_get_space(
1040                 __isl_keep isl_basic_set *bset);
1041         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
1043         #include <isl/union_set.h>
1044         __isl_give isl_space *isl_union_set_get_space(
1045                 __isl_keep isl_union_set *uset);
1047         #include <isl/map.h>
1048         __isl_give isl_space *isl_basic_map_get_space(
1049                 __isl_keep isl_basic_map *bmap);
1050         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
1052         #include <isl/union_map.h>
1053         __isl_give isl_space *isl_union_map_get_space(
1054                 __isl_keep isl_union_map *umap);
1056         #include <isl/constraint.h>
1057         __isl_give isl_space *isl_constraint_get_space(
1058                 __isl_keep isl_constraint *constraint);
1060         #include <isl/polynomial.h>
1061         __isl_give isl_space *isl_qpolynomial_get_domain_space(
1062                 __isl_keep isl_qpolynomial *qp);
1063         __isl_give isl_space *isl_qpolynomial_get_space(
1064                 __isl_keep isl_qpolynomial *qp);
1065         __isl_give isl_space *
1066         isl_qpolynomial_fold_get_domain_space(
1067                 __isl_keep isl_qpolynomial_fold *fold);
1068         __isl_give isl_space *isl_qpolynomial_fold_get_space(
1069                 __isl_keep isl_qpolynomial_fold *fold);
1070         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
1071                 __isl_keep isl_pw_qpolynomial *pwqp);
1072         __isl_give isl_space *isl_pw_qpolynomial_get_space(
1073                 __isl_keep isl_pw_qpolynomial *pwqp);
1074         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
1075                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1076         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1077                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1078         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1079                 __isl_keep isl_union_pw_qpolynomial *upwqp);
1080         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1081                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1083         #include <isl/val.h>
1084         __isl_give isl_space *isl_multi_val_get_space(
1085                 __isl_keep isl_multi_val *mv);
1087         #include <isl/aff.h>
1088         __isl_give isl_space *isl_aff_get_domain_space(
1089                 __isl_keep isl_aff *aff);
1090         __isl_give isl_space *isl_aff_get_space(
1091                 __isl_keep isl_aff *aff);
1092         __isl_give isl_space *isl_pw_aff_get_domain_space(
1093                 __isl_keep isl_pw_aff *pwaff);
1094         __isl_give isl_space *isl_pw_aff_get_space(
1095                 __isl_keep isl_pw_aff *pwaff);
1096         __isl_give isl_space *isl_multi_aff_get_domain_space(
1097                 __isl_keep isl_multi_aff *maff);
1098         __isl_give isl_space *isl_multi_aff_get_space(
1099                 __isl_keep isl_multi_aff *maff);
1100         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1101                 __isl_keep isl_pw_multi_aff *pma);
1102         __isl_give isl_space *isl_pw_multi_aff_get_space(
1103                 __isl_keep isl_pw_multi_aff *pma);
1104         __isl_give isl_space *isl_union_pw_aff_get_space(
1105                 __isl_keep isl_union_pw_aff *upa);
1106         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1107                 __isl_keep isl_union_pw_multi_aff *upma);
1108         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1109                 __isl_keep isl_multi_pw_aff *mpa);
1110         __isl_give isl_space *isl_multi_pw_aff_get_space(
1111                 __isl_keep isl_multi_pw_aff *mpa);
1112         __isl_give isl_space *
1113         isl_multi_union_pw_aff_get_domain_space(
1114                 __isl_keep isl_multi_union_pw_aff *mupa);
1115         __isl_give isl_space *
1116         isl_multi_union_pw_aff_get_space(
1117                 __isl_keep isl_multi_union_pw_aff *mupa);
1119         #include <isl/point.h>
1120         __isl_give isl_space *isl_point_get_space(
1121                 __isl_keep isl_point *pnt);
1123         #include <isl/fixed_box.h>
1124         __isl_give isl_space *isl_fixed_box_get_space(
1125                 __isl_keep isl_fixed_box *box);
1127 The number of dimensions of a given type of space
1128 may be read off from a space or an object that lives
1129 in a space using the following functions.
1130 In case of C<isl_space_dim>, type may be
1131 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1132 C<isl_dim_out> (only for relations), C<isl_dim_set>
1133 (only for sets) or C<isl_dim_all>.
1135         #include <isl/space.h>
1136         unsigned isl_space_dim(__isl_keep isl_space *space,
1137                 enum isl_dim_type type);
1139         #include <isl/local_space.h>
1140         int isl_local_space_dim(__isl_keep isl_local_space *ls,
1141                 enum isl_dim_type type);
1143         #include <isl/set.h>
1144         unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1145                 enum isl_dim_type type);
1146         unsigned isl_set_dim(__isl_keep isl_set *set,
1147                 enum isl_dim_type type);
1149         #include <isl/union_set.h>
1150         unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1151                 enum isl_dim_type type);
1153         #include <isl/map.h>
1154         unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1155                 enum isl_dim_type type);
1156         unsigned isl_map_dim(__isl_keep isl_map *map,
1157                 enum isl_dim_type type);
1159         #include <isl/union_map.h>
1160         unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1161                 enum isl_dim_type type);
1163         #include <isl/val.h>
1164         unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1165                 enum isl_dim_type type);
1167         #include <isl/aff.h>
1168         int isl_aff_dim(__isl_keep isl_aff *aff,
1169                 enum isl_dim_type type);
1170         unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1171                 enum isl_dim_type type);
1172         unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1173                 enum isl_dim_type type);
1174         unsigned isl_pw_multi_aff_dim(
1175                 __isl_keep isl_pw_multi_aff *pma,
1176                 enum isl_dim_type type);
1177         unsigned isl_multi_pw_aff_dim(
1178                 __isl_keep isl_multi_pw_aff *mpa,
1179                 enum isl_dim_type type);
1180         unsigned isl_union_pw_aff_dim(
1181                 __isl_keep isl_union_pw_aff *upa,
1182                 enum isl_dim_type type);
1183         unsigned isl_union_pw_multi_aff_dim(
1184                 __isl_keep isl_union_pw_multi_aff *upma,
1185                 enum isl_dim_type type);
1186         unsigned isl_multi_union_pw_aff_dim(
1187                 __isl_keep isl_multi_union_pw_aff *mupa,
1188                 enum isl_dim_type type);
1190         #include <isl/polynomial.h>
1191         unsigned isl_union_pw_qpolynomial_dim(
1192                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1193                 enum isl_dim_type type);
1194         unsigned isl_union_pw_qpolynomial_fold_dim(
1195                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1196                 enum isl_dim_type type);
1198 Note that an C<isl_union_set>, an C<isl_union_map>,
1199 an C<isl_union_pw_multi_aff>,
1200 an C<isl_union_pw_qpolynomial> and
1201 an C<isl_union_pw_qpolynomial_fold>
1202 only have parameters.
1204 Additional parameters can be added to a space using the following function.
1206         #include <isl/space.h>
1207         __isl_give isl_space *isl_space_add_param_id(
1208                 __isl_take isl_space *space,
1209                 __isl_take isl_id *id);
1211 If a parameter with the given identifier already appears in the space,
1212 then it is not added again.
1214 The identifiers or names of the individual dimensions of spaces
1215 may be set or read off using the following functions on spaces
1216 or objects that live in spaces.
1217 These functions are mostly useful to obtain the identifiers, positions
1218 or names of the parameters.  Identifiers of individual dimensions are
1219 essentially only useful for printing.  They are ignored by all other
1220 operations and may not be preserved across those operations.
1222         #include <isl/space.h>
1223         __isl_give isl_space *isl_space_set_dim_id(
1224                 __isl_take isl_space *space,
1225                 enum isl_dim_type type, unsigned pos,
1226                 __isl_take isl_id *id);
1227         isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1228                 enum isl_dim_type type, unsigned pos);
1229         __isl_give isl_id *isl_space_get_dim_id(
1230                 __isl_keep isl_space *space,
1231                 enum isl_dim_type type, unsigned pos);
1232         __isl_give isl_space *isl_space_set_dim_name(
1233                 __isl_take isl_space *space,
1234                  enum isl_dim_type type, unsigned pos,
1235                  __isl_keep const char *name);
1236         isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1237                 enum isl_dim_type type, unsigned pos);
1238         __isl_keep const char *isl_space_get_dim_name(
1239                 __isl_keep isl_space *space,
1240                 enum isl_dim_type type, unsigned pos);
1242         #include <isl/local_space.h>
1243         __isl_give isl_local_space *isl_local_space_set_dim_id(
1244                 __isl_take isl_local_space *ls,
1245                 enum isl_dim_type type, unsigned pos,
1246                 __isl_take isl_id *id);
1247         isl_bool isl_local_space_has_dim_id(
1248                 __isl_keep isl_local_space *ls,
1249                 enum isl_dim_type type, unsigned pos);
1250         __isl_give isl_id *isl_local_space_get_dim_id(
1251                 __isl_keep isl_local_space *ls,
1252                 enum isl_dim_type type, unsigned pos);
1253         __isl_give isl_local_space *isl_local_space_set_dim_name(
1254                 __isl_take isl_local_space *ls,
1255                 enum isl_dim_type type, unsigned pos, const char *s);
1256         isl_bool isl_local_space_has_dim_name(
1257                 __isl_keep isl_local_space *ls,
1258                 enum isl_dim_type type, unsigned pos)
1259         const char *isl_local_space_get_dim_name(
1260                 __isl_keep isl_local_space *ls,
1261                 enum isl_dim_type type, unsigned pos);
1263         #include <isl/constraint.h>
1264         const char *isl_constraint_get_dim_name(
1265                 __isl_keep isl_constraint *constraint,
1266                 enum isl_dim_type type, unsigned pos);
1268         #include <isl/set.h>
1269         __isl_give isl_id *isl_basic_set_get_dim_id(
1270                 __isl_keep isl_basic_set *bset,
1271                 enum isl_dim_type type, unsigned pos);
1272         __isl_give isl_set *isl_set_set_dim_id(
1273                 __isl_take isl_set *set, enum isl_dim_type type,
1274                 unsigned pos, __isl_take isl_id *id);
1275         isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1276                 enum isl_dim_type type, unsigned pos);
1277         __isl_give isl_id *isl_set_get_dim_id(
1278                 __isl_keep isl_set *set, enum isl_dim_type type,
1279                 unsigned pos);
1280         const char *isl_basic_set_get_dim_name(
1281                 __isl_keep isl_basic_set *bset,
1282                 enum isl_dim_type type, unsigned pos);
1283         isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1284                 enum isl_dim_type type, unsigned pos);
1285         const char *isl_set_get_dim_name(
1286                 __isl_keep isl_set *set,
1287                 enum isl_dim_type type, unsigned pos);
1289         #include <isl/map.h>
1290         __isl_give isl_map *isl_map_set_dim_id(
1291                 __isl_take isl_map *map, enum isl_dim_type type,
1292                 unsigned pos, __isl_take isl_id *id);
1293         isl_bool isl_basic_map_has_dim_id(
1294                 __isl_keep isl_basic_map *bmap,
1295                 enum isl_dim_type type, unsigned pos);
1296         isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1297                 enum isl_dim_type type, unsigned pos);
1298         __isl_give isl_id *isl_map_get_dim_id(
1299                 __isl_keep isl_map *map, enum isl_dim_type type,
1300                 unsigned pos);
1301         __isl_give isl_id *isl_union_map_get_dim_id(
1302                 __isl_keep isl_union_map *umap,
1303                 enum isl_dim_type type, unsigned pos);
1304         const char *isl_basic_map_get_dim_name(
1305                 __isl_keep isl_basic_map *bmap,
1306                 enum isl_dim_type type, unsigned pos);
1307         isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1308                 enum isl_dim_type type, unsigned pos);
1309         const char *isl_map_get_dim_name(
1310                 __isl_keep isl_map *map,
1311                 enum isl_dim_type type, unsigned pos);
1313         #include <isl/val.h>
1314         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1315                 __isl_take isl_multi_val *mv,
1316                 enum isl_dim_type type, unsigned pos,
1317                 __isl_take isl_id *id);
1318         __isl_give isl_id *isl_multi_val_get_dim_id(
1319                 __isl_keep isl_multi_val *mv,
1320                 enum isl_dim_type type, unsigned pos);
1321         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1322                 __isl_take isl_multi_val *mv,
1323                 enum isl_dim_type type, unsigned pos, const char *s);
1325         #include <isl/aff.h>
1326         __isl_give isl_aff *isl_aff_set_dim_id(
1327                 __isl_take isl_aff *aff, enum isl_dim_type type,
1328                 unsigned pos, __isl_take isl_id *id);
1329         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1330                 __isl_take isl_multi_aff *maff,
1331                 enum isl_dim_type type, unsigned pos,
1332                 __isl_take isl_id *id);
1333         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1334                 __isl_take isl_pw_aff *pma,
1335                 enum isl_dim_type type, unsigned pos,
1336                 __isl_take isl_id *id);
1337         __isl_give isl_multi_pw_aff *
1338         isl_multi_pw_aff_set_dim_id(
1339                 __isl_take isl_multi_pw_aff *mpa,
1340                 enum isl_dim_type type, unsigned pos,
1341                 __isl_take isl_id *id);
1342         __isl_give isl_multi_union_pw_aff *
1343         isl_multi_union_pw_aff_set_dim_id(
1344                 __isl_take isl_multi_union_pw_aff *mupa,
1345                 enum isl_dim_type type, unsigned pos,
1346                 __isl_take isl_id *id);
1347         __isl_give isl_id *isl_multi_aff_get_dim_id(
1348                 __isl_keep isl_multi_aff *ma,
1349                 enum isl_dim_type type, unsigned pos);
1350         isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1351                 enum isl_dim_type type, unsigned pos);
1352         __isl_give isl_id *isl_pw_aff_get_dim_id(
1353                 __isl_keep isl_pw_aff *pa,
1354                 enum isl_dim_type type, unsigned pos);
1355         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1356                 __isl_keep isl_pw_multi_aff *pma,
1357                 enum isl_dim_type type, unsigned pos);
1358         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1359                 __isl_keep isl_multi_pw_aff *mpa,
1360                 enum isl_dim_type type, unsigned pos);
1361         __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1362                 __isl_keep isl_multi_union_pw_aff *mupa,
1363                 enum isl_dim_type type, unsigned pos);
1364         __isl_give isl_aff *isl_aff_set_dim_name(
1365                 __isl_take isl_aff *aff, enum isl_dim_type type,
1366                 unsigned pos, const char *s);
1367         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1368                 __isl_take isl_multi_aff *maff,
1369                 enum isl_dim_type type, unsigned pos, const char *s);
1370         __isl_give isl_multi_pw_aff *
1371         isl_multi_pw_aff_set_dim_name(
1372                 __isl_take isl_multi_pw_aff *mpa,
1373                 enum isl_dim_type type, unsigned pos, const char *s);
1374         __isl_give isl_union_pw_aff *
1375         isl_union_pw_aff_set_dim_name(
1376                 __isl_take isl_union_pw_aff *upa,
1377                 enum isl_dim_type type, unsigned pos,
1378                 const char *s);
1379         __isl_give isl_union_pw_multi_aff *
1380         isl_union_pw_multi_aff_set_dim_name(
1381                 __isl_take isl_union_pw_multi_aff *upma,
1382                 enum isl_dim_type type, unsigned pos,
1383                 const char *s);
1384         __isl_give isl_multi_union_pw_aff *
1385         isl_multi_union_pw_aff_set_dim_name(
1386                 __isl_take isl_multi_union_pw_aff *mupa,
1387                 enum isl_dim_type type, unsigned pos,
1388         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1389                 enum isl_dim_type type, unsigned pos);
1390         const char *isl_pw_aff_get_dim_name(
1391                 __isl_keep isl_pw_aff *pa,
1392                 enum isl_dim_type type, unsigned pos);
1393         const char *isl_pw_multi_aff_get_dim_name(
1394                 __isl_keep isl_pw_multi_aff *pma,
1395                 enum isl_dim_type type, unsigned pos);
1397         #include <isl/polynomial.h>
1398         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1399                 __isl_take isl_qpolynomial *qp,
1400                 enum isl_dim_type type, unsigned pos,
1401                 const char *s);
1402         __isl_give isl_pw_qpolynomial *
1403         isl_pw_qpolynomial_set_dim_name(
1404                 __isl_take isl_pw_qpolynomial *pwqp,
1405                 enum isl_dim_type type, unsigned pos,
1406                 const char *s);
1407         __isl_give isl_pw_qpolynomial_fold *
1408         isl_pw_qpolynomial_fold_set_dim_name(
1409                 __isl_take isl_pw_qpolynomial_fold *pwf,
1410                 enum isl_dim_type type, unsigned pos,
1411                 const char *s);
1412         __isl_give isl_union_pw_qpolynomial *
1413         isl_union_pw_qpolynomial_set_dim_name(
1414                 __isl_take isl_union_pw_qpolynomial *upwqp,
1415                 enum isl_dim_type type, unsigned pos,
1416                 const char *s);
1417         __isl_give isl_union_pw_qpolynomial_fold *
1418         isl_union_pw_qpolynomial_fold_set_dim_name(
1419                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1420                 enum isl_dim_type type, unsigned pos,
1421                 const char *s);
1423 Note that C<isl_space_get_name> returns a pointer to some internal
1424 data structure, so the result can only be used while the
1425 corresponding C<isl_space> is alive.
1426 Also note that every function that operates on two sets or relations
1427 requires that both arguments have the same parameters.  This also
1428 means that if one of the arguments has named parameters, then the
1429 other needs to have named parameters too and the names need to match.
1430 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1431 arguments may have different parameters (as long as they are named),
1432 in which case the result will have as parameters the union of the parameters of
1433 the arguments.
1435 Given the identifier or name of a dimension (typically a parameter),
1436 its position can be obtained from the following functions.
1438         #include <isl/space.h>
1439         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1440                 enum isl_dim_type type, __isl_keep isl_id *id);
1441         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1442                 enum isl_dim_type type, const char *name);
1444         #include <isl/local_space.h>
1445         int isl_local_space_find_dim_by_name(
1446                 __isl_keep isl_local_space *ls,
1447                 enum isl_dim_type type, const char *name);
1449         #include <isl/val.h>
1450         int isl_multi_val_find_dim_by_id(
1451                 __isl_keep isl_multi_val *mv,
1452                 enum isl_dim_type type, __isl_keep isl_id *id);
1453         int isl_multi_val_find_dim_by_name(
1454                 __isl_keep isl_multi_val *mv,
1455                 enum isl_dim_type type, const char *name);
1457         #include <isl/set.h>
1458         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1459                 enum isl_dim_type type, __isl_keep isl_id *id);
1460         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1461                 enum isl_dim_type type, const char *name);
1463         #include <isl/map.h>
1464         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1465                 enum isl_dim_type type, __isl_keep isl_id *id);
1466         int isl_basic_map_find_dim_by_name(
1467                 __isl_keep isl_basic_map *bmap,
1468                 enum isl_dim_type type, const char *name);
1469         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1470                 enum isl_dim_type type, const char *name);
1471         int isl_union_map_find_dim_by_name(
1472                 __isl_keep isl_union_map *umap,
1473                 enum isl_dim_type type, const char *name);
1475         #include <isl/aff.h>
1476         int isl_multi_aff_find_dim_by_id(
1477                 __isl_keep isl_multi_aff *ma,
1478                 enum isl_dim_type type, __isl_keep isl_id *id);
1479         int isl_multi_pw_aff_find_dim_by_id(
1480                 __isl_keep isl_multi_pw_aff *mpa,
1481                 enum isl_dim_type type, __isl_keep isl_id *id);
1482         int isl_multi_union_pw_aff_find_dim_by_id(
1483                 __isl_keep isl_union_multi_pw_aff *mupa,
1484                 enum isl_dim_type type, __isl_keep isl_id *id);
1485         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1486                 enum isl_dim_type type, const char *name);
1487         int isl_multi_aff_find_dim_by_name(
1488                 __isl_keep isl_multi_aff *ma,
1489                 enum isl_dim_type type, const char *name);
1490         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1491                 enum isl_dim_type type, const char *name);
1492         int isl_multi_pw_aff_find_dim_by_name(
1493                 __isl_keep isl_multi_pw_aff *mpa,
1494                 enum isl_dim_type type, const char *name);
1495         int isl_pw_multi_aff_find_dim_by_name(
1496                 __isl_keep isl_pw_multi_aff *pma,
1497                 enum isl_dim_type type, const char *name);
1498         int isl_union_pw_aff_find_dim_by_name(
1499                 __isl_keep isl_union_pw_aff *upa,
1500                 enum isl_dim_type type, const char *name);
1501         int isl_union_pw_multi_aff_find_dim_by_name(
1502                 __isl_keep isl_union_pw_multi_aff *upma,
1503                 enum isl_dim_type type, const char *name);
1504         int isl_multi_union_pw_aff_find_dim_by_name(
1505                 __isl_keep isl_multi_union_pw_aff *mupa,
1506                 enum isl_dim_type type, const char *name);
1508         #include <isl/polynomial.h>
1509         int isl_pw_qpolynomial_find_dim_by_name(
1510                 __isl_keep isl_pw_qpolynomial *pwqp,
1511                 enum isl_dim_type type, const char *name);
1512         int isl_pw_qpolynomial_fold_find_dim_by_name(
1513                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1514                 enum isl_dim_type type, const char *name);
1515         int isl_union_pw_qpolynomial_find_dim_by_name(
1516                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1517                 enum isl_dim_type type, const char *name);
1518         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1519                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1520                 enum isl_dim_type type, const char *name);
1522 The identifiers or names of entire spaces may be set or read off
1523 using the following functions.
1525         #include <isl/space.h>
1526         __isl_give isl_space *isl_space_set_tuple_id(
1527                 __isl_take isl_space *space,
1528                 enum isl_dim_type type, __isl_take isl_id *id);
1529         __isl_give isl_space *isl_space_reset_tuple_id(
1530                 __isl_take isl_space *space, enum isl_dim_type type);
1531         isl_bool isl_space_has_tuple_id(
1532                 __isl_keep isl_space *space,
1533                 enum isl_dim_type type);
1534         __isl_give isl_id *isl_space_get_tuple_id(
1535                 __isl_keep isl_space *space, enum isl_dim_type type);
1536         __isl_give isl_space *isl_space_set_tuple_name(
1537                 __isl_take isl_space *space,
1538                 enum isl_dim_type type, const char *s);
1539         isl_bool isl_space_has_tuple_name(
1540                 __isl_keep isl_space *space,
1541                 enum isl_dim_type type);
1542         __isl_keep const char *isl_space_get_tuple_name(
1543                 __isl_keep isl_space *space,
1544                 enum isl_dim_type type);
1546         #include <isl/local_space.h>
1547         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1548                 __isl_take isl_local_space *ls,
1549                 enum isl_dim_type type, __isl_take isl_id *id);
1551         #include <isl/set.h>
1552         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1553                 __isl_take isl_basic_set *bset,
1554                 __isl_take isl_id *id);
1555         __isl_give isl_set *isl_set_set_tuple_id(
1556                 __isl_take isl_set *set, __isl_take isl_id *id);
1557         __isl_give isl_set *isl_set_reset_tuple_id(
1558                 __isl_take isl_set *set);
1559         isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1560         __isl_give isl_id *isl_set_get_tuple_id(
1561                 __isl_keep isl_set *set);
1562         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1563                 __isl_take isl_basic_set *set, const char *s);
1564         __isl_give isl_set *isl_set_set_tuple_name(
1565                 __isl_take isl_set *set, const char *s);
1566         const char *isl_basic_set_get_tuple_name(
1567                 __isl_keep isl_basic_set *bset);
1568         isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1569         const char *isl_set_get_tuple_name(
1570                 __isl_keep isl_set *set);
1572         #include <isl/map.h>
1573         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1574                 __isl_take isl_basic_map *bmap,
1575                 enum isl_dim_type type, __isl_take isl_id *id);
1576         __isl_give isl_map *isl_map_set_tuple_id(
1577                 __isl_take isl_map *map, enum isl_dim_type type,
1578                 __isl_take isl_id *id);
1579         __isl_give isl_map *isl_map_reset_tuple_id(
1580                 __isl_take isl_map *map, enum isl_dim_type type);
1581         isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1582                 enum isl_dim_type type);
1583         __isl_give isl_id *isl_map_get_tuple_id(
1584                 __isl_keep isl_map *map, enum isl_dim_type type);
1585         __isl_give isl_map *isl_map_set_tuple_name(
1586                 __isl_take isl_map *map,
1587                 enum isl_dim_type type, const char *s);
1588         const char *isl_basic_map_get_tuple_name(
1589                 __isl_keep isl_basic_map *bmap,
1590                 enum isl_dim_type type);
1591         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1592                 __isl_take isl_basic_map *bmap,
1593                 enum isl_dim_type type, const char *s);
1594         isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1595                 enum isl_dim_type type);
1596         const char *isl_map_get_tuple_name(
1597                 __isl_keep isl_map *map,
1598                 enum isl_dim_type type);
1600         #include <isl/val.h>
1601         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1602                 __isl_take isl_multi_val *mv,
1603                 enum isl_dim_type type, __isl_take isl_id *id);
1604         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1605                 __isl_take isl_multi_val *mv,
1606                 enum isl_dim_type type);
1607         isl_bool isl_multi_val_has_tuple_id(
1608                 __isl_keep isl_multi_val *mv,
1609                 enum isl_dim_type type);
1610         __isl_give isl_id *isl_multi_val_get_tuple_id(
1611                 __isl_keep isl_multi_val *mv,
1612                 enum isl_dim_type type);
1613         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1614                 __isl_take isl_multi_val *mv,
1615                 enum isl_dim_type type, const char *s);
1616         const char *isl_multi_val_get_tuple_name(
1617                 __isl_keep isl_multi_val *mv,
1618                 enum isl_dim_type type);
1620         #include <isl/aff.h>
1621         __isl_give isl_aff *isl_aff_set_tuple_id(
1622                 __isl_take isl_aff *aff,
1623                 enum isl_dim_type type, __isl_take isl_id *id);
1624         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1625                 __isl_take isl_multi_aff *maff,
1626                 enum isl_dim_type type, __isl_take isl_id *id);
1627         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1628                 __isl_take isl_pw_aff *pwaff,
1629                 enum isl_dim_type type, __isl_take isl_id *id);
1630         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1631                 __isl_take isl_pw_multi_aff *pma,
1632                 enum isl_dim_type type, __isl_take isl_id *id);
1633         __isl_give isl_multi_union_pw_aff *
1634         isl_multi_union_pw_aff_set_tuple_id(
1635                 __isl_take isl_multi_union_pw_aff *mupa,
1636                 enum isl_dim_type type, __isl_take isl_id *id);
1637         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1638                 __isl_take isl_multi_aff *ma,
1639                 enum isl_dim_type type);
1640         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1641                 __isl_take isl_pw_aff *pa,
1642                 enum isl_dim_type type);
1643         __isl_give isl_multi_pw_aff *
1644         isl_multi_pw_aff_reset_tuple_id(
1645                 __isl_take isl_multi_pw_aff *mpa,
1646                 enum isl_dim_type type);
1647         __isl_give isl_pw_multi_aff *
1648         isl_pw_multi_aff_reset_tuple_id(
1649                 __isl_take isl_pw_multi_aff *pma,
1650                 enum isl_dim_type type);
1651         __isl_give isl_multi_union_pw_aff *
1652         isl_multi_union_pw_aff_reset_tuple_id(
1653                 __isl_take isl_multi_union_pw_aff *mupa,
1654                 enum isl_dim_type type);
1655         isl_bool isl_multi_aff_has_tuple_id(
1656                 __isl_keep isl_multi_aff *ma,
1657                 enum isl_dim_type type);
1658         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1659                 __isl_keep isl_multi_aff *ma,
1660                 enum isl_dim_type type);
1661         isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1662                 enum isl_dim_type type);
1663         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1664                 __isl_keep isl_pw_aff *pa,
1665                 enum isl_dim_type type);
1666         isl_bool isl_pw_multi_aff_has_tuple_id(
1667                 __isl_keep isl_pw_multi_aff *pma,
1668                 enum isl_dim_type type);
1669         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1670                 __isl_keep isl_pw_multi_aff *pma,
1671                 enum isl_dim_type type);
1672         isl_bool isl_multi_pw_aff_has_tuple_id(
1673                 __isl_keep isl_multi_pw_aff *mpa,
1674                 enum isl_dim_type type);
1675         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1676                 __isl_keep isl_multi_pw_aff *mpa,
1677                 enum isl_dim_type type);
1678         isl_bool isl_multi_union_pw_aff_has_tuple_id(
1679                 __isl_keep isl_multi_union_pw_aff *mupa,
1680                 enum isl_dim_type type);
1681         __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1682                 __isl_keep isl_multi_union_pw_aff *mupa,
1683                 enum isl_dim_type type);
1684         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1685                 __isl_take isl_multi_aff *maff,
1686                 enum isl_dim_type type, const char *s);
1687         __isl_give isl_multi_pw_aff *
1688         isl_multi_pw_aff_set_tuple_name(
1689                 __isl_take isl_multi_pw_aff *mpa,
1690                 enum isl_dim_type type, const char *s);
1691         __isl_give isl_multi_union_pw_aff *
1692         isl_multi_union_pw_aff_set_tuple_name(
1693                 __isl_take isl_multi_union_pw_aff *mupa,
1694                 enum isl_dim_type type, const char *s);
1695         const char *isl_multi_aff_get_tuple_name(
1696                 __isl_keep isl_multi_aff *multi,
1697                 enum isl_dim_type type);
1698         isl_bool isl_pw_multi_aff_has_tuple_name(
1699                 __isl_keep isl_pw_multi_aff *pma,
1700                 enum isl_dim_type type);
1701         const char *isl_pw_multi_aff_get_tuple_name(
1702                 __isl_keep isl_pw_multi_aff *pma,
1703                 enum isl_dim_type type);
1704         const char *isl_multi_union_pw_aff_get_tuple_name(
1705                 __isl_keep isl_multi_union_pw_aff *mupa,
1706                 enum isl_dim_type type);
1708 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1709 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1710 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1711 data structure.
1712 Binary operations require the corresponding spaces of their arguments
1713 to have the same name.
1715 To keep the names of all parameters and tuples, but reset the user pointers
1716 of all the corresponding identifiers, use the following function.
1718         #include <isl/space.h>
1719         __isl_give isl_space *isl_space_reset_user(
1720                 __isl_take isl_space *space);
1722         #include <isl/set.h>
1723         __isl_give isl_set *isl_set_reset_user(
1724                 __isl_take isl_set *set);
1726         #include <isl/map.h>
1727         __isl_give isl_map *isl_map_reset_user(
1728                 __isl_take isl_map *map);
1730         #include <isl/union_set.h>
1731         __isl_give isl_union_set *isl_union_set_reset_user(
1732                 __isl_take isl_union_set *uset);
1734         #include <isl/union_map.h>
1735         __isl_give isl_union_map *isl_union_map_reset_user(
1736                 __isl_take isl_union_map *umap);
1738         #include <isl/val.h>
1739         __isl_give isl_multi_val *isl_multi_val_reset_user(
1740                 __isl_take isl_multi_val *mv);
1742         #include <isl/aff.h>
1743         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1744                 __isl_take isl_multi_aff *ma);
1745         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1746                 __isl_take isl_pw_aff *pa);
1747         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1748                 __isl_take isl_multi_pw_aff *mpa);
1749         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1750                 __isl_take isl_pw_multi_aff *pma);
1751         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1752                 __isl_take isl_union_pw_aff *upa);
1753         __isl_give isl_multi_union_pw_aff *
1754         isl_multi_union_pw_aff_reset_user(
1755                 __isl_take isl_multi_union_pw_aff *mupa);
1756         __isl_give isl_union_pw_multi_aff *
1757         isl_union_pw_multi_aff_reset_user(
1758                 __isl_take isl_union_pw_multi_aff *upma);
1760         #include <isl/polynomial.h>
1761         __isl_give isl_pw_qpolynomial *
1762         isl_pw_qpolynomial_reset_user(
1763                 __isl_take isl_pw_qpolynomial *pwqp);
1764         __isl_give isl_union_pw_qpolynomial *
1765         isl_union_pw_qpolynomial_reset_user(
1766                 __isl_take isl_union_pw_qpolynomial *upwqp);
1767         __isl_give isl_pw_qpolynomial_fold *
1768         isl_pw_qpolynomial_fold_reset_user(
1769                 __isl_take isl_pw_qpolynomial_fold *pwf);
1770         __isl_give isl_union_pw_qpolynomial_fold *
1771         isl_union_pw_qpolynomial_fold_reset_user(
1772                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1774 Spaces can be nested.  In particular, the domain of a set or
1775 the domain or range of a relation can be a nested relation.
1776 This process is also called I<wrapping>.
1777 The functions for detecting, constructing and deconstructing
1778 such nested spaces can be found in the wrapping properties
1779 of L</"Unary Properties">, the wrapping operations
1780 of L</"Unary Operations"> and the Cartesian product operations
1781 of L</"Basic Operations">.
1783 Spaces can be created from other spaces
1784 using the functions described in L</"Unary Operations">
1785 and L</"Binary Operations">.
1787 =head2 Local Spaces
1789 A local space is essentially a space with
1790 zero or more existentially quantified variables.
1791 The local space of various objects can be obtained
1792 using the following functions.
1794         #include <isl/constraint.h>
1795         __isl_give isl_local_space *isl_constraint_get_local_space(
1796                 __isl_keep isl_constraint *constraint);
1798         #include <isl/set.h>
1799         __isl_give isl_local_space *isl_basic_set_get_local_space(
1800                 __isl_keep isl_basic_set *bset);
1802         #include <isl/map.h>
1803         __isl_give isl_local_space *isl_basic_map_get_local_space(
1804                 __isl_keep isl_basic_map *bmap);
1806         #include <isl/aff.h>
1807         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1808                 __isl_keep isl_aff *aff);
1809         __isl_give isl_local_space *isl_aff_get_local_space(
1810                 __isl_keep isl_aff *aff);
1812 A new local space can be created from a space using
1814         #include <isl/local_space.h>
1815         __isl_give isl_local_space *isl_local_space_from_space(
1816                 __isl_take isl_space *space);
1818 They can be inspected, modified, copied and freed using the following functions.
1820         #include <isl/local_space.h>
1821         isl_bool isl_local_space_is_params(
1822                 __isl_keep isl_local_space *ls);
1823         isl_bool isl_local_space_is_set(
1824                 __isl_keep isl_local_space *ls);
1825         __isl_give isl_space *isl_local_space_get_space(
1826                 __isl_keep isl_local_space *ls);
1827         __isl_give isl_aff *isl_local_space_get_div(
1828                 __isl_keep isl_local_space *ls, int pos);
1829         __isl_give isl_local_space *isl_local_space_copy(
1830                 __isl_keep isl_local_space *ls);
1831         __isl_null isl_local_space *isl_local_space_free(
1832                 __isl_take isl_local_space *ls);
1834 Note that C<isl_local_space_get_div> can only be used on local spaces
1835 of sets.
1837 Two local spaces can be compared using
1839         isl_bool isl_local_space_is_equal(
1840                 __isl_keep isl_local_space *ls1,
1841                 __isl_keep isl_local_space *ls2);
1843 Local spaces can be created from other local spaces
1844 using the functions described in L</"Unary Operations">
1845 and L</"Binary Operations">.
1847 =head2 Creating New Sets and Relations
1849 C<isl> has functions for creating some standard sets and relations.
1851 =over
1853 =item * Empty sets and relations
1855         __isl_give isl_basic_set *isl_basic_set_empty(
1856                 __isl_take isl_space *space);
1857         __isl_give isl_basic_map *isl_basic_map_empty(
1858                 __isl_take isl_space *space);
1859         __isl_give isl_set *isl_set_empty(
1860                 __isl_take isl_space *space);
1861         __isl_give isl_map *isl_map_empty(
1862                 __isl_take isl_space *space);
1863         __isl_give isl_union_set *isl_union_set_empty(
1864                 __isl_take isl_space *space);
1865         __isl_give isl_union_map *isl_union_map_empty(
1866                 __isl_take isl_space *space);
1868 For C<isl_union_set>s and C<isl_union_map>s, the space
1869 is only used to specify the parameters.
1871 =item * Universe sets and relations
1873         __isl_give isl_basic_set *isl_basic_set_universe(
1874                 __isl_take isl_space *space);
1875         __isl_give isl_basic_map *isl_basic_map_universe(
1876                 __isl_take isl_space *space);
1877         __isl_give isl_set *isl_set_universe(
1878                 __isl_take isl_space *space);
1879         __isl_give isl_map *isl_map_universe(
1880                 __isl_take isl_space *space);
1881         __isl_give isl_union_set *isl_union_set_universe(
1882                 __isl_take isl_union_set *uset);
1883         __isl_give isl_union_map *isl_union_map_universe(
1884                 __isl_take isl_union_map *umap);
1886 The sets and relations constructed by the functions above
1887 contain all integer values, while those constructed by the
1888 functions below only contain non-negative values.
1890         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1891                 __isl_take isl_space *space);
1892         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1893                 __isl_take isl_space *space);
1894         __isl_give isl_set *isl_set_nat_universe(
1895                 __isl_take isl_space *space);
1896         __isl_give isl_map *isl_map_nat_universe(
1897                 __isl_take isl_space *space);
1899 =item * Identity relations
1901         __isl_give isl_basic_map *isl_basic_map_identity(
1902                 __isl_take isl_space *space);
1903         __isl_give isl_map *isl_map_identity(
1904                 __isl_take isl_space *space);
1906 The number of input and output dimensions in C<space> needs
1907 to be the same.
1909 =item * Lexicographic order
1911         __isl_give isl_map *isl_map_lex_lt(
1912                 __isl_take isl_space *set_space);
1913         __isl_give isl_map *isl_map_lex_le(
1914                 __isl_take isl_space *set_space);
1915         __isl_give isl_map *isl_map_lex_gt(
1916                 __isl_take isl_space *set_space);
1917         __isl_give isl_map *isl_map_lex_ge(
1918                 __isl_take isl_space *set_space);
1919         __isl_give isl_map *isl_map_lex_lt_first(
1920                 __isl_take isl_space *space, unsigned n);
1921         __isl_give isl_map *isl_map_lex_le_first(
1922                 __isl_take isl_space *space, unsigned n);
1923         __isl_give isl_map *isl_map_lex_gt_first(
1924                 __isl_take isl_space *space, unsigned n);
1925         __isl_give isl_map *isl_map_lex_ge_first(
1926                 __isl_take isl_space *space, unsigned n);
1928 The first four functions take a space for a B<set>
1929 and return relations that express that the elements in the domain
1930 are lexicographically less
1931 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1932 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1933 than the elements in the range.
1934 The last four functions take a space for a map
1935 and return relations that express that the first C<n> dimensions
1936 in the domain are lexicographically less
1937 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1938 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1939 than the first C<n> dimensions in the range.
1941 =back
1943 A basic set or relation can be converted to a set or relation
1944 using the following functions.
1946         __isl_give isl_set *isl_set_from_basic_set(
1947                 __isl_take isl_basic_set *bset);
1948         __isl_give isl_map *isl_map_from_basic_map(
1949                 __isl_take isl_basic_map *bmap);
1951 Sets and relations can be converted to union sets and relations
1952 using the following functions.
1954         __isl_give isl_union_set *isl_union_set_from_basic_set(
1955                 __isl_take isl_basic_set *bset);
1956         __isl_give isl_union_map *isl_union_map_from_basic_map(
1957                 __isl_take isl_basic_map *bmap);
1958         __isl_give isl_union_set *isl_union_set_from_set(
1959                 __isl_take isl_set *set);
1960         __isl_give isl_union_map *isl_union_map_from_map(
1961                 __isl_take isl_map *map);
1963 The inverse conversions below can only be used if the input
1964 union set or relation is known to contain elements in exactly one
1965 space.
1967         __isl_give isl_set *isl_set_from_union_set(
1968                 __isl_take isl_union_set *uset);
1969         __isl_give isl_map *isl_map_from_union_map(
1970                 __isl_take isl_union_map *umap);
1972 Sets and relations can be copied and freed again using the following
1973 functions.
1975         __isl_give isl_basic_set *isl_basic_set_copy(
1976                 __isl_keep isl_basic_set *bset);
1977         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1978         __isl_give isl_union_set *isl_union_set_copy(
1979                 __isl_keep isl_union_set *uset);
1980         __isl_give isl_basic_map *isl_basic_map_copy(
1981                 __isl_keep isl_basic_map *bmap);
1982         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1983         __isl_give isl_union_map *isl_union_map_copy(
1984                 __isl_keep isl_union_map *umap);
1985         __isl_null isl_basic_set *isl_basic_set_free(
1986                 __isl_take isl_basic_set *bset);
1987         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1988         __isl_null isl_union_set *isl_union_set_free(
1989                 __isl_take isl_union_set *uset);
1990         __isl_null isl_basic_map *isl_basic_map_free(
1991                 __isl_take isl_basic_map *bmap);
1992         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1993         __isl_null isl_union_map *isl_union_map_free(
1994                 __isl_take isl_union_map *umap);
1996 Other sets and relations can be constructed by starting
1997 from a universe set or relation, adding equality and/or
1998 inequality constraints and then projecting out the
1999 existentially quantified variables, if any.
2000 Constraints can be constructed, manipulated and
2001 added to (or removed from) (basic) sets and relations
2002 using the following functions.
2004         #include <isl/constraint.h>
2005         __isl_give isl_constraint *isl_constraint_alloc_equality(
2006                 __isl_take isl_local_space *ls);
2007         __isl_give isl_constraint *isl_constraint_alloc_inequality(
2008                 __isl_take isl_local_space *ls);
2009         __isl_give isl_constraint *isl_constraint_set_constant_si(
2010                 __isl_take isl_constraint *constraint, int v);
2011         __isl_give isl_constraint *isl_constraint_set_constant_val(
2012                 __isl_take isl_constraint *constraint,
2013                 __isl_take isl_val *v);
2014         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
2015                 __isl_take isl_constraint *constraint,
2016                 enum isl_dim_type type, int pos, int v);
2017         __isl_give isl_constraint *
2018         isl_constraint_set_coefficient_val(
2019                 __isl_take isl_constraint *constraint,
2020                 enum isl_dim_type type, int pos,
2021                 __isl_take isl_val *v);
2022         __isl_give isl_basic_map *isl_basic_map_add_constraint(
2023                 __isl_take isl_basic_map *bmap,
2024                 __isl_take isl_constraint *constraint);
2025         __isl_give isl_basic_set *isl_basic_set_add_constraint(
2026                 __isl_take isl_basic_set *bset,
2027                 __isl_take isl_constraint *constraint);
2028         __isl_give isl_map *isl_map_add_constraint(
2029                 __isl_take isl_map *map,
2030                 __isl_take isl_constraint *constraint);
2031         __isl_give isl_set *isl_set_add_constraint(
2032                 __isl_take isl_set *set,
2033                 __isl_take isl_constraint *constraint);
2035 For example, to create a set containing the even integers
2036 between 10 and 42, you would use the following code.
2038         isl_space *space;
2039         isl_local_space *ls;
2040         isl_constraint *c;
2041         isl_basic_set *bset;
2043         space = isl_space_set_alloc(ctx, 0, 2);
2044         bset = isl_basic_set_universe(isl_space_copy(space));
2045         ls = isl_local_space_from_space(space);
2047         c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
2048         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2049         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
2050         bset = isl_basic_set_add_constraint(bset, c);
2052         c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
2053         c = isl_constraint_set_constant_si(c, -10);
2054         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
2055         bset = isl_basic_set_add_constraint(bset, c);
2057         c = isl_constraint_alloc_inequality(ls);
2058         c = isl_constraint_set_constant_si(c, 42);
2059         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
2060         bset = isl_basic_set_add_constraint(bset, c);
2062         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
2064 Or, alternatively,
2066         isl_basic_set *bset;
2067         bset = isl_basic_set_read_from_str(ctx,
2068                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
2070 A basic set or relation can also be constructed from two matrices
2071 describing the equalities and the inequalities.
2073         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
2074                 __isl_take isl_space *space,
2075                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2076                 enum isl_dim_type c1,
2077                 enum isl_dim_type c2, enum isl_dim_type c3,
2078                 enum isl_dim_type c4);
2079         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
2080                 __isl_take isl_space *space,
2081                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
2082                 enum isl_dim_type c1,
2083                 enum isl_dim_type c2, enum isl_dim_type c3,
2084                 enum isl_dim_type c4, enum isl_dim_type c5);
2086 The C<isl_dim_type> arguments indicate the order in which
2087 different kinds of variables appear in the input matrices
2088 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
2089 C<isl_dim_set> and C<isl_dim_div> for sets and
2090 of C<isl_dim_cst>, C<isl_dim_param>,
2091 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2093 A (basic or union) set or relation can also be constructed from a
2094 (union) (piecewise) (multiple) affine expression
2095 or a list of affine expressions
2096 (See L</"Functions">), provided these affine expressions do not
2097 involve any NaN.
2099         __isl_give isl_basic_map *isl_basic_map_from_aff(
2100                 __isl_take isl_aff *aff);
2101         __isl_give isl_map *isl_map_from_aff(
2102                 __isl_take isl_aff *aff);
2103         __isl_give isl_set *isl_set_from_pw_aff(
2104                 __isl_take isl_pw_aff *pwaff);
2105         __isl_give isl_map *isl_map_from_pw_aff(
2106                 __isl_take isl_pw_aff *pwaff);
2107         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2108                 __isl_take isl_space *domain_space,
2109                 __isl_take isl_aff_list *list);
2110         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2111                 __isl_take isl_multi_aff *maff)
2112         __isl_give isl_map *isl_map_from_multi_aff(
2113                 __isl_take isl_multi_aff *maff)
2114         __isl_give isl_set *isl_set_from_pw_multi_aff(
2115                 __isl_take isl_pw_multi_aff *pma);
2116         __isl_give isl_map *isl_map_from_pw_multi_aff(
2117                 __isl_take isl_pw_multi_aff *pma);
2118         __isl_give isl_set *isl_set_from_multi_pw_aff(
2119                 __isl_take isl_multi_pw_aff *mpa);
2120         __isl_give isl_map *isl_map_from_multi_pw_aff(
2121                 __isl_take isl_multi_pw_aff *mpa);
2122         __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2123                 __isl_take isl_union_pw_aff *upa);
2124         __isl_give isl_union_map *
2125         isl_union_map_from_union_pw_multi_aff(
2126                 __isl_take isl_union_pw_multi_aff *upma);
2127         __isl_give isl_union_map *
2128         isl_union_map_from_multi_union_pw_aff(
2129                 __isl_take isl_multi_union_pw_aff *mupa);
2131 The C<domain_space> argument describes the domain of the resulting
2132 basic relation.  It is required because the C<list> may consist
2133 of zero affine expressions.
2134 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2135 is not allowed to be zero-dimensional.  The domain of the result
2136 is the shared domain of the union piecewise affine elements.
2138 =head2 Inspecting Sets and Relations
2140 Usually, the user should not have to care about the actual constraints
2141 of the sets and maps, but should instead apply the abstract operations
2142 explained in the following sections.
2143 Occasionally, however, it may be required to inspect the individual
2144 coefficients of the constraints.  This section explains how to do so.
2145 In these cases, it may also be useful to have C<isl> compute
2146 an explicit representation of the existentially quantified variables.
2148         __isl_give isl_set *isl_set_compute_divs(
2149                 __isl_take isl_set *set);
2150         __isl_give isl_map *isl_map_compute_divs(
2151                 __isl_take isl_map *map);
2152         __isl_give isl_union_set *isl_union_set_compute_divs(
2153                 __isl_take isl_union_set *uset);
2154         __isl_give isl_union_map *isl_union_map_compute_divs(
2155                 __isl_take isl_union_map *umap);
2157 This explicit representation defines the existentially quantified
2158 variables as integer divisions of the other variables, possibly
2159 including earlier existentially quantified variables.
2160 An explicitly represented existentially quantified variable therefore
2161 has a unique value when the values of the other variables are known.
2163 Alternatively, the existentially quantified variables can be removed
2164 using the following functions, which compute an overapproximation.
2166         #include <isl/set.h>
2167         __isl_give isl_basic_set *isl_basic_set_remove_divs(
2168                 __isl_take isl_basic_set *bset);
2169         __isl_give isl_set *isl_set_remove_divs(
2170                 __isl_take isl_set *set);
2172         #include <isl/map.h>
2173         __isl_give isl_basic_map *isl_basic_map_remove_divs(
2174                 __isl_take isl_basic_map *bmap);
2175         __isl_give isl_map *isl_map_remove_divs(
2176                 __isl_take isl_map *map);
2178         #include <isl/union_set.h>
2179         __isl_give isl_union_set *isl_union_set_remove_divs(
2180                 __isl_take isl_union_set *bset);
2182         #include <isl/union_map.h>
2183         __isl_give isl_union_map *isl_union_map_remove_divs(
2184                 __isl_take isl_union_map *bmap);
2186 It is also possible to only remove those divs that are defined
2187 in terms of a given range of dimensions or only those for which
2188 no explicit representation is known.
2190         __isl_give isl_basic_set *
2191         isl_basic_set_remove_divs_involving_dims(
2192                 __isl_take isl_basic_set *bset,
2193                 enum isl_dim_type type,
2194                 unsigned first, unsigned n);
2195         __isl_give isl_basic_map *
2196         isl_basic_map_remove_divs_involving_dims(
2197                 __isl_take isl_basic_map *bmap,
2198                 enum isl_dim_type type,
2199                 unsigned first, unsigned n);
2200         __isl_give isl_set *isl_set_remove_divs_involving_dims(
2201                 __isl_take isl_set *set, enum isl_dim_type type,
2202                 unsigned first, unsigned n);
2203         __isl_give isl_map *isl_map_remove_divs_involving_dims(
2204                 __isl_take isl_map *map, enum isl_dim_type type,
2205                 unsigned first, unsigned n);
2207         __isl_give isl_basic_set *
2208         isl_basic_set_remove_unknown_divs(
2209                 __isl_take isl_basic_set *bset);
2210         __isl_give isl_set *isl_set_remove_unknown_divs(
2211                 __isl_take isl_set *set);
2212         __isl_give isl_map *isl_map_remove_unknown_divs(
2213                 __isl_take isl_map *map);
2215 To iterate over all the sets or maps in a union set or map, use
2217         #include <isl/union_set.h>
2218         isl_stat isl_union_set_foreach_set(
2219                 __isl_keep isl_union_set *uset,
2220                 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2221                 void *user);
2223         #include <isl/union_map.h>
2224         isl_stat isl_union_map_foreach_map(
2225                 __isl_keep isl_union_map *umap,
2226                 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2227                 void *user);
2228         isl_bool isl_union_map_every_map(
2229                 __isl_keep isl_union_map *umap,
2230                 isl_bool (*test)(__isl_keep isl_map *map,
2231                         void *user),
2232                 void *user);
2234 These functions call the callback function once for each
2235 (pair of) space(s) for which there are elements in the input.
2236 The argument to the callback contains all elements in the input
2237 with that (pair of) space(s).
2238 The C<isl_union_map_every_map> variant check whether each
2239 call to the callback returns true and stops checking as soon as one
2240 of these calls returns false.
2242 The number of sets or maps in a union set or map can be obtained
2243 from
2245         int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2246         int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2248 To extract the set or map in a given space from a union, use
2250         __isl_give isl_set *isl_union_set_extract_set(
2251                 __isl_keep isl_union_set *uset,
2252                 __isl_take isl_space *space);
2253         __isl_give isl_map *isl_union_map_extract_map(
2254                 __isl_keep isl_union_map *umap,
2255                 __isl_take isl_space *space);
2257 To iterate over all the basic sets or maps in a set or map, use
2259         isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2260                 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2261                         void *user),
2262                 void *user);
2263         isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2264                 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2265                         void *user),
2266                 void *user);
2268 The callback function C<fn> should return C<isl_stat_ok> if successful and
2269 C<isl_stat_error> if an error occurs.  In the latter case, or if any other error
2270 occurs, the above functions will return C<isl_stat_error>.
2272 It should be noted that C<isl> does not guarantee that
2273 the basic sets or maps passed to C<fn> are disjoint.
2274 If this is required, then the user should call one of
2275 the following functions first.
2277         __isl_give isl_set *isl_set_make_disjoint(
2278                 __isl_take isl_set *set);
2279         __isl_give isl_map *isl_map_make_disjoint(
2280                 __isl_take isl_map *map);
2282 The number of basic sets in a set can be obtained
2283 or the number of basic maps in a map can be obtained
2284 from
2286         #include <isl/set.h>
2287         int isl_set_n_basic_set(__isl_keep isl_set *set);
2289         #include <isl/map.h>
2290         int isl_map_n_basic_map(__isl_keep isl_map *map);
2292 It is also possible to obtain a list of (basic) sets from a set
2293 or union set, a list of basic maps from a map and a list of maps from a union
2294 map.
2296         #include <isl/set.h>
2297         __isl_give isl_basic_set_list *isl_set_get_basic_set_list(
2298                 __isl_keep isl_set *set);
2300         #include <isl/union_set.h>
2301         __isl_give isl_basic_set_list *
2302         isl_union_set_get_basic_set_list(
2303                 __isl_keep isl_union_set *uset);
2304         __isl_give isl_set_list *isl_union_set_get_set_list(
2305                 __isl_keep isl_union_set *uset);
2307         #include <isl/map.h>
2308         __isl_give isl_basic_map_list *isl_map_get_basic_map_list(
2309                 __isl_keep isl_map *map);
2311         #include <isl/union_map.h>
2312         __isl_give isl_map_list *isl_union_map_get_map_list(
2313                 __isl_keep isl_union_map *umap);
2315 The returned list can be manipulated using the functions in L<"Lists">.
2317 To iterate over the constraints of a basic set or map, use
2319         #include <isl/constraint.h>
2321         int isl_basic_set_n_constraint(
2322                 __isl_keep isl_basic_set *bset);
2323         isl_stat isl_basic_set_foreach_constraint(
2324                 __isl_keep isl_basic_set *bset,
2325                 isl_stat (*fn)(__isl_take isl_constraint *c,
2326                         void *user),
2327                 void *user);
2328         int isl_basic_map_n_constraint(
2329                 __isl_keep isl_basic_map *bmap);
2330         isl_stat isl_basic_map_foreach_constraint(
2331                 __isl_keep isl_basic_map *bmap,
2332                 isl_stat (*fn)(__isl_take isl_constraint *c,
2333                         void *user),
2334                 void *user);
2335         __isl_null isl_constraint *isl_constraint_free(
2336                 __isl_take isl_constraint *c);
2338 Again, the callback function C<fn> should return C<isl_stat_ok>
2339 if successful and
2340 C<isl_stat_error> if an error occurs.  In the latter case, or if any other error
2341 occurs, the above functions will return C<isl_stat_error>.
2342 The constraint C<c> represents either an equality or an inequality.
2343 Use the following function to find out whether a constraint
2344 represents an equality.  If not, it represents an inequality.
2346         isl_bool isl_constraint_is_equality(
2347                 __isl_keep isl_constraint *constraint);
2349 It is also possible to obtain a list of constraints from a basic
2350 map or set
2352         #include <isl/constraint.h>
2353         __isl_give isl_constraint_list *
2354         isl_basic_map_get_constraint_list(
2355                 __isl_keep isl_basic_map *bmap);
2356         __isl_give isl_constraint_list *
2357         isl_basic_set_get_constraint_list(
2358                 __isl_keep isl_basic_set *bset);
2360 These functions require that all existentially quantified variables
2361 have an explicit representation.
2362 The returned list can be manipulated using the functions in L<"Lists">.
2364 The coefficients of the constraints can be inspected using
2365 the following functions.
2367         isl_bool isl_constraint_is_lower_bound(
2368                 __isl_keep isl_constraint *constraint,
2369                 enum isl_dim_type type, unsigned pos);
2370         isl_bool isl_constraint_is_upper_bound(
2371                 __isl_keep isl_constraint *constraint,
2372                 enum isl_dim_type type, unsigned pos);
2373         __isl_give isl_val *isl_constraint_get_constant_val(
2374                 __isl_keep isl_constraint *constraint);
2375         __isl_give isl_val *isl_constraint_get_coefficient_val(
2376                 __isl_keep isl_constraint *constraint,
2377                 enum isl_dim_type type, int pos);
2379 The explicit representations of the existentially quantified
2380 variables can be inspected using the following function.
2381 Note that the user is only allowed to use this function
2382 if the inspected set or map is the result of a call
2383 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2384 The existentially quantified variable is equal to the floor
2385 of the returned affine expression.  The affine expression
2386 itself can be inspected using the functions in
2387 L</"Functions">.
2389         __isl_give isl_aff *isl_constraint_get_div(
2390                 __isl_keep isl_constraint *constraint, int pos);
2392 To obtain the constraints of a basic set or map in matrix
2393 form, use the following functions.
2395         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2396                 __isl_keep isl_basic_set *bset,
2397                 enum isl_dim_type c1, enum isl_dim_type c2,
2398                 enum isl_dim_type c3, enum isl_dim_type c4);
2399         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2400                 __isl_keep isl_basic_set *bset,
2401                 enum isl_dim_type c1, enum isl_dim_type c2,
2402                 enum isl_dim_type c3, enum isl_dim_type c4);
2403         __isl_give isl_mat *isl_basic_map_equalities_matrix(
2404                 __isl_keep isl_basic_map *bmap,
2405                 enum isl_dim_type c1,
2406                 enum isl_dim_type c2, enum isl_dim_type c3,
2407                 enum isl_dim_type c4, enum isl_dim_type c5);
2408         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2409                 __isl_keep isl_basic_map *bmap,
2410                 enum isl_dim_type c1,
2411                 enum isl_dim_type c2, enum isl_dim_type c3,
2412                 enum isl_dim_type c4, enum isl_dim_type c5);
2414 The C<isl_dim_type> arguments dictate the order in which
2415 different kinds of variables appear in the resulting matrix.
2416 For set inputs, they should be a permutation of
2417 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2418 For map inputs, they should be a permutation of
2419 C<isl_dim_cst>, C<isl_dim_param>,
2420 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2422 =head2 Points
2424 Points are elements of a set.  They can be used to construct
2425 simple sets (boxes) or they can be used to represent the
2426 individual elements of a set.
2427 The zero point (the origin) can be created using
2429         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2431 The coordinates of a point can be inspected, set and changed
2432 using
2434         __isl_give isl_val *isl_point_get_coordinate_val(
2435                 __isl_keep isl_point *pnt,
2436                 enum isl_dim_type type, int pos);
2437         __isl_give isl_point *isl_point_set_coordinate_val(
2438                 __isl_take isl_point *pnt,
2439                 enum isl_dim_type type, int pos,
2440                 __isl_take isl_val *v);
2442         __isl_give isl_point *isl_point_add_ui(
2443                 __isl_take isl_point *pnt,
2444                 enum isl_dim_type type, int pos, unsigned val);
2445         __isl_give isl_point *isl_point_sub_ui(
2446                 __isl_take isl_point *pnt,
2447                 enum isl_dim_type type, int pos, unsigned val);
2449 Points can be copied or freed using
2451         __isl_give isl_point *isl_point_copy(
2452                 __isl_keep isl_point *pnt);
2453         __isl_null isl_point *isl_point_free(
2454                 __isl_take isl_point *pnt);
2456 A singleton set can be created from a point using
2458         __isl_give isl_basic_set *isl_basic_set_from_point(
2459                 __isl_take isl_point *pnt);
2460         __isl_give isl_set *isl_set_from_point(
2461                 __isl_take isl_point *pnt);
2462         __isl_give isl_union_set *isl_union_set_from_point(
2463                 __isl_take isl_point *pnt);
2465 and a box can be created from two opposite extremal points using
2467         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2468                 __isl_take isl_point *pnt1,
2469                 __isl_take isl_point *pnt2);
2470         __isl_give isl_set *isl_set_box_from_points(
2471                 __isl_take isl_point *pnt1,
2472                 __isl_take isl_point *pnt2);
2474 All elements of a B<bounded> (union) set can be enumerated using
2475 the following functions.
2477         isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2478                 isl_stat (*fn)(__isl_take isl_point *pnt,
2479                         void *user),
2480                 void *user);
2481         isl_stat isl_union_set_foreach_point(
2482                 __isl_keep isl_union_set *uset,
2483                 isl_stat (*fn)(__isl_take isl_point *pnt,
2484                         void *user),
2485                 void *user);
2487 The function C<fn> is called for each integer point in
2488 C<set> with as second argument the last argument of
2489 the C<isl_set_foreach_point> call.  The function C<fn>
2490 should return C<isl_stat_ok> on success and C<isl_stat_error> on failure.
2491 In the latter case, C<isl_set_foreach_point> will stop
2492 enumerating and return C<isl_stat_error> as well.
2493 If the enumeration is performed successfully and to completion,
2494 then C<isl_set_foreach_point> returns C<isl_stat_ok>.
2496 To obtain a single point of a (basic or union) set, use
2498         __isl_give isl_point *isl_basic_set_sample_point(
2499                 __isl_take isl_basic_set *bset);
2500         __isl_give isl_point *isl_set_sample_point(
2501                 __isl_take isl_set *set);
2502         __isl_give isl_point *isl_union_set_sample_point(
2503                 __isl_take isl_union_set *uset);
2505 If C<set> does not contain any (integer) points, then the
2506 resulting point will be ``void'', a property that can be
2507 tested using
2509         isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2511 =head2 Functions
2513 Besides sets and relation, C<isl> also supports various types of functions.
2514 Each of these types is derived from the value type (see L</"Values">)
2515 or from one of two primitive function types
2516 through the application of zero or more type constructors.
2517 We first describe the primitive type and then we describe
2518 the types derived from these primitive types.
2520 =head3 Primitive Functions
2522 C<isl> support two primitive function types, quasi-affine
2523 expressions and quasipolynomials.
2524 A quasi-affine expression is defined either over a parameter
2525 space or over a set and is composed of integer constants,
2526 parameters and set variables, addition, subtraction and
2527 integer division by an integer constant.
2528 For example, the quasi-affine expression
2530         [n] -> { [x] -> [2*floor((4 n + x)/9)] }
2532 maps C<x> to C<2*floor((4 n + x)/9>.
2533 A quasipolynomial is a polynomial expression in quasi-affine
2534 expression.  That is, it additionally allows for multiplication.
2535 Note, though, that it is not allowed to construct an integer
2536 division of an expression involving multiplications.
2537 Here is an example of a quasipolynomial that is not
2538 quasi-affine expression
2540         [n] -> { [x] -> (n*floor((4 n + x)/9)) }
2542 Note that the external representations of quasi-affine expressions
2543 and quasipolynomials are different.  Quasi-affine expressions
2544 use a notation with square brackets just like binary relations,
2545 while quasipolynomials do not.  This might change at some point.
2547 If a primitive function is defined over a parameter space,
2548 then the space of the function itself is that of a set.
2549 If it is defined over a set, then the space of the function
2550 is that of a relation.  In both cases, the set space (or
2551 the output space) is single-dimensional, anonymous and unstructured.
2552 To create functions with multiple dimensions or with other kinds
2553 of set or output spaces, use multiple expressions
2554 (see L</"Multiple Expressions">).
2556 =over
2558 =item * Quasi-affine Expressions
2560 Besides the expressions described above, a quasi-affine
2561 expression can also be set to NaN.  Such expressions
2562 typically represent a failure to represent a result
2563 as a quasi-affine expression.
2565 The zero quasi affine expression or the quasi affine expression
2566 that is equal to a given value, parameter or
2567 a specified dimension on a given domain can be created using
2569         #include <isl/aff.h>
2570         __isl_give isl_aff *isl_aff_zero_on_domain(
2571                 __isl_take isl_local_space *ls);
2572         __isl_give isl_aff *isl_aff_val_on_domain(
2573                 __isl_take isl_local_space *ls,
2574                 __isl_take isl_val *val);
2575         __isl_give isl_aff *isl_aff_param_on_domain_space_id(
2576                 __isl_take isl_space *space,
2577                 __isl_take isl_id *id);
2578         __isl_give isl_aff *isl_aff_var_on_domain(
2579                 __isl_take isl_local_space *ls,
2580                 enum isl_dim_type type, unsigned pos);
2581         __isl_give isl_aff *isl_aff_nan_on_domain(
2582                 __isl_take isl_local_space *ls);
2584 The space passed to C<isl_aff_param_on_domain_space_id>
2585 is required to have a parameter with the given identifier.
2587 Quasi affine expressions can be copied and freed using
2589         #include <isl/aff.h>
2590         __isl_give isl_aff *isl_aff_copy(
2591                 __isl_keep isl_aff *aff);
2592         __isl_null isl_aff *isl_aff_free(
2593                 __isl_take isl_aff *aff);
2595 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2596 using the following function.  The constraint is required to have
2597 a non-zero coefficient for the specified dimension.
2599         #include <isl/constraint.h>
2600         __isl_give isl_aff *isl_constraint_get_bound(
2601                 __isl_keep isl_constraint *constraint,
2602                 enum isl_dim_type type, int pos);
2604 The entire affine expression of the constraint can also be extracted
2605 using the following function.
2607         #include <isl/constraint.h>
2608         __isl_give isl_aff *isl_constraint_get_aff(
2609                 __isl_keep isl_constraint *constraint);
2611 Conversely, an equality constraint equating
2612 the affine expression to zero or an inequality constraint enforcing
2613 the affine expression to be non-negative, can be constructed using
2615         __isl_give isl_constraint *isl_equality_from_aff(
2616                 __isl_take isl_aff *aff);
2617         __isl_give isl_constraint *isl_inequality_from_aff(
2618                 __isl_take isl_aff *aff);
2620 The coefficients and the integer divisions of an affine expression
2621 can be inspected using the following functions.
2623         #include <isl/aff.h>
2624         __isl_give isl_val *isl_aff_get_constant_val(
2625                 __isl_keep isl_aff *aff);
2626         __isl_give isl_val *isl_aff_get_coefficient_val(
2627                 __isl_keep isl_aff *aff,
2628                 enum isl_dim_type type, int pos);
2629         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2630                 enum isl_dim_type type, int pos);
2631         __isl_give isl_val *isl_aff_get_denominator_val(
2632                 __isl_keep isl_aff *aff);
2633         __isl_give isl_aff *isl_aff_get_div(
2634                 __isl_keep isl_aff *aff, int pos);
2636 They can be modified using the following functions.
2638         #include <isl/aff.h>
2639         __isl_give isl_aff *isl_aff_set_constant_si(
2640                 __isl_take isl_aff *aff, int v);
2641         __isl_give isl_aff *isl_aff_set_constant_val(
2642                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2643         __isl_give isl_aff *isl_aff_set_coefficient_si(
2644                 __isl_take isl_aff *aff,
2645                 enum isl_dim_type type, int pos, int v);
2646         __isl_give isl_aff *isl_aff_set_coefficient_val(
2647                 __isl_take isl_aff *aff,
2648                 enum isl_dim_type type, int pos,
2649                 __isl_take isl_val *v);
2651         __isl_give isl_aff *isl_aff_add_constant_si(
2652                 __isl_take isl_aff *aff, int v);
2653         __isl_give isl_aff *isl_aff_add_constant_val(
2654                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2655         __isl_give isl_aff *isl_aff_add_constant_num_si(
2656                 __isl_take isl_aff *aff, int v);
2657         __isl_give isl_aff *isl_aff_add_coefficient_si(
2658                 __isl_take isl_aff *aff,
2659                 enum isl_dim_type type, int pos, int v);
2660         __isl_give isl_aff *isl_aff_add_coefficient_val(
2661                 __isl_take isl_aff *aff,
2662                 enum isl_dim_type type, int pos,
2663                 __isl_take isl_val *v);
2665 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2666 set the I<numerator> of the constant or coefficient, while
2667 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2668 the constant or coefficient as a whole.
2669 The C<add_constant> and C<add_coefficient> functions add an integer
2670 or rational value to
2671 the possibly rational constant or coefficient.
2672 The C<add_constant_num> functions add an integer value to
2673 the numerator.
2675 =item * Quasipolynomials
2677 Some simple quasipolynomials can be created using the following functions.
2679         #include <isl/polynomial.h>
2680         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2681                 __isl_take isl_space *domain);
2682         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2683                 __isl_take isl_space *domain);
2684         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2685                 __isl_take isl_space *domain);
2686         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2687                 __isl_take isl_space *domain);
2688         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2689                 __isl_take isl_space *domain);
2690         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2691                 __isl_take isl_space *domain,
2692                 __isl_take isl_val *val);
2693         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2694                 __isl_take isl_space *domain,
2695                 enum isl_dim_type type, unsigned pos);
2696         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2697                 __isl_take isl_aff *aff);
2699 Recall that the space in which a quasipolynomial lives is a map space
2700 with a one-dimensional range.  The C<domain> argument in some of
2701 the functions above corresponds to the domain of this map space.
2703 Quasipolynomials can be copied and freed again using the following
2704 functions.
2706         #include <isl/polynomial.h>
2707         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2708                 __isl_keep isl_qpolynomial *qp);
2709         __isl_null isl_qpolynomial *isl_qpolynomial_free(
2710                 __isl_take isl_qpolynomial *qp);
2712 The constant term of a quasipolynomial can be extracted using
2714         __isl_give isl_val *isl_qpolynomial_get_constant_val(
2715                 __isl_keep isl_qpolynomial *qp);
2717 To iterate over all terms in a quasipolynomial,
2720         isl_stat isl_qpolynomial_foreach_term(
2721                 __isl_keep isl_qpolynomial *qp,
2722                 isl_stat (*fn)(__isl_take isl_term *term,
2723                           void *user), void *user);
2725 The terms themselves can be inspected and freed using
2726 these functions
2728         unsigned isl_term_dim(__isl_keep isl_term *term,
2729                 enum isl_dim_type type);
2730         __isl_give isl_val *isl_term_get_coefficient_val(
2731                 __isl_keep isl_term *term);
2732         int isl_term_get_exp(__isl_keep isl_term *term,
2733                 enum isl_dim_type type, unsigned pos);
2734         __isl_give isl_aff *isl_term_get_div(
2735                 __isl_keep isl_term *term, unsigned pos);
2736         void isl_term_free(__isl_take isl_term *term);
2738 Each term is a product of parameters, set variables and
2739 integer divisions.  The function C<isl_term_get_exp>
2740 returns the exponent of a given dimensions in the given term.
2742 =back
2744 =head3 Reductions
2746 A reduction represents a maximum or a minimum of its
2747 base expressions.
2748 The only reduction type defined by C<isl> is
2749 C<isl_qpolynomial_fold>.
2751 There are currently no functions to directly create such
2752 objects, but they do appear in the piecewise quasipolynomial
2753 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2755 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2757 Reductions can be copied and freed using
2758 the following functions.
2760         #include <isl/polynomial.h>
2761         __isl_give isl_qpolynomial_fold *
2762         isl_qpolynomial_fold_copy(
2763                 __isl_keep isl_qpolynomial_fold *fold);
2764         void isl_qpolynomial_fold_free(
2765                 __isl_take isl_qpolynomial_fold *fold);
2767 To iterate over all quasipolynomials in a reduction, use
2769         isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2770                 __isl_keep isl_qpolynomial_fold *fold,
2771                 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2772                           void *user), void *user);
2774 =head3 Multiple Expressions
2776 A multiple expression represents a sequence of zero or
2777 more base expressions, all defined on the same domain space.
2778 The domain space of the multiple expression is the same
2779 as that of the base expressions, but the range space
2780 can be any space.  In case the base expressions have
2781 a set space, the corresponding multiple expression
2782 also has a set space.
2783 Objects of the value type do not have an associated space.
2784 The space of a multiple value is therefore always a set space.
2785 Similarly, the space of a multiple union piecewise
2786 affine expression is always a set space.
2787 If the base expressions are not total, then
2788 a corresponding zero-dimensional multiple expression may
2789 have an explicit domain that keeps track of the domain
2790 outside of any base expressions.
2792 The multiple expression types defined by C<isl>
2793 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2794 C<isl_multi_union_pw_aff>.
2796 A multiple expression with the value zero for
2797 each output (or set) dimension can be created
2798 using the following functions.
2800         #include <isl/val.h>
2801         __isl_give isl_multi_val *isl_multi_val_zero(
2802                 __isl_take isl_space *space);
2804         #include <isl/aff.h>
2805         __isl_give isl_multi_aff *isl_multi_aff_zero(
2806                 __isl_take isl_space *space);
2807         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2808                 __isl_take isl_space *space);
2809         __isl_give isl_multi_union_pw_aff *
2810         isl_multi_union_pw_aff_zero(
2811                 __isl_take isl_space *space);
2813 Since there is no canonical way of representing a zero
2814 value of type C<isl_union_pw_aff>, the space passed
2815 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2817 An identity function can be created using the following
2818 functions.  The space needs to be that of a relation
2819 with the same number of input and output dimensions.
2821         #include <isl/aff.h>
2822         __isl_give isl_multi_aff *isl_multi_aff_identity(
2823                 __isl_take isl_space *space);
2824         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2825                 __isl_take isl_space *space);
2827 A function that performs a projection on a universe
2828 relation or set can be created using the following functions.
2829 See also the corresponding
2830 projection operations in L</"Unary Operations">.
2832         #include <isl/aff.h>
2833         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2834                 __isl_take isl_space *space);
2835         __isl_give isl_multi_aff *isl_multi_aff_range_map(
2836                 __isl_take isl_space *space);
2837         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2838                 __isl_take isl_space *space,
2839                 enum isl_dim_type type,
2840                 unsigned first, unsigned n);
2842 A multiple expression can be created from a single
2843 base expression using the following functions.
2844 The space of the created multiple expression is the same
2845 as that of the base expression, except for
2846 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2847 lives in a parameter space and the output lives
2848 in a single-dimensional set space.
2850         #include <isl/aff.h>
2851         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2852                 __isl_take isl_aff *aff);
2853         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2854                 __isl_take isl_pw_aff *pa);
2855         __isl_give isl_multi_union_pw_aff *
2856         isl_multi_union_pw_aff_from_union_pw_aff(
2857                 __isl_take isl_union_pw_aff *upa);
2859 A multiple expression can be created from a list
2860 of base expression in a specified space.
2861 The domain of this space needs to be the same
2862 as the domains of the base expressions in the list.
2863 If the base expressions have a set space (or no associated space),
2864 then this space also needs to be a set space.
2866         #include <isl/val.h>
2867         __isl_give isl_multi_val *isl_multi_val_from_val_list(
2868                 __isl_take isl_space *space,
2869                 __isl_take isl_val_list *list);
2871         #include <isl/aff.h>
2872         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2873                 __isl_take isl_space *space,
2874                 __isl_take isl_aff_list *list);
2875         __isl_give isl_multi_pw_aff *
2876         isl_multi_pw_aff_from_pw_aff_list(
2877                 __isl_take isl_space *space,
2878                 __isl_take isl_pw_aff_list *list);
2879         __isl_give isl_multi_union_pw_aff *
2880         isl_multi_union_pw_aff_from_union_pw_aff_list(
2881                 __isl_take isl_space *space,
2882                 __isl_take isl_union_pw_aff_list *list);
2884 As a convenience, a multiple piecewise expression can
2885 also be created from a multiple expression.
2886 Each piecewise expression in the result has a single
2887 universe cell.
2889         #include <isl/aff.h>
2890         __isl_give isl_multi_pw_aff *
2891         isl_multi_pw_aff_from_multi_aff(
2892                 __isl_take isl_multi_aff *ma);
2894 Similarly, a multiple union expression can be
2895 created from a multiple expression.
2897         #include <isl/aff.h>
2898         __isl_give isl_multi_union_pw_aff *
2899         isl_multi_union_pw_aff_from_multi_aff(
2900                 __isl_take isl_multi_aff *ma);
2901         __isl_give isl_multi_union_pw_aff *
2902         isl_multi_union_pw_aff_from_multi_pw_aff(
2903                 __isl_take isl_multi_pw_aff *mpa);
2905 A multiple quasi-affine expression can be created from
2906 a multiple value with a given domain space using the following
2907 function.
2909         #include <isl/aff.h>
2910         __isl_give isl_multi_aff *
2911         isl_multi_aff_multi_val_on_space(
2912                 __isl_take isl_space *space,
2913                 __isl_take isl_multi_val *mv);
2915 Similarly,
2916 a multiple union piecewise affine expression can be created from
2917 a multiple value with a given domain or
2918 a (piecewise) multiple affine expression with a given domain
2919 using the following functions.
2921         #include <isl/aff.h>
2922         __isl_give isl_multi_union_pw_aff *
2923         isl_multi_union_pw_aff_multi_val_on_domain(
2924                 __isl_take isl_union_set *domain,
2925                 __isl_take isl_multi_val *mv);
2926         __isl_give isl_multi_union_pw_aff *
2927         isl_multi_union_pw_aff_multi_aff_on_domain(
2928                 __isl_take isl_union_set *domain,
2929                 __isl_take isl_multi_aff *ma);
2930         __isl_give isl_multi_union_pw_aff *
2931         isl_multi_union_pw_aff_pw_multi_aff_on_domain(
2932                 __isl_take isl_union_set *domain,
2933                 __isl_take isl_pw_multi_aff *pma);
2935 Multiple expressions can be copied and freed using
2936 the following functions.
2938         #include <isl/val.h>
2939         __isl_give isl_multi_val *isl_multi_val_copy(
2940                 __isl_keep isl_multi_val *mv);
2941         __isl_null isl_multi_val *isl_multi_val_free(
2942                 __isl_take isl_multi_val *mv);
2944         #include <isl/aff.h>
2945         __isl_give isl_multi_aff *isl_multi_aff_copy(
2946                 __isl_keep isl_multi_aff *maff);
2947         __isl_null isl_multi_aff *isl_multi_aff_free(
2948                 __isl_take isl_multi_aff *maff);
2949         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2950                 __isl_keep isl_multi_pw_aff *mpa);
2951         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2952                 __isl_take isl_multi_pw_aff *mpa);
2953         __isl_give isl_multi_union_pw_aff *
2954         isl_multi_union_pw_aff_copy(
2955                 __isl_keep isl_multi_union_pw_aff *mupa);
2956         __isl_null isl_multi_union_pw_aff *
2957         isl_multi_union_pw_aff_free(
2958                 __isl_take isl_multi_union_pw_aff *mupa);
2960 The base expression at a given position of a multiple
2961 expression can be extracted using the following functions.
2963         #include <isl/val.h>
2964         __isl_give isl_val *isl_multi_val_get_val(
2965                 __isl_keep isl_multi_val *mv, int pos);
2967         #include <isl/aff.h>
2968         __isl_give isl_aff *isl_multi_aff_get_aff(
2969                 __isl_keep isl_multi_aff *multi, int pos);
2970         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2971                 __isl_keep isl_multi_pw_aff *mpa, int pos);
2972         __isl_give isl_union_pw_aff *
2973         isl_multi_union_pw_aff_get_union_pw_aff(
2974                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2976 It can be replaced using the following functions.
2978         #include <isl/val.h>
2979         __isl_give isl_multi_val *isl_multi_val_set_val(
2980                 __isl_take isl_multi_val *mv, int pos,
2981                 __isl_take isl_val *val);
2983         #include <isl/aff.h>
2984         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2985                 __isl_take isl_multi_aff *multi, int pos,
2986                 __isl_take isl_aff *aff);
2987         __isl_give isl_multi_union_pw_aff *
2988         isl_multi_union_pw_aff_set_union_pw_aff(
2989                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2990                 __isl_take isl_union_pw_aff *upa);
2992 As a convenience, a sequence of base expressions that have
2993 their domains in a given space can be extracted from a sequence
2994 of union expressions using the following function.
2996         #include <isl/aff.h>
2997         __isl_give isl_multi_pw_aff *
2998         isl_multi_union_pw_aff_extract_multi_pw_aff(
2999                 __isl_keep isl_multi_union_pw_aff *mupa,
3000                 __isl_take isl_space *space);
3002 Note that there is a difference between C<isl_multi_union_pw_aff>
3003 and C<isl_union_pw_multi_aff> objects.  The first is a sequence
3004 of unions of piecewise expressions, while the second is a union
3005 of piecewise sequences.  In particular, multiple affine expressions
3006 in an C<isl_union_pw_multi_aff> may live in different spaces,
3007 while there is only a single multiple expression in
3008 an C<isl_multi_union_pw_aff>, which can therefore only live
3009 in a single space.  This means that not every
3010 C<isl_union_pw_multi_aff> can be converted to
3011 an C<isl_multi_union_pw_aff>.  Conversely, the elements
3012 of an C<isl_multi_union_pw_aff> may be defined over different domains,
3013 while each multiple expression inside an C<isl_union_pw_multi_aff>
3014 has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
3015 of dimension greater than one may therefore not be exact.
3016 The following functions can
3017 be used to perform these conversions when they are possible.
3019         #include <isl/aff.h>
3020         __isl_give isl_multi_union_pw_aff *
3021         isl_multi_union_pw_aff_from_union_pw_multi_aff(
3022                 __isl_take isl_union_pw_multi_aff *upma);
3023         __isl_give isl_union_pw_multi_aff *
3024         isl_union_pw_multi_aff_from_multi_union_pw_aff(
3025                 __isl_take isl_multi_union_pw_aff *mupa);
3027 =head3 Piecewise Expressions
3029 A piecewise expression is an expression that is described
3030 using zero or more base expression defined over the same
3031 number of cells in the domain space of the base expressions.
3032 All base expressions are defined over the same
3033 domain space and the cells are disjoint.
3034 The space of a piecewise expression is the same as
3035 that of the base expressions.
3036 If the union of the cells is a strict subset of the domain
3037 space, then the value of the piecewise expression outside
3038 this union is different for types derived from quasi-affine
3039 expressions and those derived from quasipolynomials.
3040 Piecewise expressions derived from quasi-affine expressions
3041 are considered to be undefined outside the union of their cells.
3042 Piecewise expressions derived from quasipolynomials
3043 are considered to be zero outside the union of their cells.
3045 Piecewise quasipolynomials are mainly used by the C<barvinok>
3046 library for representing the number of elements in a parametric set or map.
3047 For example, the piecewise quasipolynomial
3049         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
3051 represents the number of points in the map
3053         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
3055 The piecewise expression types defined by C<isl>
3056 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
3057 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
3059 A piecewise expression with no cells can be created using
3060 the following functions.
3062         #include <isl/aff.h>
3063         __isl_give isl_pw_aff *isl_pw_aff_empty(
3064                 __isl_take isl_space *space);
3065         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
3066                 __isl_take isl_space *space);
3068 A piecewise expression with a single universe cell can be
3069 created using the following functions.
3071         #include <isl/aff.h>
3072         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
3073                 __isl_take isl_aff *aff);
3074         __isl_give isl_pw_multi_aff *
3075         isl_pw_multi_aff_from_multi_aff(
3076                 __isl_take isl_multi_aff *ma);
3078         #include <isl/polynomial.h>
3079         __isl_give isl_pw_qpolynomial *
3080         isl_pw_qpolynomial_from_qpolynomial(
3081                 __isl_take isl_qpolynomial *qp);
3083 A piecewise expression with a single specified cell can be
3084 created using the following functions.
3086         #include <isl/aff.h>
3087         __isl_give isl_pw_aff *isl_pw_aff_alloc(
3088                 __isl_take isl_set *set, __isl_take isl_aff *aff);
3089         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
3090                 __isl_take isl_set *set,
3091                 __isl_take isl_multi_aff *maff);
3093         #include <isl/polynomial.h>
3094         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
3095                 __isl_take isl_set *set,
3096                 __isl_take isl_qpolynomial *qp);
3098 The following convenience functions first create a base expression and
3099 then create a piecewise expression over a universe domain.
3101         #include <isl/aff.h>
3102         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
3103                 __isl_take isl_local_space *ls);
3104         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
3105                 __isl_take isl_local_space *ls,
3106                 enum isl_dim_type type, unsigned pos);
3107         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
3108                 __isl_take isl_local_space *ls);
3109         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
3110                 __isl_take isl_space *space);
3111         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
3112                 __isl_take isl_space *space);
3113         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
3114                 __isl_take isl_space *space);
3115         __isl_give isl_pw_multi_aff *
3116         isl_pw_multi_aff_project_out_map(
3117                 __isl_take isl_space *space,
3118                 enum isl_dim_type type,
3119                 unsigned first, unsigned n);
3121         #include <isl/polynomial.h>
3122         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
3123                 __isl_take isl_space *space);
3125 The following convenience functions first create a base expression and
3126 then create a piecewise expression over a given domain.
3128         #include <isl/aff.h>
3129         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
3130                 __isl_take isl_set *domain,
3131                 __isl_take isl_val *v);
3132         __isl_give isl_pw_multi_aff *
3133         isl_pw_multi_aff_multi_val_on_domain(
3134                 __isl_take isl_set *domain,
3135                 __isl_take isl_multi_val *mv);
3137 As a convenience, a piecewise multiple expression can
3138 also be created from a piecewise expression.
3139 Each multiple expression in the result is derived
3140 from the corresponding base expression.
3142         #include <isl/aff.h>
3143         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
3144                 __isl_take isl_pw_aff *pa);
3146 Similarly, a piecewise quasipolynomial can be
3147 created from a piecewise quasi-affine expression using
3148 the following function.
3150         #include <isl/polynomial.h>
3151         __isl_give isl_pw_qpolynomial *
3152         isl_pw_qpolynomial_from_pw_aff(
3153                 __isl_take isl_pw_aff *pwaff);
3155 Piecewise expressions can be copied and freed using the following functions.
3157         #include <isl/aff.h>
3158         __isl_give isl_pw_aff *isl_pw_aff_copy(
3159                 __isl_keep isl_pw_aff *pwaff);
3160         __isl_null isl_pw_aff *isl_pw_aff_free(
3161                 __isl_take isl_pw_aff *pwaff);
3162         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3163                 __isl_keep isl_pw_multi_aff *pma);
3164         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3165                 __isl_take isl_pw_multi_aff *pma);
3167         #include <isl/polynomial.h>
3168         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3169                 __isl_keep isl_pw_qpolynomial *pwqp);
3170         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3171                 __isl_take isl_pw_qpolynomial *pwqp);
3172         __isl_give isl_pw_qpolynomial_fold *
3173         isl_pw_qpolynomial_fold_copy(
3174                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3175         __isl_null isl_pw_qpolynomial_fold *
3176         isl_pw_qpolynomial_fold_free(
3177                 __isl_take isl_pw_qpolynomial_fold *pwf);
3179 To iterate over the different cells of a piecewise expression,
3180 use the following functions.
3182         #include <isl/aff.h>
3183         isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3184         int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3185         isl_stat isl_pw_aff_foreach_piece(
3186                 __isl_keep isl_pw_aff *pwaff,
3187                 isl_stat (*fn)(__isl_take isl_set *set,
3188                           __isl_take isl_aff *aff,
3189                           void *user), void *user);
3190         int isl_pw_multi_aff_n_piece(
3191                 __isl_keep isl_pw_multi_aff *pma);
3192         isl_stat isl_pw_multi_aff_foreach_piece(
3193                 __isl_keep isl_pw_multi_aff *pma,
3194                 isl_stat (*fn)(__isl_take isl_set *set,
3195                             __isl_take isl_multi_aff *maff,
3196                             void *user), void *user);
3198         #include <isl/polynomial.h>
3199         int isl_pw_qpolynomial_n_piece(
3200                 __isl_keep isl_pw_qpolynomial *pwqp);
3201         isl_stat isl_pw_qpolynomial_foreach_piece(
3202                 __isl_keep isl_pw_qpolynomial *pwqp,
3203                 isl_stat (*fn)(__isl_take isl_set *set,
3204                           __isl_take isl_qpolynomial *qp,
3205                           void *user), void *user);
3206         isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3207                 __isl_keep isl_pw_qpolynomial *pwqp,
3208                 isl_stat (*fn)(__isl_take isl_set *set,
3209                           __isl_take isl_qpolynomial *qp,
3210                           void *user), void *user);
3211         int isl_pw_qpolynomial_fold_n_piece(
3212                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3213         isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3214                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3215                 isl_stat (*fn)(__isl_take isl_set *set,
3216                           __isl_take isl_qpolynomial_fold *fold,
3217                           void *user), void *user);
3218         isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3219                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3220                 isl_stat (*fn)(__isl_take isl_set *set,
3221                           __isl_take isl_qpolynomial_fold *fold,
3222                           void *user), void *user);
3224 As usual, the function C<fn> should return C<isl_stat_ok> on success
3225 and C<isl_stat_error> on failure.  The difference between
3226 C<isl_pw_qpolynomial_foreach_piece> and
3227 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3228 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3229 compute unique representations for all existentially quantified
3230 variables and then turn these existentially quantified variables
3231 into extra set variables, adapting the associated quasipolynomial
3232 accordingly.  This means that the C<set> passed to C<fn>
3233 will not have any existentially quantified variables, but that
3234 the dimensions of the sets may be different for different
3235 invocations of C<fn>.
3236 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3237 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3239 A piecewise expression consisting of the expressions at a given
3240 position of a piecewise multiple expression can be extracted
3241 using the following function.
3243         #include <isl/aff.h>
3244         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3245                 __isl_keep isl_pw_multi_aff *pma, int pos);
3247 These expressions can be replaced using the following function.
3249         #include <isl/aff.h>
3250         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3251                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3252                 __isl_take isl_pw_aff *pa);
3254 Note that there is a difference between C<isl_multi_pw_aff> and
3255 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3256 affine expressions, while the second is a piecewise sequence
3257 of affine expressions.  In particular, each of the piecewise
3258 affine expressions in an C<isl_multi_pw_aff> may have a different
3259 domain, while all multiple expressions associated to a cell
3260 in an C<isl_pw_multi_aff> have the same domain.
3261 It is possible to convert between the two, but when converting
3262 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3263 of the result is the intersection of the domains of the input.
3264 The reverse conversion is exact.
3266         #include <isl/aff.h>
3267         __isl_give isl_pw_multi_aff *
3268         isl_pw_multi_aff_from_multi_pw_aff(
3269                 __isl_take isl_multi_pw_aff *mpa);
3270         __isl_give isl_multi_pw_aff *
3271         isl_multi_pw_aff_from_pw_multi_aff(
3272                 __isl_take isl_pw_multi_aff *pma);
3274 =head3 Union Expressions
3276 A union expression collects base expressions defined
3277 over different domains.  The space of a union expression
3278 is that of the shared parameter space.
3280 The union expression types defined by C<isl>
3281 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3282 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3283 In case of
3284 C<isl_union_pw_aff>,
3285 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>,
3286 there can be at most one base expression for a given domain space.
3287 In case of
3288 C<isl_union_pw_multi_aff>,
3289 there can be multiple such expressions for a given domain space,
3290 but the domains of these expressions need to be disjoint.
3292 An empty union expression can be created using the following functions.
3294         #include <isl/aff.h>
3295         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3296                 __isl_take isl_space *space);
3297         __isl_give isl_union_pw_multi_aff *
3298         isl_union_pw_multi_aff_empty(
3299                 __isl_take isl_space *space);
3301         #include <isl/polynomial.h>
3302         __isl_give isl_union_pw_qpolynomial *
3303         isl_union_pw_qpolynomial_zero(
3304                 __isl_take isl_space *space);
3306 A union expression containing a single base expression
3307 can be created using the following functions.
3309         #include <isl/aff.h>
3310         __isl_give isl_union_pw_aff *
3311         isl_union_pw_aff_from_pw_aff(
3312                 __isl_take isl_pw_aff *pa);
3313         __isl_give isl_union_pw_multi_aff *
3314         isl_union_pw_multi_aff_from_aff(
3315                 __isl_take isl_aff *aff);
3316         __isl_give isl_union_pw_multi_aff *
3317         isl_union_pw_multi_aff_from_pw_multi_aff(
3318                 __isl_take isl_pw_multi_aff *pma);
3320         #include <isl/polynomial.h>
3321         __isl_give isl_union_pw_qpolynomial *
3322         isl_union_pw_qpolynomial_from_pw_qpolynomial(
3323                 __isl_take isl_pw_qpolynomial *pwqp);
3325 The following functions create a base expression on each
3326 of the sets in the union set and collect the results.
3328         #include <isl/aff.h>
3329         __isl_give isl_union_pw_multi_aff *
3330         isl_union_pw_multi_aff_from_union_pw_aff(
3331                 __isl_take isl_union_pw_aff *upa);
3332         __isl_give isl_union_pw_aff *
3333         isl_union_pw_multi_aff_get_union_pw_aff(
3334                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3335         __isl_give isl_union_pw_aff *
3336         isl_union_pw_aff_val_on_domain(
3337                 __isl_take isl_union_set *domain,
3338                 __isl_take isl_val *v);
3339         __isl_give isl_union_pw_multi_aff *
3340         isl_union_pw_multi_aff_multi_val_on_domain(
3341                 __isl_take isl_union_set *domain,
3342                 __isl_take isl_multi_val *mv);
3343         __isl_give isl_union_pw_aff *
3344         isl_union_pw_aff_param_on_domain_id(
3345                 __isl_take isl_union_set *domain,
3346                 __isl_take isl_id *id);
3348 The C<id> argument of C<isl_union_pw_aff_param_on_domain_id>
3349 is the identifier of a parameter that may or may not already
3350 be present in C<domain>.
3352 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3353 or piecewise affine
3354 expression on a given domain can be created using the following
3355 functions.
3357         #include <isl/aff.h>
3358         __isl_give isl_union_pw_aff *
3359         isl_union_pw_aff_aff_on_domain(
3360                 __isl_take isl_union_set *domain,
3361                 __isl_take isl_aff *aff);
3362         __isl_give isl_union_pw_aff *
3363         isl_union_pw_aff_pw_aff_on_domain(
3364                 __isl_take isl_union_set *domain,
3365                 __isl_take isl_pw_aff *pa);
3367 A base expression can be added to a union expression using
3368 the following functions.
3370         #include <isl/aff.h>
3371         __isl_give isl_union_pw_aff *
3372         isl_union_pw_aff_add_pw_aff(
3373                 __isl_take isl_union_pw_aff *upa,
3374                 __isl_take isl_pw_aff *pa);
3375         __isl_give isl_union_pw_multi_aff *
3376         isl_union_pw_multi_aff_add_pw_multi_aff(
3377                 __isl_take isl_union_pw_multi_aff *upma,
3378                 __isl_take isl_pw_multi_aff *pma);
3380         #include <isl/polynomial.h>
3381         __isl_give isl_union_pw_qpolynomial *
3382         isl_union_pw_qpolynomial_add_pw_qpolynomial(
3383                 __isl_take isl_union_pw_qpolynomial *upwqp,
3384                 __isl_take isl_pw_qpolynomial *pwqp);
3386 Union expressions can be copied and freed using
3387 the following functions.
3389         #include <isl/aff.h>
3390         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3391                 __isl_keep isl_union_pw_aff *upa);
3392         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3393                 __isl_take isl_union_pw_aff *upa);
3394         __isl_give isl_union_pw_multi_aff *
3395         isl_union_pw_multi_aff_copy(
3396                 __isl_keep isl_union_pw_multi_aff *upma);
3397         __isl_null isl_union_pw_multi_aff *
3398         isl_union_pw_multi_aff_free(
3399                 __isl_take isl_union_pw_multi_aff *upma);
3401         #include <isl/polynomial.h>
3402         __isl_give isl_union_pw_qpolynomial *
3403         isl_union_pw_qpolynomial_copy(
3404                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3405         __isl_null isl_union_pw_qpolynomial *
3406         isl_union_pw_qpolynomial_free(
3407                 __isl_take isl_union_pw_qpolynomial *upwqp);
3408         __isl_give isl_union_pw_qpolynomial_fold *
3409         isl_union_pw_qpolynomial_fold_copy(
3410                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3411         __isl_null isl_union_pw_qpolynomial_fold *
3412         isl_union_pw_qpolynomial_fold_free(
3413                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3415 To iterate over the base expressions in a union expression,
3416 use the following functions.
3418         #include <isl/aff.h>
3419         int isl_union_pw_aff_n_pw_aff(
3420                 __isl_keep isl_union_pw_aff *upa);
3421         isl_stat isl_union_pw_aff_foreach_pw_aff(
3422                 __isl_keep isl_union_pw_aff *upa,
3423                 isl_stat (*fn)(__isl_take isl_pw_aff *pa,
3424                         void *user), void *user);
3425         int isl_union_pw_multi_aff_n_pw_multi_aff(
3426                 __isl_keep isl_union_pw_multi_aff *upma);
3427         isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3428                 __isl_keep isl_union_pw_multi_aff *upma,
3429                 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3430                             void *user), void *user);
3432         #include <isl/polynomial.h>
3433         int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3434                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3435         isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3436                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3437                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3438                             void *user), void *user);
3439         int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3440                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3441         isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3442                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3443                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3444                             void *user), void *user);
3446 To extract the base expression in a given space from a union, use
3447 the following functions.
3449         #include <isl/aff.h>
3450         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3451                 __isl_keep isl_union_pw_aff *upa,
3452                 __isl_take isl_space *space);
3453         __isl_give isl_pw_multi_aff *
3454         isl_union_pw_multi_aff_extract_pw_multi_aff(
3455                 __isl_keep isl_union_pw_multi_aff *upma,
3456                 __isl_take isl_space *space);
3458         #include <isl/polynomial.h>
3459         __isl_give isl_pw_qpolynomial *
3460         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3461                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3462                 __isl_take isl_space *space);
3464 =head2 Input and Output
3466 For set and relation,
3467 C<isl> supports its own input/output format, which is similar
3468 to the C<Omega> format, but also supports the C<PolyLib> format
3469 in some cases.
3470 For other object types, typically only an C<isl> format is supported.
3472 =head3 C<isl> format
3474 The C<isl> format is similar to that of C<Omega>, but has a different
3475 syntax for describing the parameters and allows for the definition
3476 of an existentially quantified variable as the integer division
3477 of an affine expression.
3478 For example, the set of integers C<i> between C<0> and C<n>
3479 such that C<i % 10 <= 6> can be described as
3481         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3482                                 i - 10 a <= 6) }
3484 A set or relation can have several disjuncts, separated
3485 by the keyword C<or>.  Each disjunct is either a conjunction
3486 of constraints or a projection (C<exists>) of a conjunction
3487 of constraints.  The constraints are separated by the keyword
3488 C<and>.
3490 =head3 C<PolyLib> format
3492 If the represented set is a union, then the first line
3493 contains a single number representing the number of disjuncts.
3494 Otherwise, a line containing the number C<1> is optional.
3496 Each disjunct is represented by a matrix of constraints.
3497 The first line contains two numbers representing
3498 the number of rows and columns,
3499 where the number of rows is equal to the number of constraints
3500 and the number of columns is equal to two plus the number of variables.
3501 The following lines contain the actual rows of the constraint matrix.
3502 In each row, the first column indicates whether the constraint
3503 is an equality (C<0>) or inequality (C<1>).  The final column
3504 corresponds to the constant term.
3506 If the set is parametric, then the coefficients of the parameters
3507 appear in the last columns before the constant column.
3508 The coefficients of any existentially quantified variables appear
3509 between those of the set variables and those of the parameters.
3511 =head3 Extended C<PolyLib> format
3513 The extended C<PolyLib> format is nearly identical to the
3514 C<PolyLib> format.  The only difference is that the line
3515 containing the number of rows and columns of a constraint matrix
3516 also contains four additional numbers:
3517 the number of output dimensions, the number of input dimensions,
3518 the number of local dimensions (i.e., the number of existentially
3519 quantified variables) and the number of parameters.
3520 For sets, the number of ``output'' dimensions is equal
3521 to the number of set dimensions, while the number of ``input''
3522 dimensions is zero.
3524 =head3 Input
3526 Objects can be read from input using the following functions.
3528         #include <isl/val.h>
3529         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3530                 const char *str);
3531         __isl_give isl_multi_val *isl_multi_val_read_from_str(
3532                 isl_ctx *ctx, const char *str);
3534         #include <isl/set.h>
3535         __isl_give isl_basic_set *isl_basic_set_read_from_file(
3536                 isl_ctx *ctx, FILE *input);
3537         __isl_give isl_basic_set *isl_basic_set_read_from_str(
3538                 isl_ctx *ctx, const char *str);
3539         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3540                 FILE *input);
3541         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3542                 const char *str);
3544         #include <isl/map.h>
3545         __isl_give isl_basic_map *isl_basic_map_read_from_file(
3546                 isl_ctx *ctx, FILE *input);
3547         __isl_give isl_basic_map *isl_basic_map_read_from_str(
3548                 isl_ctx *ctx, const char *str);
3549         __isl_give isl_map *isl_map_read_from_file(
3550                 isl_ctx *ctx, FILE *input);
3551         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3552                 const char *str);
3554         #include <isl/union_set.h>
3555         __isl_give isl_union_set *isl_union_set_read_from_file(
3556                 isl_ctx *ctx, FILE *input);
3557         __isl_give isl_union_set *isl_union_set_read_from_str(
3558                 isl_ctx *ctx, const char *str);
3560         #include <isl/union_map.h>
3561         __isl_give isl_union_map *isl_union_map_read_from_file(
3562                 isl_ctx *ctx, FILE *input);
3563         __isl_give isl_union_map *isl_union_map_read_from_str(
3564                 isl_ctx *ctx, const char *str);
3566         #include <isl/aff.h>
3567         __isl_give isl_aff *isl_aff_read_from_str(
3568                 isl_ctx *ctx, const char *str);
3569         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3570                 isl_ctx *ctx, const char *str);
3571         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3572                 isl_ctx *ctx, const char *str);
3573         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3574                 isl_ctx *ctx, const char *str);
3575         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3576                 isl_ctx *ctx, const char *str);
3577         __isl_give isl_union_pw_aff *
3578         isl_union_pw_aff_read_from_str(
3579                 isl_ctx *ctx, const char *str);
3580         __isl_give isl_union_pw_multi_aff *
3581         isl_union_pw_multi_aff_read_from_str(
3582                 isl_ctx *ctx, const char *str);
3583         __isl_give isl_multi_union_pw_aff *
3584         isl_multi_union_pw_aff_read_from_str(
3585                 isl_ctx *ctx, const char *str);
3587         #include <isl/polynomial.h>
3588         __isl_give isl_union_pw_qpolynomial *
3589         isl_union_pw_qpolynomial_read_from_str(
3590                 isl_ctx *ctx, const char *str);
3592 For sets and relations,
3593 the input format is autodetected and may be either the C<PolyLib> format
3594 or the C<isl> format.
3596 =head3 Output
3598 Before anything can be printed, an C<isl_printer> needs to
3599 be created.
3601         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3602                 FILE *file);
3603         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3604         __isl_null isl_printer *isl_printer_free(
3605                 __isl_take isl_printer *printer);
3607 C<isl_printer_to_file> prints to the given file, while
3608 C<isl_printer_to_str> prints to a string that can be extracted
3609 using the following function.
3611         #include <isl/printer.h>
3612         __isl_give char *isl_printer_get_str(
3613                 __isl_keep isl_printer *printer);
3615 The printer can be inspected using the following functions.
3617         FILE *isl_printer_get_file(
3618                 __isl_keep isl_printer *printer);
3619         int isl_printer_get_output_format(
3620                 __isl_keep isl_printer *p);
3621         int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3623 The behavior of the printer can be modified in various ways
3625         __isl_give isl_printer *isl_printer_set_output_format(
3626                 __isl_take isl_printer *p, int output_format);
3627         __isl_give isl_printer *isl_printer_set_indent(
3628                 __isl_take isl_printer *p, int indent);
3629         __isl_give isl_printer *isl_printer_set_indent_prefix(
3630                 __isl_take isl_printer *p, const char *prefix);
3631         __isl_give isl_printer *isl_printer_indent(
3632                 __isl_take isl_printer *p, int indent);
3633         __isl_give isl_printer *isl_printer_set_prefix(
3634                 __isl_take isl_printer *p, const char *prefix);
3635         __isl_give isl_printer *isl_printer_set_suffix(
3636                 __isl_take isl_printer *p, const char *suffix);
3637         __isl_give isl_printer *isl_printer_set_yaml_style(
3638                 __isl_take isl_printer *p, int yaml_style);
3640 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3641 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3642 and defaults to C<ISL_FORMAT_ISL>.
3643 Each line in the output is prefixed by C<indent_prefix>,
3644 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3645 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3646 In the C<PolyLib> format output,
3647 the coefficients of the existentially quantified variables
3648 appear between those of the set variables and those
3649 of the parameters.
3650 The function C<isl_printer_indent> increases the indentation
3651 by the specified amount (which may be negative).
3652 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3653 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3654 in YAML format.
3656 To actually print something, use
3658         #include <isl/printer.h>
3659         __isl_give isl_printer *isl_printer_print_double(
3660                 __isl_take isl_printer *p, double d);
3662         #include <isl/val.h>
3663         __isl_give isl_printer *isl_printer_print_val(
3664                 __isl_take isl_printer *p, __isl_keep isl_val *v);
3666         #include <isl/set.h>
3667         __isl_give isl_printer *isl_printer_print_basic_set(
3668                 __isl_take isl_printer *printer,
3669                 __isl_keep isl_basic_set *bset);
3670         __isl_give isl_printer *isl_printer_print_set(
3671                 __isl_take isl_printer *printer,
3672                 __isl_keep isl_set *set);
3674         #include <isl/map.h>
3675         __isl_give isl_printer *isl_printer_print_basic_map(
3676                 __isl_take isl_printer *printer,
3677                 __isl_keep isl_basic_map *bmap);
3678         __isl_give isl_printer *isl_printer_print_map(
3679                 __isl_take isl_printer *printer,
3680                 __isl_keep isl_map *map);
3682         #include <isl/union_set.h>
3683         __isl_give isl_printer *isl_printer_print_union_set(
3684                 __isl_take isl_printer *p,
3685                 __isl_keep isl_union_set *uset);
3687         #include <isl/union_map.h>
3688         __isl_give isl_printer *isl_printer_print_union_map(
3689                 __isl_take isl_printer *p,
3690                 __isl_keep isl_union_map *umap);
3692         #include <isl/val.h>
3693         __isl_give isl_printer *isl_printer_print_multi_val(
3694                 __isl_take isl_printer *p,
3695                 __isl_keep isl_multi_val *mv);
3697         #include <isl/aff.h>
3698         __isl_give isl_printer *isl_printer_print_aff(
3699                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3700         __isl_give isl_printer *isl_printer_print_multi_aff(
3701                 __isl_take isl_printer *p,
3702                 __isl_keep isl_multi_aff *maff);
3703         __isl_give isl_printer *isl_printer_print_pw_aff(
3704                 __isl_take isl_printer *p,
3705                 __isl_keep isl_pw_aff *pwaff);
3706         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3707                 __isl_take isl_printer *p,
3708                 __isl_keep isl_pw_multi_aff *pma);
3709         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3710                 __isl_take isl_printer *p,
3711                 __isl_keep isl_multi_pw_aff *mpa);
3712         __isl_give isl_printer *isl_printer_print_union_pw_aff(
3713                 __isl_take isl_printer *p,
3714                 __isl_keep isl_union_pw_aff *upa);
3715         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3716                 __isl_take isl_printer *p,
3717                 __isl_keep isl_union_pw_multi_aff *upma);
3718         __isl_give isl_printer *
3719         isl_printer_print_multi_union_pw_aff(
3720                 __isl_take isl_printer *p,
3721                 __isl_keep isl_multi_union_pw_aff *mupa);
3723         #include <isl/polynomial.h>
3724         __isl_give isl_printer *isl_printer_print_qpolynomial(
3725                 __isl_take isl_printer *p,
3726                 __isl_keep isl_qpolynomial *qp);
3727         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3728                 __isl_take isl_printer *p,
3729                 __isl_keep isl_pw_qpolynomial *pwqp);
3730         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3731                 __isl_take isl_printer *p,
3732                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3734         __isl_give isl_printer *
3735         isl_printer_print_pw_qpolynomial_fold(
3736                 __isl_take isl_printer *p,
3737                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3738         __isl_give isl_printer *
3739         isl_printer_print_union_pw_qpolynomial_fold(
3740                 __isl_take isl_printer *p,
3741                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3743 For C<isl_printer_print_qpolynomial>,
3744 C<isl_printer_print_pw_qpolynomial> and
3745 C<isl_printer_print_pw_qpolynomial_fold>,
3746 the output format of the printer
3747 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3748 For C<isl_printer_print_union_pw_qpolynomial> and
3749 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3750 is supported.
3751 In case of printing in C<ISL_FORMAT_C>, the user may want
3752 to set the names of all dimensions first.
3754 C<isl> also provides limited support for printing YAML documents,
3755 just enough for the internal use for printing such documents.
3757         #include <isl/printer.h>
3758         __isl_give isl_printer *isl_printer_yaml_start_mapping(
3759                 __isl_take isl_printer *p);
3760         __isl_give isl_printer *isl_printer_yaml_end_mapping(
3761                 __isl_take isl_printer *p);
3762         __isl_give isl_printer *isl_printer_yaml_start_sequence(
3763                 __isl_take isl_printer *p);
3764         __isl_give isl_printer *isl_printer_yaml_end_sequence(
3765                 __isl_take isl_printer *p);
3766         __isl_give isl_printer *isl_printer_yaml_next(
3767                 __isl_take isl_printer *p);
3769 A document is started by a call to either
3770 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3771 Anything printed to the printer after such a call belong to the
3772 first key of the mapping or the first element in the sequence.
3773 The function C<isl_printer_yaml_next> moves to the value if
3774 we are currently printing a mapping key, the next key if we
3775 are printing a value or the next element if we are printing
3776 an element in a sequence.
3777 Nested mappings and sequences are initiated by the same
3778 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3779 Each call to these functions needs to have a corresponding call to
3780 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3782 When called on a file printer, the following function flushes
3783 the file.  When called on a string printer, the buffer is cleared.
3785         __isl_give isl_printer *isl_printer_flush(
3786                 __isl_take isl_printer *p);
3788 The following functions allow the user to attach
3789 notes to a printer in order to keep track of additional state.
3791         #include <isl/printer.h>
3792         isl_bool isl_printer_has_note(__isl_keep isl_printer *p,
3793                 __isl_keep isl_id *id);
3794         __isl_give isl_id *isl_printer_get_note(
3795                 __isl_keep isl_printer *p, __isl_take isl_id *id);
3796         __isl_give isl_printer *isl_printer_set_note(
3797                 __isl_take isl_printer *p,
3798                 __isl_take isl_id *id, __isl_take isl_id *note);
3800 C<isl_printer_set_note> associates the given note to the given
3801 identifier in the printer.
3802 C<isl_printer_get_note> retrieves a note associated to an
3803 identifier, while
3804 C<isl_printer_has_note> checks if there is such a note.
3805 C<isl_printer_get_note> fails if the requested note does not exist.
3807 Alternatively, a string representation can be obtained
3808 directly using the following functions, which always print
3809 in isl format.
3811         #include <isl/id.h>
3812         __isl_give char *isl_id_to_str(
3813                 __isl_keep isl_id *id);
3815         #include <isl/space.h>
3816         __isl_give char *isl_space_to_str(
3817                 __isl_keep isl_space *space);
3819         #include <isl/val.h>
3820         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3821         __isl_give char *isl_multi_val_to_str(
3822                 __isl_keep isl_multi_val *mv);
3824         #include <isl/set.h>
3825         __isl_give char *isl_basic_set_to_str(
3826                 __isl_keep isl_basic_set *bset);
3827         __isl_give char *isl_set_to_str(
3828                 __isl_keep isl_set *set);
3830         #include <isl/union_set.h>
3831         __isl_give char *isl_union_set_to_str(
3832                 __isl_keep isl_union_set *uset);
3834         #include <isl/map.h>
3835         __isl_give char *isl_basic_map_to_str(
3836                 __isl_keep isl_basic_map *bmap);
3837         __isl_give char *isl_map_to_str(
3838                 __isl_keep isl_map *map);
3840         #include <isl/union_map.h>
3841         __isl_give char *isl_union_map_to_str(
3842                 __isl_keep isl_union_map *umap);
3844         #include <isl/aff.h>
3845         __isl_give char *isl_aff_to_str(__isl_keep isl_aff *aff);
3846         __isl_give char *isl_pw_aff_to_str(
3847                 __isl_keep isl_pw_aff *pa);
3848         __isl_give char *isl_multi_aff_to_str(
3849                 __isl_keep isl_multi_aff *ma);
3850         __isl_give char *isl_pw_multi_aff_to_str(
3851                 __isl_keep isl_pw_multi_aff *pma);
3852         __isl_give char *isl_multi_pw_aff_to_str(
3853                 __isl_keep isl_multi_pw_aff *mpa);
3854         __isl_give char *isl_union_pw_aff_to_str(
3855                 __isl_keep isl_union_pw_aff *upa);
3856         __isl_give char *isl_union_pw_multi_aff_to_str(
3857                 __isl_keep isl_union_pw_multi_aff *upma);
3858         __isl_give char *isl_multi_union_pw_aff_to_str(
3859                 __isl_keep isl_multi_union_pw_aff *mupa);
3861         #include <isl/point.h>
3862         __isl_give char *isl_point_to_str(
3863                 __isl_keep isl_point *pnt);
3865         #include <isl/polynomial.h>
3866         __isl_give char *isl_pw_qpolynomial_to_str(
3867                 __isl_keep isl_pw_qpolynomial *pwqp);
3868         __isl_give char *isl_union_pw_qpolynomial_to_str(
3869                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3871 =head2 Properties
3873 =head3 Unary Properties
3875 =over
3877 =item * Emptiness
3879 The following functions test whether the given set or relation
3880 contains any integer points.  The ``plain'' variants do not perform
3881 any computations, but simply check if the given set or relation
3882 is already known to be empty.
3884         #include <isl/set.h>
3885         isl_bool isl_basic_set_plain_is_empty(
3886                 __isl_keep isl_basic_set *bset);
3887         isl_bool isl_basic_set_is_empty(
3888                 __isl_keep isl_basic_set *bset);
3889         isl_bool isl_set_plain_is_empty(
3890                 __isl_keep isl_set *set);
3891         isl_bool isl_set_is_empty(__isl_keep isl_set *set);
3893         #include <isl/union_set.h>
3894         isl_bool isl_union_set_is_empty(
3895                 __isl_keep isl_union_set *uset);
3897         #include <isl/map.h>
3898         isl_bool isl_basic_map_plain_is_empty(
3899                 __isl_keep isl_basic_map *bmap);
3900         isl_bool isl_basic_map_is_empty(
3901                 __isl_keep isl_basic_map *bmap);
3902         isl_bool isl_map_plain_is_empty(
3903                 __isl_keep isl_map *map);
3904         isl_bool isl_map_is_empty(__isl_keep isl_map *map);
3906         #include <isl/union_map.h>
3907         isl_bool isl_union_map_plain_is_empty(
3908                 __isl_keep isl_union_map *umap);
3909         isl_bool isl_union_map_is_empty(
3910                 __isl_keep isl_union_map *umap);
3912 =item * Universality
3914         isl_bool isl_basic_set_plain_is_universe(
3915                 __isl_keep isl_basic_set *bset);
3916         isl_bool isl_basic_set_is_universe(
3917                 __isl_keep isl_basic_set *bset);
3918         isl_bool isl_basic_map_plain_is_universe(
3919                 __isl_keep isl_basic_map *bmap);
3920         isl_bool isl_basic_map_is_universe(
3921                 __isl_keep isl_basic_map *bmap);
3922         isl_bool isl_set_plain_is_universe(
3923                 __isl_keep isl_set *set);
3924         isl_bool isl_map_plain_is_universe(
3925                 __isl_keep isl_map *map);
3927 =item * Single-valuedness
3929         #include <isl/set.h>
3930         isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
3932         #include <isl/map.h>
3933         isl_bool isl_basic_map_is_single_valued(
3934                 __isl_keep isl_basic_map *bmap);
3935         isl_bool isl_map_plain_is_single_valued(
3936                 __isl_keep isl_map *map);
3937         isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
3939         #include <isl/union_map.h>
3940         isl_bool isl_union_map_is_single_valued(
3941                 __isl_keep isl_union_map *umap);
3943 =item * Injectivity
3945         isl_bool isl_map_plain_is_injective(
3946                 __isl_keep isl_map *map);
3947         isl_bool isl_map_is_injective(
3948                 __isl_keep isl_map *map);
3949         isl_bool isl_union_map_plain_is_injective(
3950                 __isl_keep isl_union_map *umap);
3951         isl_bool isl_union_map_is_injective(
3952                 __isl_keep isl_union_map *umap);
3954 =item * Bijectivity
3956         isl_bool isl_map_is_bijective(
3957                 __isl_keep isl_map *map);
3958         isl_bool isl_union_map_is_bijective(
3959                 __isl_keep isl_union_map *umap);
3961 =item * Identity
3963 The following functions test whether the given relation
3964 only maps elements to themselves.
3966         #include <isl/map.h>
3967         isl_bool isl_map_is_identity(
3968                 __isl_keep isl_map *map);
3970         #include <isl/union_map.h>
3971         isl_bool isl_union_map_is_identity(
3972                 __isl_keep isl_union_map *umap);
3974 =item * Position
3976         __isl_give isl_val *
3977         isl_basic_map_plain_get_val_if_fixed(
3978                 __isl_keep isl_basic_map *bmap,
3979                 enum isl_dim_type type, unsigned pos);
3980         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3981                 __isl_keep isl_set *set,
3982                 enum isl_dim_type type, unsigned pos);
3983         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3984                 __isl_keep isl_map *map,
3985                 enum isl_dim_type type, unsigned pos);
3987 If the set or relation obviously lies on a hyperplane where the given dimension
3988 has a fixed value, then return that value.
3989 Otherwise return NaN.
3991 =item * Stride
3993         isl_stat isl_set_dim_residue_class_val(
3994                 __isl_keep isl_set *set,
3995                 int pos, __isl_give isl_val **modulo,
3996                 __isl_give isl_val **residue);
3998 Check if the values of the given set dimension are equal to a fixed
3999 value modulo some integer value.  If so, assign the modulo to C<*modulo>
4000 and the fixed value to C<*residue>.  If the given dimension attains only
4001 a single value, then assign C<0> to C<*modulo> and the fixed value to
4002 C<*residue>.
4003 If the dimension does not attain only a single value and if no modulo
4004 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
4006         #include <isl/set.h>
4007         __isl_give isl_stride_info *isl_set_get_stride_info(
4008                 __isl_keep isl_set *set, int pos);
4009         __isl_give isl_val *isl_set_get_stride(
4010                 __isl_keep isl_set *set, int pos);
4012         #include <isl/map.h>
4013         __isl_give isl_stride_info *
4014         isl_map_get_range_stride_info(
4015                 __isl_keep isl_map *map, int pos);
4017 Check if the values of the given set dimension are equal to
4018 some affine expression of the other dimensions (the offset)
4019 modulo some integer stride or
4020 check if the values of the given output dimensions are equal to
4021 some affine expression of the input dimensions (the offset)
4022 modulo some integer stride.
4023 If no more specific information can be found, then the stride
4024 is taken to be one and the offset is taken to be the zero expression.
4025 The function C<isl_set_get_stride> performs the same
4026 computation as C<isl_set_get_stride_info> but only returns the stride.
4027 For the other functions,
4028 the stride and offset can be extracted from the returned object
4029 using the following functions.
4031         #include <isl/stride_info.h>
4032         __isl_give isl_val *isl_stride_info_get_stride(
4033                 __isl_keep isl_stride_info *si);
4034         __isl_give isl_aff *isl_stride_info_get_offset(
4035                 __isl_keep isl_stride_info *si);
4037 The stride info object can be copied and released using the following
4038 functions.
4040         #include <isl/stride_info.h>
4041         __isl_give isl_stride_info *isl_stride_info_copy(
4042                 __isl_keep isl_stride_info *si);
4043         __isl_null isl_stride_info *isl_stride_info_free(
4044                 __isl_take isl_stride_info *si);
4046 =item * Dependence
4048 To check whether the description of a set, relation or function depends
4049 on one or more given dimensions,
4050 the following functions can be used.
4052         #include <isl/constraint.h>
4053         isl_bool isl_constraint_involves_dims(
4054                 __isl_keep isl_constraint *constraint,
4055                 enum isl_dim_type type, unsigned first, unsigned n);
4057         #include <isl/set.h>
4058         isl_bool isl_basic_set_involves_dims(
4059                 __isl_keep isl_basic_set *bset,
4060                 enum isl_dim_type type, unsigned first, unsigned n);
4061         isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
4062                 enum isl_dim_type type, unsigned first, unsigned n);
4064         #include <isl/map.h>
4065         isl_bool isl_basic_map_involves_dims(
4066                 __isl_keep isl_basic_map *bmap,
4067                 enum isl_dim_type type, unsigned first, unsigned n);
4068         isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
4069                 enum isl_dim_type type, unsigned first, unsigned n);
4071         #include <isl/union_map.h>
4072         isl_bool isl_union_map_involves_dims(
4073                 __isl_keep isl_union_map *umap,
4074                 enum isl_dim_type type, unsigned first, unsigned n);
4076         #include <isl/aff.h>
4077         isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
4078                 enum isl_dim_type type, unsigned first, unsigned n);
4079         isl_bool isl_pw_aff_involves_dims(
4080                 __isl_keep isl_pw_aff *pwaff,
4081                 enum isl_dim_type type, unsigned first, unsigned n);
4082         isl_bool isl_multi_aff_involves_dims(
4083                 __isl_keep isl_multi_aff *ma,
4084                 enum isl_dim_type type, unsigned first, unsigned n);
4085         isl_bool isl_pw_multi_aff_involves_dims(
4086                 __isl_keep isl_pw_multi_aff *pma,
4087                 enum isl_dim_type type, unsigned first, unsigned n);
4088         isl_bool isl_multi_pw_aff_involves_dims(
4089                 __isl_keep isl_multi_pw_aff *mpa,
4090                 enum isl_dim_type type, unsigned first, unsigned n);
4092         #include <isl/polynomial.h>
4093         isl_bool isl_qpolynomial_involves_dims(
4094                 __isl_keep isl_qpolynomial *qp,
4095                 enum isl_dim_type type, unsigned first, unsigned n);
4097 Similarly, the following functions can be used to check whether
4098 a given dimension is involved in any lower or upper bound.
4100         #include <isl/set.h>
4101         isl_bool isl_set_dim_has_any_lower_bound(
4102                 __isl_keep isl_set *set,
4103                 enum isl_dim_type type, unsigned pos);
4104         isl_bool isl_set_dim_has_any_upper_bound(
4105                 __isl_keep isl_set *set,
4106                 enum isl_dim_type type, unsigned pos);
4108 Note that these functions return true even if there is a bound on
4109 the dimension on only some of the basic sets of C<set>.
4110 To check if they have a bound for all of the basic sets in C<set>,
4111 use the following functions instead.
4113         #include <isl/set.h>
4114         isl_bool isl_set_dim_has_lower_bound(
4115                 __isl_keep isl_set *set,
4116                 enum isl_dim_type type, unsigned pos);
4117         isl_bool isl_set_dim_has_upper_bound(
4118                 __isl_keep isl_set *set,
4119                 enum isl_dim_type type, unsigned pos);
4121 =item * Space
4123 To check whether a set is a parameter domain, use this function:
4125         isl_bool isl_set_is_params(__isl_keep isl_set *set);
4126         isl_bool isl_union_set_is_params(
4127                 __isl_keep isl_union_set *uset);
4129 =item * Wrapping
4131 The following functions check whether the space of the given
4132 (basic) set or relation domain and/or range is a wrapped relation.
4134         #include <isl/space.h>
4135         isl_bool isl_space_is_wrapping(
4136                 __isl_keep isl_space *space);
4137         isl_bool isl_space_domain_is_wrapping(
4138                 __isl_keep isl_space *space);
4139         isl_bool isl_space_range_is_wrapping(
4140                 __isl_keep isl_space *space);
4141         isl_bool isl_space_is_product(
4142                 __isl_keep isl_space *space);
4144         #include <isl/set.h>
4145         isl_bool isl_basic_set_is_wrapping(
4146                 __isl_keep isl_basic_set *bset);
4147         isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
4149         #include <isl/map.h>
4150         isl_bool isl_map_domain_is_wrapping(
4151                 __isl_keep isl_map *map);
4152         isl_bool isl_map_range_is_wrapping(
4153                 __isl_keep isl_map *map);
4154         isl_bool isl_map_is_product(__isl_keep isl_map *map);
4156         #include <isl/val.h>
4157         isl_bool isl_multi_val_range_is_wrapping(
4158                 __isl_keep isl_multi_val *mv);
4160         #include <isl/aff.h>
4161         isl_bool isl_multi_aff_range_is_wrapping(
4162                 __isl_keep isl_multi_aff *ma);
4163         isl_bool isl_multi_pw_aff_range_is_wrapping(
4164                 __isl_keep isl_multi_pw_aff *mpa);
4165         isl_bool isl_multi_union_pw_aff_range_is_wrapping(
4166                 __isl_keep isl_multi_union_pw_aff *mupa);
4168 The input to C<isl_space_is_wrapping> should
4169 be the space of a set, while that of
4170 C<isl_space_domain_is_wrapping> and
4171 C<isl_space_range_is_wrapping> should be the space of a relation.
4172 The input to C<isl_space_is_product> can be either the space
4173 of a set or that of a binary relation.
4174 In case the input is the space of a binary relation, it checks
4175 whether both domain and range are wrapping.
4177 =item * Internal Product
4179         isl_bool isl_basic_map_can_zip(
4180                 __isl_keep isl_basic_map *bmap);
4181         isl_bool isl_map_can_zip(__isl_keep isl_map *map);
4183 Check whether the product of domain and range of the given relation
4184 can be computed,
4185 i.e., whether both domain and range are nested relations.
4187 =item * Currying
4189         #include <isl/space.h>
4190         isl_bool isl_space_can_curry(
4191                 __isl_keep isl_space *space);
4193         #include <isl/map.h>
4194         isl_bool isl_basic_map_can_curry(
4195                 __isl_keep isl_basic_map *bmap);
4196         isl_bool isl_map_can_curry(__isl_keep isl_map *map);
4198 Check whether the domain of the (basic) relation is a wrapped relation.
4200         #include <isl/space.h>
4201         __isl_give isl_space *isl_space_uncurry(
4202                 __isl_take isl_space *space);
4204         #include <isl/map.h>
4205         isl_bool isl_basic_map_can_uncurry(
4206                 __isl_keep isl_basic_map *bmap);
4207         isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
4209 Check whether the range of the (basic) relation is a wrapped relation.
4211         #include <isl/space.h>
4212         isl_bool isl_space_can_range_curry(
4213                 __isl_keep isl_space *space);
4215         #include <isl/map.h>
4216         isl_bool isl_map_can_range_curry(
4217                 __isl_keep isl_map *map);
4219 Check whether the domain of the relation wrapped in the range of
4220 the input is itself a wrapped relation.
4222 =item * Special Values
4224         #include <isl/aff.h>
4225         isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
4226         isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
4227         isl_bool isl_multi_pw_aff_is_cst(
4228                 __isl_keep isl_multi_pw_aff *mpa);
4230 Check whether the given expression is a constant.
4232         #include <isl/val.h>
4233         isl_bool isl_multi_val_involves_nan(
4234                 __isl_keep isl_multi_val *mv);
4236         #include <isl/aff.h>
4237         isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
4238         isl_bool isl_multi_aff_involves_nan(
4239                 __isl_keep isl_multi_aff *ma);
4240         isl_bool isl_pw_aff_involves_nan(
4241                 __isl_keep isl_pw_aff *pa);
4242         isl_bool isl_pw_multi_aff_involves_nan(
4243                 __isl_keep isl_pw_multi_aff *pma);
4244         isl_bool isl_multi_pw_aff_involves_nan(
4245                 __isl_keep isl_multi_pw_aff *mpa);
4246         isl_bool isl_union_pw_aff_involves_nan(
4247                 __isl_keep isl_union_pw_aff *upa);
4248         isl_bool isl_union_pw_multi_aff_involves_nan(
4249                 __isl_keep isl_union_pw_multi_aff *upma);
4250         isl_bool isl_multi_union_pw_aff_involves_nan(
4251                 __isl_keep isl_multi_union_pw_aff *mupa);
4253         #include <isl/polynomial.h>
4254         isl_bool isl_qpolynomial_is_nan(
4255                 __isl_keep isl_qpolynomial *qp);
4256         isl_bool isl_qpolynomial_fold_is_nan(
4257                 __isl_keep isl_qpolynomial_fold *fold);
4258         isl_bool isl_pw_qpolynomial_involves_nan(
4259                 __isl_keep isl_pw_qpolynomial *pwqp);
4260         isl_bool isl_pw_qpolynomial_fold_involves_nan(
4261                 __isl_keep isl_pw_qpolynomial_fold *pwf);
4262         isl_bool isl_union_pw_qpolynomial_involves_nan(
4263                 __isl_keep isl_union_pw_qpolynomial *upwqp);
4264         isl_bool isl_union_pw_qpolynomial_fold_involves_nan(
4265                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
4267 Check whether the given expression is equal to or involves NaN.
4269         #include <isl/aff.h>
4270         isl_bool isl_aff_plain_is_zero(
4271                 __isl_keep isl_aff *aff);
4273 Check whether the affine expression is obviously zero.
4275 =back
4277 =head3 Binary Properties
4279 =over
4281 =item * Equality
4283 The following functions check whether two objects
4284 represent the same set, relation or function.
4285 The C<plain> variants only return true if the objects
4286 are obviously the same.  That is, they may return false
4287 even if the objects are the same, but they will never
4288 return true if the objects are not the same.
4290         #include <isl/set.h>
4291         isl_bool isl_basic_set_plain_is_equal(
4292                 __isl_keep isl_basic_set *bset1,
4293                 __isl_keep isl_basic_set *bset2);
4294         isl_bool isl_basic_set_is_equal(
4295                 __isl_keep isl_basic_set *bset1,
4296                 __isl_keep isl_basic_set *bset2);
4297         isl_bool isl_set_plain_is_equal(
4298                 __isl_keep isl_set *set1,
4299                 __isl_keep isl_set *set2);
4300         isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
4301                 __isl_keep isl_set *set2);
4303         #include <isl/map.h>
4304         isl_bool isl_basic_map_is_equal(
4305                 __isl_keep isl_basic_map *bmap1,
4306                 __isl_keep isl_basic_map *bmap2);
4307         isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
4308                 __isl_keep isl_map *map2);
4309         isl_bool isl_map_plain_is_equal(
4310                 __isl_keep isl_map *map1,
4311                 __isl_keep isl_map *map2);
4313         #include <isl/union_set.h>
4314         isl_bool isl_union_set_is_equal(
4315                 __isl_keep isl_union_set *uset1,
4316                 __isl_keep isl_union_set *uset2);
4318         #include <isl/union_map.h>
4319         isl_bool isl_union_map_is_equal(
4320                 __isl_keep isl_union_map *umap1,
4321                 __isl_keep isl_union_map *umap2);
4323         #include <isl/aff.h>
4324         isl_bool isl_aff_plain_is_equal(
4325                 __isl_keep isl_aff *aff1,
4326                 __isl_keep isl_aff *aff2);
4327         isl_bool isl_multi_aff_plain_is_equal(
4328                 __isl_keep isl_multi_aff *maff1,
4329                 __isl_keep isl_multi_aff *maff2);
4330         isl_bool isl_pw_aff_plain_is_equal(
4331                 __isl_keep isl_pw_aff *pwaff1,
4332                 __isl_keep isl_pw_aff *pwaff2);
4333         isl_bool isl_pw_aff_is_equal(
4334                 __isl_keep isl_pw_aff *pa1,
4335                 __isl_keep isl_pw_aff *pa2);
4336         isl_bool isl_pw_multi_aff_plain_is_equal(
4337                 __isl_keep isl_pw_multi_aff *pma1,
4338                 __isl_keep isl_pw_multi_aff *pma2);
4339         isl_bool isl_pw_multi_aff_is_equal(
4340                 __isl_keep isl_pw_multi_aff *pma1,
4341                 __isl_keep isl_pw_multi_aff *pma2);
4342         isl_bool isl_multi_pw_aff_plain_is_equal(
4343                 __isl_keep isl_multi_pw_aff *mpa1,
4344                 __isl_keep isl_multi_pw_aff *mpa2);
4345         isl_bool isl_multi_pw_aff_is_equal(
4346                 __isl_keep isl_multi_pw_aff *mpa1,
4347                 __isl_keep isl_multi_pw_aff *mpa2);
4348         isl_bool isl_union_pw_aff_plain_is_equal(
4349                 __isl_keep isl_union_pw_aff *upa1,
4350                 __isl_keep isl_union_pw_aff *upa2);
4351         isl_bool isl_union_pw_multi_aff_plain_is_equal(
4352                 __isl_keep isl_union_pw_multi_aff *upma1,
4353                 __isl_keep isl_union_pw_multi_aff *upma2);
4354         isl_bool isl_multi_union_pw_aff_plain_is_equal(
4355                 __isl_keep isl_multi_union_pw_aff *mupa1,
4356                 __isl_keep isl_multi_union_pw_aff *mupa2);
4358         #include <isl/polynomial.h>
4359         isl_bool isl_union_pw_qpolynomial_plain_is_equal(
4360                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
4361                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
4362         isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
4363                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
4364                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
4366 =item * Disjointness
4368         #include <isl/set.h>
4369         isl_bool isl_basic_set_is_disjoint(
4370                 __isl_keep isl_basic_set *bset1,
4371                 __isl_keep isl_basic_set *bset2);
4372         isl_bool isl_set_plain_is_disjoint(
4373                 __isl_keep isl_set *set1,
4374                 __isl_keep isl_set *set2);
4375         isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
4376                 __isl_keep isl_set *set2);
4378         #include <isl/map.h>
4379         isl_bool isl_basic_map_is_disjoint(
4380                 __isl_keep isl_basic_map *bmap1,
4381                 __isl_keep isl_basic_map *bmap2);
4382         isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
4383                 __isl_keep isl_map *map2);
4385         #include <isl/union_set.h>
4386         isl_bool isl_union_set_is_disjoint(
4387                 __isl_keep isl_union_set *uset1,
4388                 __isl_keep isl_union_set *uset2);
4390         #include <isl/union_map.h>
4391         isl_bool isl_union_map_is_disjoint(
4392                 __isl_keep isl_union_map *umap1,
4393                 __isl_keep isl_union_map *umap2);
4395 =item * Subset
4397         isl_bool isl_basic_set_is_subset(
4398                 __isl_keep isl_basic_set *bset1,
4399                 __isl_keep isl_basic_set *bset2);
4400         isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4401                 __isl_keep isl_set *set2);
4402         isl_bool isl_set_is_strict_subset(
4403                 __isl_keep isl_set *set1,
4404                 __isl_keep isl_set *set2);
4405         isl_bool isl_union_set_is_subset(
4406                 __isl_keep isl_union_set *uset1,
4407                 __isl_keep isl_union_set *uset2);
4408         isl_bool isl_union_set_is_strict_subset(
4409                 __isl_keep isl_union_set *uset1,
4410                 __isl_keep isl_union_set *uset2);
4411         isl_bool isl_basic_map_is_subset(
4412                 __isl_keep isl_basic_map *bmap1,
4413                 __isl_keep isl_basic_map *bmap2);
4414         isl_bool isl_basic_map_is_strict_subset(
4415                 __isl_keep isl_basic_map *bmap1,
4416                 __isl_keep isl_basic_map *bmap2);
4417         isl_bool isl_map_is_subset(
4418                 __isl_keep isl_map *map1,
4419                 __isl_keep isl_map *map2);
4420         isl_bool isl_map_is_strict_subset(
4421                 __isl_keep isl_map *map1,
4422                 __isl_keep isl_map *map2);
4423         isl_bool isl_union_map_is_subset(
4424                 __isl_keep isl_union_map *umap1,
4425                 __isl_keep isl_union_map *umap2);
4426         isl_bool isl_union_map_is_strict_subset(
4427                 __isl_keep isl_union_map *umap1,
4428                 __isl_keep isl_union_map *umap2);
4430 Check whether the first argument is a (strict) subset of the
4431 second argument.
4433 =item * Order
4435 Every comparison function returns a negative value if the first
4436 argument is considered smaller than the second, a positive value
4437 if the first argument is considered greater and zero if the two
4438 constraints are considered the same by the comparison criterion.
4440         #include <isl/constraint.h>
4441         int isl_constraint_plain_cmp(
4442                 __isl_keep isl_constraint *c1,
4443                 __isl_keep isl_constraint *c2);
4445 This function is useful for sorting C<isl_constraint>s.
4446 The order depends on the internal representation of the inputs.
4447 The order is fixed over different calls to the function (assuming
4448 the internal representation of the inputs has not changed), but may
4449 change over different versions of C<isl>.
4451         #include <isl/constraint.h>
4452         int isl_constraint_cmp_last_non_zero(
4453                 __isl_keep isl_constraint *c1,
4454                 __isl_keep isl_constraint *c2);
4456 This function can be used to sort constraints that live in the same
4457 local space.  Constraints that involve ``earlier'' dimensions or
4458 that have a smaller coefficient for the shared latest dimension
4459 are considered smaller than other constraints.
4460 This function only defines a B<partial> order.
4462         #include <isl/set.h>
4463         int isl_set_plain_cmp(__isl_keep isl_set *set1,
4464                 __isl_keep isl_set *set2);
4466 This function is useful for sorting C<isl_set>s.
4467 The order depends on the internal representation of the inputs.
4468 The order is fixed over different calls to the function (assuming
4469 the internal representation of the inputs has not changed), but may
4470 change over different versions of C<isl>.
4472         #include <isl/aff.h>
4473         int isl_multi_aff_plain_cmp(
4474                 __isl_keep isl_multi_aff *ma1,
4475                 __isl_keep isl_multi_aff *ma2);
4476         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4477                 __isl_keep isl_pw_aff *pa2);
4479 The functions C<isl_multi_aff_plain_cmp> and
4480 C<isl_pw_aff_plain_cmp> can be used to sort C<isl_multi_aff>s and
4481 C<isl_pw_aff>s.  The order is not strictly defined.
4482 The current order sorts expressions that only involve
4483 earlier dimensions before those that involve later dimensions.
4485 =back
4487 =head2 Unary Operations
4489 =over
4491 =item * Complement
4493         __isl_give isl_set *isl_set_complement(
4494                 __isl_take isl_set *set);
4495         __isl_give isl_map *isl_map_complement(
4496                 __isl_take isl_map *map);
4498 =item * Inverse map
4500         #include <isl/space.h>
4501         __isl_give isl_space *isl_space_reverse(
4502                 __isl_take isl_space *space);
4504         #include <isl/map.h>
4505         __isl_give isl_basic_map *isl_basic_map_reverse(
4506                 __isl_take isl_basic_map *bmap);
4507         __isl_give isl_map *isl_map_reverse(
4508                 __isl_take isl_map *map);
4510         #include <isl/union_map.h>
4511         __isl_give isl_union_map *isl_union_map_reverse(
4512                 __isl_take isl_union_map *umap);
4514 =item * Projection
4516         #include <isl/space.h>
4517         __isl_give isl_space *isl_space_domain(
4518                 __isl_take isl_space *space);
4519         __isl_give isl_space *isl_space_range(
4520                 __isl_take isl_space *space);
4521         __isl_give isl_space *isl_space_params(
4522                 __isl_take isl_space *space);
4524         #include <isl/local_space.h>
4525         __isl_give isl_local_space *isl_local_space_domain(
4526                 __isl_take isl_local_space *ls);
4527         __isl_give isl_local_space *isl_local_space_range(
4528                 __isl_take isl_local_space *ls);
4530         #include <isl/set.h>
4531         __isl_give isl_basic_set *isl_basic_set_project_out(
4532                 __isl_take isl_basic_set *bset,
4533                 enum isl_dim_type type, unsigned first, unsigned n);
4534         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4535                 enum isl_dim_type type, unsigned first, unsigned n);
4536         __isl_give isl_map *isl_set_project_onto_map(
4537                 __isl_take isl_set *set,
4538                 enum isl_dim_type type, unsigned first,
4539                 unsigned n);
4540         __isl_give isl_basic_set *isl_basic_set_params(
4541                 __isl_take isl_basic_set *bset);
4542         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4544 The function C<isl_set_project_onto_map> returns a relation
4545 that projects the input set onto the given set dimensions.
4547         #include <isl/map.h>
4548         __isl_give isl_basic_map *isl_basic_map_project_out(
4549                 __isl_take isl_basic_map *bmap,
4550                 enum isl_dim_type type, unsigned first, unsigned n);
4551         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4552                 enum isl_dim_type type, unsigned first, unsigned n);
4553         __isl_give isl_basic_set *isl_basic_map_domain(
4554                 __isl_take isl_basic_map *bmap);
4555         __isl_give isl_basic_set *isl_basic_map_range(
4556                 __isl_take isl_basic_map *bmap);
4557         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4558         __isl_give isl_set *isl_map_domain(
4559                 __isl_take isl_map *bmap);
4560         __isl_give isl_set *isl_map_range(
4561                 __isl_take isl_map *map);
4563         #include <isl/union_set.h>
4564         __isl_give isl_union_set *isl_union_set_project_out(
4565                 __isl_take isl_union_set *uset,
4566                 enum isl_dim_type type,
4567                 unsigned first, unsigned n);
4568         __isl_give isl_set *isl_union_set_params(
4569                 __isl_take isl_union_set *uset);
4571 The function C<isl_union_set_project_out> can only project out
4572 parameters.
4574         #include <isl/union_map.h>
4575         __isl_give isl_union_map *isl_union_map_project_out(
4576                 __isl_take isl_union_map *umap,
4577                 enum isl_dim_type type, unsigned first, unsigned n);
4578         __isl_give isl_union_map *
4579         isl_union_map_project_out_all_params(
4580                 __isl_take isl_union_map *umap);
4581         __isl_give isl_set *isl_union_map_params(
4582                 __isl_take isl_union_map *umap);
4583         __isl_give isl_union_set *isl_union_map_domain(
4584                 __isl_take isl_union_map *umap);
4585         __isl_give isl_union_set *isl_union_map_range(
4586                 __isl_take isl_union_map *umap);
4588 The function C<isl_union_map_project_out> can only project out
4589 parameters.
4591         #include <isl/aff.h>
4592         __isl_give isl_aff *isl_aff_project_domain_on_params(
4593                 __isl_take isl_aff *aff);
4594         __isl_give isl_multi_aff *
4595         isl_multi_aff_project_domain_on_params(
4596                 __isl_take isl_multi_aff *ma);
4597         __isl_give isl_pw_aff *
4598         isl_pw_aff_project_domain_on_params(
4599                 __isl_take isl_pw_aff *pa);
4600         __isl_give isl_multi_pw_aff *
4601         isl_multi_pw_aff_project_domain_on_params(
4602                 __isl_take isl_multi_pw_aff *mpa);
4603         __isl_give isl_pw_multi_aff *
4604         isl_pw_multi_aff_project_domain_on_params(
4605                 __isl_take isl_pw_multi_aff *pma);
4606         __isl_give isl_set *isl_pw_aff_domain(
4607                 __isl_take isl_pw_aff *pwaff);
4608         __isl_give isl_set *isl_pw_multi_aff_domain(
4609                 __isl_take isl_pw_multi_aff *pma);
4610         __isl_give isl_set *isl_multi_pw_aff_domain(
4611                 __isl_take isl_multi_pw_aff *mpa);
4612         __isl_give isl_union_set *isl_union_pw_aff_domain(
4613                 __isl_take isl_union_pw_aff *upa);
4614         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4615                 __isl_take isl_union_pw_multi_aff *upma);
4616         __isl_give isl_union_set *
4617         isl_multi_union_pw_aff_domain(
4618                 __isl_take isl_multi_union_pw_aff *mupa);
4619         __isl_give isl_set *isl_pw_aff_params(
4620                 __isl_take isl_pw_aff *pwa);
4622 If no explicit domain was set on a zero-dimensional input to
4623 C<isl_multi_union_pw_aff_domain>, then this function will
4624 return a parameter set.
4626         #include <isl/polynomial.h>
4627         __isl_give isl_qpolynomial *
4628         isl_qpolynomial_project_domain_on_params(
4629                 __isl_take isl_qpolynomial *qp);
4630         __isl_give isl_pw_qpolynomial *
4631         isl_pw_qpolynomial_project_domain_on_params(
4632                 __isl_take isl_pw_qpolynomial *pwqp);
4633         __isl_give isl_pw_qpolynomial_fold *
4634         isl_pw_qpolynomial_fold_project_domain_on_params(
4635                 __isl_take isl_pw_qpolynomial_fold *pwf);
4636         __isl_give isl_set *isl_pw_qpolynomial_domain(
4637                 __isl_take isl_pw_qpolynomial *pwqp);
4638         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4639                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4640         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4641                 __isl_take isl_union_pw_qpolynomial *upwqp);
4643         #include <isl/space.h>
4644         __isl_give isl_space *isl_space_domain_map(
4645                 __isl_take isl_space *space);
4646         __isl_give isl_space *isl_space_range_map(
4647                 __isl_take isl_space *space);
4649         #include <isl/map.h>
4650         __isl_give isl_map *isl_set_wrapped_domain_map(
4651                 __isl_take isl_set *set);
4652         __isl_give isl_basic_map *isl_basic_map_domain_map(
4653                 __isl_take isl_basic_map *bmap);
4654         __isl_give isl_basic_map *isl_basic_map_range_map(
4655                 __isl_take isl_basic_map *bmap);
4656         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4657         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4659         #include <isl/union_map.h>
4660         __isl_give isl_union_map *isl_union_map_domain_map(
4661                 __isl_take isl_union_map *umap);
4662         __isl_give isl_union_pw_multi_aff *
4663         isl_union_map_domain_map_union_pw_multi_aff(
4664                 __isl_take isl_union_map *umap);
4665         __isl_give isl_union_map *isl_union_map_range_map(
4666                 __isl_take isl_union_map *umap);
4667         __isl_give isl_union_map *
4668         isl_union_set_wrapped_domain_map(
4669                 __isl_take isl_union_set *uset);
4671 The functions above construct a (basic, regular or union) relation
4672 that maps (a wrapped version of) the input relation to its domain or range.
4673 C<isl_set_wrapped_domain_map> maps the input set to the domain
4674 of its wrapped relation.
4676 =item * Elimination
4678         __isl_give isl_basic_set *isl_basic_set_eliminate(
4679                 __isl_take isl_basic_set *bset,
4680                 enum isl_dim_type type,
4681                 unsigned first, unsigned n);
4682         __isl_give isl_set *isl_set_eliminate(
4683                 __isl_take isl_set *set, enum isl_dim_type type,
4684                 unsigned first, unsigned n);
4685         __isl_give isl_basic_map *isl_basic_map_eliminate(
4686                 __isl_take isl_basic_map *bmap,
4687                 enum isl_dim_type type,
4688                 unsigned first, unsigned n);
4689         __isl_give isl_map *isl_map_eliminate(
4690                 __isl_take isl_map *map, enum isl_dim_type type,
4691                 unsigned first, unsigned n);
4693 Eliminate the coefficients for the given dimensions from the constraints,
4694 without removing the dimensions.
4696 =item * Constructing a set from a parameter domain
4698 A zero-dimensional (local) space or (basic) set can be constructed
4699 on a given parameter domain using the following functions.
4701         #include <isl/space.h>
4702         __isl_give isl_space *isl_space_set_from_params(
4703                 __isl_take isl_space *space);
4705         #include <isl/local_space.h>
4706         __isl_give isl_local_space *
4707         isl_local_space_set_from_params(
4708                 __isl_take isl_local_space *ls);
4710         #include <isl/set.h>
4711         __isl_give isl_basic_set *isl_basic_set_from_params(
4712                 __isl_take isl_basic_set *bset);
4713         __isl_give isl_set *isl_set_from_params(
4714                 __isl_take isl_set *set);
4716 =item * Constructing a relation from one or two sets
4718 Create a relation with the given set(s) as domain and/or range.
4719 If only the domain or the range is specified, then
4720 the range or domain of the created relation is a zero-dimensional
4721 flat anonymous space.
4723         #include <isl/space.h>
4724         __isl_give isl_space *isl_space_from_domain(
4725                 __isl_take isl_space *space);
4726         __isl_give isl_space *isl_space_from_range(
4727                 __isl_take isl_space *space);
4728         __isl_give isl_space *isl_space_map_from_set(
4729                 __isl_take isl_space *space);
4730         __isl_give isl_space *isl_space_map_from_domain_and_range(
4731                 __isl_take isl_space *domain,
4732                 __isl_take isl_space *range);
4734         #include <isl/local_space.h>
4735         __isl_give isl_local_space *isl_local_space_from_domain(
4736                 __isl_take isl_local_space *ls);
4738         #include <isl/map.h>
4739         __isl_give isl_map *isl_map_from_domain(
4740                 __isl_take isl_set *set);
4741         __isl_give isl_map *isl_map_from_range(
4742                 __isl_take isl_set *set);
4744         #include <isl/union_map.h>
4745         __isl_give isl_union_map *isl_union_map_from_domain(
4746                 __isl_take isl_union_set *uset);
4747         __isl_give isl_union_map *isl_union_map_from_range(
4748                 __isl_take isl_union_set *uset);
4749         __isl_give isl_union_map *
4750         isl_union_map_from_domain_and_range(
4751                 __isl_take isl_union_set *domain,
4752                 __isl_take isl_union_set *range);
4754         #include <isl/val.h>
4755         __isl_give isl_multi_val *isl_multi_val_from_range(
4756                 __isl_take isl_multi_val *mv);
4758         #include <isl/aff.h>
4759         __isl_give isl_aff *isl_aff_from_range(
4760                 __isl_take isl_aff *aff);
4761         __isl_give isl_multi_aff *isl_multi_aff_from_range(
4762                 __isl_take isl_multi_aff *ma);
4763         __isl_give isl_pw_aff *isl_pw_aff_from_range(
4764                 __isl_take isl_pw_aff *pwa);
4765         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4766                 __isl_take isl_multi_pw_aff *mpa);
4767         __isl_give isl_multi_union_pw_aff *
4768         isl_multi_union_pw_aff_from_range(
4769                 __isl_take isl_multi_union_pw_aff *mupa);
4770         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4771                 __isl_take isl_set *set);
4772         __isl_give isl_union_pw_multi_aff *
4773         isl_union_pw_multi_aff_from_domain(
4774                 __isl_take isl_union_set *uset);
4776         #include <isl/polynomial.h>
4777         __isl_give isl_pw_qpolynomial *
4778         isl_pw_qpolynomial_from_range(
4779                 __isl_take isl_pw_qpolynomial *pwqp);
4780         __isl_give isl_pw_qpolynomial_fold *
4781         isl_pw_qpolynomial_fold_from_range(
4782                 __isl_take isl_pw_qpolynomial_fold *pwf);
4784 =item * Slicing
4786         #include <isl/set.h>
4787         __isl_give isl_basic_set *isl_basic_set_fix_si(
4788                 __isl_take isl_basic_set *bset,
4789                 enum isl_dim_type type, unsigned pos, int value);
4790         __isl_give isl_basic_set *isl_basic_set_fix_val(
4791                 __isl_take isl_basic_set *bset,
4792                 enum isl_dim_type type, unsigned pos,
4793                 __isl_take isl_val *v);
4794         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4795                 enum isl_dim_type type, unsigned pos, int value);
4796         __isl_give isl_set *isl_set_fix_val(
4797                 __isl_take isl_set *set,
4798                 enum isl_dim_type type, unsigned pos,
4799                 __isl_take isl_val *v);
4801         #include <isl/map.h>
4802         __isl_give isl_basic_map *isl_basic_map_fix_si(
4803                 __isl_take isl_basic_map *bmap,
4804                 enum isl_dim_type type, unsigned pos, int value);
4805         __isl_give isl_basic_map *isl_basic_map_fix_val(
4806                 __isl_take isl_basic_map *bmap,
4807                 enum isl_dim_type type, unsigned pos,
4808                 __isl_take isl_val *v);
4809         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4810                 enum isl_dim_type type, unsigned pos, int value);
4811         __isl_give isl_map *isl_map_fix_val(
4812                 __isl_take isl_map *map,
4813                 enum isl_dim_type type, unsigned pos,
4814                 __isl_take isl_val *v);
4816         #include <isl/aff.h>
4817         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4818                 __isl_take isl_pw_multi_aff *pma,
4819                 enum isl_dim_type type, unsigned pos, int value);
4821         #include <isl/polynomial.h>
4822         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4823                 __isl_take isl_pw_qpolynomial *pwqp,
4824                 enum isl_dim_type type, unsigned n,
4825                 __isl_take isl_val *v);
4826         __isl_give isl_pw_qpolynomial_fold *
4827         isl_pw_qpolynomial_fold_fix_val(
4828                 __isl_take isl_pw_qpolynomial_fold *pwf,
4829                 enum isl_dim_type type, unsigned n,
4830                 __isl_take isl_val *v);
4832 Intersect the set, relation or function domain
4833 with the hyperplane where the given
4834 dimension has the fixed given value.
4836         #include <isl/set.h>
4837         __isl_give isl_basic_set *
4838         isl_basic_set_lower_bound_val(
4839                 __isl_take isl_basic_set *bset,
4840                 enum isl_dim_type type, unsigned pos,
4841                 __isl_take isl_val *value);
4842         __isl_give isl_basic_set *
4843         isl_basic_set_upper_bound_val(
4844                 __isl_take isl_basic_set *bset,
4845                 enum isl_dim_type type, unsigned pos,
4846                 __isl_take isl_val *value);
4847         __isl_give isl_set *isl_set_lower_bound_si(
4848                 __isl_take isl_set *set,
4849                 enum isl_dim_type type, unsigned pos, int value);
4850         __isl_give isl_set *isl_set_lower_bound_val(
4851                 __isl_take isl_set *set,
4852                 enum isl_dim_type type, unsigned pos,
4853                 __isl_take isl_val *value);
4854         __isl_give isl_set *isl_set_upper_bound_si(
4855                 __isl_take isl_set *set,
4856                 enum isl_dim_type type, unsigned pos, int value);
4857         __isl_give isl_set *isl_set_upper_bound_val(
4858                 __isl_take isl_set *set,
4859                 enum isl_dim_type type, unsigned pos,
4860                 __isl_take isl_val *value);
4862         #include <isl/map.h>
4863         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4864                 __isl_take isl_basic_map *bmap,
4865                 enum isl_dim_type type, unsigned pos, int value);
4866         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4867                 __isl_take isl_basic_map *bmap,
4868                 enum isl_dim_type type, unsigned pos, int value);
4869         __isl_give isl_map *isl_map_lower_bound_si(
4870                 __isl_take isl_map *map,
4871                 enum isl_dim_type type, unsigned pos, int value);
4872         __isl_give isl_map *isl_map_upper_bound_si(
4873                 __isl_take isl_map *map,
4874                 enum isl_dim_type type, unsigned pos, int value);
4876 Intersect the set or relation with the half-space where the given
4877 dimension has a value bounded by the fixed given integer value.
4879         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4880                 enum isl_dim_type type1, int pos1,
4881                 enum isl_dim_type type2, int pos2);
4882         __isl_give isl_basic_map *isl_basic_map_equate(
4883                 __isl_take isl_basic_map *bmap,
4884                 enum isl_dim_type type1, int pos1,
4885                 enum isl_dim_type type2, int pos2);
4886         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4887                 enum isl_dim_type type1, int pos1,
4888                 enum isl_dim_type type2, int pos2);
4890 Intersect the set or relation with the hyperplane where the given
4891 dimensions are equal to each other.
4893         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4894                 enum isl_dim_type type1, int pos1,
4895                 enum isl_dim_type type2, int pos2);
4897 Intersect the relation with the hyperplane where the given
4898 dimensions have opposite values.
4900         __isl_give isl_map *isl_map_order_le(
4901                 __isl_take isl_map *map,
4902                 enum isl_dim_type type1, int pos1,
4903                 enum isl_dim_type type2, int pos2);
4904         __isl_give isl_basic_map *isl_basic_map_order_ge(
4905                 __isl_take isl_basic_map *bmap,
4906                 enum isl_dim_type type1, int pos1,
4907                 enum isl_dim_type type2, int pos2);
4908         __isl_give isl_map *isl_map_order_ge(
4909                 __isl_take isl_map *map,
4910                 enum isl_dim_type type1, int pos1,
4911                 enum isl_dim_type type2, int pos2);
4912         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4913                 enum isl_dim_type type1, int pos1,
4914                 enum isl_dim_type type2, int pos2);
4915         __isl_give isl_basic_map *isl_basic_map_order_gt(
4916                 __isl_take isl_basic_map *bmap,
4917                 enum isl_dim_type type1, int pos1,
4918                 enum isl_dim_type type2, int pos2);
4919         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4920                 enum isl_dim_type type1, int pos1,
4921                 enum isl_dim_type type2, int pos2);
4923 Intersect the relation with the half-space where the given
4924 dimensions satisfy the given ordering.
4926         #include <isl/union_set.h>
4927         __isl_give isl_union_map *isl_union_map_remove_map_if(
4928                 __isl_take isl_union_map *umap,
4929                 isl_bool (*fn)(__isl_keep isl_map *map,
4930                         void *user), void *user);
4932 This function calls the callback function once for each
4933 pair of spaces for which there are elements in the input.
4934 If the callback returns C<isl_bool_true>, then all those elements
4935 are removed from the result.  The only remaining elements in the output
4936 are then those for which the callback returns C<isl_bool_false>.
4938 =item * Locus
4940         #include <isl/aff.h>
4941         __isl_give isl_basic_set *isl_aff_zero_basic_set(
4942                 __isl_take isl_aff *aff);
4943         __isl_give isl_basic_set *isl_aff_neg_basic_set(
4944                 __isl_take isl_aff *aff);
4945         __isl_give isl_set *isl_pw_aff_pos_set(
4946                 __isl_take isl_pw_aff *pa);
4947         __isl_give isl_set *isl_pw_aff_nonneg_set(
4948                 __isl_take isl_pw_aff *pwaff);
4949         __isl_give isl_set *isl_pw_aff_zero_set(
4950                 __isl_take isl_pw_aff *pwaff);
4951         __isl_give isl_set *isl_pw_aff_non_zero_set(
4952                 __isl_take isl_pw_aff *pwaff);
4953         __isl_give isl_union_set *
4954         isl_union_pw_aff_zero_union_set(
4955                 __isl_take isl_union_pw_aff *upa);
4956         __isl_give isl_union_set *
4957         isl_multi_union_pw_aff_zero_union_set(
4958                 __isl_take isl_multi_union_pw_aff *mupa);
4960 The function C<isl_aff_neg_basic_set> returns a basic set
4961 containing those elements in the domain space
4962 of C<aff> where C<aff> is negative.
4963 The function C<isl_pw_aff_nonneg_set> returns a set
4964 containing those elements in the domain
4965 of C<pwaff> where C<pwaff> is non-negative.
4966 The function C<isl_multi_union_pw_aff_zero_union_set>
4967 returns a union set containing those elements
4968 in the domains of its elements where they are all zero.
4970 =item * Identity
4972         __isl_give isl_map *isl_set_identity(
4973                 __isl_take isl_set *set);
4974         __isl_give isl_union_map *isl_union_set_identity(
4975                 __isl_take isl_union_set *uset);
4976         __isl_give isl_union_pw_multi_aff *
4977         isl_union_set_identity_union_pw_multi_aff(
4978                 __isl_take isl_union_set *uset);
4980 Construct an identity relation on the given (union) set.
4982 =item * Function Extraction
4984 A piecewise quasi affine expression that is equal to 1 on a set
4985 and 0 outside the set can be created using the following function.
4987         #include <isl/aff.h>
4988         __isl_give isl_pw_aff *isl_set_indicator_function(
4989                 __isl_take isl_set *set);
4991 A piecewise multiple quasi affine expression can be extracted
4992 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4993 and the C<isl_map> is single-valued.
4994 In case of a conversion from an C<isl_union_map>
4995 to an C<isl_union_pw_multi_aff>, these properties need to hold
4996 in each domain space.
4997 A conversion to a C<isl_multi_union_pw_aff> additionally
4998 requires that the input is non-empty and involves only a single
4999 range space.
5001         #include <isl/aff.h>
5002         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
5003                 __isl_take isl_set *set);
5004         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
5005                 __isl_take isl_map *map);
5007         __isl_give isl_union_pw_multi_aff *
5008         isl_union_pw_multi_aff_from_union_set(
5009                 __isl_take isl_union_set *uset);
5010         __isl_give isl_union_pw_multi_aff *
5011         isl_union_pw_multi_aff_from_union_map(
5012                 __isl_take isl_union_map *umap);
5014         __isl_give isl_multi_union_pw_aff *
5015         isl_multi_union_pw_aff_from_union_map(
5016                 __isl_take isl_union_map *umap);
5018 =item * Deltas
5020         __isl_give isl_basic_set *isl_basic_map_deltas(
5021                 __isl_take isl_basic_map *bmap);
5022         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
5023         __isl_give isl_union_set *isl_union_map_deltas(
5024                 __isl_take isl_union_map *umap);
5026 These functions return a (basic) set containing the differences
5027 between image elements and corresponding domain elements in the input.
5029         __isl_give isl_basic_map *isl_basic_map_deltas_map(
5030                 __isl_take isl_basic_map *bmap);
5031         __isl_give isl_map *isl_map_deltas_map(
5032                 __isl_take isl_map *map);
5033         __isl_give isl_union_map *isl_union_map_deltas_map(
5034                 __isl_take isl_union_map *umap);
5036 The functions above construct a (basic, regular or union) relation
5037 that maps (a wrapped version of) the input relation to its delta set.
5039 =item * Coalescing
5041 Simplify the representation of a set, relation or functions by trying
5042 to combine pairs of basic sets or relations into a single
5043 basic set or relation.
5045         #include <isl/set.h>
5046         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
5048         #include <isl/map.h>
5049         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
5051         #include <isl/union_set.h>
5052         __isl_give isl_union_set *isl_union_set_coalesce(
5053                 __isl_take isl_union_set *uset);
5055         #include <isl/union_map.h>
5056         __isl_give isl_union_map *isl_union_map_coalesce(
5057                 __isl_take isl_union_map *umap);
5059         #include <isl/aff.h>
5060         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
5061                 __isl_take isl_pw_aff *pwqp);
5062         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
5063                 __isl_take isl_pw_multi_aff *pma);
5064         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
5065                 __isl_take isl_multi_pw_aff *mpa);
5066         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
5067                 __isl_take isl_union_pw_aff *upa);
5068         __isl_give isl_union_pw_multi_aff *
5069         isl_union_pw_multi_aff_coalesce(
5070                 __isl_take isl_union_pw_multi_aff *upma);
5071         __isl_give isl_multi_union_pw_aff *
5072         isl_multi_union_pw_aff_coalesce(
5073                 __isl_take isl_multi_union_pw_aff *aff);
5075         #include <isl/polynomial.h>
5076         __isl_give isl_pw_qpolynomial_fold *
5077         isl_pw_qpolynomial_fold_coalesce(
5078                 __isl_take isl_pw_qpolynomial_fold *pwf);
5079         __isl_give isl_union_pw_qpolynomial *
5080         isl_union_pw_qpolynomial_coalesce(
5081                 __isl_take isl_union_pw_qpolynomial *upwqp);
5082         __isl_give isl_union_pw_qpolynomial_fold *
5083         isl_union_pw_qpolynomial_fold_coalesce(
5084                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
5086 One of the methods for combining pairs of basic sets or relations
5087 can result in coefficients that are much larger than those that appear
5088 in the constraints of the input.  By default, the coefficients are
5089 not allowed to grow larger, but this can be changed by unsetting
5090 the following option.
5092         isl_stat isl_options_set_coalesce_bounded_wrapping(
5093                 isl_ctx *ctx, int val);
5094         int isl_options_get_coalesce_bounded_wrapping(
5095                 isl_ctx *ctx);
5097 =item * Detecting equalities
5099         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
5100                 __isl_take isl_basic_set *bset);
5101         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
5102                 __isl_take isl_basic_map *bmap);
5103         __isl_give isl_set *isl_set_detect_equalities(
5104                 __isl_take isl_set *set);
5105         __isl_give isl_map *isl_map_detect_equalities(
5106                 __isl_take isl_map *map);
5107         __isl_give isl_union_set *isl_union_set_detect_equalities(
5108                 __isl_take isl_union_set *uset);
5109         __isl_give isl_union_map *isl_union_map_detect_equalities(
5110                 __isl_take isl_union_map *umap);
5112 Simplify the representation of a set or relation by detecting implicit
5113 equalities.
5115 =item * Removing redundant constraints
5117         #include <isl/set.h>
5118         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
5119                 __isl_take isl_basic_set *bset);
5120         __isl_give isl_set *isl_set_remove_redundancies(
5121                 __isl_take isl_set *set);
5123         #include <isl/union_set.h>
5124         __isl_give isl_union_set *
5125         isl_union_set_remove_redundancies(
5126                 __isl_take isl_union_set *uset);
5128         #include <isl/map.h>
5129         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
5130                 __isl_take isl_basic_map *bmap);
5131         __isl_give isl_map *isl_map_remove_redundancies(
5132                 __isl_take isl_map *map);
5134         #include <isl/union_map.h>
5135         __isl_give isl_union_map *
5136         isl_union_map_remove_redundancies(
5137                 __isl_take isl_union_map *umap);
5139 =item * Convex hull
5141         __isl_give isl_basic_set *isl_set_convex_hull(
5142                 __isl_take isl_set *set);
5143         __isl_give isl_basic_map *isl_map_convex_hull(
5144                 __isl_take isl_map *map);
5146 If the input set or relation has any existentially quantified
5147 variables, then the result of these operations is currently undefined.
5149 =item * Simple hull
5151         #include <isl/set.h>
5152         __isl_give isl_basic_set *
5153         isl_set_unshifted_simple_hull(
5154                 __isl_take isl_set *set);
5155         __isl_give isl_basic_set *isl_set_simple_hull(
5156                 __isl_take isl_set *set);
5157         __isl_give isl_basic_set *
5158         isl_set_plain_unshifted_simple_hull(
5159                 __isl_take isl_set *set);
5160         __isl_give isl_basic_set *
5161         isl_set_unshifted_simple_hull_from_set_list(
5162                 __isl_take isl_set *set,
5163                 __isl_take isl_set_list *list);
5165         #include <isl/map.h>
5166         __isl_give isl_basic_map *
5167         isl_map_unshifted_simple_hull(
5168                 __isl_take isl_map *map);
5169         __isl_give isl_basic_map *isl_map_simple_hull(
5170                 __isl_take isl_map *map);
5171         __isl_give isl_basic_map *
5172         isl_map_plain_unshifted_simple_hull(
5173                 __isl_take isl_map *map);
5174                 __isl_give isl_basic_map *
5175         isl_map_unshifted_simple_hull_from_map_list(
5176                 __isl_take isl_map *map,
5177                 __isl_take isl_map_list *list);
5179         #include <isl/union_map.h>
5180         __isl_give isl_union_map *isl_union_map_simple_hull(
5181                 __isl_take isl_union_map *umap);
5183 These functions compute a single basic set or relation
5184 that contains the whole input set or relation.
5185 In particular, the output is described by translates
5186 of the constraints describing the basic sets or relations in the input.
5187 In case of C<isl_set_unshifted_simple_hull>, only the original
5188 constraints are used, without any translation.
5189 In case of C<isl_set_plain_unshifted_simple_hull> and
5190 C<isl_map_plain_unshifted_simple_hull>, the result is described
5191 by original constraints that are obviously satisfied
5192 by the entire input set or relation.
5193 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
5194 C<isl_map_unshifted_simple_hull_from_map_list>, the
5195 constraints are taken from the elements of the second argument.
5197 =begin latex
5199 (See \autoref{s:simple hull}.)
5201 =end latex
5203 =item * Affine hull
5205         __isl_give isl_basic_set *isl_basic_set_affine_hull(
5206                 __isl_take isl_basic_set *bset);
5207         __isl_give isl_basic_set *isl_set_affine_hull(
5208                 __isl_take isl_set *set);
5209         __isl_give isl_union_set *isl_union_set_affine_hull(
5210                 __isl_take isl_union_set *uset);
5211         __isl_give isl_basic_map *isl_basic_map_affine_hull(
5212                 __isl_take isl_basic_map *bmap);
5213         __isl_give isl_basic_map *isl_map_affine_hull(
5214                 __isl_take isl_map *map);
5215         __isl_give isl_union_map *isl_union_map_affine_hull(
5216                 __isl_take isl_union_map *umap);
5218 In case of union sets and relations, the affine hull is computed
5219 per space.
5221 =item * Polyhedral hull
5223         __isl_give isl_basic_set *isl_set_polyhedral_hull(
5224                 __isl_take isl_set *set);
5225         __isl_give isl_basic_map *isl_map_polyhedral_hull(
5226                 __isl_take isl_map *map);
5227         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
5228                 __isl_take isl_union_set *uset);
5229         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
5230                 __isl_take isl_union_map *umap);
5232 These functions compute a single basic set or relation
5233 not involving any existentially quantified variables
5234 that contains the whole input set or relation.
5235 In case of union sets and relations, the polyhedral hull is computed
5236 per space.
5238 =item * Box hull
5240         #include <isl/map.h>
5241         __isl_give isl_fixed_box *
5242         isl_map_get_range_simple_fixed_box_hull(
5243                 __isl_keep isl_map *map);
5245 This function tries to approximate the range of the map by a box of fixed size.
5246 The box is described in terms of an offset living in the same space as
5247 the input map and a size living in the range space.  For any element
5248 in the input map, the range value is greater than or equal to
5249 the offset applied to the domain value and the difference with
5250 this offset is strictly smaller than the size.
5251 If no fixed-size approximation of the range can be found,
5252 an I<invalid> box is returned, i.e., one for which
5253 C<isl_fixed_box_is_valid> below returns false.
5255 The validity, the offset and the size of the box can be obtained using
5256 the following functions.
5258         #include <isl/fixed_box.h>
5259         isl_bool isl_fixed_box_is_valid(
5260                 __isl_keep isl_fixed_box *box);
5261         __isl_give isl_multi_aff *isl_fixed_box_get_offset(
5262                 __isl_keep isl_fixed_box *box);
5263         __isl_give isl_multi_val *isl_fixed_box_get_size(
5264                 __isl_keep isl_fixed_box *box);
5266 The box can be copied and freed using the following functions.
5268         #include <isl/fixed_box.h>
5269         __isl_give isl_fixed_box *isl_fixed_box_copy(
5270                 __isl_keep isl_fixed_box *box);
5271         __isl_null isl_fixed_box *isl_fixed_box_free(
5272                 __isl_take isl_fixed_box *box);
5274 =item * Other approximations
5276         #include <isl/set.h>
5277         __isl_give isl_basic_set *
5278         isl_basic_set_drop_constraints_involving_dims(
5279                 __isl_take isl_basic_set *bset,
5280                 enum isl_dim_type type,
5281                 unsigned first, unsigned n);
5282         __isl_give isl_basic_set *
5283         isl_basic_set_drop_constraints_not_involving_dims(
5284                 __isl_take isl_basic_set *bset,
5285                 enum isl_dim_type type,
5286                 unsigned first, unsigned n);
5287         __isl_give isl_set *
5288         isl_set_drop_constraints_involving_dims(
5289                 __isl_take isl_set *set,
5290                 enum isl_dim_type type,
5291                 unsigned first, unsigned n);
5292         __isl_give isl_set *
5293         isl_set_drop_constraints_not_involving_dims(
5294                 __isl_take isl_set *set,
5295                 enum isl_dim_type type,
5296                 unsigned first, unsigned n);
5298         #include <isl/map.h>
5299         __isl_give isl_basic_map *
5300         isl_basic_map_drop_constraints_involving_dims(
5301                 __isl_take isl_basic_map *bmap,
5302                 enum isl_dim_type type,
5303                 unsigned first, unsigned n);
5304         __isl_give isl_basic_map *
5305         isl_basic_map_drop_constraints_not_involving_dims(
5306                 __isl_take isl_basic_map *bmap,
5307                 enum isl_dim_type type,
5308                 unsigned first, unsigned n);
5309         __isl_give isl_map *
5310         isl_map_drop_constraints_involving_dims(
5311                 __isl_take isl_map *map,
5312                 enum isl_dim_type type,
5313                 unsigned first, unsigned n);
5314         __isl_give isl_map *
5315         isl_map_drop_constraints_not_involving_dims(
5316                 __isl_take isl_map *map,
5317                 enum isl_dim_type type,
5318                 unsigned first, unsigned n);
5320 These functions drop any constraints (not) involving the specified dimensions.
5321 Note that the result depends on the representation of the input.
5323         #include <isl/polynomial.h>
5324         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
5325                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
5326         __isl_give isl_union_pw_qpolynomial *
5327         isl_union_pw_qpolynomial_to_polynomial(
5328                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
5330 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
5331 the polynomial will be an overapproximation.  If C<sign> is negative,
5332 it will be an underapproximation.  If C<sign> is zero, the approximation
5333 will lie somewhere in between.
5335 =item * Feasibility
5337         __isl_give isl_basic_set *isl_basic_set_sample(
5338                 __isl_take isl_basic_set *bset);
5339         __isl_give isl_basic_set *isl_set_sample(
5340                 __isl_take isl_set *set);
5341         __isl_give isl_basic_map *isl_basic_map_sample(
5342                 __isl_take isl_basic_map *bmap);
5343         __isl_give isl_basic_map *isl_map_sample(
5344                 __isl_take isl_map *map);
5346 If the input (basic) set or relation is non-empty, then return
5347 a singleton subset of the input.  Otherwise, return an empty set.
5349 =item * Optimization
5351         #include <isl/ilp.h>
5352         __isl_give isl_val *isl_basic_set_max_val(
5353                 __isl_keep isl_basic_set *bset,
5354                 __isl_keep isl_aff *obj);
5355         __isl_give isl_val *isl_set_min_val(
5356                 __isl_keep isl_set *set,
5357                 __isl_keep isl_aff *obj);
5358         __isl_give isl_val *isl_set_max_val(
5359                 __isl_keep isl_set *set,
5360                 __isl_keep isl_aff *obj);
5361         __isl_give isl_multi_val *
5362         isl_union_set_min_multi_union_pw_aff(
5363                 __isl_keep isl_union_set *set,
5364                 __isl_keep isl_multi_union_pw_aff *obj);
5366 Compute the minimum or maximum of the integer affine expression C<obj>
5367 over the points in C<set>, returning the result in C<opt>.
5368 The result is C<NULL> in case of an error, the optimal value in case
5369 there is one, negative infinity or infinity if the problem is unbounded and
5370 NaN if the problem is empty.
5372         #include <isl/ilp.h>
5373         __isl_give isl_val *isl_basic_set_dim_max_val(
5374                 __isl_take isl_basic_set *bset, int pos);
5376 Return the maximal value attained by the given set dimension,
5377 independently of the parameter values and of any other dimensions.
5378 The result is C<NULL> in case of an error, the optimal value in case
5379 there is one, infinity if the problem is unbounded and
5380 NaN if the input is empty.
5382 =item * Parametric optimization
5384         __isl_give isl_pw_aff *isl_set_dim_min(
5385                 __isl_take isl_set *set, int pos);
5386         __isl_give isl_pw_aff *isl_set_dim_max(
5387                 __isl_take isl_set *set, int pos);
5388         __isl_give isl_pw_aff *isl_map_dim_min(
5389                 __isl_take isl_map *map, int pos);
5390         __isl_give isl_pw_aff *isl_map_dim_max(
5391                 __isl_take isl_map *map, int pos);
5393 Compute the minimum or maximum of the given set or output dimension
5394 as a function of the parameters (and input dimensions), but independently
5395 of the other set or output dimensions.
5396 For lexicographic optimization, see L<"Lexicographic Optimization">.
5398 =item * Dual
5400 The following functions compute either the set of (rational) coefficient
5401 values of valid constraints for the given set or the set of (rational)
5402 values satisfying the constraints with coefficients from the given set.
5403 Internally, these two sets of functions perform essentially the
5404 same operations, except that the set of coefficients is assumed to
5405 be a cone, while the set of values may be any polyhedron.
5406 The current implementation is based on the Farkas lemma and
5407 Fourier-Motzkin elimination, but this may change or be made optional
5408 in future.  In particular, future implementations may use different
5409 dualization algorithms or skip the elimination step.
5411         #include <isl/set.h>
5412         __isl_give isl_basic_set *isl_basic_set_coefficients(
5413                 __isl_take isl_basic_set *bset);
5414         __isl_give isl_basic_set_list *
5415         isl_basic_set_list_coefficients(
5416                 __isl_take isl_basic_set_list *list);
5417         __isl_give isl_basic_set *isl_set_coefficients(
5418                 __isl_take isl_set *set);
5419         __isl_give isl_union_set *isl_union_set_coefficients(
5420                 __isl_take isl_union_set *bset);
5421         __isl_give isl_basic_set *isl_basic_set_solutions(
5422                 __isl_take isl_basic_set *bset);
5423         __isl_give isl_basic_set *isl_set_solutions(
5424                 __isl_take isl_set *set);
5425         __isl_give isl_union_set *isl_union_set_solutions(
5426                 __isl_take isl_union_set *bset);
5428 =item * Power
5430         __isl_give isl_map *isl_map_fixed_power_val(
5431                 __isl_take isl_map *map,
5432                 __isl_take isl_val *exp);
5433         __isl_give isl_union_map *
5434         isl_union_map_fixed_power_val(
5435                 __isl_take isl_union_map *umap,
5436                 __isl_take isl_val *exp);
5438 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
5439 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
5440 of C<map> is computed.
5442         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
5443                 int *exact);
5444         __isl_give isl_union_map *isl_union_map_power(
5445                 __isl_take isl_union_map *umap, int *exact);
5447 Compute a parametric representation for all positive powers I<k> of C<map>.
5448 The result maps I<k> to a nested relation corresponding to the
5449 I<k>th power of C<map>.
5450 The result may be an overapproximation.  If the result is known to be exact,
5451 then C<*exact> is set to C<1>.
5453 =item * Transitive closure
5455         __isl_give isl_map *isl_map_transitive_closure(
5456                 __isl_take isl_map *map, int *exact);
5457         __isl_give isl_union_map *isl_union_map_transitive_closure(
5458                 __isl_take isl_union_map *umap, int *exact);
5460 Compute the transitive closure of C<map>.
5461 The result may be an overapproximation.  If the result is known to be exact,
5462 then C<*exact> is set to C<1>.
5464 =item * Reaching path lengths
5466         __isl_give isl_map *isl_map_reaching_path_lengths(
5467                 __isl_take isl_map *map, int *exact);
5469 Compute a relation that maps each element in the range of C<map>
5470 to the lengths of all paths composed of edges in C<map> that
5471 end up in the given element.
5472 The result may be an overapproximation.  If the result is known to be exact,
5473 then C<*exact> is set to C<1>.
5474 To compute the I<maximal> path length, the resulting relation
5475 should be postprocessed by C<isl_map_lexmax>.
5476 In particular, if the input relation is a dependence relation
5477 (mapping sources to sinks), then the maximal path length corresponds
5478 to the free schedule.
5479 Note, however, that C<isl_map_lexmax> expects the maximum to be
5480 finite, so if the path lengths are unbounded (possibly due to
5481 the overapproximation), then you will get an error message.
5483 =item * Wrapping
5485         #include <isl/space.h>
5486         __isl_give isl_space *isl_space_wrap(
5487                 __isl_take isl_space *space);
5488         __isl_give isl_space *isl_space_unwrap(
5489                 __isl_take isl_space *space);
5491         #include <isl/local_space.h>
5492         __isl_give isl_local_space *isl_local_space_wrap(
5493                 __isl_take isl_local_space *ls);
5495         #include <isl/set.h>
5496         __isl_give isl_basic_map *isl_basic_set_unwrap(
5497                 __isl_take isl_basic_set *bset);
5498         __isl_give isl_map *isl_set_unwrap(
5499                 __isl_take isl_set *set);
5501         #include <isl/map.h>
5502         __isl_give isl_basic_set *isl_basic_map_wrap(
5503                 __isl_take isl_basic_map *bmap);
5504         __isl_give isl_set *isl_map_wrap(
5505                 __isl_take isl_map *map);
5507         #include <isl/union_set.h>
5508         __isl_give isl_union_map *isl_union_set_unwrap(
5509                 __isl_take isl_union_set *uset);
5511         #include <isl/union_map.h>
5512         __isl_give isl_union_set *isl_union_map_wrap(
5513                 __isl_take isl_union_map *umap);
5515 The input to C<isl_space_unwrap> should
5516 be the space of a set, while that of
5517 C<isl_space_wrap> should be the space of a relation.
5518 Conversely, the output of C<isl_space_unwrap> is the space
5519 of a relation, while that of C<isl_space_wrap> is the space of a set.
5521 =item * Flattening
5523 Remove any internal structure of domain (and range) of the given
5524 set or relation.  If there is any such internal structure in the input,
5525 then the name of the space is also removed.
5527         #include <isl/space.h>
5528         __isl_give isl_space *isl_space_flatten_domain(
5529                 __isl_take isl_space *space);
5530         __isl_give isl_space *isl_space_flatten_range(
5531                 __isl_take isl_space *space);
5533         #include <isl/local_space.h>
5534         __isl_give isl_local_space *
5535         isl_local_space_flatten_domain(
5536                 __isl_take isl_local_space *ls);
5537         __isl_give isl_local_space *
5538         isl_local_space_flatten_range(
5539                 __isl_take isl_local_space *ls);
5541         #include <isl/set.h>
5542         __isl_give isl_basic_set *isl_basic_set_flatten(
5543                 __isl_take isl_basic_set *bset);
5544         __isl_give isl_set *isl_set_flatten(
5545                 __isl_take isl_set *set);
5547         #include <isl/map.h>
5548         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
5549                 __isl_take isl_basic_map *bmap);
5550         __isl_give isl_basic_map *isl_basic_map_flatten_range(
5551                 __isl_take isl_basic_map *bmap);
5552         __isl_give isl_map *isl_map_flatten_range(
5553                 __isl_take isl_map *map);
5554         __isl_give isl_map *isl_map_flatten_domain(
5555                 __isl_take isl_map *map);
5556         __isl_give isl_basic_map *isl_basic_map_flatten(
5557                 __isl_take isl_basic_map *bmap);
5558         __isl_give isl_map *isl_map_flatten(
5559                 __isl_take isl_map *map);
5561         #include <isl/val.h>
5562         __isl_give isl_multi_val *isl_multi_val_flatten_range(
5563                 __isl_take isl_multi_val *mv);
5565         #include <isl/aff.h>
5566         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5567                 __isl_take isl_multi_aff *ma);
5568         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5569                 __isl_take isl_multi_aff *ma);
5570         __isl_give isl_multi_pw_aff *
5571         isl_multi_pw_aff_flatten_range(
5572                 __isl_take isl_multi_pw_aff *mpa);
5573         __isl_give isl_multi_union_pw_aff *
5574         isl_multi_union_pw_aff_flatten_range(
5575                 __isl_take isl_multi_union_pw_aff *mupa);
5577         #include <isl/map.h>
5578         __isl_give isl_map *isl_set_flatten_map(
5579                 __isl_take isl_set *set);
5581 The function above constructs a relation
5582 that maps the input set to a flattened version of the set.
5584 =item * Lifting
5586 Lift the input set to a space with extra dimensions corresponding
5587 to the existentially quantified variables in the input.
5588 In particular, the result lives in a wrapped map where the domain
5589 is the original space and the range corresponds to the original
5590 existentially quantified variables.
5592         #include <isl/set.h>
5593         __isl_give isl_basic_set *isl_basic_set_lift(
5594                 __isl_take isl_basic_set *bset);
5595         __isl_give isl_set *isl_set_lift(
5596                 __isl_take isl_set *set);
5597         __isl_give isl_union_set *isl_union_set_lift(
5598                 __isl_take isl_union_set *uset);
5600 Given a local space that contains the existentially quantified
5601 variables of a set, a basic relation that, when applied to
5602 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
5603 can be constructed using the following function.
5605         #include <isl/local_space.h>
5606         __isl_give isl_basic_map *isl_local_space_lifting(
5607                 __isl_take isl_local_space *ls);
5609         #include <isl/aff.h>
5610         __isl_give isl_multi_aff *isl_multi_aff_lift(
5611                 __isl_take isl_multi_aff *maff,
5612                 __isl_give isl_local_space **ls);
5614 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
5615 then it is assigned the local space that lies at the basis of
5616 the lifting applied.
5618 =item * Internal Product
5620         #include <isl/space.h>
5621         __isl_give isl_space *isl_space_zip(
5622                 __isl_take isl_space *space);
5624         #include <isl/map.h>
5625         __isl_give isl_basic_map *isl_basic_map_zip(
5626                 __isl_take isl_basic_map *bmap);
5627         __isl_give isl_map *isl_map_zip(
5628                 __isl_take isl_map *map);
5630         #include <isl/union_map.h>
5631         __isl_give isl_union_map *isl_union_map_zip(
5632                 __isl_take isl_union_map *umap);
5634 Given a relation with nested relations for domain and range,
5635 interchange the range of the domain with the domain of the range.
5637 =item * Currying
5639         #include <isl/space.h>
5640         __isl_give isl_space *isl_space_curry(
5641                 __isl_take isl_space *space);
5642         __isl_give isl_space *isl_space_uncurry(
5643                 __isl_take isl_space *space);
5645         #include <isl/map.h>
5646         __isl_give isl_basic_map *isl_basic_map_curry(
5647                 __isl_take isl_basic_map *bmap);
5648         __isl_give isl_basic_map *isl_basic_map_uncurry(
5649                 __isl_take isl_basic_map *bmap);
5650         __isl_give isl_map *isl_map_curry(
5651                 __isl_take isl_map *map);
5652         __isl_give isl_map *isl_map_uncurry(
5653                 __isl_take isl_map *map);
5655         #include <isl/union_map.h>
5656         __isl_give isl_union_map *isl_union_map_curry(
5657                 __isl_take isl_union_map *umap);
5658         __isl_give isl_union_map *isl_union_map_uncurry(
5659                 __isl_take isl_union_map *umap);
5661 Given a relation with a nested relation for domain,
5662 the C<curry> functions
5663 move the range of the nested relation out of the domain
5664 and use it as the domain of a nested relation in the range,
5665 with the original range as range of this nested relation.
5666 The C<uncurry> functions perform the inverse operation.
5668         #include <isl/space.h>
5669         __isl_give isl_space *isl_space_range_curry(
5670                 __isl_take isl_space *space);
5672         #include <isl/map.h>
5673         __isl_give isl_map *isl_map_range_curry(
5674                 __isl_take isl_map *map);
5676         #include <isl/union_map.h>
5677         __isl_give isl_union_map *isl_union_map_range_curry(
5678                 __isl_take isl_union_map *umap);
5680 These functions apply the currying to the relation that
5681 is nested inside the range of the input.
5683 =item * Aligning parameters
5685 Change the order of the parameters of the given set, relation
5686 or function
5687 such that the first parameters match those of C<model>.
5688 This may involve the introduction of extra parameters.
5689 All parameters need to be named.
5691         #include <isl/space.h>
5692         __isl_give isl_space *isl_space_align_params(
5693                 __isl_take isl_space *space1,
5694                 __isl_take isl_space *space2)
5696         #include <isl/set.h>
5697         __isl_give isl_basic_set *isl_basic_set_align_params(
5698                 __isl_take isl_basic_set *bset,
5699                 __isl_take isl_space *model);
5700         __isl_give isl_set *isl_set_align_params(
5701                 __isl_take isl_set *set,
5702                 __isl_take isl_space *model);
5704         #include <isl/map.h>
5705         __isl_give isl_basic_map *isl_basic_map_align_params(
5706                 __isl_take isl_basic_map *bmap,
5707                 __isl_take isl_space *model);
5708         __isl_give isl_map *isl_map_align_params(
5709                 __isl_take isl_map *map,
5710                 __isl_take isl_space *model);
5712         #include <isl/val.h>
5713         __isl_give isl_multi_val *isl_multi_val_align_params(
5714                 __isl_take isl_multi_val *mv,
5715                 __isl_take isl_space *model);
5717         #include <isl/aff.h>
5718         __isl_give isl_aff *isl_aff_align_params(
5719                 __isl_take isl_aff *aff,
5720                 __isl_take isl_space *model);
5721         __isl_give isl_multi_aff *isl_multi_aff_align_params(
5722                 __isl_take isl_multi_aff *multi,
5723                 __isl_take isl_space *model);
5724         __isl_give isl_pw_aff *isl_pw_aff_align_params(
5725                 __isl_take isl_pw_aff *pwaff,
5726                 __isl_take isl_space *model);
5727         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5728                 __isl_take isl_pw_multi_aff *pma,
5729                 __isl_take isl_space *model);
5730         __isl_give isl_union_pw_aff *
5731         isl_union_pw_aff_align_params(
5732                 __isl_take isl_union_pw_aff *upa,
5733                 __isl_take isl_space *model);
5734         __isl_give isl_union_pw_multi_aff *
5735         isl_union_pw_multi_aff_align_params(
5736                 __isl_take isl_union_pw_multi_aff *upma,
5737                 __isl_take isl_space *model);
5738         __isl_give isl_multi_union_pw_aff *
5739         isl_multi_union_pw_aff_align_params(
5740                 __isl_take isl_multi_union_pw_aff *mupa,
5741                 __isl_take isl_space *model);
5743         #include <isl/polynomial.h>
5744         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5745                 __isl_take isl_qpolynomial *qp,
5746                 __isl_take isl_space *model);
5748 =item * Drop unused parameters
5750 Drop parameters that are not referenced by the isl object.
5751 All parameters need to be named.
5753         #include <isl/set.h>
5754         __isl_give isl_basic_set *
5755         isl_basic_set_drop_unused_params(
5756                 __isl_take isl_basic_set *bset);
5757         __isl_give isl_set *isl_set_drop_unused_params(
5758                 __isl_take isl_set *set);
5760         #include <isl/map.h>
5761         __isl_give isl_basic_map *
5762         isl_basic_map_drop_unused_params(
5763                 __isl_take isl_basic_map *bmap);
5764         __isl_give isl_map *isl_map_drop_unused_params(
5765                 __isl_take isl_map *map);
5767         #include <isl/aff.h>
5768         __isl_give isl_pw_aff *isl_pw_aff_drop_unused_params(
5769                 __isl_take isl_pw_aff *pa);
5770         __isl_give isl_pw_multi_aff *
5771         isl_pw_multi_aff_drop_unused_params(
5772                 __isl_take isl_pw_multi_aff *pma);
5774         #include <isl/polynomial.h>
5775         __isl_give isl_pw_qpolynomial *
5776         isl_pw_qpolynomial_drop_unused_params(
5777                 __isl_take isl_pw_qpolynomial *pwqp);
5778         __isl_give isl_pw_qpolynomial_fold *
5779         isl_pw_qpolynomial_fold_drop_unused_params(
5780                 __isl_take isl_pw_qpolynomial_fold *pwf);
5782 =item * Unary Arithmetic Operations
5784         #include <isl/set.h>
5785         __isl_give isl_set *isl_set_neg(
5786                 __isl_take isl_set *set);
5787         #include <isl/map.h>
5788         __isl_give isl_map *isl_map_neg(
5789                 __isl_take isl_map *map);
5791 C<isl_set_neg> constructs a set containing the opposites of
5792 the elements in its argument.
5793 The domain of the result of C<isl_map_neg> is the same
5794 as the domain of its argument.  The corresponding range
5795 elements are the opposites of the corresponding range
5796 elements in the argument.
5798         #include <isl/val.h>
5799         __isl_give isl_multi_val *isl_multi_val_neg(
5800                 __isl_take isl_multi_val *mv);
5802         #include <isl/aff.h>
5803         __isl_give isl_aff *isl_aff_neg(
5804                 __isl_take isl_aff *aff);
5805         __isl_give isl_multi_aff *isl_multi_aff_neg(
5806                 __isl_take isl_multi_aff *ma);
5807         __isl_give isl_pw_aff *isl_pw_aff_neg(
5808                 __isl_take isl_pw_aff *pwaff);
5809         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5810                 __isl_take isl_pw_multi_aff *pma);
5811         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5812                 __isl_take isl_multi_pw_aff *mpa);
5813         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5814                 __isl_take isl_union_pw_aff *upa);
5815         __isl_give isl_union_pw_multi_aff *
5816         isl_union_pw_multi_aff_neg(
5817                 __isl_take isl_union_pw_multi_aff *upma);
5818         __isl_give isl_multi_union_pw_aff *
5819         isl_multi_union_pw_aff_neg(
5820                 __isl_take isl_multi_union_pw_aff *mupa);
5821         __isl_give isl_aff *isl_aff_ceil(
5822                 __isl_take isl_aff *aff);
5823         __isl_give isl_pw_aff *isl_pw_aff_ceil(
5824                 __isl_take isl_pw_aff *pwaff);
5825         __isl_give isl_aff *isl_aff_floor(
5826                 __isl_take isl_aff *aff);
5827         __isl_give isl_multi_aff *isl_multi_aff_floor(
5828                 __isl_take isl_multi_aff *ma);
5829         __isl_give isl_pw_aff *isl_pw_aff_floor(
5830                 __isl_take isl_pw_aff *pwaff);
5831         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5832                 __isl_take isl_union_pw_aff *upa);
5833         __isl_give isl_multi_union_pw_aff *
5834         isl_multi_union_pw_aff_floor(
5835                 __isl_take isl_multi_union_pw_aff *mupa);
5837         #include <isl/aff.h>
5838         __isl_give isl_pw_aff *isl_pw_aff_list_min(
5839                 __isl_take isl_pw_aff_list *list);
5840         __isl_give isl_pw_aff *isl_pw_aff_list_max(
5841                 __isl_take isl_pw_aff_list *list);
5843         #include <isl/polynomial.h>
5844         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5845                 __isl_take isl_qpolynomial *qp);
5846         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5847                 __isl_take isl_pw_qpolynomial *pwqp);
5848         __isl_give isl_union_pw_qpolynomial *
5849         isl_union_pw_qpolynomial_neg(
5850                 __isl_take isl_union_pw_qpolynomial *upwqp);
5851         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5852                 __isl_take isl_qpolynomial *qp,
5853                 unsigned exponent);
5854         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5855                 __isl_take isl_pw_qpolynomial *pwqp,
5856                 unsigned exponent);
5858 =item * Evaluation
5860 The following functions evaluate a function in a point.
5862         #include <isl/aff.h>
5863         __isl_give isl_val *isl_aff_eval(
5864                 __isl_take isl_aff *aff,
5865                 __isl_take isl_point *pnt);
5866         __isl_give isl_val *isl_pw_aff_eval(
5867                 __isl_take isl_pw_aff *pa,
5868                 __isl_take isl_point *pnt);
5870         #include <isl/polynomial.h>
5871         __isl_give isl_val *isl_pw_qpolynomial_eval(
5872                 __isl_take isl_pw_qpolynomial *pwqp,
5873                 __isl_take isl_point *pnt);
5874         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5875                 __isl_take isl_pw_qpolynomial_fold *pwf,
5876                 __isl_take isl_point *pnt);
5877         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5878                 __isl_take isl_union_pw_qpolynomial *upwqp,
5879                 __isl_take isl_point *pnt);
5880         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5881                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5882                 __isl_take isl_point *pnt);
5884 These functions return NaN when evaluated at a void point.
5885 Note that C<isl_pw_aff_eval> returns NaN when the function is evaluated outside
5886 its definition domain, while C<isl_pw_qpolynomial_eval> returns zero
5887 when the function is evaluated outside its explicit domain.
5889 =item * Dimension manipulation
5891 It is usually not advisable to directly change the (input or output)
5892 space of a set or a relation as this removes the name and the internal
5893 structure of the space.  However, the functions below can be useful
5894 to add new parameters, assuming
5895 C<isl_set_align_params> and C<isl_map_align_params>
5896 are not sufficient.
5898         #include <isl/space.h>
5899         __isl_give isl_space *isl_space_add_dims(
5900                 __isl_take isl_space *space,
5901                 enum isl_dim_type type, unsigned n);
5902         __isl_give isl_space *isl_space_insert_dims(
5903                 __isl_take isl_space *space,
5904                 enum isl_dim_type type, unsigned pos, unsigned n);
5905         __isl_give isl_space *isl_space_drop_dims(
5906                 __isl_take isl_space *space,
5907                 enum isl_dim_type type, unsigned first, unsigned n);
5908         __isl_give isl_space *isl_space_move_dims(
5909                 __isl_take isl_space *space,
5910                 enum isl_dim_type dst_type, unsigned dst_pos,
5911                 enum isl_dim_type src_type, unsigned src_pos,
5912                 unsigned n);
5914         #include <isl/local_space.h>
5915         __isl_give isl_local_space *isl_local_space_add_dims(
5916                 __isl_take isl_local_space *ls,
5917                 enum isl_dim_type type, unsigned n);
5918         __isl_give isl_local_space *isl_local_space_insert_dims(
5919                 __isl_take isl_local_space *ls,
5920                 enum isl_dim_type type, unsigned first, unsigned n);
5921         __isl_give isl_local_space *isl_local_space_drop_dims(
5922                 __isl_take isl_local_space *ls,
5923                 enum isl_dim_type type, unsigned first, unsigned n);
5925         #include <isl/set.h>
5926         __isl_give isl_basic_set *isl_basic_set_add_dims(
5927                 __isl_take isl_basic_set *bset,
5928                 enum isl_dim_type type, unsigned n);
5929         __isl_give isl_set *isl_set_add_dims(
5930                 __isl_take isl_set *set,
5931                 enum isl_dim_type type, unsigned n);
5932         __isl_give isl_basic_set *isl_basic_set_insert_dims(
5933                 __isl_take isl_basic_set *bset,
5934                 enum isl_dim_type type, unsigned pos,
5935                 unsigned n);
5936         __isl_give isl_set *isl_set_insert_dims(
5937                 __isl_take isl_set *set,
5938                 enum isl_dim_type type, unsigned pos, unsigned n);
5939         __isl_give isl_basic_set *isl_basic_set_move_dims(
5940                 __isl_take isl_basic_set *bset,
5941                 enum isl_dim_type dst_type, unsigned dst_pos,
5942                 enum isl_dim_type src_type, unsigned src_pos,
5943                 unsigned n);
5944         __isl_give isl_set *isl_set_move_dims(
5945                 __isl_take isl_set *set,
5946                 enum isl_dim_type dst_type, unsigned dst_pos,
5947                 enum isl_dim_type src_type, unsigned src_pos,
5948                 unsigned n);
5950         #include <isl/map.h>
5951         __isl_give isl_basic_map *isl_basic_map_add_dims(
5952                 __isl_take isl_basic_map *bmap,
5953                 enum isl_dim_type type, unsigned n);
5954         __isl_give isl_map *isl_map_add_dims(
5955                 __isl_take isl_map *map,
5956                 enum isl_dim_type type, unsigned n);
5957         __isl_give isl_basic_map *isl_basic_map_insert_dims(
5958                 __isl_take isl_basic_map *bmap,
5959                 enum isl_dim_type type, unsigned pos,
5960                 unsigned n);
5961         __isl_give isl_map *isl_map_insert_dims(
5962                 __isl_take isl_map *map,
5963                 enum isl_dim_type type, unsigned pos, unsigned n);
5964         __isl_give isl_basic_map *isl_basic_map_move_dims(
5965                 __isl_take isl_basic_map *bmap,
5966                 enum isl_dim_type dst_type, unsigned dst_pos,
5967                 enum isl_dim_type src_type, unsigned src_pos,
5968                 unsigned n);
5969         __isl_give isl_map *isl_map_move_dims(
5970                 __isl_take isl_map *map,
5971                 enum isl_dim_type dst_type, unsigned dst_pos,
5972                 enum isl_dim_type src_type, unsigned src_pos,
5973                 unsigned n);
5975         #include <isl/val.h>
5976         __isl_give isl_multi_val *isl_multi_val_insert_dims(
5977                 __isl_take isl_multi_val *mv,
5978                 enum isl_dim_type type, unsigned first, unsigned n);
5979         __isl_give isl_multi_val *isl_multi_val_add_dims(
5980                 __isl_take isl_multi_val *mv,
5981                 enum isl_dim_type type, unsigned n);
5982         __isl_give isl_multi_val *isl_multi_val_drop_dims(
5983                 __isl_take isl_multi_val *mv,
5984                 enum isl_dim_type type, unsigned first, unsigned n);
5986         #include <isl/aff.h>
5987         __isl_give isl_aff *isl_aff_insert_dims(
5988                 __isl_take isl_aff *aff,
5989                 enum isl_dim_type type, unsigned first, unsigned n);
5990         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5991                 __isl_take isl_multi_aff *ma,
5992                 enum isl_dim_type type, unsigned first, unsigned n);
5993         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5994                 __isl_take isl_pw_aff *pwaff,
5995                 enum isl_dim_type type, unsigned first, unsigned n);
5996         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5997                 __isl_take isl_multi_pw_aff *mpa,
5998                 enum isl_dim_type type, unsigned first, unsigned n);
5999         __isl_give isl_aff *isl_aff_add_dims(
6000                 __isl_take isl_aff *aff,
6001                 enum isl_dim_type type, unsigned n);
6002         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
6003                 __isl_take isl_multi_aff *ma,
6004                 enum isl_dim_type type, unsigned n);
6005         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
6006                 __isl_take isl_pw_aff *pwaff,
6007                 enum isl_dim_type type, unsigned n);
6008         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
6009                 __isl_take isl_multi_pw_aff *mpa,
6010                 enum isl_dim_type type, unsigned n);
6011         __isl_give isl_aff *isl_aff_drop_dims(
6012                 __isl_take isl_aff *aff,
6013                 enum isl_dim_type type, unsigned first, unsigned n);
6014         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
6015                 __isl_take isl_multi_aff *maff,
6016                 enum isl_dim_type type, unsigned first, unsigned n);
6017         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
6018                 __isl_take isl_pw_aff *pwaff,
6019                 enum isl_dim_type type, unsigned first, unsigned n);
6020         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
6021                 __isl_take isl_pw_multi_aff *pma,
6022                 enum isl_dim_type type, unsigned first, unsigned n);
6023         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
6024                 __isl_take isl_union_pw_aff *upa,
6025                 enum isl_dim_type type, unsigned first, unsigned n);
6026         __isl_give isl_union_pw_multi_aff *
6027                 isl_union_pw_multi_aff_drop_dims(
6028                 __isl_take isl_union_pw_multi_aff *upma,
6029                 enum isl_dim_type type,
6030                 unsigned first, unsigned n);
6031         __isl_give isl_multi_union_pw_aff *
6032         isl_multi_union_pw_aff_drop_dims(
6033                 __isl_take isl_multi_union_pw_aff *mupa,
6034                 enum isl_dim_type type, unsigned first,
6035                 unsigned n);
6036         __isl_give isl_aff *isl_aff_move_dims(
6037                 __isl_take isl_aff *aff,
6038                 enum isl_dim_type dst_type, unsigned dst_pos,
6039                 enum isl_dim_type src_type, unsigned src_pos,
6040                 unsigned n);
6041         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
6042                 __isl_take isl_multi_aff *ma,
6043                 enum isl_dim_type dst_type, unsigned dst_pos,
6044                 enum isl_dim_type src_type, unsigned src_pos,
6045                 unsigned n);
6046         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
6047                 __isl_take isl_pw_aff *pa,
6048                 enum isl_dim_type dst_type, unsigned dst_pos,
6049                 enum isl_dim_type src_type, unsigned src_pos,
6050                 unsigned n);
6051         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
6052                 __isl_take isl_multi_pw_aff *pma,
6053                 enum isl_dim_type dst_type, unsigned dst_pos,
6054                 enum isl_dim_type src_type, unsigned src_pos,
6055                 unsigned n);
6057         #include <isl/polynomial.h>
6058         __isl_give isl_union_pw_qpolynomial *
6059         isl_union_pw_qpolynomial_drop_dims(
6060                 __isl_take isl_union_pw_qpolynomial *upwqp,
6061                 enum isl_dim_type type,
6062                 unsigned first, unsigned n);
6063         __isl_give isl_union_pw_qpolynomial_fold *
6064                 isl_union_pw_qpolynomial_fold_drop_dims(
6065                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6066                 enum isl_dim_type type,
6067                 unsigned first, unsigned n);
6069 The operations on union expressions can only manipulate parameters.
6071 =back
6073 =head2 Binary Operations
6075 The two arguments of a binary operation not only need to live
6076 in the same C<isl_ctx>, they currently also need to have
6077 the same (number of) parameters.
6079 =head3 Basic Operations
6081 =over
6083 =item * Intersection
6085         #include <isl/local_space.h>
6086         __isl_give isl_local_space *isl_local_space_intersect(
6087                 __isl_take isl_local_space *ls1,
6088                 __isl_take isl_local_space *ls2);
6090         #include <isl/set.h>
6091         __isl_give isl_basic_set *isl_basic_set_intersect_params(
6092                 __isl_take isl_basic_set *bset1,
6093                 __isl_take isl_basic_set *bset2);
6094         __isl_give isl_basic_set *isl_basic_set_intersect(
6095                 __isl_take isl_basic_set *bset1,
6096                 __isl_take isl_basic_set *bset2);
6097         __isl_give isl_basic_set *isl_basic_set_list_intersect(
6098                 __isl_take struct isl_basic_set_list *list);
6099         __isl_give isl_set *isl_set_intersect_params(
6100                 __isl_take isl_set *set,
6101                 __isl_take isl_set *params);
6102         __isl_give isl_set *isl_set_intersect(
6103                 __isl_take isl_set *set1,
6104                 __isl_take isl_set *set2);
6106         #include <isl/map.h>
6107         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
6108                 __isl_take isl_basic_map *bmap,
6109                 __isl_take isl_basic_set *bset);
6110         __isl_give isl_basic_map *isl_basic_map_intersect_range(
6111                 __isl_take isl_basic_map *bmap,
6112                 __isl_take isl_basic_set *bset);
6113         __isl_give isl_basic_map *isl_basic_map_intersect(
6114                 __isl_take isl_basic_map *bmap1,
6115                 __isl_take isl_basic_map *bmap2);
6116         __isl_give isl_basic_map *isl_basic_map_list_intersect(
6117                 __isl_take isl_basic_map_list *list);
6118         __isl_give isl_map *isl_map_intersect_params(
6119                 __isl_take isl_map *map,
6120                 __isl_take isl_set *params);
6121         __isl_give isl_map *isl_map_intersect_domain(
6122                 __isl_take isl_map *map,
6123                 __isl_take isl_set *set);
6124         __isl_give isl_map *isl_map_intersect_range(
6125                 __isl_take isl_map *map,
6126                 __isl_take isl_set *set);
6127         __isl_give isl_map *isl_map_intersect(
6128                 __isl_take isl_map *map1,
6129                 __isl_take isl_map *map2);
6130         __isl_give isl_map *
6131         isl_map_intersect_domain_factor_range(
6132                 __isl_take isl_map *map,
6133                 __isl_take isl_map *factor);
6134         __isl_give isl_map *
6135         isl_map_intersect_range_factor_range(
6136                 __isl_take isl_map *map,
6137                 __isl_take isl_map *factor);
6139         #include <isl/union_set.h>
6140         __isl_give isl_union_set *isl_union_set_intersect_params(
6141                 __isl_take isl_union_set *uset,
6142                 __isl_take isl_set *set);
6143         __isl_give isl_union_set *isl_union_set_intersect(
6144                 __isl_take isl_union_set *uset1,
6145                 __isl_take isl_union_set *uset2);
6147         #include <isl/union_map.h>
6148         __isl_give isl_union_map *isl_union_map_intersect_params(
6149                 __isl_take isl_union_map *umap,
6150                 __isl_take isl_set *set);
6151         __isl_give isl_union_map *isl_union_map_intersect_domain(
6152                 __isl_take isl_union_map *umap,
6153                 __isl_take isl_union_set *uset);
6154         __isl_give isl_union_map *isl_union_map_intersect_range(
6155                 __isl_take isl_union_map *umap,
6156                 __isl_take isl_union_set *uset);
6157         __isl_give isl_union_map *isl_union_map_intersect(
6158                 __isl_take isl_union_map *umap1,
6159                 __isl_take isl_union_map *umap2);
6160         __isl_give isl_union_map *
6161         isl_union_map_intersect_range_factor_range(
6162                 __isl_take isl_union_map *umap,
6163                 __isl_take isl_union_map *factor);
6165         #include <isl/aff.h>
6166         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
6167                 __isl_take isl_pw_aff *pa,
6168                 __isl_take isl_set *set);
6169         __isl_give isl_multi_pw_aff *
6170         isl_multi_pw_aff_intersect_domain(
6171                 __isl_take isl_multi_pw_aff *mpa,
6172                 __isl_take isl_set *domain);
6173         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
6174                 __isl_take isl_pw_multi_aff *pma,
6175                 __isl_take isl_set *set);
6176         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
6177                 __isl_take isl_union_pw_aff *upa,
6178                 __isl_take isl_union_set *uset);
6179         __isl_give isl_union_pw_multi_aff *
6180         isl_union_pw_multi_aff_intersect_domain(
6181                 __isl_take isl_union_pw_multi_aff *upma,
6182                 __isl_take isl_union_set *uset);
6183         __isl_give isl_multi_union_pw_aff *
6184         isl_multi_union_pw_aff_intersect_domain(
6185                 __isl_take isl_multi_union_pw_aff *mupa,
6186                 __isl_take isl_union_set *uset);
6187         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
6188                 __isl_take isl_pw_aff *pa,
6189                 __isl_take isl_set *set);
6190         __isl_give isl_multi_pw_aff *
6191         isl_multi_pw_aff_intersect_params(
6192                 __isl_take isl_multi_pw_aff *mpa,
6193                 __isl_take isl_set *set);
6194         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
6195                 __isl_take isl_pw_multi_aff *pma,
6196                 __isl_take isl_set *set);
6197         __isl_give isl_union_pw_aff *
6198         isl_union_pw_aff_intersect_params(
6199                 __isl_take isl_union_pw_aff *upa,
6200         __isl_give isl_union_pw_multi_aff *
6201         isl_union_pw_multi_aff_intersect_params(
6202                 __isl_take isl_union_pw_multi_aff *upma,
6203                 __isl_take isl_set *set);
6204         __isl_give isl_multi_union_pw_aff *
6205         isl_multi_union_pw_aff_intersect_params(
6206                 __isl_take isl_multi_union_pw_aff *mupa,
6207                 __isl_take isl_set *params);
6208         isl_multi_union_pw_aff_intersect_range(
6209                 __isl_take isl_multi_union_pw_aff *mupa,
6210                 __isl_take isl_set *set);
6212         #include <isl/polynomial.h>
6213         __isl_give isl_pw_qpolynomial *
6214         isl_pw_qpolynomial_intersect_domain(
6215                 __isl_take isl_pw_qpolynomial *pwpq,
6216                 __isl_take isl_set *set);
6217         __isl_give isl_union_pw_qpolynomial *
6218         isl_union_pw_qpolynomial_intersect_domain(
6219                 __isl_take isl_union_pw_qpolynomial *upwpq,
6220                 __isl_take isl_union_set *uset);
6221         __isl_give isl_union_pw_qpolynomial_fold *
6222         isl_union_pw_qpolynomial_fold_intersect_domain(
6223                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6224                 __isl_take isl_union_set *uset);
6225         __isl_give isl_pw_qpolynomial *
6226         isl_pw_qpolynomial_intersect_params(
6227                 __isl_take isl_pw_qpolynomial *pwpq,
6228                 __isl_take isl_set *set);
6229         __isl_give isl_pw_qpolynomial_fold *
6230         isl_pw_qpolynomial_fold_intersect_params(
6231                 __isl_take isl_pw_qpolynomial_fold *pwf,
6232                 __isl_take isl_set *set);
6233         __isl_give isl_union_pw_qpolynomial *
6234         isl_union_pw_qpolynomial_intersect_params(
6235                 __isl_take isl_union_pw_qpolynomial *upwpq,
6236                 __isl_take isl_set *set);
6237         __isl_give isl_union_pw_qpolynomial_fold *
6238         isl_union_pw_qpolynomial_fold_intersect_params(
6239                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6240                 __isl_take isl_set *set);
6242 The second argument to the C<_params> functions needs to be
6243 a parametric (basic) set.  For the other functions, a parametric set
6244 for either argument is only allowed if the other argument is
6245 a parametric set as well.
6246 The list passed to C<isl_basic_set_list_intersect> needs to have
6247 at least one element and all elements need to live in the same space.
6248 The function C<isl_multi_union_pw_aff_intersect_range>
6249 restricts the input function to those shared domain elements
6250 that map to the specified range.
6252 =item * Union
6254         #include <isl/set.h>
6255         __isl_give isl_set *isl_basic_set_union(
6256                 __isl_take isl_basic_set *bset1,
6257                 __isl_take isl_basic_set *bset2);
6258         __isl_give isl_set *isl_set_union(
6259                 __isl_take isl_set *set1,
6260                 __isl_take isl_set *set2);
6261         __isl_give isl_set *isl_set_list_union(
6262                 __isl_take isl_set_list *list);
6264         #include <isl/map.h>
6265         __isl_give isl_map *isl_basic_map_union(
6266                 __isl_take isl_basic_map *bmap1,
6267                 __isl_take isl_basic_map *bmap2);
6268         __isl_give isl_map *isl_map_union(
6269                 __isl_take isl_map *map1,
6270                 __isl_take isl_map *map2);
6272         #include <isl/union_set.h>
6273         __isl_give isl_union_set *isl_union_set_union(
6274                 __isl_take isl_union_set *uset1,
6275                 __isl_take isl_union_set *uset2);
6276         __isl_give isl_union_set *isl_union_set_list_union(
6277                 __isl_take isl_union_set_list *list);
6279         #include <isl/union_map.h>
6280         __isl_give isl_union_map *isl_union_map_union(
6281                 __isl_take isl_union_map *umap1,
6282                 __isl_take isl_union_map *umap2);
6284 The list passed to C<isl_set_list_union> needs to have
6285 at least one element and all elements need to live in the same space.
6287 =item * Set difference
6289         #include <isl/set.h>
6290         __isl_give isl_set *isl_set_subtract(
6291                 __isl_take isl_set *set1,
6292                 __isl_take isl_set *set2);
6294         #include <isl/map.h>
6295         __isl_give isl_map *isl_map_subtract(
6296                 __isl_take isl_map *map1,
6297                 __isl_take isl_map *map2);
6298         __isl_give isl_map *isl_map_subtract_domain(
6299                 __isl_take isl_map *map,
6300                 __isl_take isl_set *dom);
6301         __isl_give isl_map *isl_map_subtract_range(
6302                 __isl_take isl_map *map,
6303                 __isl_take isl_set *dom);
6305         #include <isl/union_set.h>
6306         __isl_give isl_union_set *isl_union_set_subtract(
6307                 __isl_take isl_union_set *uset1,
6308                 __isl_take isl_union_set *uset2);
6310         #include <isl/union_map.h>
6311         __isl_give isl_union_map *isl_union_map_subtract(
6312                 __isl_take isl_union_map *umap1,
6313                 __isl_take isl_union_map *umap2);
6314         __isl_give isl_union_map *isl_union_map_subtract_domain(
6315                 __isl_take isl_union_map *umap,
6316                 __isl_take isl_union_set *dom);
6317         __isl_give isl_union_map *isl_union_map_subtract_range(
6318                 __isl_take isl_union_map *umap,
6319                 __isl_take isl_union_set *dom);
6321         #include <isl/aff.h>
6322         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
6323                 __isl_take isl_pw_aff *pa,
6324                 __isl_take isl_set *set);
6325         __isl_give isl_pw_multi_aff *
6326         isl_pw_multi_aff_subtract_domain(
6327                 __isl_take isl_pw_multi_aff *pma,
6328                 __isl_take isl_set *set);
6329         __isl_give isl_union_pw_aff *
6330         isl_union_pw_aff_subtract_domain(
6331                 __isl_take isl_union_pw_aff *upa,
6332                 __isl_take isl_union_set *uset);
6333         __isl_give isl_union_pw_multi_aff *
6334         isl_union_pw_multi_aff_subtract_domain(
6335                 __isl_take isl_union_pw_multi_aff *upma,
6336                 __isl_take isl_set *set);
6338         #include <isl/polynomial.h>
6339         __isl_give isl_pw_qpolynomial *
6340         isl_pw_qpolynomial_subtract_domain(
6341                 __isl_take isl_pw_qpolynomial *pwpq,
6342                 __isl_take isl_set *set);
6343         __isl_give isl_pw_qpolynomial_fold *
6344         isl_pw_qpolynomial_fold_subtract_domain(
6345                 __isl_take isl_pw_qpolynomial_fold *pwf,
6346                 __isl_take isl_set *set);
6347         __isl_give isl_union_pw_qpolynomial *
6348         isl_union_pw_qpolynomial_subtract_domain(
6349                 __isl_take isl_union_pw_qpolynomial *upwpq,
6350                 __isl_take isl_union_set *uset);
6351         __isl_give isl_union_pw_qpolynomial_fold *
6352         isl_union_pw_qpolynomial_fold_subtract_domain(
6353                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6354                 __isl_take isl_union_set *uset);
6356 =item * Application
6358         #include <isl/space.h>
6359         __isl_give isl_space *isl_space_join(
6360                 __isl_take isl_space *left,
6361                 __isl_take isl_space *right);
6363         #include <isl/map.h>
6364         __isl_give isl_basic_set *isl_basic_set_apply(
6365                 __isl_take isl_basic_set *bset,
6366                 __isl_take isl_basic_map *bmap);
6367         __isl_give isl_set *isl_set_apply(
6368                 __isl_take isl_set *set,
6369                 __isl_take isl_map *map);
6370         __isl_give isl_union_set *isl_union_set_apply(
6371                 __isl_take isl_union_set *uset,
6372                 __isl_take isl_union_map *umap);
6373         __isl_give isl_basic_map *isl_basic_map_apply_domain(
6374                 __isl_take isl_basic_map *bmap1,
6375                 __isl_take isl_basic_map *bmap2);
6376         __isl_give isl_basic_map *isl_basic_map_apply_range(
6377                 __isl_take isl_basic_map *bmap1,
6378                 __isl_take isl_basic_map *bmap2);
6379         __isl_give isl_map *isl_map_apply_domain(
6380                 __isl_take isl_map *map1,
6381                 __isl_take isl_map *map2);
6382         __isl_give isl_map *isl_map_apply_range(
6383                 __isl_take isl_map *map1,
6384                 __isl_take isl_map *map2);
6386         #include <isl/union_map.h>
6387         __isl_give isl_union_map *isl_union_map_apply_domain(
6388                 __isl_take isl_union_map *umap1,
6389                 __isl_take isl_union_map *umap2);
6390         __isl_give isl_union_map *isl_union_map_apply_range(
6391                 __isl_take isl_union_map *umap1,
6392                 __isl_take isl_union_map *umap2);
6394         #include <isl/aff.h>
6395         __isl_give isl_union_pw_aff *
6396         isl_multi_union_pw_aff_apply_aff(
6397                 __isl_take isl_multi_union_pw_aff *mupa,
6398                 __isl_take isl_aff *aff);
6399         __isl_give isl_union_pw_aff *
6400         isl_multi_union_pw_aff_apply_pw_aff(
6401                 __isl_take isl_multi_union_pw_aff *mupa,
6402                 __isl_take isl_pw_aff *pa);
6403         __isl_give isl_multi_union_pw_aff *
6404         isl_multi_union_pw_aff_apply_multi_aff(
6405                 __isl_take isl_multi_union_pw_aff *mupa,
6406                 __isl_take isl_multi_aff *ma);
6407         __isl_give isl_multi_union_pw_aff *
6408         isl_multi_union_pw_aff_apply_pw_multi_aff(
6409                 __isl_take isl_multi_union_pw_aff *mupa,
6410                 __isl_take isl_pw_multi_aff *pma);
6412 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
6413 over the shared domain of the elements of the input.  The dimension is
6414 required to be greater than zero.
6415 The C<isl_multi_union_pw_aff> argument of
6416 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
6417 but only if the range of the C<isl_multi_aff> argument
6418 is also zero-dimensional.
6419 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
6421         #include <isl/polynomial.h>
6422         __isl_give isl_pw_qpolynomial_fold *
6423         isl_set_apply_pw_qpolynomial_fold(
6424                 __isl_take isl_set *set,
6425                 __isl_take isl_pw_qpolynomial_fold *pwf,
6426                 int *tight);
6427         __isl_give isl_pw_qpolynomial_fold *
6428         isl_map_apply_pw_qpolynomial_fold(
6429                 __isl_take isl_map *map,
6430                 __isl_take isl_pw_qpolynomial_fold *pwf,
6431                 int *tight);
6432         __isl_give isl_union_pw_qpolynomial_fold *
6433         isl_union_set_apply_union_pw_qpolynomial_fold(
6434                 __isl_take isl_union_set *uset,
6435                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6436                 int *tight);
6437         __isl_give isl_union_pw_qpolynomial_fold *
6438         isl_union_map_apply_union_pw_qpolynomial_fold(
6439                 __isl_take isl_union_map *umap,
6440                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6441                 int *tight);
6443 The functions taking a map
6444 compose the given map with the given piecewise quasipolynomial reduction.
6445 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
6446 over all elements in the intersection of the range of the map
6447 and the domain of the piecewise quasipolynomial reduction
6448 as a function of an element in the domain of the map.
6449 The functions taking a set compute a bound over all elements in the
6450 intersection of the set and the domain of the
6451 piecewise quasipolynomial reduction.
6453 =item * Preimage
6455         #include <isl/set.h>
6456         __isl_give isl_basic_set *
6457         isl_basic_set_preimage_multi_aff(
6458                 __isl_take isl_basic_set *bset,
6459                 __isl_take isl_multi_aff *ma);
6460         __isl_give isl_set *isl_set_preimage_multi_aff(
6461                 __isl_take isl_set *set,
6462                 __isl_take isl_multi_aff *ma);
6463         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
6464                 __isl_take isl_set *set,
6465                 __isl_take isl_pw_multi_aff *pma);
6466         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
6467                 __isl_take isl_set *set,
6468                 __isl_take isl_multi_pw_aff *mpa);
6470         #include <isl/union_set.h>
6471         __isl_give isl_union_set *
6472         isl_union_set_preimage_multi_aff(
6473                 __isl_take isl_union_set *uset,
6474                 __isl_take isl_multi_aff *ma);
6475         __isl_give isl_union_set *
6476         isl_union_set_preimage_pw_multi_aff(
6477                 __isl_take isl_union_set *uset,
6478                 __isl_take isl_pw_multi_aff *pma);
6479         __isl_give isl_union_set *
6480         isl_union_set_preimage_union_pw_multi_aff(
6481                 __isl_take isl_union_set *uset,
6482                 __isl_take isl_union_pw_multi_aff *upma);
6484         #include <isl/map.h>
6485         __isl_give isl_basic_map *
6486         isl_basic_map_preimage_domain_multi_aff(
6487                 __isl_take isl_basic_map *bmap,
6488                 __isl_take isl_multi_aff *ma);
6489         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
6490                 __isl_take isl_map *map,
6491                 __isl_take isl_multi_aff *ma);
6492         __isl_give isl_map *isl_map_preimage_range_multi_aff(
6493                 __isl_take isl_map *map,
6494                 __isl_take isl_multi_aff *ma);
6495         __isl_give isl_map *
6496         isl_map_preimage_domain_pw_multi_aff(
6497                 __isl_take isl_map *map,
6498                 __isl_take isl_pw_multi_aff *pma);
6499         __isl_give isl_map *
6500         isl_map_preimage_range_pw_multi_aff(
6501                 __isl_take isl_map *map,
6502                 __isl_take isl_pw_multi_aff *pma);
6503         __isl_give isl_map *
6504         isl_map_preimage_domain_multi_pw_aff(
6505                 __isl_take isl_map *map,
6506                 __isl_take isl_multi_pw_aff *mpa);
6507         __isl_give isl_basic_map *
6508         isl_basic_map_preimage_range_multi_aff(
6509                 __isl_take isl_basic_map *bmap,
6510                 __isl_take isl_multi_aff *ma);
6512         #include <isl/union_map.h>
6513         __isl_give isl_union_map *
6514         isl_union_map_preimage_domain_multi_aff(
6515                 __isl_take isl_union_map *umap,
6516                 __isl_take isl_multi_aff *ma);
6517         __isl_give isl_union_map *
6518         isl_union_map_preimage_range_multi_aff(
6519                 __isl_take isl_union_map *umap,
6520                 __isl_take isl_multi_aff *ma);
6521         __isl_give isl_union_map *
6522         isl_union_map_preimage_domain_pw_multi_aff(
6523                 __isl_take isl_union_map *umap,
6524                 __isl_take isl_pw_multi_aff *pma);
6525         __isl_give isl_union_map *
6526         isl_union_map_preimage_range_pw_multi_aff(
6527                 __isl_take isl_union_map *umap,
6528                 __isl_take isl_pw_multi_aff *pma);
6529         __isl_give isl_union_map *
6530         isl_union_map_preimage_domain_union_pw_multi_aff(
6531                 __isl_take isl_union_map *umap,
6532                 __isl_take isl_union_pw_multi_aff *upma);
6533         __isl_give isl_union_map *
6534         isl_union_map_preimage_range_union_pw_multi_aff(
6535                 __isl_take isl_union_map *umap,
6536                 __isl_take isl_union_pw_multi_aff *upma);
6538 These functions compute the preimage of the given set or map domain/range under
6539 the given function.  In other words, the expression is plugged
6540 into the set description or into the domain/range of the map.
6542 =item * Pullback
6544         #include <isl/aff.h>
6545         __isl_give isl_aff *isl_aff_pullback_aff(
6546                 __isl_take isl_aff *aff1,
6547                 __isl_take isl_aff *aff2);
6548         __isl_give isl_aff *isl_aff_pullback_multi_aff(
6549                 __isl_take isl_aff *aff,
6550                 __isl_take isl_multi_aff *ma);
6551         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
6552                 __isl_take isl_pw_aff *pa,
6553                 __isl_take isl_multi_aff *ma);
6554         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
6555                 __isl_take isl_pw_aff *pa,
6556                 __isl_take isl_pw_multi_aff *pma);
6557         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
6558                 __isl_take isl_pw_aff *pa,
6559                 __isl_take isl_multi_pw_aff *mpa);
6560         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
6561                 __isl_take isl_multi_aff *ma1,
6562                 __isl_take isl_multi_aff *ma2);
6563         __isl_give isl_pw_multi_aff *
6564         isl_pw_multi_aff_pullback_multi_aff(
6565                 __isl_take isl_pw_multi_aff *pma,
6566                 __isl_take isl_multi_aff *ma);
6567         __isl_give isl_multi_pw_aff *
6568         isl_multi_pw_aff_pullback_multi_aff(
6569                 __isl_take isl_multi_pw_aff *mpa,
6570                 __isl_take isl_multi_aff *ma);
6571         __isl_give isl_pw_multi_aff *
6572         isl_pw_multi_aff_pullback_pw_multi_aff(
6573                 __isl_take isl_pw_multi_aff *pma1,
6574                 __isl_take isl_pw_multi_aff *pma2);
6575         __isl_give isl_multi_pw_aff *
6576         isl_multi_pw_aff_pullback_pw_multi_aff(
6577                 __isl_take isl_multi_pw_aff *mpa,
6578                 __isl_take isl_pw_multi_aff *pma);
6579         __isl_give isl_multi_pw_aff *
6580         isl_multi_pw_aff_pullback_multi_pw_aff(
6581                 __isl_take isl_multi_pw_aff *mpa1,
6582                 __isl_take isl_multi_pw_aff *mpa2);
6583         __isl_give isl_union_pw_aff *
6584         isl_union_pw_aff_pullback_union_pw_multi_aff(
6585                 __isl_take isl_union_pw_aff *upa,
6586                 __isl_take isl_union_pw_multi_aff *upma);
6587         __isl_give isl_union_pw_multi_aff *
6588         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
6589                 __isl_take isl_union_pw_multi_aff *upma1,
6590                 __isl_take isl_union_pw_multi_aff *upma2);
6591         __isl_give isl_multi_union_pw_aff *
6592         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
6593                 __isl_take isl_multi_union_pw_aff *mupa,
6594                 __isl_take isl_union_pw_multi_aff *upma);
6596 These functions precompose the first expression by the second function.
6597 In other words, the second function is plugged
6598 into the first expression.
6600 =item * Locus
6602         #include <isl/aff.h>
6603         __isl_give isl_basic_set *isl_aff_eq_basic_set(
6604                 __isl_take isl_aff *aff1,
6605                 __isl_take isl_aff *aff2);
6606         __isl_give isl_set *isl_aff_eq_set(
6607                 __isl_take isl_aff *aff1,
6608                 __isl_take isl_aff *aff2);
6609         __isl_give isl_set *isl_aff_ne_set(
6610                 __isl_take isl_aff *aff1,
6611                 __isl_take isl_aff *aff2);
6612         __isl_give isl_basic_set *isl_aff_le_basic_set(
6613                 __isl_take isl_aff *aff1,
6614                 __isl_take isl_aff *aff2);
6615         __isl_give isl_set *isl_aff_le_set(
6616                 __isl_take isl_aff *aff1,
6617                 __isl_take isl_aff *aff2);
6618         __isl_give isl_basic_set *isl_aff_lt_basic_set(
6619                 __isl_take isl_aff *aff1,
6620                 __isl_take isl_aff *aff2);
6621         __isl_give isl_set *isl_aff_lt_set(
6622                 __isl_take isl_aff *aff1,
6623                 __isl_take isl_aff *aff2);
6624         __isl_give isl_basic_set *isl_aff_ge_basic_set(
6625                 __isl_take isl_aff *aff1,
6626                 __isl_take isl_aff *aff2);
6627         __isl_give isl_set *isl_aff_ge_set(
6628                 __isl_take isl_aff *aff1,
6629                 __isl_take isl_aff *aff2);
6630         __isl_give isl_basic_set *isl_aff_gt_basic_set(
6631                 __isl_take isl_aff *aff1,
6632                 __isl_take isl_aff *aff2);
6633         __isl_give isl_set *isl_aff_gt_set(
6634                 __isl_take isl_aff *aff1,
6635                 __isl_take isl_aff *aff2);
6636         __isl_give isl_set *isl_pw_aff_eq_set(
6637                 __isl_take isl_pw_aff *pwaff1,
6638                 __isl_take isl_pw_aff *pwaff2);
6639         __isl_give isl_set *isl_pw_aff_ne_set(
6640                 __isl_take isl_pw_aff *pwaff1,
6641                 __isl_take isl_pw_aff *pwaff2);
6642         __isl_give isl_set *isl_pw_aff_le_set(
6643                 __isl_take isl_pw_aff *pwaff1,
6644                 __isl_take isl_pw_aff *pwaff2);
6645         __isl_give isl_set *isl_pw_aff_lt_set(
6646                 __isl_take isl_pw_aff *pwaff1,
6647                 __isl_take isl_pw_aff *pwaff2);
6648         __isl_give isl_set *isl_pw_aff_ge_set(
6649                 __isl_take isl_pw_aff *pwaff1,
6650                 __isl_take isl_pw_aff *pwaff2);
6651         __isl_give isl_set *isl_pw_aff_gt_set(
6652                 __isl_take isl_pw_aff *pwaff1,
6653                 __isl_take isl_pw_aff *pwaff2);
6655         __isl_give isl_set *isl_multi_aff_lex_le_set(
6656                 __isl_take isl_multi_aff *ma1,
6657                 __isl_take isl_multi_aff *ma2);
6658         __isl_give isl_set *isl_multi_aff_lex_lt_set(
6659                 __isl_take isl_multi_aff *ma1,
6660                 __isl_take isl_multi_aff *ma2);
6661         __isl_give isl_set *isl_multi_aff_lex_ge_set(
6662                 __isl_take isl_multi_aff *ma1,
6663                 __isl_take isl_multi_aff *ma2);
6664         __isl_give isl_set *isl_multi_aff_lex_gt_set(
6665                 __isl_take isl_multi_aff *ma1,
6666                 __isl_take isl_multi_aff *ma2);
6668         __isl_give isl_set *isl_pw_aff_list_eq_set(
6669                 __isl_take isl_pw_aff_list *list1,
6670                 __isl_take isl_pw_aff_list *list2);
6671         __isl_give isl_set *isl_pw_aff_list_ne_set(
6672                 __isl_take isl_pw_aff_list *list1,
6673                 __isl_take isl_pw_aff_list *list2);
6674         __isl_give isl_set *isl_pw_aff_list_le_set(
6675                 __isl_take isl_pw_aff_list *list1,
6676                 __isl_take isl_pw_aff_list *list2);
6677         __isl_give isl_set *isl_pw_aff_list_lt_set(
6678                 __isl_take isl_pw_aff_list *list1,
6679                 __isl_take isl_pw_aff_list *list2);
6680         __isl_give isl_set *isl_pw_aff_list_ge_set(
6681                 __isl_take isl_pw_aff_list *list1,
6682                 __isl_take isl_pw_aff_list *list2);
6683         __isl_give isl_set *isl_pw_aff_list_gt_set(
6684                 __isl_take isl_pw_aff_list *list1,
6685                 __isl_take isl_pw_aff_list *list2);
6687 The function C<isl_aff_ge_basic_set> returns a basic set
6688 containing those elements in the shared space
6689 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
6690 The function C<isl_pw_aff_ge_set> returns a set
6691 containing those elements in the shared domain
6692 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
6693 greater than or equal to C<pwaff2>.
6694 The function C<isl_multi_aff_lex_le_set> returns a set
6695 containing those elements in the shared domain space
6696 where C<ma1> is lexicographically smaller than or
6697 equal to C<ma2>.
6698 The functions operating on C<isl_pw_aff_list> apply the corresponding
6699 C<isl_pw_aff> function to each pair of elements in the two lists.
6701         #include <isl/aff.h>
6702         __isl_give isl_map *isl_pw_aff_eq_map(
6703                 __isl_take isl_pw_aff *pa1,
6704                 __isl_take isl_pw_aff *pa2);
6705         __isl_give isl_map *isl_pw_aff_lt_map(
6706                 __isl_take isl_pw_aff *pa1,
6707                 __isl_take isl_pw_aff *pa2);
6708         __isl_give isl_map *isl_pw_aff_gt_map(
6709                 __isl_take isl_pw_aff *pa1,
6710                 __isl_take isl_pw_aff *pa2);
6712         __isl_give isl_map *isl_multi_pw_aff_eq_map(
6713                 __isl_take isl_multi_pw_aff *mpa1,
6714                 __isl_take isl_multi_pw_aff *mpa2);
6715         __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
6716                 __isl_take isl_multi_pw_aff *mpa1,
6717                 __isl_take isl_multi_pw_aff *mpa2);
6718         __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
6719                 __isl_take isl_multi_pw_aff *mpa1,
6720                 __isl_take isl_multi_pw_aff *mpa2);
6722 These functions return a map between domain elements of the arguments
6723 where the function values satisfy the given relation.
6725         #include <isl/union_map.h>
6726         __isl_give isl_union_map *
6727         isl_union_map_eq_at_multi_union_pw_aff(
6728                 __isl_take isl_union_map *umap,
6729                 __isl_take isl_multi_union_pw_aff *mupa);
6730         __isl_give isl_union_map *
6731         isl_union_map_lex_lt_at_multi_union_pw_aff(
6732                 __isl_take isl_union_map *umap,
6733                 __isl_take isl_multi_union_pw_aff *mupa);
6734         __isl_give isl_union_map *
6735         isl_union_map_lex_gt_at_multi_union_pw_aff(
6736                 __isl_take isl_union_map *umap,
6737                 __isl_take isl_multi_union_pw_aff *mupa);
6739 These functions select the subset of elements in the union map
6740 that have an equal or lexicographically smaller function value.
6742 =item * Cartesian Product
6744         #include <isl/space.h>
6745         __isl_give isl_space *isl_space_product(
6746                 __isl_take isl_space *space1,
6747                 __isl_take isl_space *space2);
6748         __isl_give isl_space *isl_space_domain_product(
6749                 __isl_take isl_space *space1,
6750                 __isl_take isl_space *space2);
6751         __isl_give isl_space *isl_space_range_product(
6752                 __isl_take isl_space *space1,
6753                 __isl_take isl_space *space2);
6755 The functions
6756 C<isl_space_product>, C<isl_space_domain_product>
6757 and C<isl_space_range_product> take pairs or relation spaces and
6758 produce a single relations space, where either the domain, the range
6759 or both domain and range are wrapped spaces of relations between
6760 the domains and/or ranges of the input spaces.
6761 If the product is only constructed over the domain or the range
6762 then the ranges or the domains of the inputs should be the same.
6763 The function C<isl_space_product> also accepts a pair of set spaces,
6764 in which case it returns a wrapped space of a relation between the
6765 two input spaces.
6767         #include <isl/set.h>
6768         __isl_give isl_set *isl_set_product(
6769                 __isl_take isl_set *set1,
6770                 __isl_take isl_set *set2);
6772         #include <isl/map.h>
6773         __isl_give isl_basic_map *isl_basic_map_domain_product(
6774                 __isl_take isl_basic_map *bmap1,
6775                 __isl_take isl_basic_map *bmap2);
6776         __isl_give isl_basic_map *isl_basic_map_range_product(
6777                 __isl_take isl_basic_map *bmap1,
6778                 __isl_take isl_basic_map *bmap2);
6779         __isl_give isl_basic_map *isl_basic_map_product(
6780                 __isl_take isl_basic_map *bmap1,
6781                 __isl_take isl_basic_map *bmap2);
6782         __isl_give isl_map *isl_map_domain_product(
6783                 __isl_take isl_map *map1,
6784                 __isl_take isl_map *map2);
6785         __isl_give isl_map *isl_map_range_product(
6786                 __isl_take isl_map *map1,
6787                 __isl_take isl_map *map2);
6788         __isl_give isl_map *isl_map_product(
6789                 __isl_take isl_map *map1,
6790                 __isl_take isl_map *map2);
6792         #include <isl/union_set.h>
6793         __isl_give isl_union_set *isl_union_set_product(
6794                 __isl_take isl_union_set *uset1,
6795                 __isl_take isl_union_set *uset2);
6797         #include <isl/union_map.h>
6798         __isl_give isl_union_map *isl_union_map_domain_product(
6799                 __isl_take isl_union_map *umap1,
6800                 __isl_take isl_union_map *umap2);
6801         __isl_give isl_union_map *isl_union_map_range_product(
6802                 __isl_take isl_union_map *umap1,
6803                 __isl_take isl_union_map *umap2);
6804         __isl_give isl_union_map *isl_union_map_product(
6805                 __isl_take isl_union_map *umap1,
6806                 __isl_take isl_union_map *umap2);
6808         #include <isl/val.h>
6809         __isl_give isl_multi_val *isl_multi_val_range_product(
6810                 __isl_take isl_multi_val *mv1,
6811                 __isl_take isl_multi_val *mv2);
6812         __isl_give isl_multi_val *isl_multi_val_product(
6813                 __isl_take isl_multi_val *mv1,
6814                 __isl_take isl_multi_val *mv2);
6816         #include <isl/aff.h>
6817         __isl_give isl_multi_aff *isl_multi_aff_range_product(
6818                 __isl_take isl_multi_aff *ma1,
6819                 __isl_take isl_multi_aff *ma2);
6820         __isl_give isl_multi_aff *isl_multi_aff_product(
6821                 __isl_take isl_multi_aff *ma1,
6822                 __isl_take isl_multi_aff *ma2);
6823         __isl_give isl_multi_pw_aff *
6824         isl_multi_pw_aff_range_product(
6825                 __isl_take isl_multi_pw_aff *mpa1,
6826                 __isl_take isl_multi_pw_aff *mpa2);
6827         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6828                 __isl_take isl_multi_pw_aff *mpa1,
6829                 __isl_take isl_multi_pw_aff *mpa2);
6830         __isl_give isl_pw_multi_aff *
6831         isl_pw_multi_aff_range_product(
6832                 __isl_take isl_pw_multi_aff *pma1,
6833                 __isl_take isl_pw_multi_aff *pma2);
6834         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6835                 __isl_take isl_pw_multi_aff *pma1,
6836                 __isl_take isl_pw_multi_aff *pma2);
6837         __isl_give isl_multi_union_pw_aff *
6838         isl_multi_union_pw_aff_range_product(
6839                 __isl_take isl_multi_union_pw_aff *mupa1,
6840                 __isl_take isl_multi_union_pw_aff *mupa2);
6842 The above functions compute the cross product of the given
6843 sets, relations or functions.  The domains and ranges of the results
6844 are wrapped maps between domains and ranges of the inputs.
6845 To obtain a ``flat'' product, use the following functions
6846 instead.
6848         #include <isl/set.h>
6849         __isl_give isl_basic_set *isl_basic_set_flat_product(
6850                 __isl_take isl_basic_set *bset1,
6851                 __isl_take isl_basic_set *bset2);
6852         __isl_give isl_set *isl_set_flat_product(
6853                 __isl_take isl_set *set1,
6854                 __isl_take isl_set *set2);
6856         #include <isl/map.h>
6857         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6858                 __isl_take isl_basic_map *bmap1,
6859                 __isl_take isl_basic_map *bmap2);
6860         __isl_give isl_map *isl_map_flat_domain_product(
6861                 __isl_take isl_map *map1,
6862                 __isl_take isl_map *map2);
6863         __isl_give isl_map *isl_map_flat_range_product(
6864                 __isl_take isl_map *map1,
6865                 __isl_take isl_map *map2);
6866         __isl_give isl_basic_map *isl_basic_map_flat_product(
6867                 __isl_take isl_basic_map *bmap1,
6868                 __isl_take isl_basic_map *bmap2);
6869         __isl_give isl_map *isl_map_flat_product(
6870                 __isl_take isl_map *map1,
6871                 __isl_take isl_map *map2);
6873         #include <isl/union_map.h>
6874         __isl_give isl_union_map *
6875         isl_union_map_flat_domain_product(
6876                 __isl_take isl_union_map *umap1,
6877                 __isl_take isl_union_map *umap2);
6878         __isl_give isl_union_map *
6879         isl_union_map_flat_range_product(
6880                 __isl_take isl_union_map *umap1,
6881                 __isl_take isl_union_map *umap2);
6883         #include <isl/val.h>
6884         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6885                 __isl_take isl_multi_val *mv1,
6886                 __isl_take isl_multi_aff *mv2);
6888         #include <isl/aff.h>
6889         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6890                 __isl_take isl_multi_aff *ma1,
6891                 __isl_take isl_multi_aff *ma2);
6892         __isl_give isl_pw_multi_aff *
6893         isl_pw_multi_aff_flat_range_product(
6894                 __isl_take isl_pw_multi_aff *pma1,
6895                 __isl_take isl_pw_multi_aff *pma2);
6896         __isl_give isl_multi_pw_aff *
6897         isl_multi_pw_aff_flat_range_product(
6898                 __isl_take isl_multi_pw_aff *mpa1,
6899                 __isl_take isl_multi_pw_aff *mpa2);
6900         __isl_give isl_union_pw_multi_aff *
6901         isl_union_pw_multi_aff_flat_range_product(
6902                 __isl_take isl_union_pw_multi_aff *upma1,
6903                 __isl_take isl_union_pw_multi_aff *upma2);
6904         __isl_give isl_multi_union_pw_aff *
6905         isl_multi_union_pw_aff_flat_range_product(
6906                 __isl_take isl_multi_union_pw_aff *mupa1,
6907                 __isl_take isl_multi_union_pw_aff *mupa2);
6909         #include <isl/space.h>
6910         __isl_give isl_space *isl_space_factor_domain(
6911                 __isl_take isl_space *space);
6912         __isl_give isl_space *isl_space_factor_range(
6913                 __isl_take isl_space *space);
6914         __isl_give isl_space *isl_space_domain_factor_domain(
6915                 __isl_take isl_space *space);
6916         __isl_give isl_space *isl_space_domain_factor_range(
6917                 __isl_take isl_space *space);
6918         __isl_give isl_space *isl_space_range_factor_domain(
6919                 __isl_take isl_space *space);
6920         __isl_give isl_space *isl_space_range_factor_range(
6921                 __isl_take isl_space *space);
6923 The functions C<isl_space_range_factor_domain> and
6924 C<isl_space_range_factor_range> extract the two arguments from
6925 the result of a call to C<isl_space_range_product>.
6927 The arguments of a call to a product can be extracted
6928 from the result using the following functions.
6930         #include <isl/map.h>
6931         __isl_give isl_map *isl_map_factor_domain(
6932                 __isl_take isl_map *map);
6933         __isl_give isl_map *isl_map_factor_range(
6934                 __isl_take isl_map *map);
6935         __isl_give isl_map *isl_map_domain_factor_domain(
6936                 __isl_take isl_map *map);
6937         __isl_give isl_map *isl_map_domain_factor_range(
6938                 __isl_take isl_map *map);
6939         __isl_give isl_map *isl_map_range_factor_domain(
6940                 __isl_take isl_map *map);
6941         __isl_give isl_map *isl_map_range_factor_range(
6942                 __isl_take isl_map *map);
6944         #include <isl/union_map.h>
6945         __isl_give isl_union_map *isl_union_map_factor_domain(
6946                 __isl_take isl_union_map *umap);
6947         __isl_give isl_union_map *isl_union_map_factor_range(
6948                 __isl_take isl_union_map *umap);
6949         __isl_give isl_union_map *
6950         isl_union_map_domain_factor_domain(
6951                 __isl_take isl_union_map *umap);
6952         __isl_give isl_union_map *
6953         isl_union_map_domain_factor_range(
6954                 __isl_take isl_union_map *umap);
6955         __isl_give isl_union_map *
6956         isl_union_map_range_factor_domain(
6957                 __isl_take isl_union_map *umap);
6958         __isl_give isl_union_map *
6959         isl_union_map_range_factor_range(
6960                 __isl_take isl_union_map *umap);
6962         #include <isl/val.h>
6963         __isl_give isl_multi_val *isl_multi_val_factor_range(
6964                 __isl_take isl_multi_val *mv);
6965         __isl_give isl_multi_val *
6966         isl_multi_val_range_factor_domain(
6967                 __isl_take isl_multi_val *mv);
6968         __isl_give isl_multi_val *
6969         isl_multi_val_range_factor_range(
6970                 __isl_take isl_multi_val *mv);
6972         #include <isl/aff.h>
6973         __isl_give isl_multi_aff *isl_multi_aff_factor_range(
6974                 __isl_take isl_multi_aff *ma);
6975         __isl_give isl_multi_aff *
6976         isl_multi_aff_range_factor_domain(
6977                 __isl_take isl_multi_aff *ma);
6978         __isl_give isl_multi_aff *
6979         isl_multi_aff_range_factor_range(
6980                 __isl_take isl_multi_aff *ma);
6981         __isl_give isl_multi_pw_aff *
6982         isl_multi_pw_aff_factor_range(
6983                 __isl_take isl_multi_pw_aff *mpa);
6984         __isl_give isl_multi_pw_aff *
6985         isl_multi_pw_aff_range_factor_domain(
6986                 __isl_take isl_multi_pw_aff *mpa);
6987         __isl_give isl_multi_pw_aff *
6988         isl_multi_pw_aff_range_factor_range(
6989                 __isl_take isl_multi_pw_aff *mpa);
6990         __isl_give isl_multi_union_pw_aff *
6991         isl_multi_union_pw_aff_factor_range(
6992                 __isl_take isl_multi_union_pw_aff *mupa);
6993         __isl_give isl_multi_union_pw_aff *
6994         isl_multi_union_pw_aff_range_factor_domain(
6995                 __isl_take isl_multi_union_pw_aff *mupa);
6996         __isl_give isl_multi_union_pw_aff *
6997         isl_multi_union_pw_aff_range_factor_range(
6998                 __isl_take isl_multi_union_pw_aff *mupa);
7000 The splice functions are a generalization of the flat product functions,
7001 where the second argument may be inserted at any position inside
7002 the first argument rather than being placed at the end.
7003 The functions C<isl_multi_val_factor_range>,
7004 C<isl_multi_aff_factor_range>,
7005 C<isl_multi_pw_aff_factor_range> and
7006 C<isl_multi_union_pw_aff_factor_range>
7007 take functions that live in a set space.
7009         #include <isl/val.h>
7010         __isl_give isl_multi_val *isl_multi_val_range_splice(
7011                 __isl_take isl_multi_val *mv1, unsigned pos,
7012                 __isl_take isl_multi_val *mv2);
7014         #include <isl/aff.h>
7015         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
7016                 __isl_take isl_multi_aff *ma1, unsigned pos,
7017                 __isl_take isl_multi_aff *ma2);
7018         __isl_give isl_multi_aff *isl_multi_aff_splice(
7019                 __isl_take isl_multi_aff *ma1,
7020                 unsigned in_pos, unsigned out_pos,
7021                 __isl_take isl_multi_aff *ma2);
7022         __isl_give isl_multi_pw_aff *
7023         isl_multi_pw_aff_range_splice(
7024                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
7025                 __isl_take isl_multi_pw_aff *mpa2);
7026         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
7027                 __isl_take isl_multi_pw_aff *mpa1,
7028                 unsigned in_pos, unsigned out_pos,
7029                 __isl_take isl_multi_pw_aff *mpa2);
7030         __isl_give isl_multi_union_pw_aff *
7031         isl_multi_union_pw_aff_range_splice(
7032                 __isl_take isl_multi_union_pw_aff *mupa1,
7033                 unsigned pos,
7034                 __isl_take isl_multi_union_pw_aff *mupa2);
7036 =item * Simplification
7038 When applied to a set or relation,
7039 the gist operation returns a set or relation that has the
7040 same intersection with the context as the input set or relation.
7041 Any implicit equality in the intersection is made explicit in the result,
7042 while all inequalities that are redundant with respect to the intersection
7043 are removed.
7044 In case of union sets and relations, the gist operation is performed
7045 per space.
7047 When applied to a function,
7048 the gist operation applies the set gist operation to each of
7049 the cells in the domain of the input piecewise expression.
7050 The context is also exploited
7051 to simplify the expression associated to each cell.
7053         #include <isl/set.h>
7054         __isl_give isl_basic_set *isl_basic_set_gist(
7055                 __isl_take isl_basic_set *bset,
7056                 __isl_take isl_basic_set *context);
7057         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
7058                 __isl_take isl_set *context);
7059         __isl_give isl_set *isl_set_gist_params(
7060                 __isl_take isl_set *set,
7061                 __isl_take isl_set *context);
7063         #include <isl/map.h>
7064         __isl_give isl_basic_map *isl_basic_map_gist(
7065                 __isl_take isl_basic_map *bmap,
7066                 __isl_take isl_basic_map *context);
7067         __isl_give isl_basic_map *isl_basic_map_gist_domain(
7068                 __isl_take isl_basic_map *bmap,
7069                 __isl_take isl_basic_set *context);
7070         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
7071                 __isl_take isl_map *context);
7072         __isl_give isl_map *isl_map_gist_params(
7073                 __isl_take isl_map *map,
7074                 __isl_take isl_set *context);
7075         __isl_give isl_map *isl_map_gist_domain(
7076                 __isl_take isl_map *map,
7077                 __isl_take isl_set *context);
7078         __isl_give isl_map *isl_map_gist_range(
7079                 __isl_take isl_map *map,
7080                 __isl_take isl_set *context);
7082         #include <isl/union_set.h>
7083         __isl_give isl_union_set *isl_union_set_gist(
7084                 __isl_take isl_union_set *uset,
7085                 __isl_take isl_union_set *context);
7086         __isl_give isl_union_set *isl_union_set_gist_params(
7087                 __isl_take isl_union_set *uset,
7088                 __isl_take isl_set *set);
7090         #include <isl/union_map.h>
7091         __isl_give isl_union_map *isl_union_map_gist(
7092                 __isl_take isl_union_map *umap,
7093                 __isl_take isl_union_map *context);
7094         __isl_give isl_union_map *isl_union_map_gist_params(
7095                 __isl_take isl_union_map *umap,
7096                 __isl_take isl_set *set);
7097         __isl_give isl_union_map *isl_union_map_gist_domain(
7098                 __isl_take isl_union_map *umap,
7099                 __isl_take isl_union_set *uset);
7100         __isl_give isl_union_map *isl_union_map_gist_range(
7101                 __isl_take isl_union_map *umap,
7102                 __isl_take isl_union_set *uset);
7104         #include <isl/aff.h>
7105         __isl_give isl_aff *isl_aff_gist_params(
7106                 __isl_take isl_aff *aff,
7107                 __isl_take isl_set *context);
7108         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
7109                 __isl_take isl_set *context);
7110         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
7111                 __isl_take isl_multi_aff *maff,
7112                 __isl_take isl_set *context);
7113         __isl_give isl_multi_aff *isl_multi_aff_gist(
7114                 __isl_take isl_multi_aff *maff,
7115                 __isl_take isl_set *context);
7116         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
7117                 __isl_take isl_pw_aff *pwaff,
7118                 __isl_take isl_set *context);
7119         __isl_give isl_pw_aff *isl_pw_aff_gist(
7120                 __isl_take isl_pw_aff *pwaff,
7121                 __isl_take isl_set *context);
7122         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
7123                 __isl_take isl_pw_multi_aff *pma,
7124                 __isl_take isl_set *set);
7125         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
7126                 __isl_take isl_pw_multi_aff *pma,
7127                 __isl_take isl_set *set);
7128         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
7129                 __isl_take isl_multi_pw_aff *mpa,
7130                 __isl_take isl_set *set);
7131         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
7132                 __isl_take isl_multi_pw_aff *mpa,
7133                 __isl_take isl_set *set);
7134         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
7135                 __isl_take isl_union_pw_aff *upa,
7136                 __isl_take isl_union_set *context);
7137         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
7138                 __isl_take isl_union_pw_aff *upa,
7139                 __isl_take isl_set *context);
7140         __isl_give isl_union_pw_multi_aff *
7141         isl_union_pw_multi_aff_gist_params(
7142                 __isl_take isl_union_pw_multi_aff *upma,
7143                 __isl_take isl_set *context);
7144         __isl_give isl_union_pw_multi_aff *
7145         isl_union_pw_multi_aff_gist(
7146                 __isl_take isl_union_pw_multi_aff *upma,
7147                 __isl_take isl_union_set *context);
7148         __isl_give isl_multi_union_pw_aff *
7149         isl_multi_union_pw_aff_gist_params(
7150                 __isl_take isl_multi_union_pw_aff *aff,
7151                 __isl_take isl_set *context);
7152         __isl_give isl_multi_union_pw_aff *
7153         isl_multi_union_pw_aff_gist(
7154                 __isl_take isl_multi_union_pw_aff *aff,
7155                 __isl_take isl_union_set *context);
7157         #include <isl/polynomial.h>
7158         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
7159                 __isl_take isl_qpolynomial *qp,
7160                 __isl_take isl_set *context);
7161         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
7162                 __isl_take isl_qpolynomial *qp,
7163                 __isl_take isl_set *context);
7164         __isl_give isl_qpolynomial_fold *
7165         isl_qpolynomial_fold_gist_params(
7166                 __isl_take isl_qpolynomial_fold *fold,
7167                 __isl_take isl_set *context);
7168         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
7169                 __isl_take isl_qpolynomial_fold *fold,
7170                 __isl_take isl_set *context);
7171         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
7172                 __isl_take isl_pw_qpolynomial *pwqp,
7173                 __isl_take isl_set *context);
7174         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
7175                 __isl_take isl_pw_qpolynomial *pwqp,
7176                 __isl_take isl_set *context);
7177         __isl_give isl_pw_qpolynomial_fold *
7178         isl_pw_qpolynomial_fold_gist(
7179                 __isl_take isl_pw_qpolynomial_fold *pwf,
7180                 __isl_take isl_set *context);
7181         __isl_give isl_pw_qpolynomial_fold *
7182         isl_pw_qpolynomial_fold_gist_params(
7183                 __isl_take isl_pw_qpolynomial_fold *pwf,
7184                 __isl_take isl_set *context);
7185         __isl_give isl_union_pw_qpolynomial *
7186         isl_union_pw_qpolynomial_gist_params(
7187                 __isl_take isl_union_pw_qpolynomial *upwqp,
7188                 __isl_take isl_set *context);
7189         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
7190                 __isl_take isl_union_pw_qpolynomial *upwqp,
7191                 __isl_take isl_union_set *context);
7192         __isl_give isl_union_pw_qpolynomial_fold *
7193         isl_union_pw_qpolynomial_fold_gist(
7194                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7195                 __isl_take isl_union_set *context);
7196         __isl_give isl_union_pw_qpolynomial_fold *
7197         isl_union_pw_qpolynomial_fold_gist_params(
7198                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7199                 __isl_take isl_set *context);
7201 =item * Binary Arithmetic Operations
7203         #include <isl/set.h>
7204         __isl_give isl_set *isl_set_sum(
7205                 __isl_take isl_set *set1,
7206                 __isl_take isl_set *set2);
7207         #include <isl/map.h>
7208         __isl_give isl_map *isl_map_sum(
7209                 __isl_take isl_map *map1,
7210                 __isl_take isl_map *map2);
7212 C<isl_set_sum> computes the Minkowski sum of its two arguments,
7213 i.e., the set containing the sums of pairs of elements from
7214 C<set1> and C<set2>.
7215 The domain of the result of C<isl_map_sum> is the intersection
7216 of the domains of its two arguments.  The corresponding range
7217 elements are the sums of the corresponding range elements
7218 in the two arguments.
7220         #include <isl/val.h>
7221         __isl_give isl_multi_val *isl_multi_val_add(
7222                 __isl_take isl_multi_val *mv1,
7223                 __isl_take isl_multi_val *mv2);
7224         __isl_give isl_multi_val *isl_multi_val_sub(
7225                 __isl_take isl_multi_val *mv1,
7226                 __isl_take isl_multi_val *mv2);
7228         #include <isl/aff.h>
7229         __isl_give isl_aff *isl_aff_add(
7230                 __isl_take isl_aff *aff1,
7231                 __isl_take isl_aff *aff2);
7232         __isl_give isl_multi_aff *isl_multi_aff_add(
7233                 __isl_take isl_multi_aff *maff1,
7234                 __isl_take isl_multi_aff *maff2);
7235         __isl_give isl_pw_aff *isl_pw_aff_add(
7236                 __isl_take isl_pw_aff *pwaff1,
7237                 __isl_take isl_pw_aff *pwaff2);
7238         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
7239                 __isl_take isl_multi_pw_aff *mpa1,
7240                 __isl_take isl_multi_pw_aff *mpa2);
7241         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
7242                 __isl_take isl_pw_multi_aff *pma1,
7243                 __isl_take isl_pw_multi_aff *pma2);
7244         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
7245                 __isl_take isl_union_pw_aff *upa1,
7246                 __isl_take isl_union_pw_aff *upa2);
7247         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
7248                 __isl_take isl_union_pw_multi_aff *upma1,
7249                 __isl_take isl_union_pw_multi_aff *upma2);
7250         __isl_give isl_multi_union_pw_aff *
7251         isl_multi_union_pw_aff_add(
7252                 __isl_take isl_multi_union_pw_aff *mupa1,
7253                 __isl_take isl_multi_union_pw_aff *mupa2);
7254         __isl_give isl_pw_aff *isl_pw_aff_min(
7255                 __isl_take isl_pw_aff *pwaff1,
7256                 __isl_take isl_pw_aff *pwaff2);
7257         __isl_give isl_pw_aff *isl_pw_aff_max(
7258                 __isl_take isl_pw_aff *pwaff1,
7259                 __isl_take isl_pw_aff *pwaff2);
7260         __isl_give isl_aff *isl_aff_sub(
7261                 __isl_take isl_aff *aff1,
7262                 __isl_take isl_aff *aff2);
7263         __isl_give isl_multi_aff *isl_multi_aff_sub(
7264                 __isl_take isl_multi_aff *ma1,
7265                 __isl_take isl_multi_aff *ma2);
7266         __isl_give isl_pw_aff *isl_pw_aff_sub(
7267                 __isl_take isl_pw_aff *pwaff1,
7268                 __isl_take isl_pw_aff *pwaff2);
7269         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
7270                 __isl_take isl_multi_pw_aff *mpa1,
7271                 __isl_take isl_multi_pw_aff *mpa2);
7272         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
7273                 __isl_take isl_pw_multi_aff *pma1,
7274                 __isl_take isl_pw_multi_aff *pma2);
7275         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
7276                 __isl_take isl_union_pw_aff *upa1,
7277                 __isl_take isl_union_pw_aff *upa2);
7278         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
7279                 __isl_take isl_union_pw_multi_aff *upma1,
7280                 __isl_take isl_union_pw_multi_aff *upma2);
7281         __isl_give isl_multi_union_pw_aff *
7282         isl_multi_union_pw_aff_sub(
7283                 __isl_take isl_multi_union_pw_aff *mupa1,
7284                 __isl_take isl_multi_union_pw_aff *mupa2);
7286 C<isl_aff_sub> subtracts the second argument from the first.
7288         #include <isl/polynomial.h>
7289         __isl_give isl_qpolynomial *isl_qpolynomial_add(
7290                 __isl_take isl_qpolynomial *qp1,
7291                 __isl_take isl_qpolynomial *qp2);
7292         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
7293                 __isl_take isl_pw_qpolynomial *pwqp1,
7294                 __isl_take isl_pw_qpolynomial *pwqp2);
7295         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
7296                 __isl_take isl_pw_qpolynomial *pwqp1,
7297                 __isl_take isl_pw_qpolynomial *pwqp2);
7298         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
7299                 __isl_take isl_pw_qpolynomial_fold *pwf1,
7300                 __isl_take isl_pw_qpolynomial_fold *pwf2);
7301         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
7302                 __isl_take isl_union_pw_qpolynomial *upwqp1,
7303                 __isl_take isl_union_pw_qpolynomial *upwqp2);
7304         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
7305                 __isl_take isl_qpolynomial *qp1,
7306                 __isl_take isl_qpolynomial *qp2);
7307         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
7308                 __isl_take isl_pw_qpolynomial *pwqp1,
7309                 __isl_take isl_pw_qpolynomial *pwqp2);
7310         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
7311                 __isl_take isl_union_pw_qpolynomial *upwqp1,
7312                 __isl_take isl_union_pw_qpolynomial *upwqp2);
7313         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
7314                 __isl_take isl_pw_qpolynomial_fold *pwf1,
7315                 __isl_take isl_pw_qpolynomial_fold *pwf2);
7316         __isl_give isl_union_pw_qpolynomial_fold *
7317         isl_union_pw_qpolynomial_fold_fold(
7318                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
7319                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
7321         #include <isl/aff.h>
7322         __isl_give isl_pw_aff *isl_pw_aff_union_add(
7323                 __isl_take isl_pw_aff *pwaff1,
7324                 __isl_take isl_pw_aff *pwaff2);
7325         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
7326                 __isl_take isl_pw_multi_aff *pma1,
7327                 __isl_take isl_pw_multi_aff *pma2);
7328         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
7329                 __isl_take isl_union_pw_aff *upa1,
7330                 __isl_take isl_union_pw_aff *upa2);
7331         __isl_give isl_union_pw_multi_aff *
7332         isl_union_pw_multi_aff_union_add(
7333                 __isl_take isl_union_pw_multi_aff *upma1,
7334                 __isl_take isl_union_pw_multi_aff *upma2);
7335         __isl_give isl_multi_union_pw_aff *
7336         isl_multi_union_pw_aff_union_add(
7337                 __isl_take isl_multi_union_pw_aff *mupa1,
7338                 __isl_take isl_multi_union_pw_aff *mupa2);
7339         __isl_give isl_pw_aff *isl_pw_aff_union_min(
7340                 __isl_take isl_pw_aff *pwaff1,
7341                 __isl_take isl_pw_aff *pwaff2);
7342         __isl_give isl_pw_aff *isl_pw_aff_union_max(
7343                 __isl_take isl_pw_aff *pwaff1,
7344                 __isl_take isl_pw_aff *pwaff2);
7346 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
7347 expression with a domain that is the union of those of C<pwaff1> and
7348 C<pwaff2> and such that on each cell, the quasi-affine expression is
7349 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
7350 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
7351 associated expression is the defined one.
7352 This in contrast to the C<isl_pw_aff_max> function, which is
7353 only defined on the shared definition domain of the arguments.
7355         #include <isl/val.h>
7356         __isl_give isl_multi_val *isl_multi_val_add_val(
7357                 __isl_take isl_multi_val *mv,
7358                 __isl_take isl_val *v);
7359         __isl_give isl_multi_val *isl_multi_val_mod_val(
7360                 __isl_take isl_multi_val *mv,
7361                 __isl_take isl_val *v);
7362         __isl_give isl_multi_val *isl_multi_val_scale_val(
7363                 __isl_take isl_multi_val *mv,
7364                 __isl_take isl_val *v);
7365         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
7366                 __isl_take isl_multi_val *mv,
7367                 __isl_take isl_val *v);
7369         #include <isl/aff.h>
7370         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
7371                 __isl_take isl_val *mod);
7372         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
7373                 __isl_take isl_pw_aff *pa,
7374                 __isl_take isl_val *mod);
7375         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
7376                 __isl_take isl_union_pw_aff *upa,
7377                 __isl_take isl_val *f);
7378         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
7379                 __isl_take isl_val *v);
7380         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
7381                 __isl_take isl_multi_aff *ma,
7382                 __isl_take isl_val *v);
7383         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
7384                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
7385         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
7386                 __isl_take isl_multi_pw_aff *mpa,
7387                 __isl_take isl_val *v);
7388         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
7389                 __isl_take isl_pw_multi_aff *pma,
7390                 __isl_take isl_val *v);
7391         __isl_give isl_union_pw_multi_aff *
7392         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
7393                 __isl_take isl_union_pw_aff *upa,
7394                 __isl_take isl_val *f);
7395         isl_union_pw_multi_aff_scale_val(
7396                 __isl_take isl_union_pw_multi_aff *upma,
7397                 __isl_take isl_val *val);
7398         __isl_give isl_multi_union_pw_aff *
7399         isl_multi_union_pw_aff_scale_val(
7400                 __isl_take isl_multi_union_pw_aff *mupa,
7401                 __isl_take isl_val *v);
7402         __isl_give isl_aff *isl_aff_scale_down_ui(
7403                 __isl_take isl_aff *aff, unsigned f);
7404         __isl_give isl_aff *isl_aff_scale_down_val(
7405                 __isl_take isl_aff *aff, __isl_take isl_val *v);
7406         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
7407                 __isl_take isl_multi_aff *ma,
7408                 __isl_take isl_val *v);
7409         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
7410                 __isl_take isl_pw_aff *pa,
7411                 __isl_take isl_val *f);
7412         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
7413                 __isl_take isl_multi_pw_aff *mpa,
7414                 __isl_take isl_val *v);
7415         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
7416                 __isl_take isl_pw_multi_aff *pma,
7417                 __isl_take isl_val *v);
7418         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
7419                 __isl_take isl_union_pw_aff *upa,
7420                 __isl_take isl_val *v);
7421         __isl_give isl_union_pw_multi_aff *
7422         isl_union_pw_multi_aff_scale_down_val(
7423                 __isl_take isl_union_pw_multi_aff *upma,
7424                 __isl_take isl_val *val);
7425         __isl_give isl_multi_union_pw_aff *
7426         isl_multi_union_pw_aff_scale_down_val(
7427                 __isl_take isl_multi_union_pw_aff *mupa,
7428                 __isl_take isl_val *v);
7430         #include <isl/polynomial.h>
7431         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
7432                 __isl_take isl_qpolynomial *qp,
7433                 __isl_take isl_val *v);
7434         __isl_give isl_qpolynomial_fold *
7435         isl_qpolynomial_fold_scale_val(
7436                 __isl_take isl_qpolynomial_fold *fold,
7437                 __isl_take isl_val *v);
7438         __isl_give isl_pw_qpolynomial *
7439         isl_pw_qpolynomial_scale_val(
7440                 __isl_take isl_pw_qpolynomial *pwqp,
7441                 __isl_take isl_val *v);
7442         __isl_give isl_pw_qpolynomial_fold *
7443         isl_pw_qpolynomial_fold_scale_val(
7444                 __isl_take isl_pw_qpolynomial_fold *pwf,
7445                 __isl_take isl_val *v);
7446         __isl_give isl_union_pw_qpolynomial *
7447         isl_union_pw_qpolynomial_scale_val(
7448                 __isl_take isl_union_pw_qpolynomial *upwqp,
7449                 __isl_take isl_val *v);
7450         __isl_give isl_union_pw_qpolynomial_fold *
7451         isl_union_pw_qpolynomial_fold_scale_val(
7452                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7453                 __isl_take isl_val *v);
7454         __isl_give isl_qpolynomial *
7455         isl_qpolynomial_scale_down_val(
7456                 __isl_take isl_qpolynomial *qp,
7457                 __isl_take isl_val *v);
7458         __isl_give isl_qpolynomial_fold *
7459         isl_qpolynomial_fold_scale_down_val(
7460                 __isl_take isl_qpolynomial_fold *fold,
7461                 __isl_take isl_val *v);
7462         __isl_give isl_pw_qpolynomial *
7463         isl_pw_qpolynomial_scale_down_val(
7464                 __isl_take isl_pw_qpolynomial *pwqp,
7465                 __isl_take isl_val *v);
7466         __isl_give isl_pw_qpolynomial_fold *
7467         isl_pw_qpolynomial_fold_scale_down_val(
7468                 __isl_take isl_pw_qpolynomial_fold *pwf,
7469                 __isl_take isl_val *v);
7470         __isl_give isl_union_pw_qpolynomial *
7471         isl_union_pw_qpolynomial_scale_down_val(
7472                 __isl_take isl_union_pw_qpolynomial *upwqp,
7473                 __isl_take isl_val *v);
7474         __isl_give isl_union_pw_qpolynomial_fold *
7475         isl_union_pw_qpolynomial_fold_scale_down_val(
7476                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7477                 __isl_take isl_val *v);
7479         #include <isl/val.h>
7480         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
7481                 __isl_take isl_multi_val *mv1,
7482                 __isl_take isl_multi_val *mv2);
7483         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
7484                 __isl_take isl_multi_val *mv1,
7485                 __isl_take isl_multi_val *mv2);
7486         __isl_give isl_multi_val *
7487         isl_multi_val_scale_down_multi_val(
7488                 __isl_take isl_multi_val *mv1,
7489                 __isl_take isl_multi_val *mv2);
7491         #include <isl/aff.h>
7492         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
7493                 __isl_take isl_multi_aff *ma,
7494                 __isl_take isl_multi_val *mv);
7495         __isl_give isl_multi_union_pw_aff *
7496         isl_multi_union_pw_aff_mod_multi_val(
7497                 __isl_take isl_multi_union_pw_aff *upma,
7498                 __isl_take isl_multi_val *mv);
7499         __isl_give isl_multi_pw_aff *
7500         isl_multi_pw_aff_mod_multi_val(
7501                 __isl_take isl_multi_pw_aff *mpa,
7502                 __isl_take isl_multi_val *mv);
7503         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
7504                 __isl_take isl_multi_aff *ma,
7505                 __isl_take isl_multi_val *mv);
7506         __isl_give isl_pw_multi_aff *
7507         isl_pw_multi_aff_scale_multi_val(
7508                 __isl_take isl_pw_multi_aff *pma,
7509                 __isl_take isl_multi_val *mv);
7510         __isl_give isl_multi_pw_aff *
7511         isl_multi_pw_aff_scale_multi_val(
7512                 __isl_take isl_multi_pw_aff *mpa,
7513                 __isl_take isl_multi_val *mv);
7514         __isl_give isl_multi_union_pw_aff *
7515         isl_multi_union_pw_aff_scale_multi_val(
7516                 __isl_take isl_multi_union_pw_aff *mupa,
7517                 __isl_take isl_multi_val *mv);
7518         __isl_give isl_union_pw_multi_aff *
7519         isl_union_pw_multi_aff_scale_multi_val(
7520                 __isl_take isl_union_pw_multi_aff *upma,
7521                 __isl_take isl_multi_val *mv);
7522         __isl_give isl_multi_aff *
7523         isl_multi_aff_scale_down_multi_val(
7524                 __isl_take isl_multi_aff *ma,
7525                 __isl_take isl_multi_val *mv);
7526         __isl_give isl_multi_pw_aff *
7527         isl_multi_pw_aff_scale_down_multi_val(
7528                 __isl_take isl_multi_pw_aff *mpa,
7529                 __isl_take isl_multi_val *mv);
7530         __isl_give isl_multi_union_pw_aff *
7531         isl_multi_union_pw_aff_scale_down_multi_val(
7532                 __isl_take isl_multi_union_pw_aff *mupa,
7533                 __isl_take isl_multi_val *mv);
7535 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
7536 by the corresponding elements of C<mv>.
7538         #include <isl/aff.h>
7539         __isl_give isl_aff *isl_aff_mul(
7540                 __isl_take isl_aff *aff1,
7541                 __isl_take isl_aff *aff2);
7542         __isl_give isl_aff *isl_aff_div(
7543                 __isl_take isl_aff *aff1,
7544                 __isl_take isl_aff *aff2);
7545         __isl_give isl_pw_aff *isl_pw_aff_mul(
7546                 __isl_take isl_pw_aff *pwaff1,
7547                 __isl_take isl_pw_aff *pwaff2);
7548         __isl_give isl_pw_aff *isl_pw_aff_div(
7549                 __isl_take isl_pw_aff *pa1,
7550                 __isl_take isl_pw_aff *pa2);
7551         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
7552                 __isl_take isl_pw_aff *pa1,
7553                 __isl_take isl_pw_aff *pa2);
7554         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
7555                 __isl_take isl_pw_aff *pa1,
7556                 __isl_take isl_pw_aff *pa2);
7558 When multiplying two affine expressions, at least one of the two needs
7559 to be a constant.  Similarly, when dividing an affine expression by another,
7560 the second expression needs to be a constant.
7561 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
7562 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
7563 remainder.
7565         #include <isl/polynomial.h>
7566         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
7567                 __isl_take isl_qpolynomial *qp1,
7568                 __isl_take isl_qpolynomial *qp2);
7569         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
7570                 __isl_take isl_pw_qpolynomial *pwqp1,
7571                 __isl_take isl_pw_qpolynomial *pwqp2);
7572         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
7573                 __isl_take isl_union_pw_qpolynomial *upwqp1,
7574                 __isl_take isl_union_pw_qpolynomial *upwqp2);
7576 =back
7578 =head3 Lexicographic Optimization
7580 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
7581 the following functions
7582 compute a set that contains the lexicographic minimum or maximum
7583 of the elements in C<set> (or C<bset>) for those values of the parameters
7584 that satisfy C<dom>.
7585 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7586 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
7587 has no elements.
7588 In other words, the union of the parameter values
7589 for which the result is non-empty and of C<*empty>
7590 is equal to C<dom>.
7592         #include <isl/set.h>
7593         __isl_give isl_set *isl_basic_set_partial_lexmin(
7594                 __isl_take isl_basic_set *bset,
7595                 __isl_take isl_basic_set *dom,
7596                 __isl_give isl_set **empty);
7597         __isl_give isl_set *isl_basic_set_partial_lexmax(
7598                 __isl_take isl_basic_set *bset,
7599                 __isl_take isl_basic_set *dom,
7600                 __isl_give isl_set **empty);
7601         __isl_give isl_set *isl_set_partial_lexmin(
7602                 __isl_take isl_set *set, __isl_take isl_set *dom,
7603                 __isl_give isl_set **empty);
7604         __isl_give isl_set *isl_set_partial_lexmax(
7605                 __isl_take isl_set *set, __isl_take isl_set *dom,
7606                 __isl_give isl_set **empty);
7608 Given a (basic) set C<set> (or C<bset>), the following functions simply
7609 return a set containing the lexicographic minimum or maximum
7610 of the elements in C<set> (or C<bset>).
7611 In case of union sets, the optimum is computed per space.
7613         #include <isl/set.h>
7614         __isl_give isl_set *isl_basic_set_lexmin(
7615                 __isl_take isl_basic_set *bset);
7616         __isl_give isl_set *isl_basic_set_lexmax(
7617                 __isl_take isl_basic_set *bset);
7618         __isl_give isl_set *isl_set_lexmin(
7619                 __isl_take isl_set *set);
7620         __isl_give isl_set *isl_set_lexmax(
7621                 __isl_take isl_set *set);
7622         __isl_give isl_union_set *isl_union_set_lexmin(
7623                 __isl_take isl_union_set *uset);
7624         __isl_give isl_union_set *isl_union_set_lexmax(
7625                 __isl_take isl_union_set *uset);
7627 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
7628 the following functions
7629 compute a relation that maps each element of C<dom>
7630 to the single lexicographic minimum or maximum
7631 of the elements that are associated to that same
7632 element in C<map> (or C<bmap>).
7633 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7634 that contains the elements in C<dom> that do not map
7635 to any elements in C<map> (or C<bmap>).
7636 In other words, the union of the domain of the result and of C<*empty>
7637 is equal to C<dom>.
7639         #include <isl/map.h>
7640         __isl_give isl_map *isl_basic_map_partial_lexmax(
7641                 __isl_take isl_basic_map *bmap,
7642                 __isl_take isl_basic_set *dom,
7643                 __isl_give isl_set **empty);
7644         __isl_give isl_map *isl_basic_map_partial_lexmin(
7645                 __isl_take isl_basic_map *bmap,
7646                 __isl_take isl_basic_set *dom,
7647                 __isl_give isl_set **empty);
7648         __isl_give isl_map *isl_map_partial_lexmax(
7649                 __isl_take isl_map *map, __isl_take isl_set *dom,
7650                 __isl_give isl_set **empty);
7651         __isl_give isl_map *isl_map_partial_lexmin(
7652                 __isl_take isl_map *map, __isl_take isl_set *dom,
7653                 __isl_give isl_set **empty);
7655 Given a (basic) map C<map> (or C<bmap>), the following functions simply
7656 return a map mapping each element in the domain of
7657 C<map> (or C<bmap>) to the lexicographic minimum or maximum
7658 of all elements associated to that element.
7659 In case of union relations, the optimum is computed per space.
7661         #include <isl/map.h>
7662         __isl_give isl_map *isl_basic_map_lexmin(
7663                 __isl_take isl_basic_map *bmap);
7664         __isl_give isl_map *isl_basic_map_lexmax(
7665                 __isl_take isl_basic_map *bmap);
7666         __isl_give isl_map *isl_map_lexmin(
7667                 __isl_take isl_map *map);
7668         __isl_give isl_map *isl_map_lexmax(
7669                 __isl_take isl_map *map);
7670         __isl_give isl_union_map *isl_union_map_lexmin(
7671                 __isl_take isl_union_map *umap);
7672         __isl_give isl_union_map *isl_union_map_lexmax(
7673                 __isl_take isl_union_map *umap);
7675 The following functions return their result in the form of
7676 a piecewise multi-affine expression,
7677 but are otherwise equivalent to the corresponding functions
7678 returning a basic set or relation.
7680         #include <isl/set.h>
7681         __isl_give isl_pw_multi_aff *
7682         isl_basic_set_partial_lexmin_pw_multi_aff(
7683                 __isl_take isl_basic_set *bset,
7684                 __isl_take isl_basic_set *dom,
7685                 __isl_give isl_set **empty);
7686         __isl_give isl_pw_multi_aff *
7687         isl_basic_set_partial_lexmax_pw_multi_aff(
7688                 __isl_take isl_basic_set *bset,
7689                 __isl_take isl_basic_set *dom,
7690                 __isl_give isl_set **empty);
7691         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
7692                 __isl_take isl_set *set);
7693         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
7694                 __isl_take isl_set *set);
7696         #include <isl/map.h>
7697         __isl_give isl_pw_multi_aff *
7698         isl_basic_map_lexmin_pw_multi_aff(
7699                 __isl_take isl_basic_map *bmap);
7700         __isl_give isl_pw_multi_aff *
7701         isl_basic_map_partial_lexmin_pw_multi_aff(
7702                 __isl_take isl_basic_map *bmap,
7703                 __isl_take isl_basic_set *dom,
7704                 __isl_give isl_set **empty);
7705         __isl_give isl_pw_multi_aff *
7706         isl_basic_map_partial_lexmax_pw_multi_aff(
7707                 __isl_take isl_basic_map *bmap,
7708                 __isl_take isl_basic_set *dom,
7709                 __isl_give isl_set **empty);
7710         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
7711                 __isl_take isl_map *map);
7712         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
7713                 __isl_take isl_map *map);
7715 The following functions return the lexicographic minimum or maximum
7716 on the shared domain of the inputs and the single defined function
7717 on those parts of the domain where only a single function is defined.
7719         #include <isl/aff.h>
7720         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
7721                 __isl_take isl_pw_multi_aff *pma1,
7722                 __isl_take isl_pw_multi_aff *pma2);
7723         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
7724                 __isl_take isl_pw_multi_aff *pma1,
7725                 __isl_take isl_pw_multi_aff *pma2);
7727 If the input to a lexicographic optimization problem has
7728 multiple constraints with the same coefficients for the optimized
7729 variables, then, by default, this symmetry is exploited by
7730 replacing those constraints by a single constraint with
7731 an abstract bound, which is in turn bounded by the corresponding terms
7732 in the original constraints.
7733 Without this optimization, the solver would typically consider
7734 all possible orderings of those original bounds, resulting in a needless
7735 decomposition of the domain.
7736 However, the optimization can also result in slowdowns since
7737 an extra parameter is introduced that may get used in additional
7738 integer divisions.
7739 The following option determines whether symmetry detection is applied
7740 during lexicographic optimization.
7742         #include <isl/options.h>
7743         isl_stat isl_options_set_pip_symmetry(isl_ctx *ctx,
7744                 int val);
7745         int isl_options_get_pip_symmetry(isl_ctx *ctx);
7747 =begin latex
7749 See also \autoref{s:offline}.
7751 =end latex
7753 =head2 Ternary Operations
7755         #include <isl/aff.h>
7756         __isl_give isl_pw_aff *isl_pw_aff_cond(
7757                 __isl_take isl_pw_aff *cond,
7758                 __isl_take isl_pw_aff *pwaff_true,
7759                 __isl_take isl_pw_aff *pwaff_false);
7761 The function C<isl_pw_aff_cond> performs a conditional operator
7762 and returns an expression that is equal to C<pwaff_true>
7763 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
7764 where C<cond> is zero.
7766 =head2 Lists
7768 Lists are defined over several element types, including
7769 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
7770 C<isl_union_pw_multi_aff>, C<isl_constraint>,
7771 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
7772 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
7773 Here we take lists of C<isl_set>s as an example.
7774 Lists can be created, copied, modified and freed using the following functions.
7776         #include <isl/set.h>
7777         __isl_give isl_set_list *isl_set_list_from_set(
7778                 __isl_take isl_set *el);
7779         __isl_give isl_set_list *isl_set_list_alloc(
7780                 isl_ctx *ctx, int n);
7781         __isl_give isl_set_list *isl_set_list_copy(
7782                 __isl_keep isl_set_list *list);
7783         __isl_give isl_set_list *isl_set_list_insert(
7784                 __isl_take isl_set_list *list, unsigned pos,
7785                 __isl_take isl_set *el);
7786         __isl_give isl_set_list *isl_set_list_add(
7787                 __isl_take isl_set_list *list,
7788                 __isl_take isl_set *el);
7789         __isl_give isl_set_list *isl_set_list_drop(
7790                 __isl_take isl_set_list *list,
7791                 unsigned first, unsigned n);
7792         __isl_give isl_set_list *isl_set_list_set_set(
7793                 __isl_take isl_set_list *list, int index,
7794                 __isl_take isl_set *set);
7795         __isl_give isl_set_list *isl_set_list_concat(
7796                 __isl_take isl_set_list *list1,
7797                 __isl_take isl_set_list *list2);
7798         __isl_give isl_set_list *isl_set_list_map(
7799                 __isl_take isl_set_list *list,
7800                 __isl_give isl_set *(*fn)(__isl_take isl_set *el,
7801                         void *user),
7802                 void *user);
7803         __isl_give isl_set_list *isl_set_list_sort(
7804                 __isl_take isl_set_list *list,
7805                 int (*cmp)(__isl_keep isl_set *a,
7806                         __isl_keep isl_set *b, void *user),
7807                 void *user);
7808         __isl_null isl_set_list *isl_set_list_free(
7809                 __isl_take isl_set_list *list);
7811 C<isl_set_list_alloc> creates an empty list with an initial capacity
7812 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
7813 add elements to a list, increasing its capacity as needed.
7814 C<isl_set_list_from_set> creates a list with a single element.
7816 Lists can be inspected using the following functions.
7818         #include <isl/set.h>
7819         int isl_set_list_n_set(__isl_keep isl_set_list *list);
7820         __isl_give isl_set *isl_set_list_get_set(
7821                 __isl_keep isl_set_list *list, int index);
7822         isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
7823                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7824                 void *user);
7825         isl_stat isl_set_list_foreach_scc(
7826                 __isl_keep isl_set_list *list,
7827                 isl_bool (*follows)(__isl_keep isl_set *a,
7828                         __isl_keep isl_set *b, void *user),
7829                 void *follows_user,
7830                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7831                 void *fn_user);
7833 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
7834 strongly connected components of the graph with as vertices the elements
7835 of C<list> and a directed edge from vertex C<b> to vertex C<a>
7836 iff C<follows(a, b)> returns C<isl_bool_true>.  The callbacks C<follows> and
7837 C<fn> should return C<isl_bool_error> or C<isl_stat_error> on error.
7839 Lists can be printed using
7841         #include <isl/set.h>
7842         __isl_give isl_printer *isl_printer_print_set_list(
7843                 __isl_take isl_printer *p,
7844                 __isl_keep isl_set_list *list);
7846 =head2 Associative arrays
7848 Associative arrays map isl objects of a specific type to isl objects
7849 of some (other) specific type.  They are defined for several pairs
7850 of types, including (C<isl_map>, C<isl_basic_set>),
7851 (C<isl_id>, C<isl_ast_expr>),
7852 (C<isl_id>, C<isl_id>) and
7853 (C<isl_id>, C<isl_pw_aff>).
7854 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7855 as an example.
7857 Associative arrays can be created, copied and freed using
7858 the following functions.
7860         #include <isl/id_to_ast_expr.h>
7861         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7862                 isl_ctx *ctx, int min_size);
7863         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7864                 __isl_keep isl_id_to_ast_expr *id2expr);
7865         __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7866                 __isl_take isl_id_to_ast_expr *id2expr);
7868 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7869 to specify the expected size of the associative array.
7870 The associative array will be grown automatically as needed.
7872 Associative arrays can be inspected using the following functions.
7874         #include <isl/id_to_ast_expr.h>
7875         __isl_give isl_maybe_isl_ast_expr
7876         isl_id_to_ast_expr_try_get(
7877                 __isl_keep isl_id_to_ast_expr *id2expr,
7878                 __isl_keep isl_id *key);
7879         isl_bool isl_id_to_ast_expr_has(
7880                 __isl_keep isl_id_to_ast_expr *id2expr,
7881                 __isl_keep isl_id *key);
7882         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7883                 __isl_keep isl_id_to_ast_expr *id2expr,
7884                 __isl_take isl_id *key);
7885         isl_stat isl_id_to_ast_expr_foreach(
7886                 __isl_keep isl_id_to_ast_expr *id2expr,
7887                 isl_stat (*fn)(__isl_take isl_id *key,
7888                         __isl_take isl_ast_expr *val, void *user),
7889                 void *user);
7891 The function C<isl_id_to_ast_expr_try_get> returns a structure
7892 containing two elements, C<valid> and C<value>.
7893 If there is a value associated to the key, then C<valid>
7894 is set to C<isl_bool_true> and C<value> contains a copy of
7895 the associated value.  Otherwise C<value> is C<NULL> and
7896 C<valid> may be C<isl_bool_error> or C<isl_bool_false> depending
7897 on whether some error has occurred or there simply is no associated value.
7898 The function C<isl_id_to_ast_expr_has> returns the C<valid> field
7899 in the structure and
7900 the function C<isl_id_to_ast_expr_get> returns the C<value> field.
7902 Associative arrays can be modified using the following functions.
7904         #include <isl/id_to_ast_expr.h>
7905         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7906                 __isl_take isl_id_to_ast_expr *id2expr,
7907                 __isl_take isl_id *key,
7908                 __isl_take isl_ast_expr *val);
7909         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7910                 __isl_take isl_id_to_ast_expr *id2expr,
7911                 __isl_take isl_id *key);
7913 Associative arrays can be printed using the following function.
7915         #include <isl/id_to_ast_expr.h>
7916         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7917                 __isl_take isl_printer *p,
7918                 __isl_keep isl_id_to_ast_expr *id2expr);
7920 =head2 Vectors
7922 Vectors can be created, copied and freed using the following functions.
7924         #include <isl/vec.h>
7925         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7926                 unsigned size);
7927         __isl_give isl_vec *isl_vec_zero(isl_ctx *ctx,
7928                 unsigned size);
7929         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7930         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7932 Note that the elements of a vector created by C<isl_vec_alloc>
7933 may have arbitrary values.
7934 A vector created by C<isl_vec_zero> has elements with value zero.
7935 The elements can be changed and inspected using the following functions.
7937         int isl_vec_size(__isl_keep isl_vec *vec);
7938         __isl_give isl_val *isl_vec_get_element_val(
7939                 __isl_keep isl_vec *vec, int pos);
7940         __isl_give isl_vec *isl_vec_set_element_si(
7941                 __isl_take isl_vec *vec, int pos, int v);
7942         __isl_give isl_vec *isl_vec_set_element_val(
7943                 __isl_take isl_vec *vec, int pos,
7944                 __isl_take isl_val *v);
7945         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7946                 int v);
7947         __isl_give isl_vec *isl_vec_set_val(
7948                 __isl_take isl_vec *vec, __isl_take isl_val *v);
7949         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7950                 __isl_keep isl_vec *vec2, int pos);
7952 C<isl_vec_get_element> will return a negative value if anything went wrong.
7953 In that case, the value of C<*v> is undefined.
7955 The following function can be used to concatenate two vectors.
7957         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7958                 __isl_take isl_vec *vec2);
7960 =head2 Matrices
7962 Matrices can be created, copied and freed using the following functions.
7964         #include <isl/mat.h>
7965         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7966                 unsigned n_row, unsigned n_col);
7967         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7968         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7970 Note that the elements of a newly created matrix may have arbitrary values.
7971 The elements can be changed and inspected using the following functions.
7973         int isl_mat_rows(__isl_keep isl_mat *mat);
7974         int isl_mat_cols(__isl_keep isl_mat *mat);
7975         __isl_give isl_val *isl_mat_get_element_val(
7976                 __isl_keep isl_mat *mat, int row, int col);
7977         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7978                 int row, int col, int v);
7979         __isl_give isl_mat *isl_mat_set_element_val(
7980                 __isl_take isl_mat *mat, int row, int col,
7981                 __isl_take isl_val *v);
7983 The following function computes the rank of a matrix.
7984 The return value may be -1 if some error occurred.
7986         #include <isl/mat.h>
7987         int isl_mat_rank(__isl_keep isl_mat *mat);
7989 The following function can be used to compute the (right) inverse
7990 of a matrix, i.e., a matrix such that the product of the original
7991 and the inverse (in that order) is a multiple of the identity matrix.
7992 The input matrix is assumed to be of full row-rank.
7994         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7996 The following function can be used to compute the (right) kernel
7997 (or null space) of a matrix, i.e., a matrix such that the product of
7998 the original and the kernel (in that order) is the zero matrix.
8000         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
8002 The following function computes a basis for the space spanned
8003 by the rows of a matrix.
8005         __isl_give isl_mat *isl_mat_row_basis(
8006                 __isl_take isl_mat *mat);
8008 The following function computes rows that extend a basis of C<mat1>
8009 to a basis that also covers C<mat2>.
8011         __isl_give isl_mat *isl_mat_row_basis_extension(
8012                 __isl_take isl_mat *mat1,
8013                 __isl_take isl_mat *mat2);
8015 The following function checks whether there is no linear dependence
8016 among the combined rows of "mat1" and "mat2" that is not already present
8017 in "mat1" or "mat2" individually.
8018 If "mat1" and "mat2" have linearly independent rows by themselves,
8019 then this means that there is no linear dependence among all rows together.
8021         isl_bool isl_mat_has_linearly_independent_rows(
8022                 __isl_keep isl_mat *mat1,
8023                 __isl_keep isl_mat *mat2);
8025 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
8027 The following functions determine
8028 an upper or lower bound on a quasipolynomial over its domain.
8030         __isl_give isl_pw_qpolynomial_fold *
8031         isl_pw_qpolynomial_bound(
8032                 __isl_take isl_pw_qpolynomial *pwqp,
8033                 enum isl_fold type, int *tight);
8035         __isl_give isl_union_pw_qpolynomial_fold *
8036         isl_union_pw_qpolynomial_bound(
8037                 __isl_take isl_union_pw_qpolynomial *upwqp,
8038                 enum isl_fold type, int *tight);
8040 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
8041 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
8042 is the returned bound is known be tight, i.e., for each value
8043 of the parameters there is at least
8044 one element in the domain that reaches the bound.
8045 If the domain of C<pwqp> is not wrapping, then the bound is computed
8046 over all elements in that domain and the result has a purely parametric
8047 domain.  If the domain of C<pwqp> is wrapping, then the bound is
8048 computed over the range of the wrapped relation.  The domain of the
8049 wrapped relation becomes the domain of the result.
8051 =head2 Parametric Vertex Enumeration
8053 The parametric vertex enumeration described in this section
8054 is mainly intended to be used internally and by the C<barvinok>
8055 library.
8057         #include <isl/vertices.h>
8058         __isl_give isl_vertices *isl_basic_set_compute_vertices(
8059                 __isl_keep isl_basic_set *bset);
8061 The function C<isl_basic_set_compute_vertices> performs the
8062 actual computation of the parametric vertices and the chamber
8063 decomposition and stores the result in an C<isl_vertices> object.
8064 This information can be queried by either iterating over all
8065 the vertices or iterating over all the chambers or cells
8066 and then iterating over all vertices that are active on the chamber.
8068         isl_stat isl_vertices_foreach_vertex(
8069                 __isl_keep isl_vertices *vertices,
8070                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
8071                         void *user), void *user);
8073         isl_stat isl_vertices_foreach_cell(
8074                 __isl_keep isl_vertices *vertices,
8075                 isl_stat (*fn)(__isl_take isl_cell *cell,
8076                         void *user), void *user);
8077         isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
8078                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
8079                         void *user), void *user);
8081 Other operations that can be performed on an C<isl_vertices> object are
8082 the following.
8084         int isl_vertices_get_n_vertices(
8085                 __isl_keep isl_vertices *vertices);
8086         __isl_null isl_vertices *isl_vertices_free(
8087                 __isl_take isl_vertices *vertices);
8089 Vertices can be inspected and destroyed using the following functions.
8091         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
8092         __isl_give isl_basic_set *isl_vertex_get_domain(
8093                 __isl_keep isl_vertex *vertex);
8094         __isl_give isl_multi_aff *isl_vertex_get_expr(
8095                 __isl_keep isl_vertex *vertex);
8096         void isl_vertex_free(__isl_take isl_vertex *vertex);
8098 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
8099 describing the vertex in terms of the parameters,
8100 while C<isl_vertex_get_domain> returns the activity domain
8101 of the vertex.
8103 Chambers can be inspected and destroyed using the following functions.
8105         __isl_give isl_basic_set *isl_cell_get_domain(
8106                 __isl_keep isl_cell *cell);
8107         void isl_cell_free(__isl_take isl_cell *cell);
8109 =head1 Polyhedral Compilation Library
8111 This section collects functionality in C<isl> that has been specifically
8112 designed for use during polyhedral compilation.
8114 =head2 Schedule Trees
8116 A schedule tree is a structured representation of a schedule,
8117 assigning a relative order to a set of domain elements.
8118 The relative order expressed by the schedule tree is
8119 defined recursively.  In particular, the order between
8120 two domain elements is determined by the node that is closest
8121 to the root that refers to both elements and that orders them apart.
8122 Each node in the tree is of one of several types.
8123 The root node is always of type C<isl_schedule_node_domain>
8124 (or C<isl_schedule_node_extension>)
8125 and it describes the (extra) domain elements to which the schedule applies.
8126 The other types of nodes are as follows.
8128 =over
8130 =item C<isl_schedule_node_band>
8132 A band of schedule dimensions.  Each schedule dimension is represented
8133 by a union piecewise quasi-affine expression.  If this expression
8134 assigns a different value to two domain elements, while all previous
8135 schedule dimensions in the same band assign them the same value,
8136 then the two domain elements are ordered according to these two
8137 different values.
8138 Each expression is required to be total in the domain elements
8139 that reach the band node.
8141 =item C<isl_schedule_node_expansion>
8143 An expansion node maps each of the domain elements that reach the node
8144 to one or more domain elements.  The image of this mapping forms
8145 the set of domain elements that reach the child of the expansion node.
8146 The function that maps each of the expanded domain elements
8147 to the original domain element from which it was expanded
8148 is called the contraction.
8150 =item C<isl_schedule_node_filter>
8152 A filter node does not impose any ordering, but rather intersects
8153 the set of domain elements that the current subtree refers to
8154 with a given union set.  The subtree of the filter node only
8155 refers to domain elements in the intersection.
8156 A filter node is typically only used as a child of a sequence or
8157 set node.
8159 =item C<isl_schedule_node_leaf>
8161 A leaf of the schedule tree.  Leaf nodes do not impose any ordering.
8163 =item C<isl_schedule_node_mark>
8165 A mark node can be used to attach any kind of information to a subtree
8166 of the schedule tree.
8168 =item C<isl_schedule_node_sequence>
8170 A sequence node has one or more children, each of which is a filter node.
8171 The filters on these filter nodes form a partition of
8172 the domain elements that the current subtree refers to.
8173 If two domain elements appear in distinct filters then the sequence
8174 node orders them according to the child positions of the corresponding
8175 filter nodes.
8177 =item C<isl_schedule_node_set>
8179 A set node is similar to a sequence node, except that
8180 it expresses that domain elements appearing in distinct filters
8181 may have any order.  The order of the children of a set node
8182 is therefore also immaterial.
8184 =back
8186 The following node types are only supported by the AST generator.
8188 =over
8190 =item C<isl_schedule_node_context>
8192 The context describes constraints on the parameters and
8193 the schedule dimensions of outer
8194 bands that the AST generator may assume to hold.  It is also the only
8195 kind of node that may introduce additional parameters.
8196 The space of the context is that of the flat product of the outer
8197 band nodes.  In particular, if there are no outer band nodes, then
8198 this space is the unnamed zero-dimensional space.
8199 Since a context node references the outer band nodes, any tree
8200 containing a context node is considered to be anchored.
8202 =item C<isl_schedule_node_extension>
8204 An extension node instructs the AST generator to add additional
8205 domain elements that need to be scheduled.
8206 The additional domain elements are described by the range of
8207 the extension map in terms of the outer schedule dimensions,
8208 i.e., the flat product of the outer band nodes.
8209 Note that domain elements are added whenever the AST generator
8210 reaches the extension node, meaning that there are still some
8211 active domain elements for which an AST needs to be generated.
8212 The conditions under which some domain elements are still active
8213 may however not be completely described by the outer AST nodes
8214 generated at that point.
8215 Since an extension node references the outer band nodes, any tree
8216 containing an extension node is considered to be anchored.
8218 An extension node may also appear as the root of a schedule tree,
8219 when it is intended to be inserted into another tree
8220 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
8221 In this case, the domain of the extension node should
8222 correspond to the flat product of the outer band nodes
8223 in this other schedule tree at the point where the extension tree
8224 will be inserted.
8226 =item C<isl_schedule_node_guard>
8228 The guard describes constraints on the parameters and
8229 the schedule dimensions of outer
8230 bands that need to be enforced by the outer nodes
8231 in the generated AST.
8232 That is, the part of the AST that is generated from descendants
8233 of the guard node can assume that these constraints are satisfied.
8234 The space of the guard is that of the flat product of the outer
8235 band nodes.  In particular, if there are no outer band nodes, then
8236 this space is the unnamed zero-dimensional space.
8237 Since a guard node references the outer band nodes, any tree
8238 containing a guard node is considered to be anchored.
8240 =back
8242 Except for the C<isl_schedule_node_context> nodes,
8243 none of the nodes may introduce any parameters that were not
8244 already present in the root domain node.
8246 A schedule tree is encapsulated in an C<isl_schedule> object.
8247 The simplest such objects, those with a tree consisting of single domain node,
8248 can be created using the following functions with either an empty
8249 domain or a given domain.
8251         #include <isl/schedule.h>
8252         __isl_give isl_schedule *isl_schedule_empty(
8253                 __isl_take isl_space *space);
8254         __isl_give isl_schedule *isl_schedule_from_domain(
8255                 __isl_take isl_union_set *domain);
8257 The function C<isl_schedule_constraints_compute_schedule> described
8258 in L</"Scheduling"> can also be used to construct schedules.
8260 C<isl_schedule> objects may be copied and freed using the following functions.
8262         #include <isl/schedule.h>
8263         __isl_give isl_schedule *isl_schedule_copy(
8264                 __isl_keep isl_schedule *sched);
8265         __isl_null isl_schedule *isl_schedule_free(
8266                 __isl_take isl_schedule *sched);
8268 The following functions checks whether two C<isl_schedule> objects
8269 are obviously the same.
8271         #include <isl/schedule.h>
8272         isl_bool isl_schedule_plain_is_equal(
8273                 __isl_keep isl_schedule *schedule1,
8274                 __isl_keep isl_schedule *schedule2);
8276 The domain of the schedule, i.e., the domain described by the root node,
8277 can be obtained using the following function.
8279         #include <isl/schedule.h>
8280         __isl_give isl_union_set *isl_schedule_get_domain(
8281                 __isl_keep isl_schedule *schedule);
8283 An extra top-level band node (right underneath the domain node) can
8284 be introduced into the schedule using the following function.
8285 The schedule tree is assumed not to have any anchored nodes.
8287         #include <isl/schedule.h>
8288         __isl_give isl_schedule *
8289         isl_schedule_insert_partial_schedule(
8290                 __isl_take isl_schedule *schedule,
8291                 __isl_take isl_multi_union_pw_aff *partial);
8293 A top-level context node (right underneath the domain node) can
8294 be introduced into the schedule using the following function.
8296         #include <isl/schedule.h>
8297         __isl_give isl_schedule *isl_schedule_insert_context(
8298                 __isl_take isl_schedule *schedule,
8299                 __isl_take isl_set *context)
8301 A top-level guard node (right underneath the domain node) can
8302 be introduced into the schedule using the following function.
8304         #include <isl/schedule.h>
8305         __isl_give isl_schedule *isl_schedule_insert_guard(
8306                 __isl_take isl_schedule *schedule,
8307                 __isl_take isl_set *guard)
8309 A schedule that combines two schedules either in the given
8310 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
8311 or an C<isl_schedule_node_set> node,
8312 can be created using the following functions.
8314         #include <isl/schedule.h>
8315         __isl_give isl_schedule *isl_schedule_sequence(
8316                 __isl_take isl_schedule *schedule1,
8317                 __isl_take isl_schedule *schedule2);
8318         __isl_give isl_schedule *isl_schedule_set(
8319                 __isl_take isl_schedule *schedule1,
8320                 __isl_take isl_schedule *schedule2);
8322 The domains of the two input schedules need to be disjoint.
8324 The following function can be used to restrict the domain
8325 of a schedule with a domain node as root to be a subset of the given union set.
8326 This operation may remove nodes in the tree that have become
8327 redundant.
8329         #include <isl/schedule.h>
8330         __isl_give isl_schedule *isl_schedule_intersect_domain(
8331                 __isl_take isl_schedule *schedule,
8332                 __isl_take isl_union_set *domain);
8334 The following function can be used to simplify the domain
8335 of a schedule with a domain node as root with respect to the given
8336 parameter domain.
8338         #include <isl/schedule.h>
8339         __isl_give isl_schedule *isl_schedule_gist_domain_params(
8340                 __isl_take isl_schedule *schedule,
8341                 __isl_take isl_set *context);
8343 The following function resets the user pointers on all parameter
8344 and tuple identifiers referenced by the nodes of the given schedule.
8346         #include <isl/schedule.h>
8347         __isl_give isl_schedule *isl_schedule_reset_user(
8348                 __isl_take isl_schedule *schedule);
8350 The following function aligns the parameters of all nodes
8351 in the given schedule to the given space.
8353         #include <isl/schedule.h>
8354         __isl_give isl_schedule *isl_schedule_align_params(
8355                 __isl_take isl_schedule *schedule,
8356                 __isl_take isl_space *space);
8358 The following function allows the user to plug in a given function
8359 in the iteration domains.  The input schedule is not allowed to contain
8360 any expansion nodes.
8362         #include <isl/schedule.h>
8363         __isl_give isl_schedule *
8364         isl_schedule_pullback_union_pw_multi_aff(
8365                 __isl_take isl_schedule *schedule,
8366                 __isl_take isl_union_pw_multi_aff *upma);
8368 The following function can be used to plug in the schedule C<expansion>
8369 in the leaves of C<schedule>, where C<contraction> describes how
8370 the domain elements of C<expansion> map to the domain elements
8371 at the original leaves of C<schedule>.
8372 The resulting schedule will contain expansion nodes, unless
8373 C<contraction> is an identity function.
8375         #include <isl/schedule.h>
8376         __isl_give isl_schedule *isl_schedule_expand(
8377                 __isl_take isl_schedule *schedule,
8378                 __isl_take isl_union_pw_multi_aff *contraction,
8379                 __isl_take isl_schedule *expansion);
8381 An C<isl_union_map> representation of the schedule can be obtained
8382 from an C<isl_schedule> using the following function.
8384         #include <isl/schedule.h>
8385         __isl_give isl_union_map *isl_schedule_get_map(
8386                 __isl_keep isl_schedule *sched);
8388 The resulting relation encodes the same relative ordering as
8389 the schedule by mapping the domain elements to a common schedule space.
8390 If the schedule_separate_components option is set, then the order
8391 of the children of a set node is explicitly encoded in the result.
8392 If the tree contains any expansion nodes, then the relation
8393 is formulated in terms of the expanded domain elements.
8395 Schedules can be read from input using the following functions.
8397         #include <isl/schedule.h>
8398         __isl_give isl_schedule *isl_schedule_read_from_file(
8399                 isl_ctx *ctx, FILE *input);
8400         __isl_give isl_schedule *isl_schedule_read_from_str(
8401                 isl_ctx *ctx, const char *str);
8403 A representation of the schedule can be printed using
8405         #include <isl/schedule.h>
8406         __isl_give isl_printer *isl_printer_print_schedule(
8407                 __isl_take isl_printer *p,
8408                 __isl_keep isl_schedule *schedule);
8409         __isl_give char *isl_schedule_to_str(
8410                 __isl_keep isl_schedule *schedule);
8412 C<isl_schedule_to_str> prints the schedule in flow format.
8414 The schedule tree can be traversed through the use of
8415 C<isl_schedule_node> objects that point to a particular
8416 position in the schedule tree.  Whenever a C<isl_schedule_node>
8417 is used to modify a node in the schedule tree, the original schedule
8418 tree is left untouched and the modifications are performed to a copy
8419 of the tree.  The returned C<isl_schedule_node> then points to
8420 this modified copy of the tree.
8422 The root of the schedule tree can be obtained using the following function.
8424         #include <isl/schedule.h>
8425         __isl_give isl_schedule_node *isl_schedule_get_root(
8426                 __isl_keep isl_schedule *schedule);
8428 A pointer to a newly created schedule tree with a single domain
8429 node can be created using the following functions.
8431         #include <isl/schedule_node.h>
8432         __isl_give isl_schedule_node *
8433         isl_schedule_node_from_domain(
8434                 __isl_take isl_union_set *domain);
8435         __isl_give isl_schedule_node *
8436         isl_schedule_node_from_extension(
8437                 __isl_take isl_union_map *extension);
8439 C<isl_schedule_node_from_extension> creates a tree with an extension
8440 node as root.
8442 Schedule nodes can be copied and freed using the following functions.
8444         #include <isl/schedule_node.h>
8445         __isl_give isl_schedule_node *isl_schedule_node_copy(
8446                 __isl_keep isl_schedule_node *node);
8447         __isl_null isl_schedule_node *isl_schedule_node_free(
8448                 __isl_take isl_schedule_node *node);
8450 The following functions can be used to check if two schedule
8451 nodes point to the same position in the same schedule.
8453         #include <isl/schedule_node.h>
8454         isl_bool isl_schedule_node_is_equal(
8455                 __isl_keep isl_schedule_node *node1,
8456                 __isl_keep isl_schedule_node *node2);
8458 The following properties can be obtained from a schedule node.
8460         #include <isl/schedule_node.h>
8461         enum isl_schedule_node_type isl_schedule_node_get_type(
8462                 __isl_keep isl_schedule_node *node);
8463         enum isl_schedule_node_type
8464         isl_schedule_node_get_parent_type(
8465                 __isl_keep isl_schedule_node *node);
8466         __isl_give isl_schedule *isl_schedule_node_get_schedule(
8467                 __isl_keep isl_schedule_node *node);
8469 The function C<isl_schedule_node_get_type> returns the type of
8470 the node, while C<isl_schedule_node_get_parent_type> returns
8471 type of the parent of the node, which is required to exist.
8472 The function C<isl_schedule_node_get_schedule> returns a copy
8473 to the schedule to which the node belongs.
8475 The following functions can be used to move the schedule node
8476 to a different position in the tree or to check if such a position
8477 exists.
8479         #include <isl/schedule_node.h>
8480         isl_bool isl_schedule_node_has_parent(
8481                 __isl_keep isl_schedule_node *node);
8482         __isl_give isl_schedule_node *isl_schedule_node_parent(
8483                 __isl_take isl_schedule_node *node);
8484         __isl_give isl_schedule_node *isl_schedule_node_root(
8485                 __isl_take isl_schedule_node *node);
8486         __isl_give isl_schedule_node *isl_schedule_node_ancestor(
8487                 __isl_take isl_schedule_node *node,
8488                 int generation);
8489         int isl_schedule_node_n_children(
8490                 __isl_keep isl_schedule_node *node);
8491         __isl_give isl_schedule_node *isl_schedule_node_child(
8492                 __isl_take isl_schedule_node *node, int pos);
8493         isl_bool isl_schedule_node_has_children(
8494                 __isl_keep isl_schedule_node *node);
8495         __isl_give isl_schedule_node *isl_schedule_node_first_child(
8496                 __isl_take isl_schedule_node *node);
8497         isl_bool isl_schedule_node_has_previous_sibling(
8498                 __isl_keep isl_schedule_node *node);
8499         __isl_give isl_schedule_node *
8500         isl_schedule_node_previous_sibling(
8501                 __isl_take isl_schedule_node *node);
8502         isl_bool isl_schedule_node_has_next_sibling(
8503                 __isl_keep isl_schedule_node *node);
8504         __isl_give isl_schedule_node *
8505         isl_schedule_node_next_sibling(
8506                 __isl_take isl_schedule_node *node);
8508 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
8509 is the node itself, the ancestor of generation 1 is its parent and so on.
8511 It is also possible to query the number of ancestors of a node,
8512 the position of the current node
8513 within the children of its parent, the position of the subtree
8514 containing a node within the children of an ancestor
8515 or to obtain a copy of a given
8516 child without destroying the current node.
8517 Given two nodes that point to the same schedule, their closest
8518 shared ancestor can be obtained using
8519 C<isl_schedule_node_get_shared_ancestor>.
8521         #include <isl/schedule_node.h>
8522         int isl_schedule_node_get_tree_depth(
8523                 __isl_keep isl_schedule_node *node);
8524         int isl_schedule_node_get_child_position(
8525                 __isl_keep isl_schedule_node *node);
8526         int isl_schedule_node_get_ancestor_child_position(
8527                 __isl_keep isl_schedule_node *node,
8528                 __isl_keep isl_schedule_node *ancestor);
8529         __isl_give isl_schedule_node *isl_schedule_node_get_child(
8530                 __isl_keep isl_schedule_node *node, int pos);
8531         __isl_give isl_schedule_node *
8532         isl_schedule_node_get_shared_ancestor(
8533                 __isl_keep isl_schedule_node *node1,
8534                 __isl_keep isl_schedule_node *node2);
8536 All nodes in a schedule tree or
8537 all descendants of a specific node (including the node) can be visited
8538 in depth-first pre-order using the following functions.
8540         #include <isl/schedule.h>
8541         isl_stat isl_schedule_foreach_schedule_node_top_down(
8542                 __isl_keep isl_schedule *sched,
8543                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8544                         void *user), void *user);
8546         #include <isl/schedule_node.h>
8547         isl_stat isl_schedule_node_foreach_descendant_top_down(
8548                 __isl_keep isl_schedule_node *node,
8549                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8550                         void *user), void *user);
8552 The callback function is slightly different from the usual
8553 callbacks in that it not only indicates success (non-negative result)
8554 or failure (negative result), but also indicates whether the children
8555 of the given node should be visited.  In particular, if the callback
8556 returns a positive value, then the children are visited, but if
8557 the callback returns zero, then the children are not visited.
8559 The following functions checks whether
8560 all descendants of a specific node (including the node itself)
8561 satisfy a user-specified test.
8563         #include <isl/schedule_node.h>
8564         isl_bool isl_schedule_node_every_descendant(
8565                 __isl_keep isl_schedule_node *node,
8566                 isl_bool (*test)(__isl_keep isl_schedule_node *node,
8567                         void *user), void *user)
8569 The ancestors of a node in a schedule tree can be visited from
8570 the root down to and including the parent of the node using
8571 the following function.
8573         #include <isl/schedule_node.h>
8574         isl_stat isl_schedule_node_foreach_ancestor_top_down(
8575                 __isl_keep isl_schedule_node *node,
8576                 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
8577                         void *user), void *user);
8579 The following functions allows for a depth-first post-order
8580 traversal of the nodes in a schedule tree or
8581 of the descendants of a specific node (including the node
8582 itself), where the user callback is allowed to modify the
8583 visited node.
8585         #include <isl/schedule.h>
8586         __isl_give isl_schedule *
8587         isl_schedule_map_schedule_node_bottom_up(
8588                 __isl_take isl_schedule *schedule,
8589                 __isl_give isl_schedule_node *(*fn)(
8590                         __isl_take isl_schedule_node *node,
8591                         void *user), void *user);
8593         #include <isl/schedule_node.h>
8594         __isl_give isl_schedule_node *
8595         isl_schedule_node_map_descendant_bottom_up(
8596                 __isl_take isl_schedule_node *node,
8597                 __isl_give isl_schedule_node *(*fn)(
8598                         __isl_take isl_schedule_node *node,
8599                         void *user), void *user);
8601 The traversal continues from the node returned by the callback function.
8602 It is the responsibility of the user to ensure that this does not
8603 lead to an infinite loop.  It is safest to always return a pointer
8604 to the same position (same ancestors and child positions) as the input node.
8606 The following function removes a node (along with its descendants)
8607 from a schedule tree and returns a pointer to the leaf at the
8608 same position in the updated tree.
8609 It is not allowed to remove the root of a schedule tree or
8610 a child of a set or sequence node.
8612         #include <isl/schedule_node.h>
8613         __isl_give isl_schedule_node *isl_schedule_node_cut(
8614                 __isl_take isl_schedule_node *node);
8616 The following function removes a single node
8617 from a schedule tree and returns a pointer to the child
8618 of the node, now located at the position of the original node
8619 or to a leaf node at that position if there was no child.
8620 It is not allowed to remove the root of a schedule tree,
8621 a set or sequence node, a child of a set or sequence node or
8622 a band node with an anchored subtree.
8624         #include <isl/schedule_node.h>
8625         __isl_give isl_schedule_node *isl_schedule_node_delete(
8626                 __isl_take isl_schedule_node *node);
8628 Most nodes in a schedule tree only contain local information.
8629 In some cases, however, a node may also refer to the schedule dimensions
8630 of its outer band nodes.
8631 This means that the position of the node within the tree should
8632 not be changed, or at least that no changes are performed to the
8633 outer band nodes.  The following function can be used to test
8634 whether the subtree rooted at a given node contains any such nodes.
8636         #include <isl/schedule_node.h>
8637         isl_bool isl_schedule_node_is_subtree_anchored(
8638                 __isl_keep isl_schedule_node *node);
8640 The following function resets the user pointers on all parameter
8641 and tuple identifiers referenced by the given schedule node.
8643         #include <isl/schedule_node.h>
8644         __isl_give isl_schedule_node *isl_schedule_node_reset_user(
8645                 __isl_take isl_schedule_node *node);
8647 The following function aligns the parameters of the given schedule
8648 node to the given space.
8650         #include <isl/schedule_node.h>
8651         __isl_give isl_schedule_node *
8652         isl_schedule_node_align_params(
8653                 __isl_take isl_schedule_node *node,
8654                 __isl_take isl_space *space);
8656 Several node types have their own functions for querying
8657 (and in some cases setting) some node type specific properties.
8659         #include <isl/schedule_node.h>
8660         __isl_give isl_space *isl_schedule_node_band_get_space(
8661                 __isl_keep isl_schedule_node *node);
8662         __isl_give isl_multi_union_pw_aff *
8663         isl_schedule_node_band_get_partial_schedule(
8664                 __isl_keep isl_schedule_node *node);
8665         __isl_give isl_union_map *
8666         isl_schedule_node_band_get_partial_schedule_union_map(
8667                 __isl_keep isl_schedule_node *node);
8668         unsigned isl_schedule_node_band_n_member(
8669                 __isl_keep isl_schedule_node *node);
8670         isl_bool isl_schedule_node_band_member_get_coincident(
8671                 __isl_keep isl_schedule_node *node, int pos);
8672         __isl_give isl_schedule_node *
8673         isl_schedule_node_band_member_set_coincident(
8674                 __isl_take isl_schedule_node *node, int pos,
8675                 int coincident);
8676         isl_bool isl_schedule_node_band_get_permutable(
8677                 __isl_keep isl_schedule_node *node);
8678         __isl_give isl_schedule_node *
8679         isl_schedule_node_band_set_permutable(
8680                 __isl_take isl_schedule_node *node, int permutable);
8681         enum isl_ast_loop_type
8682         isl_schedule_node_band_member_get_ast_loop_type(
8683                 __isl_keep isl_schedule_node *node, int pos);
8684         __isl_give isl_schedule_node *
8685         isl_schedule_node_band_member_set_ast_loop_type(
8686                 __isl_take isl_schedule_node *node, int pos,
8687                 enum isl_ast_loop_type type);
8688         __isl_give isl_union_set *
8689         enum isl_ast_loop_type
8690         isl_schedule_node_band_member_get_isolate_ast_loop_type(
8691                 __isl_keep isl_schedule_node *node, int pos);
8692         __isl_give isl_schedule_node *
8693         isl_schedule_node_band_member_set_isolate_ast_loop_type(
8694                 __isl_take isl_schedule_node *node, int pos,
8695                 enum isl_ast_loop_type type);
8696         isl_schedule_node_band_get_ast_build_options(
8697                 __isl_keep isl_schedule_node *node);
8698         __isl_give isl_schedule_node *
8699         isl_schedule_node_band_set_ast_build_options(
8700                 __isl_take isl_schedule_node *node,
8701                 __isl_take isl_union_set *options);
8702         __isl_give isl_set *
8703         isl_schedule_node_band_get_ast_isolate_option(
8704                 __isl_keep isl_schedule_node *node);
8706 The function C<isl_schedule_node_band_get_space> returns the space
8707 of the partial schedule of the band.
8708 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
8709 returns a representation of the partial schedule of the band node
8710 in the form of an C<isl_union_map>.
8711 The coincident and permutable properties are set by
8712 C<isl_schedule_constraints_compute_schedule> on the schedule tree
8713 it produces.
8714 A scheduling dimension is considered to be ``coincident''
8715 if it satisfies the coincidence constraints within its band.
8716 That is, if the dependence distances of the coincidence
8717 constraints are all zero in that direction (for fixed
8718 iterations of outer bands).
8719 A band is marked permutable if it was produced using the Pluto-like scheduler.
8720 Note that the scheduler may have to resort to a Feautrier style scheduling
8721 step even if the default scheduler is used.
8722 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
8723 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
8724 For the meaning of these loop AST generation types and the difference
8725 between the regular loop AST generation type and the isolate
8726 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
8727 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
8728 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
8729 may return C<isl_ast_loop_error> if an error occurs.
8730 The AST build options govern how an AST is generated for
8731 the individual schedule dimensions during AST generation.
8732 See L</"AST Generation Options (Schedule Tree)">.
8733 The isolate option for the given node can be extracted from these
8734 AST build options using the function
8735 C<isl_schedule_node_band_get_ast_isolate_option>.
8737         #include <isl/schedule_node.h>
8738         __isl_give isl_set *
8739         isl_schedule_node_context_get_context(
8740                 __isl_keep isl_schedule_node *node);
8742         #include <isl/schedule_node.h>
8743         __isl_give isl_union_set *
8744         isl_schedule_node_domain_get_domain(
8745                 __isl_keep isl_schedule_node *node);
8747         #include <isl/schedule_node.h>
8748         __isl_give isl_union_map *
8749         isl_schedule_node_expansion_get_expansion(
8750                 __isl_keep isl_schedule_node *node);
8751         __isl_give isl_union_pw_multi_aff *
8752         isl_schedule_node_expansion_get_contraction(
8753                 __isl_keep isl_schedule_node *node);
8755         #include <isl/schedule_node.h>
8756         __isl_give isl_union_map *
8757         isl_schedule_node_extension_get_extension(
8758                 __isl_keep isl_schedule_node *node);
8760         #include <isl/schedule_node.h>
8761         __isl_give isl_union_set *
8762         isl_schedule_node_filter_get_filter(
8763                 __isl_keep isl_schedule_node *node);
8765         #include <isl/schedule_node.h>
8766         __isl_give isl_set *isl_schedule_node_guard_get_guard(
8767                 __isl_keep isl_schedule_node *node);
8769         #include <isl/schedule_node.h>
8770         __isl_give isl_id *isl_schedule_node_mark_get_id(
8771                 __isl_keep isl_schedule_node *node);
8773 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
8774 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
8775 partial schedules related to the node.
8777         #include <isl/schedule_node.h>
8778         __isl_give isl_multi_union_pw_aff *
8779         isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
8780                 __isl_keep isl_schedule_node *node);
8781         __isl_give isl_union_pw_multi_aff *
8782         isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
8783                 __isl_keep isl_schedule_node *node);
8784         __isl_give isl_union_map *
8785         isl_schedule_node_get_prefix_schedule_union_map(
8786                 __isl_keep isl_schedule_node *node);
8787         __isl_give isl_union_map *
8788         isl_schedule_node_get_prefix_schedule_relation(
8789                 __isl_keep isl_schedule_node *node);
8790         __isl_give isl_union_map *
8791         isl_schedule_node_get_subtree_schedule_union_map(
8792                 __isl_keep isl_schedule_node *node);
8794 In particular, the functions
8795 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
8796 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
8797 and C<isl_schedule_node_get_prefix_schedule_union_map>
8798 return a relative ordering on the domain elements that reach the given
8799 node determined by its ancestors.
8800 The function C<isl_schedule_node_get_prefix_schedule_relation>
8801 additionally includes the domain constraints in the result.
8802 The function C<isl_schedule_node_get_subtree_schedule_union_map>
8803 returns a representation of the partial schedule defined by the
8804 subtree rooted at the given node.
8805 If the tree contains any expansion nodes, then the subtree schedule
8806 is formulated in terms of the expanded domain elements.
8807 The tree passed to functions returning a prefix schedule
8808 may only contain extension nodes if these would not affect
8809 the result of these functions.  That is, if one of the ancestors
8810 is an extension node, then all of the domain elements that were
8811 added by the extension node need to have been filtered out
8812 by filter nodes between the extension node and the input node.
8813 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
8814 may not contain in extension nodes in the selected subtree.
8816 The expansion/contraction defined by an entire subtree, combining
8817 the expansions/contractions
8818 on the expansion nodes in the subtree, can be obtained using
8819 the following functions.
8821         #include <isl/schedule_node.h>
8822         __isl_give isl_union_map *
8823         isl_schedule_node_get_subtree_expansion(
8824                 __isl_keep isl_schedule_node *node);
8825         __isl_give isl_union_pw_multi_aff *
8826         isl_schedule_node_get_subtree_contraction(
8827                 __isl_keep isl_schedule_node *node);
8829 The total number of outer band members of given node, i.e.,
8830 the shared output dimension of the maps in the result
8831 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
8832 using the following function.
8834         #include <isl/schedule_node.h>
8835         int isl_schedule_node_get_schedule_depth(
8836                 __isl_keep isl_schedule_node *node);
8838 The following functions return the elements that reach the given node
8839 or the union of universes in the spaces that contain these elements.
8841         #include <isl/schedule_node.h>
8842         __isl_give isl_union_set *
8843         isl_schedule_node_get_domain(
8844                 __isl_keep isl_schedule_node *node);
8845         __isl_give isl_union_set *
8846         isl_schedule_node_get_universe_domain(
8847                 __isl_keep isl_schedule_node *node);
8849 The input tree of C<isl_schedule_node_get_domain>
8850 may only contain extension nodes if these would not affect
8851 the result of this function.  That is, if one of the ancestors
8852 is an extension node, then all of the domain elements that were
8853 added by the extension node need to have been filtered out
8854 by filter nodes between the extension node and the input node.
8856 The following functions can be used to introduce additional nodes
8857 in the schedule tree.  The new node is introduced at the point
8858 in the tree where the C<isl_schedule_node> points to and
8859 the results points to the new node.
8861         #include <isl/schedule_node.h>
8862         __isl_give isl_schedule_node *
8863         isl_schedule_node_insert_partial_schedule(
8864                 __isl_take isl_schedule_node *node,
8865                 __isl_take isl_multi_union_pw_aff *schedule);
8867 This function inserts a new band node with (the greatest integer
8868 part of) the given partial schedule.
8869 The subtree rooted at the given node is assumed not to have
8870 any anchored nodes.
8872         #include <isl/schedule_node.h>
8873         __isl_give isl_schedule_node *
8874         isl_schedule_node_insert_context(
8875                 __isl_take isl_schedule_node *node,
8876                 __isl_take isl_set *context);
8878 This function inserts a new context node with the given context constraints.
8880         #include <isl/schedule_node.h>
8881         __isl_give isl_schedule_node *
8882         isl_schedule_node_insert_filter(
8883                 __isl_take isl_schedule_node *node,
8884                 __isl_take isl_union_set *filter);
8886 This function inserts a new filter node with the given filter.
8887 If the original node already pointed to a filter node, then the
8888 two filter nodes are merged into one.
8890         #include <isl/schedule_node.h>
8891         __isl_give isl_schedule_node *
8892         isl_schedule_node_insert_guard(
8893                 __isl_take isl_schedule_node *node,
8894                 __isl_take isl_set *guard);
8896 This function inserts a new guard node with the given guard constraints.
8898         #include <isl/schedule_node.h>
8899         __isl_give isl_schedule_node *
8900         isl_schedule_node_insert_mark(
8901                 __isl_take isl_schedule_node *node,
8902                 __isl_take isl_id *mark);
8904 This function inserts a new mark node with the give mark identifier.
8906         #include <isl/schedule_node.h>
8907         __isl_give isl_schedule_node *
8908         isl_schedule_node_insert_sequence(
8909                 __isl_take isl_schedule_node *node,
8910                 __isl_take isl_union_set_list *filters);
8911         __isl_give isl_schedule_node *
8912         isl_schedule_node_insert_set(
8913                 __isl_take isl_schedule_node *node,
8914                 __isl_take isl_union_set_list *filters);
8916 These functions insert a new sequence or set node with the given
8917 filters as children.
8919         #include <isl/schedule_node.h>
8920         __isl_give isl_schedule_node *isl_schedule_node_group(
8921                 __isl_take isl_schedule_node *node,
8922                 __isl_take isl_id *group_id);
8924 This function introduces an expansion node in between the current
8925 node and its parent that expands instances of a space with tuple
8926 identifier C<group_id> to the original domain elements that reach
8927 the node.  The group instances are identified by the prefix schedule
8928 of those domain elements.  The ancestors of the node are adjusted
8929 to refer to the group instances instead of the original domain
8930 elements.  The return value points to the same node in the updated
8931 schedule tree as the input node, i.e., to the child of the newly
8932 introduced expansion node.  Grouping instances of different statements
8933 ensures that they will be treated as a single statement by the
8934 AST generator up to the point of the expansion node.
8936 The following function can be used to flatten a nested
8937 sequence.
8939         #include <isl/schedule_node.h>
8940         __isl_give isl_schedule_node *
8941         isl_schedule_node_sequence_splice_child(
8942                 __isl_take isl_schedule_node *node, int pos);
8944 That is, given a sequence node C<node> that has another sequence node
8945 in its child at position C<pos> (in particular, the child of that filter
8946 node is a sequence node), attach the children of that other sequence
8947 node as children of C<node>, replacing the original child at position
8948 C<pos>.
8950 The partial schedule of a band node can be scaled (down) or reduced using
8951 the following functions.
8953         #include <isl/schedule_node.h>
8954         __isl_give isl_schedule_node *
8955         isl_schedule_node_band_scale(
8956                 __isl_take isl_schedule_node *node,
8957                 __isl_take isl_multi_val *mv);
8958         __isl_give isl_schedule_node *
8959         isl_schedule_node_band_scale_down(
8960                 __isl_take isl_schedule_node *node,
8961                 __isl_take isl_multi_val *mv);
8962         __isl_give isl_schedule_node *
8963         isl_schedule_node_band_mod(
8964                 __isl_take isl_schedule_node *node,
8965                 __isl_take isl_multi_val *mv);
8967 The spaces of the two arguments need to match.
8968 After scaling, the partial schedule is replaced by its greatest
8969 integer part to ensure that the schedule remains integral.
8971 The partial schedule of a band node can be shifted by an
8972 C<isl_multi_union_pw_aff> with a domain that is a superset
8973 of the domain of the partial schedule using
8974 the following function.
8976         #include <isl/schedule_node.h>
8977         __isl_give isl_schedule_node *
8978         isl_schedule_node_band_shift(
8979                 __isl_take isl_schedule_node *node,
8980                 __isl_take isl_multi_union_pw_aff *shift);
8982 A band node can be tiled using the following function.
8984         #include <isl/schedule_node.h>
8985         __isl_give isl_schedule_node *isl_schedule_node_band_tile(
8986                 __isl_take isl_schedule_node *node,
8987                 __isl_take isl_multi_val *sizes);
8989         isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8990                 int val);
8991         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8992         isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8993                 int val);
8994         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8996 The C<isl_schedule_node_band_tile> function tiles
8997 the band using the given tile sizes inside its schedule.
8998 A new child band node is created to represent the point loops and it is
8999 inserted between the modified band and its children.
9000 The subtree rooted at the given node is assumed not to have
9001 any anchored nodes.
9002 The C<tile_scale_tile_loops> option specifies whether the tile
9003 loops iterators should be scaled by the tile sizes.
9004 If the C<tile_shift_point_loops> option is set, then the point loops
9005 are shifted to start at zero.
9007 A band node can be split into two nested band nodes
9008 using the following function.
9010         #include <isl/schedule_node.h>
9011         __isl_give isl_schedule_node *isl_schedule_node_band_split(
9012                 __isl_take isl_schedule_node *node, int pos);
9014 The resulting outer band node contains the first C<pos> dimensions of
9015 the schedule of C<node> while the inner band contains the remaining dimensions.
9016 The schedules of the two band nodes live in anonymous spaces.
9017 The loop AST generation type options and the isolate option
9018 are split over the two band nodes.
9020 A band node can be moved down to the leaves of the subtree rooted
9021 at the band node using the following function.
9023         #include <isl/schedule_node.h>
9024         __isl_give isl_schedule_node *isl_schedule_node_band_sink(
9025                 __isl_take isl_schedule_node *node);
9027 The subtree rooted at the given node is assumed not to have
9028 any anchored nodes.
9029 The result points to the node in the resulting tree that is in the same
9030 position as the node pointed to by C<node> in the original tree.
9032         #include <isl/schedule_node.h>
9033         __isl_give isl_schedule_node *
9034         isl_schedule_node_order_before(
9035                 __isl_take isl_schedule_node *node,
9036                 __isl_take isl_union_set *filter);
9037         __isl_give isl_schedule_node *
9038         isl_schedule_node_order_after(
9039                 __isl_take isl_schedule_node *node,
9040                 __isl_take isl_union_set *filter);
9042 These functions split the domain elements that reach C<node>
9043 into those that satisfy C<filter> and those that do not and
9044 arranges for the elements that do satisfy the filter to be
9045 executed before (in case of C<isl_schedule_node_order_before>)
9046 or after (in case of C<isl_schedule_node_order_after>)
9047 those that do not.  The order is imposed by
9048 a sequence node, possibly reusing the grandparent of C<node>
9049 on two copies of the subtree attached to the original C<node>.
9050 Both copies are simplified with respect to their filter.
9052 Return a pointer to the copy of the subtree that does not
9053 satisfy C<filter>.  If there is no such copy (because all
9054 reaching domain elements satisfy the filter), then return
9055 the original pointer.
9057         #include <isl/schedule_node.h>
9058         __isl_give isl_schedule_node *
9059         isl_schedule_node_graft_before(
9060                 __isl_take isl_schedule_node *node,
9061                 __isl_take isl_schedule_node *graft);
9062         __isl_give isl_schedule_node *
9063         isl_schedule_node_graft_after(
9064                 __isl_take isl_schedule_node *node,
9065                 __isl_take isl_schedule_node *graft);
9067 This function inserts the C<graft> tree into the tree containing C<node>
9068 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
9069 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
9070 The root node of C<graft>
9071 should be an extension node where the domain of the extension
9072 is the flat product of all outer band nodes of C<node>.
9073 The root node may also be a domain node.
9074 The elements of the domain or the range of the extension may not
9075 intersect with the domain elements that reach "node".
9076 The schedule tree of C<graft> may not be anchored.
9078 The schedule tree of C<node> is modified to include an extension node
9079 corresponding to the root node of C<graft> as a child of the original
9080 parent of C<node>.  The original node that C<node> points to and the
9081 child of the root node of C<graft> are attached to this extension node
9082 through a sequence, with appropriate filters and with the child
9083 of C<graft> appearing before or after the original C<node>.
9085 If C<node> already appears inside a sequence that is the child of
9086 an extension node and if the spaces of the new domain elements
9087 do not overlap with those of the original domain elements,
9088 then that extension node is extended with the new extension
9089 rather than introducing a new segment of extension and sequence nodes.
9091 Return a pointer to the same node in the modified tree that
9092 C<node> pointed to in the original tree.
9094 A representation of the schedule node can be printed using
9096         #include <isl/schedule_node.h>
9097         __isl_give isl_printer *isl_printer_print_schedule_node(
9098                 __isl_take isl_printer *p,
9099                 __isl_keep isl_schedule_node *node);
9100         __isl_give char *isl_schedule_node_to_str(
9101                 __isl_keep isl_schedule_node *node);
9103 C<isl_schedule_node_to_str> prints the schedule node in block format.
9105 =head2 Dependence Analysis
9107 C<isl> contains specialized functionality for performing
9108 array dataflow analysis.  That is, given a I<sink> access relation,
9109 a collection of possible I<source> accesses and
9110 a collection of I<kill> accesses,
9111 C<isl> can compute relations that describe
9112 for each iteration of the sink access, which iterations
9113 of which of the source access relations may have
9114 accessed the same data element before the given iteration
9115 of the sink access without any intermediate kill of that data element.
9116 The resulting dependence relations map source iterations
9117 to either the corresponding sink iterations or
9118 pairs of corresponding sink iterations and accessed data elements.
9119 To compute standard flow dependences, the sink should be
9120 a read, while the sources should be writes.
9121 If no kills are specified,
9122 then memory based dependence analysis is performed.
9123 If, on the other hand, all sources are also kills,
9124 then value based dependence analysis is performed.
9125 If any of the source accesses are marked as being I<must>
9126 accesses, then they are also treated as kills.
9127 Furthermore, the specification of must-sources results
9128 in the computation of must-dependences.
9129 Only dependences originating in a must access not coscheduled
9130 with any other access to the same element and without
9131 any may accesses between the must access and the sink access
9132 are considered to be must dependences.
9134 =head3 High-level Interface
9136 A high-level interface to dependence analysis is provided
9137 by the following function.
9139         #include <isl/flow.h>
9140         __isl_give isl_union_flow *
9141         isl_union_access_info_compute_flow(
9142                 __isl_take isl_union_access_info *access);
9144 The input C<isl_union_access_info> object describes the sink
9145 access relations, the source access relations and a schedule,
9146 while the output C<isl_union_flow> object describes
9147 the resulting dependence relations and the subsets of the
9148 sink relations for which no source was found.
9150 An C<isl_union_access_info> is created, modified, copied and freed using
9151 the following functions.
9153         #include <isl/flow.h>
9154         __isl_give isl_union_access_info *
9155         isl_union_access_info_from_sink(
9156                 __isl_take isl_union_map *sink);
9157         __isl_give isl_union_access_info *
9158         isl_union_access_info_set_kill(
9159                 __isl_take isl_union_access_info *access,
9160                 __isl_take isl_union_map *kill);
9161         __isl_give isl_union_access_info *
9162         isl_union_access_info_set_may_source(
9163                 __isl_take isl_union_access_info *access,
9164                 __isl_take isl_union_map *may_source);
9165         __isl_give isl_union_access_info *
9166         isl_union_access_info_set_must_source(
9167                 __isl_take isl_union_access_info *access,
9168                 __isl_take isl_union_map *must_source);
9169         __isl_give isl_union_access_info *
9170         isl_union_access_info_set_schedule(
9171                 __isl_take isl_union_access_info *access,
9172                 __isl_take isl_schedule *schedule);
9173         __isl_give isl_union_access_info *
9174         isl_union_access_info_set_schedule_map(
9175                 __isl_take isl_union_access_info *access,
9176                 __isl_take isl_union_map *schedule_map);
9177         __isl_give isl_union_access_info *
9178         isl_union_access_info_copy(
9179                 __isl_keep isl_union_access_info *access);
9180         __isl_null isl_union_access_info *
9181         isl_union_access_info_free(
9182                 __isl_take isl_union_access_info *access);
9184 The may sources set by C<isl_union_access_info_set_may_source>
9185 do not need to include the must sources set by
9186 C<isl_union_access_info_set_must_source> as a subset.
9187 The kills set by C<isl_union_access_info_set_kill> may overlap
9188 with the may-sources and/or must-sources.
9189 The user is free not to call one (or more) of these functions,
9190 in which case the corresponding set is kept to its empty default.
9191 Similarly, the default schedule initialized by
9192 C<isl_union_access_info_from_sink> is empty.
9193 The current schedule is determined by the last call to either
9194 C<isl_union_access_info_set_schedule> or
9195 C<isl_union_access_info_set_schedule_map>.
9196 The domain of the schedule corresponds to the domains of
9197 the access relations.  In particular, the domains of the access
9198 relations are effectively intersected with the domain of the schedule
9199 and only the resulting accesses are considered by the dependence analysis.
9201 An C<isl_union_access_info> object can be read from input
9202 using the following function.
9204         #include <isl/flow.h>
9205         __isl_give isl_union_access_info *
9206         isl_union_access_info_read_from_file(isl_ctx *ctx,
9207                 FILE *input);
9209 A representation of the information contained in an object
9210 of type C<isl_union_access_info> can be obtained using
9212         #include <isl/flow.h>
9213         __isl_give isl_printer *
9214         isl_printer_print_union_access_info(
9215                 __isl_take isl_printer *p,
9216                 __isl_keep isl_union_access_info *access);
9217         __isl_give char *isl_union_access_info_to_str(
9218                 __isl_keep isl_union_access_info *access);
9220 C<isl_union_access_info_to_str> prints the information in flow format.
9222 The output of C<isl_union_access_info_compute_flow> can be examined,
9223 copied, and freed using the following functions.
9225         #include <isl/flow.h>
9226         __isl_give isl_union_map *isl_union_flow_get_must_dependence(
9227                 __isl_keep isl_union_flow *flow);
9228         __isl_give isl_union_map *isl_union_flow_get_may_dependence(
9229                 __isl_keep isl_union_flow *flow);
9230         __isl_give isl_union_map *
9231         isl_union_flow_get_full_must_dependence(
9232                 __isl_keep isl_union_flow *flow);
9233         __isl_give isl_union_map *
9234         isl_union_flow_get_full_may_dependence(
9235                 __isl_keep isl_union_flow *flow);
9236         __isl_give isl_union_map *isl_union_flow_get_must_no_source(
9237                 __isl_keep isl_union_flow *flow);
9238         __isl_give isl_union_map *isl_union_flow_get_may_no_source(
9239                 __isl_keep isl_union_flow *flow);
9240         __isl_give isl_union_flow *isl_union_flow_copy(
9241                 __isl_keep isl_union_flow *flow);
9242         __isl_null isl_union_flow *isl_union_flow_free(
9243                 __isl_take isl_union_flow *flow);
9245 The relation returned by C<isl_union_flow_get_must_dependence>
9246 relates domain elements of must sources to domain elements of the sink.
9247 The relation returned by C<isl_union_flow_get_may_dependence>
9248 relates domain elements of must or may sources to domain elements of the sink
9249 and includes the previous relation as a subset.
9250 The relation returned by C<isl_union_flow_get_full_must_dependence>
9251 relates domain elements of must sources to pairs of domain elements of the sink
9252 and accessed data elements.
9253 The relation returned by C<isl_union_flow_get_full_may_dependence>
9254 relates domain elements of must or may sources to pairs of
9255 domain elements of the sink and accessed data elements.
9256 This relation includes the previous relation as a subset.
9257 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
9258 of the sink relation for which no dependences have been found.
9259 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
9260 of the sink relation for which no definite dependences have been found.
9261 That is, it contains those sink access that do not contribute to any
9262 of the elements in the relation returned
9263 by C<isl_union_flow_get_must_dependence>.
9265 A representation of the information contained in an object
9266 of type C<isl_union_flow> can be obtained using
9268         #include <isl/flow.h>
9269         __isl_give isl_printer *isl_printer_print_union_flow(
9270                 __isl_take isl_printer *p,
9271                 __isl_keep isl_union_flow *flow);
9272         __isl_give char *isl_union_flow_to_str(
9273                 __isl_keep isl_union_flow *flow);
9275 C<isl_union_flow_to_str> prints the information in flow format.
9277 =head3 Low-level Interface
9279 A lower-level interface is provided by the following functions.
9281         #include <isl/flow.h>
9283         typedef int (*isl_access_level_before)(void *first, void *second);
9285         __isl_give isl_access_info *isl_access_info_alloc(
9286                 __isl_take isl_map *sink,
9287                 void *sink_user, isl_access_level_before fn,
9288                 int max_source);
9289         __isl_give isl_access_info *isl_access_info_add_source(
9290                 __isl_take isl_access_info *acc,
9291                 __isl_take isl_map *source, int must,
9292                 void *source_user);
9293         __isl_null isl_access_info *isl_access_info_free(
9294                 __isl_take isl_access_info *acc);
9296         __isl_give isl_flow *isl_access_info_compute_flow(
9297                 __isl_take isl_access_info *acc);
9299         isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
9300                 isl_stat (*fn)(__isl_take isl_map *dep, int must,
9301                           void *dep_user, void *user),
9302                 void *user);
9303         __isl_give isl_map *isl_flow_get_no_source(
9304                 __isl_keep isl_flow *deps, int must);
9305         void isl_flow_free(__isl_take isl_flow *deps);
9307 The function C<isl_access_info_compute_flow> performs the actual
9308 dependence analysis.  The other functions are used to construct
9309 the input for this function or to read off the output.
9311 The input is collected in an C<isl_access_info>, which can
9312 be created through a call to C<isl_access_info_alloc>.
9313 The arguments to this functions are the sink access relation
9314 C<sink>, a token C<sink_user> used to identify the sink
9315 access to the user, a callback function for specifying the
9316 relative order of source and sink accesses, and the number
9317 of source access relations that will be added.
9319 The callback function has type C<int (*)(void *first, void *second)>.
9320 The function is called with two user supplied tokens identifying
9321 either a source or the sink and it should return the shared nesting
9322 level and the relative order of the two accesses.
9323 In particular, let I<n> be the number of loops shared by
9324 the two accesses.  If C<first> precedes C<second> textually,
9325 then the function should return I<2 * n + 1>; otherwise,
9326 it should return I<2 * n>.
9327 The low-level interface assumes that no sources are coscheduled.
9328 If the information returned by the callback does not allow
9329 the relative order to be determined, then one of the sources
9330 is arbitrarily taken to be executed after the other(s).
9332 The sources can be added to the C<isl_access_info> object by performing
9333 (at most) C<max_source> calls to C<isl_access_info_add_source>.
9334 C<must> indicates whether the source is a I<must> access
9335 or a I<may> access.  Note that a multi-valued access relation
9336 should only be marked I<must> if every iteration in the domain
9337 of the relation accesses I<all> elements in its image.
9338 The C<source_user> token is again used to identify
9339 the source access.  The range of the source access relation
9340 C<source> should have the same dimension as the range
9341 of the sink access relation.
9342 The C<isl_access_info_free> function should usually not be
9343 called explicitly, because it is already called implicitly by
9344 C<isl_access_info_compute_flow>.
9346 The result of the dependence analysis is collected in an
9347 C<isl_flow>.  There may be elements of
9348 the sink access for which no preceding source access could be
9349 found or for which all preceding sources are I<may> accesses.
9350 The relations containing these elements can be obtained through
9351 calls to C<isl_flow_get_no_source>, the first with C<must> set
9352 and the second with C<must> unset.
9353 In the case of standard flow dependence analysis,
9354 with the sink a read and the sources I<must> writes,
9355 the first relation corresponds to the reads from uninitialized
9356 array elements and the second relation is empty.
9357 The actual flow dependences can be extracted using
9358 C<isl_flow_foreach>.  This function will call the user-specified
9359 callback function C<fn> for each B<non-empty> dependence between
9360 a source and the sink.  The callback function is called
9361 with four arguments, the actual flow dependence relation
9362 mapping source iterations to sink iterations, a boolean that
9363 indicates whether it is a I<must> or I<may> dependence, a token
9364 identifying the source and an additional C<void *> with value
9365 equal to the third argument of the C<isl_flow_foreach> call.
9366 A dependence is marked I<must> if it originates from a I<must>
9367 source and if it is not followed by any I<may> sources.
9369 After finishing with an C<isl_flow>, the user should call
9370 C<isl_flow_free> to free all associated memory.
9372 =head3 Interaction with the Low-level Interface
9374 During the dependence analysis, we frequently need to perform
9375 the following operation.  Given a relation between sink iterations
9376 and potential source iterations from a particular source domain,
9377 what is the last potential source iteration corresponding to each
9378 sink iteration.  It can sometimes be convenient to adjust
9379 the set of potential source iterations before or after each such operation.
9380 The prototypical example is fuzzy array dataflow analysis,
9381 where we need to analyze if, based on data-dependent constraints,
9382 the sink iteration can ever be executed without one or more of
9383 the corresponding potential source iterations being executed.
9384 If so, we can introduce extra parameters and select an unknown
9385 but fixed source iteration from the potential source iterations.
9386 To be able to perform such manipulations, C<isl> provides the following
9387 function.
9389         #include <isl/flow.h>
9391         typedef __isl_give isl_restriction *(*isl_access_restrict)(
9392                 __isl_keep isl_map *source_map,
9393                 __isl_keep isl_set *sink, void *source_user,
9394                 void *user);
9395         __isl_give isl_access_info *isl_access_info_set_restrict(
9396                 __isl_take isl_access_info *acc,
9397                 isl_access_restrict fn, void *user);
9399 The function C<isl_access_info_set_restrict> should be called
9400 before calling C<isl_access_info_compute_flow> and registers a callback function
9401 that will be called any time C<isl> is about to compute the last
9402 potential source.  The first argument is the (reverse) proto-dependence,
9403 mapping sink iterations to potential source iterations.
9404 The second argument represents the sink iterations for which
9405 we want to compute the last source iteration.
9406 The third argument is the token corresponding to the source
9407 and the final argument is the token passed to C<isl_access_info_set_restrict>.
9408 The callback is expected to return a restriction on either the input or
9409 the output of the operation computing the last potential source.
9410 If the input needs to be restricted then restrictions are needed
9411 for both the source and the sink iterations.  The sink iterations
9412 and the potential source iterations will be intersected with these sets.
9413 If the output needs to be restricted then only a restriction on the source
9414 iterations is required.
9415 If any error occurs, the callback should return C<NULL>.
9416 An C<isl_restriction> object can be created, freed and inspected
9417 using the following functions.
9419         #include <isl/flow.h>
9421         __isl_give isl_restriction *isl_restriction_input(
9422                 __isl_take isl_set *source_restr,
9423                 __isl_take isl_set *sink_restr);
9424         __isl_give isl_restriction *isl_restriction_output(
9425                 __isl_take isl_set *source_restr);
9426         __isl_give isl_restriction *isl_restriction_none(
9427                 __isl_take isl_map *source_map);
9428         __isl_give isl_restriction *isl_restriction_empty(
9429                 __isl_take isl_map *source_map);
9430         __isl_null isl_restriction *isl_restriction_free(
9431                 __isl_take isl_restriction *restr);
9433 C<isl_restriction_none> and C<isl_restriction_empty> are special
9434 cases of C<isl_restriction_input>.  C<isl_restriction_none>
9435 is essentially equivalent to
9437         isl_restriction_input(isl_set_universe(
9438             isl_space_range(isl_map_get_space(source_map))),
9439                             isl_set_universe(
9440             isl_space_domain(isl_map_get_space(source_map))));
9442 whereas C<isl_restriction_empty> is essentially equivalent to
9444         isl_restriction_input(isl_set_empty(
9445             isl_space_range(isl_map_get_space(source_map))),
9446                             isl_set_universe(
9447             isl_space_domain(isl_map_get_space(source_map))));
9449 =head2 Scheduling
9451         #include <isl/schedule.h>
9452         __isl_give isl_schedule *
9453         isl_schedule_constraints_compute_schedule(
9454                 __isl_take isl_schedule_constraints *sc);
9456 The function C<isl_schedule_constraints_compute_schedule> can be
9457 used to compute a schedule that satisfies the given schedule constraints.
9458 These schedule constraints include the iteration domain for which
9459 a schedule should be computed and dependences between pairs of
9460 iterations.  In particular, these dependences include
9461 I<validity> dependences and I<proximity> dependences.
9462 By default, the algorithm used to construct the schedule is similar
9463 to that of C<Pluto>.
9464 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
9465 be selected.
9466 The generated schedule respects all validity dependences.
9467 That is, all dependence distances over these dependences in the
9468 scheduled space are lexicographically positive.
9470 The default algorithm tries to ensure that the dependence distances
9471 over coincidence constraints are zero and to minimize the
9472 dependence distances over proximity dependences.
9473 Moreover, it tries to obtain sequences (bands) of schedule dimensions
9474 for groups of domains where the dependence distances over validity
9475 dependences have only non-negative values.
9476 Note that when minimizing the maximal dependence distance
9477 over proximity dependences, a single affine expression in the parameters
9478 is constructed that bounds all dependence distances.  If no such expression
9479 exists, then the algorithm will fail and resort to an alternative
9480 scheduling algorithm.  In particular, this means that adding proximity
9481 dependences may eliminate valid solutions.  A typical example where this
9482 phenomenon may occur is when some subset of the proximity dependences
9483 has no restriction on some parameter, forcing the coefficient of that
9484 parameter to be zero, while some other subset forces the dependence
9485 distance to depend on that parameter, requiring the same coefficient
9486 to be non-zero.
9487 When using Feautrier's algorithm, the coincidence and proximity constraints
9488 are only taken into account during the extension to a
9489 full-dimensional schedule.
9491 An C<isl_schedule_constraints> object can be constructed
9492 and manipulated using the following functions.
9494         #include <isl/schedule.h>
9495         __isl_give isl_schedule_constraints *
9496         isl_schedule_constraints_copy(
9497                 __isl_keep isl_schedule_constraints *sc);
9498         __isl_give isl_schedule_constraints *
9499         isl_schedule_constraints_on_domain(
9500                 __isl_take isl_union_set *domain);
9501         __isl_give isl_schedule_constraints *
9502         isl_schedule_constraints_set_context(
9503                 __isl_take isl_schedule_constraints *sc,
9504                 __isl_take isl_set *context);
9505         __isl_give isl_schedule_constraints *
9506         isl_schedule_constraints_set_validity(
9507                 __isl_take isl_schedule_constraints *sc,
9508                 __isl_take isl_union_map *validity);
9509         __isl_give isl_schedule_constraints *
9510         isl_schedule_constraints_set_coincidence(
9511                 __isl_take isl_schedule_constraints *sc,
9512                 __isl_take isl_union_map *coincidence);
9513         __isl_give isl_schedule_constraints *
9514         isl_schedule_constraints_set_proximity(
9515                 __isl_take isl_schedule_constraints *sc,
9516                 __isl_take isl_union_map *proximity);
9517         __isl_give isl_schedule_constraints *
9518         isl_schedule_constraints_set_conditional_validity(
9519                 __isl_take isl_schedule_constraints *sc,
9520                 __isl_take isl_union_map *condition,
9521                 __isl_take isl_union_map *validity);
9522         __isl_give isl_schedule_constraints *
9523         isl_schedule_constraints_apply(
9524                 __isl_take isl_schedule_constraints *sc,
9525                 __isl_take isl_union_map *umap);
9526         __isl_null isl_schedule_constraints *
9527         isl_schedule_constraints_free(
9528                 __isl_take isl_schedule_constraints *sc);
9530 The initial C<isl_schedule_constraints> object created by
9531 C<isl_schedule_constraints_on_domain> does not impose any constraints.
9532 That is, it has an empty set of dependences.
9533 The function C<isl_schedule_constraints_set_context> allows the user
9534 to specify additional constraints on the parameters that may
9535 be assumed to hold during the construction of the schedule.
9536 The function C<isl_schedule_constraints_set_validity> replaces the
9537 validity dependences, mapping domain elements I<i> to domain
9538 elements that should be scheduled after I<i>.
9539 The function C<isl_schedule_constraints_set_coincidence> replaces the
9540 coincidence dependences, mapping domain elements I<i> to domain
9541 elements that should be scheduled together with I<I>, if possible.
9542 The function C<isl_schedule_constraints_set_proximity> replaces the
9543 proximity dependences, mapping domain elements I<i> to domain
9544 elements that should be scheduled either before I<I>
9545 or as early as possible after I<i>.
9547 The function C<isl_schedule_constraints_set_conditional_validity>
9548 replaces the conditional validity constraints.
9549 A conditional validity constraint is only imposed when any of the corresponding
9550 conditions is satisfied, i.e., when any of them is non-zero.
9551 That is, the scheduler ensures that within each band if the dependence
9552 distances over the condition constraints are not all zero
9553 then all corresponding conditional validity constraints are respected.
9554 A conditional validity constraint corresponds to a condition
9555 if the two are adjacent, i.e., if the domain of one relation intersect
9556 the range of the other relation.
9557 The typical use case of conditional validity constraints is
9558 to allow order constraints between live ranges to be violated
9559 as long as the live ranges themselves are local to the band.
9560 To allow more fine-grained control over which conditions correspond
9561 to which conditional validity constraints, the domains and ranges
9562 of these relations may include I<tags>.  That is, the domains and
9563 ranges of those relation may themselves be wrapped relations
9564 where the iteration domain appears in the domain of those wrapped relations
9565 and the range of the wrapped relations can be arbitrarily chosen
9566 by the user.  Conditions and conditional validity constraints are only
9567 considered adjacent to each other if the entire wrapped relation matches.
9568 In particular, a relation with a tag will never be considered adjacent
9569 to a relation without a tag.
9571 The function C<isl_schedule_constraints_apply> takes
9572 schedule constraints that are defined on some set of domain elements
9573 and transforms them to schedule constraints on the elements
9574 to which these domain elements are mapped by the given transformation.
9576 An C<isl_schedule_constraints> object can be inspected
9577 using the following functions.
9579         #include <isl/schedule.h>
9580         __isl_give isl_union_set *
9581         isl_schedule_constraints_get_domain(
9582                 __isl_keep isl_schedule_constraints *sc);
9583         __isl_give isl_set *isl_schedule_constraints_get_context(
9584                 __isl_keep isl_schedule_constraints *sc);
9585         __isl_give isl_union_map *
9586         isl_schedule_constraints_get_validity(
9587                 __isl_keep isl_schedule_constraints *sc);
9588         __isl_give isl_union_map *
9589         isl_schedule_constraints_get_coincidence(
9590                 __isl_keep isl_schedule_constraints *sc);
9591         __isl_give isl_union_map *
9592         isl_schedule_constraints_get_proximity(
9593                 __isl_keep isl_schedule_constraints *sc);
9594         __isl_give isl_union_map *
9595         isl_schedule_constraints_get_conditional_validity(
9596                 __isl_keep isl_schedule_constraints *sc);
9597         __isl_give isl_union_map *
9598         isl_schedule_constraints_get_conditional_validity_condition(
9599                 __isl_keep isl_schedule_constraints *sc);
9601 An C<isl_schedule_constraints> object can be read from input
9602 using the following functions.
9604         #include <isl/schedule.h>
9605         __isl_give isl_schedule_constraints *
9606         isl_schedule_constraints_read_from_str(isl_ctx *ctx,
9607                 const char *str);
9608         __isl_give isl_schedule_constraints *
9609         isl_schedule_constraints_read_from_file(isl_ctx *ctx,
9610                 FILE *input);
9612 The contents of an C<isl_schedule_constraints> object can be printed
9613 using the following functions.
9615         #include <isl/schedule.h>
9616         __isl_give isl_printer *
9617         isl_printer_print_schedule_constraints(
9618                 __isl_take isl_printer *p,
9619                 __isl_keep isl_schedule_constraints *sc);
9620         __isl_give char *isl_schedule_constraints_to_str(
9621                 __isl_keep isl_schedule_constraints *sc);
9623 The following function computes a schedule directly from
9624 an iteration domain and validity and proximity dependences
9625 and is implemented in terms of the functions described above.
9626 The use of C<isl_union_set_compute_schedule> is discouraged.
9628         #include <isl/schedule.h>
9629         __isl_give isl_schedule *isl_union_set_compute_schedule(
9630                 __isl_take isl_union_set *domain,
9631                 __isl_take isl_union_map *validity,
9632                 __isl_take isl_union_map *proximity);
9634 The generated schedule represents a schedule tree.
9635 For more information on schedule trees, see
9636 L</"Schedule Trees">.
9638 =head3 Options
9640         #include <isl/schedule.h>
9641         isl_stat isl_options_set_schedule_max_coefficient(
9642                 isl_ctx *ctx, int val);
9643         int isl_options_get_schedule_max_coefficient(
9644                 isl_ctx *ctx);
9645         isl_stat isl_options_set_schedule_max_constant_term(
9646                 isl_ctx *ctx, int val);
9647         int isl_options_get_schedule_max_constant_term(
9648                 isl_ctx *ctx);
9649         isl_stat isl_options_set_schedule_serialize_sccs(
9650                 isl_ctx *ctx, int val);
9651         int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
9652         isl_stat isl_options_set_schedule_whole_component(
9653                 isl_ctx *ctx, int val);
9654         int isl_options_get_schedule_whole_component(
9655                 isl_ctx *ctx);
9656         isl_stat isl_options_set_schedule_maximize_band_depth(
9657                 isl_ctx *ctx, int val);
9658         int isl_options_get_schedule_maximize_band_depth(
9659                 isl_ctx *ctx);
9660         isl_stat isl_options_set_schedule_maximize_coincidence(
9661                 isl_ctx *ctx, int val);
9662         int isl_options_get_schedule_maximize_coincidence(
9663                 isl_ctx *ctx);
9664         isl_stat isl_options_set_schedule_outer_coincidence(
9665                 isl_ctx *ctx, int val);
9666         int isl_options_get_schedule_outer_coincidence(
9667                 isl_ctx *ctx);
9668         isl_stat isl_options_set_schedule_split_scaled(
9669                 isl_ctx *ctx, int val);
9670         int isl_options_get_schedule_split_scaled(
9671                 isl_ctx *ctx);
9672         isl_stat isl_options_set_schedule_treat_coalescing(
9673                 isl_ctx *ctx, int val);
9674         int isl_options_get_schedule_treat_coalescing(
9675                 isl_ctx *ctx);
9676         isl_stat isl_options_set_schedule_algorithm(
9677                 isl_ctx *ctx, int val);
9678         int isl_options_get_schedule_algorithm(
9679                 isl_ctx *ctx);
9680         isl_stat isl_options_set_schedule_carry_self_first(
9681                 isl_ctx *ctx, int val);
9682         int isl_options_get_schedule_carry_self_first(
9683                 isl_ctx *ctx);
9684         isl_stat isl_options_set_schedule_separate_components(
9685                 isl_ctx *ctx, int val);
9686         int isl_options_get_schedule_separate_components(
9687                 isl_ctx *ctx);
9689 =over
9691 =item * schedule_max_coefficient
9693 This option enforces that the coefficients for variable and parameter
9694 dimensions in the calculated schedule are not larger than the specified value.
9695 This option can significantly increase the speed of the scheduling calculation
9696 and may also prevent fusing of unrelated dimensions. A value of -1 means that
9697 this option does not introduce bounds on the variable or parameter
9698 coefficients.
9700 =item * schedule_max_constant_term
9702 This option enforces that the constant coefficients in the calculated schedule
9703 are not larger than the maximal constant term. This option can significantly
9704 increase the speed of the scheduling calculation and may also prevent fusing of
9705 unrelated dimensions. A value of -1 means that this option does not introduce
9706 bounds on the constant coefficients.
9708 =item * schedule_serialize_sccs
9710 If this option is set, then all strongly connected components
9711 in the dependence graph are serialized as soon as they are detected.
9712 This means in particular that instances of statements will only
9713 appear in the same band node if these statements belong
9714 to the same strongly connected component at the point where
9715 the band node is constructed.
9717 =item * schedule_whole_component
9719 If this option is set, then entire (weakly) connected
9720 components in the dependence graph are scheduled together
9721 as a whole.
9722 Otherwise, each strongly connected component within
9723 such a weakly connected component is first scheduled separately
9724 and then combined with other strongly connected components.
9725 This option has no effect if C<schedule_serialize_sccs> is set.
9727 =item * schedule_maximize_band_depth
9729 If this option is set, then the scheduler tries to maximize
9730 the width of the bands.  Wider bands give more possibilities for tiling.
9731 In particular, if the C<schedule_whole_component> option is set,
9732 then bands are split if this might result in wider bands.
9733 Otherwise, the effect of this option is to only allow
9734 strongly connected components to be combined if this does
9735 not reduce the width of the bands.
9736 Note that if the C<schedule_serialize_sccs> options is set, then
9737 the C<schedule_maximize_band_depth> option therefore has no effect.
9739 =item * schedule_maximize_coincidence
9741 This option is only effective if the C<schedule_whole_component>
9742 option is turned off.
9743 If the C<schedule_maximize_coincidence> option is set, then (clusters of)
9744 strongly connected components are only combined with each other
9745 if this does not reduce the number of coincident band members.
9747 =item * schedule_outer_coincidence
9749 If this option is set, then we try to construct schedules
9750 where the outermost scheduling dimension in each band
9751 satisfies the coincidence constraints.
9753 =item * schedule_algorithm
9755 Selects the scheduling algorithm to be used.
9756 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
9757 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
9759 =item * schedule_split_scaled
9761 If this option is set, then we try to construct schedules in which the
9762 constant term is split off from the linear part if the linear parts of
9763 the scheduling rows for all nodes in the graph have a common non-trivial
9764 divisor.
9765 The constant term is then dropped and the linear
9766 part is reduced.
9767 This option is only effective when the Feautrier style scheduler is
9768 being used, either as the main scheduler or as a fallback for the
9769 Pluto-like scheduler.
9771 =item * schedule_treat_coalescing
9773 If this option is set, then the scheduler will try and avoid
9774 producing schedules that perform loop coalescing.
9775 In particular, for the Pluto-like scheduler, this option places
9776 bounds on the schedule coefficients based on the sizes of the instance sets.
9777 For the Feautrier style scheduler, this option detects potentially
9778 coalescing schedules and then tries to adjust the schedule to avoid
9779 the coalescing.
9781 =item * schedule_carry_self_first
9783 If this option is set, then the Feautrier style scheduler
9784 (when used as a fallback for the Pluto-like scheduler) will
9785 first try to only carry self-dependences.
9787 =item * schedule_separate_components
9789 If this option is set then the function C<isl_schedule_get_map>
9790 will treat set nodes in the same way as sequence nodes.
9792 =back
9794 =head2 AST Generation
9796 This section describes the C<isl> functionality for generating
9797 ASTs that visit all the elements
9798 in a domain in an order specified by a schedule tree or
9799 a schedule map.
9800 In case the schedule given as a C<isl_union_map>, an AST is generated
9801 that visits all the elements in the domain of the C<isl_union_map>
9802 according to the lexicographic order of the corresponding image
9803 element(s).  If the range of the C<isl_union_map> consists of
9804 elements in more than one space, then each of these spaces is handled
9805 separately in an arbitrary order.
9806 It should be noted that the schedule tree or the image elements
9807 in a schedule map only specify the I<order>
9808 in which the corresponding domain elements should be visited.
9809 No direct relation between the partial schedule values
9810 or the image elements on the one hand and the loop iterators
9811 in the generated AST on the other hand should be assumed.
9813 Each AST is generated within a build.  The initial build
9814 simply specifies the constraints on the parameters (if any)
9815 and can be created, inspected, copied and freed using the following functions.
9817         #include <isl/ast_build.h>
9818         __isl_give isl_ast_build *isl_ast_build_alloc(
9819                 isl_ctx *ctx);
9820         __isl_give isl_ast_build *isl_ast_build_from_context(
9821                 __isl_take isl_set *set);
9822         __isl_give isl_ast_build *isl_ast_build_copy(
9823                 __isl_keep isl_ast_build *build);
9824         __isl_null isl_ast_build *isl_ast_build_free(
9825                 __isl_take isl_ast_build *build);
9827 The C<set> argument is usually a parameter set with zero or more parameters.
9828 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
9829 this set is required to be a parameter set.
9830 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
9831 specify any parameter constraints.
9832 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
9833 and L</"Fine-grained Control over AST Generation">.
9834 Finally, the AST itself can be constructed using one of the following
9835 functions.
9837         #include <isl/ast_build.h>
9838         __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
9839                 __isl_keep isl_ast_build *build,
9840                 __isl_take isl_schedule *schedule);
9841         __isl_give isl_ast_node *
9842         isl_ast_build_node_from_schedule_map(
9843                 __isl_keep isl_ast_build *build,
9844                 __isl_take isl_union_map *schedule);
9846 =head3 Inspecting the AST
9848 The basic properties of an AST node can be obtained as follows.
9850         #include <isl/ast.h>
9851         enum isl_ast_node_type isl_ast_node_get_type(
9852                 __isl_keep isl_ast_node *node);
9854 The type of an AST node is one of
9855 C<isl_ast_node_for>,
9856 C<isl_ast_node_if>,
9857 C<isl_ast_node_block>,
9858 C<isl_ast_node_mark> or
9859 C<isl_ast_node_user>.
9860 An C<isl_ast_node_for> represents a for node.
9861 An C<isl_ast_node_if> represents an if node.
9862 An C<isl_ast_node_block> represents a compound node.
9863 An C<isl_ast_node_mark> introduces a mark in the AST.
9864 An C<isl_ast_node_user> represents an expression statement.
9865 An expression statement typically corresponds to a domain element, i.e.,
9866 one of the elements that is visited by the AST.
9868 Each type of node has its own additional properties.
9870         #include <isl/ast.h>
9871         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
9872                 __isl_keep isl_ast_node *node);
9873         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
9874                 __isl_keep isl_ast_node *node);
9875         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
9876                 __isl_keep isl_ast_node *node);
9877         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
9878                 __isl_keep isl_ast_node *node);
9879         __isl_give isl_ast_node *isl_ast_node_for_get_body(
9880                 __isl_keep isl_ast_node *node);
9881         isl_bool isl_ast_node_for_is_degenerate(
9882                 __isl_keep isl_ast_node *node);
9884 An C<isl_ast_for> is considered degenerate if it is known to execute
9885 exactly once.
9887         #include <isl/ast.h>
9888         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
9889                 __isl_keep isl_ast_node *node);
9890         __isl_give isl_ast_node *isl_ast_node_if_get_then(
9891                 __isl_keep isl_ast_node *node);
9892         isl_bool isl_ast_node_if_has_else(
9893                 __isl_keep isl_ast_node *node);
9894         __isl_give isl_ast_node *isl_ast_node_if_get_else(
9895                 __isl_keep isl_ast_node *node);
9897         __isl_give isl_ast_node_list *
9898         isl_ast_node_block_get_children(
9899                 __isl_keep isl_ast_node *node);
9901         __isl_give isl_id *isl_ast_node_mark_get_id(
9902                 __isl_keep isl_ast_node *node);
9903         __isl_give isl_ast_node *isl_ast_node_mark_get_node(
9904                 __isl_keep isl_ast_node *node);
9906 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
9907 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
9909         #include <isl/ast.h>
9910         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
9911                 __isl_keep isl_ast_node *node);
9913 All descendants of a specific node in the AST (including the node itself)
9914 can be visited
9915 in depth-first pre-order using the following function.
9917         #include <isl/ast.h>
9918         isl_stat isl_ast_node_foreach_descendant_top_down(
9919                 __isl_keep isl_ast_node *node,
9920                 isl_bool (*fn)(__isl_keep isl_ast_node *node,
9921                         void *user), void *user);
9923 The callback function should return C<isl_bool_true> if the children
9924 of the given node should be visited and C<isl_bool_false> if they should not.
9925 It should return C<isl_bool_error> in case of failure, in which case
9926 the entire traversal is aborted.
9928 Each of the returned C<isl_ast_expr>s can in turn be inspected using
9929 the following functions.
9931         #include <isl/ast.h>
9932         enum isl_ast_expr_type isl_ast_expr_get_type(
9933                 __isl_keep isl_ast_expr *expr);
9935 The type of an AST expression is one of
9936 C<isl_ast_expr_op>,
9937 C<isl_ast_expr_id> or
9938 C<isl_ast_expr_int>.
9939 An C<isl_ast_expr_op> represents the result of an operation.
9940 An C<isl_ast_expr_id> represents an identifier.
9941 An C<isl_ast_expr_int> represents an integer value.
9943 Each type of expression has its own additional properties.
9945         #include <isl/ast.h>
9946         enum isl_ast_op_type isl_ast_expr_get_op_type(
9947                 __isl_keep isl_ast_expr *expr);
9948         int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
9949         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
9950                 __isl_keep isl_ast_expr *expr, int pos);
9951         isl_stat isl_ast_expr_foreach_ast_op_type(
9952                 __isl_keep isl_ast_expr *expr,
9953                 isl_stat (*fn)(enum isl_ast_op_type type,
9954                         void *user), void *user);
9955         isl_stat isl_ast_node_foreach_ast_op_type(
9956                 __isl_keep isl_ast_node *node,
9957                 isl_stat (*fn)(enum isl_ast_op_type type,
9958                         void *user), void *user);
9960 C<isl_ast_expr_get_op_type> returns the type of the operation
9961 performed.  C<isl_ast_expr_get_op_n_arg> returns the number of
9962 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
9963 argument.
9964 C<isl_ast_expr_foreach_ast_op_type> calls C<fn> for each distinct
9965 C<isl_ast_op_type> that appears in C<expr>.
9966 C<isl_ast_node_foreach_ast_op_type> does the same for each distinct
9967 C<isl_ast_op_type> that appears in C<node>.
9968 The operation type is one of the following.
9970 =over
9972 =item C<isl_ast_op_and>
9974 Logical I<and> of two arguments.
9975 Both arguments can be evaluated.
9977 =item C<isl_ast_op_and_then>
9979 Logical I<and> of two arguments.
9980 The second argument can only be evaluated if the first evaluates to true.
9982 =item C<isl_ast_op_or>
9984 Logical I<or> of two arguments.
9985 Both arguments can be evaluated.
9987 =item C<isl_ast_op_or_else>
9989 Logical I<or> of two arguments.
9990 The second argument can only be evaluated if the first evaluates to false.
9992 =item C<isl_ast_op_max>
9994 Maximum of two or more arguments.
9996 =item C<isl_ast_op_min>
9998 Minimum of two or more arguments.
10000 =item C<isl_ast_op_minus>
10002 Change sign.
10004 =item C<isl_ast_op_add>
10006 Sum of two arguments.
10008 =item C<isl_ast_op_sub>
10010 Difference of two arguments.
10012 =item C<isl_ast_op_mul>
10014 Product of two arguments.
10016 =item C<isl_ast_op_div>
10018 Exact division.  That is, the result is known to be an integer.
10020 =item C<isl_ast_op_fdiv_q>
10022 Result of integer division, rounded towards negative
10023 infinity.
10024 The divisor is known to be positive.
10026 =item C<isl_ast_op_pdiv_q>
10028 Result of integer division, where dividend is known to be non-negative.
10029 The divisor is known to be positive.
10031 =item C<isl_ast_op_pdiv_r>
10033 Remainder of integer division, where dividend is known to be non-negative.
10034 The divisor is known to be positive.
10036 =item C<isl_ast_op_zdiv_r>
10038 Equal to zero iff the remainder on integer division is zero.
10039 The divisor is known to be positive.
10041 =item C<isl_ast_op_cond>
10043 Conditional operator defined on three arguments.
10044 If the first argument evaluates to true, then the result
10045 is equal to the second argument.  Otherwise, the result
10046 is equal to the third argument.
10047 The second and third argument may only be evaluated if
10048 the first argument evaluates to true and false, respectively.
10049 Corresponds to C<a ? b : c> in C.
10051 =item C<isl_ast_op_select>
10053 Conditional operator defined on three arguments.
10054 If the first argument evaluates to true, then the result
10055 is equal to the second argument.  Otherwise, the result
10056 is equal to the third argument.
10057 The second and third argument may be evaluated independently
10058 of the value of the first argument.
10059 Corresponds to C<a * b + (1 - a) * c> in C.
10061 =item C<isl_ast_op_eq>
10063 Equality relation.
10065 =item C<isl_ast_op_le>
10067 Less than or equal relation.
10069 =item C<isl_ast_op_lt>
10071 Less than relation.
10073 =item C<isl_ast_op_ge>
10075 Greater than or equal relation.
10077 =item C<isl_ast_op_gt>
10079 Greater than relation.
10081 =item C<isl_ast_op_call>
10083 A function call.
10084 The number of arguments of the C<isl_ast_expr> is one more than
10085 the number of arguments in the function call, the first argument
10086 representing the function being called.
10088 =item C<isl_ast_op_access>
10090 An array access.
10091 The number of arguments of the C<isl_ast_expr> is one more than
10092 the number of index expressions in the array access, the first argument
10093 representing the array being accessed.
10095 =item C<isl_ast_op_member>
10097 A member access.
10098 This operation has two arguments, a structure and the name of
10099 the member of the structure being accessed.
10101 =back
10103         #include <isl/ast.h>
10104         __isl_give isl_id *isl_ast_expr_get_id(
10105                 __isl_keep isl_ast_expr *expr);
10107 Return the identifier represented by the AST expression.
10109         #include <isl/ast.h>
10110         __isl_give isl_val *isl_ast_expr_get_val(
10111                 __isl_keep isl_ast_expr *expr);
10113 Return the integer represented by the AST expression.
10115 =head3 Properties of ASTs
10117         #include <isl/ast.h>
10118         isl_bool isl_ast_expr_is_equal(
10119                 __isl_keep isl_ast_expr *expr1,
10120                 __isl_keep isl_ast_expr *expr2);
10122 Check if two C<isl_ast_expr>s are equal to each other.
10124 =head3 Manipulating and printing the AST
10126 AST nodes can be copied and freed using the following functions.
10128         #include <isl/ast.h>
10129         __isl_give isl_ast_node *isl_ast_node_copy(
10130                 __isl_keep isl_ast_node *node);
10131         __isl_null isl_ast_node *isl_ast_node_free(
10132                 __isl_take isl_ast_node *node);
10134 AST expressions can be copied and freed using the following functions.
10136         #include <isl/ast.h>
10137         __isl_give isl_ast_expr *isl_ast_expr_copy(
10138                 __isl_keep isl_ast_expr *expr);
10139         __isl_null isl_ast_expr *isl_ast_expr_free(
10140                 __isl_take isl_ast_expr *expr);
10142 New AST expressions can be created either directly or within
10143 the context of an C<isl_ast_build>.
10145         #include <isl/ast.h>
10146         __isl_give isl_ast_expr *isl_ast_expr_from_val(
10147                 __isl_take isl_val *v);
10148         __isl_give isl_ast_expr *isl_ast_expr_from_id(
10149                 __isl_take isl_id *id);
10150         __isl_give isl_ast_expr *isl_ast_expr_neg(
10151                 __isl_take isl_ast_expr *expr);
10152         __isl_give isl_ast_expr *isl_ast_expr_address_of(
10153                 __isl_take isl_ast_expr *expr);
10154         __isl_give isl_ast_expr *isl_ast_expr_add(
10155                 __isl_take isl_ast_expr *expr1,
10156                 __isl_take isl_ast_expr *expr2);
10157         __isl_give isl_ast_expr *isl_ast_expr_sub(
10158                 __isl_take isl_ast_expr *expr1,
10159                 __isl_take isl_ast_expr *expr2);
10160         __isl_give isl_ast_expr *isl_ast_expr_mul(
10161                 __isl_take isl_ast_expr *expr1,
10162                 __isl_take isl_ast_expr *expr2);
10163         __isl_give isl_ast_expr *isl_ast_expr_div(
10164                 __isl_take isl_ast_expr *expr1,
10165                 __isl_take isl_ast_expr *expr2);
10166         __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
10167                 __isl_take isl_ast_expr *expr1,
10168                 __isl_take isl_ast_expr *expr2);
10169         __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
10170                 __isl_take isl_ast_expr *expr1,
10171                 __isl_take isl_ast_expr *expr2);
10172         __isl_give isl_ast_expr *isl_ast_expr_and(
10173                 __isl_take isl_ast_expr *expr1,
10174                 __isl_take isl_ast_expr *expr2)
10175         __isl_give isl_ast_expr *isl_ast_expr_and_then(
10176                 __isl_take isl_ast_expr *expr1,
10177                 __isl_take isl_ast_expr *expr2)
10178         __isl_give isl_ast_expr *isl_ast_expr_or(
10179                 __isl_take isl_ast_expr *expr1,
10180                 __isl_take isl_ast_expr *expr2)
10181         __isl_give isl_ast_expr *isl_ast_expr_or_else(
10182                 __isl_take isl_ast_expr *expr1,
10183                 __isl_take isl_ast_expr *expr2)
10184         __isl_give isl_ast_expr *isl_ast_expr_eq(
10185                 __isl_take isl_ast_expr *expr1,
10186                 __isl_take isl_ast_expr *expr2);
10187         __isl_give isl_ast_expr *isl_ast_expr_le(
10188                 __isl_take isl_ast_expr *expr1,
10189                 __isl_take isl_ast_expr *expr2);
10190         __isl_give isl_ast_expr *isl_ast_expr_lt(
10191                 __isl_take isl_ast_expr *expr1,
10192                 __isl_take isl_ast_expr *expr2);
10193         __isl_give isl_ast_expr *isl_ast_expr_ge(
10194                 __isl_take isl_ast_expr *expr1,
10195                 __isl_take isl_ast_expr *expr2);
10196         __isl_give isl_ast_expr *isl_ast_expr_gt(
10197                 __isl_take isl_ast_expr *expr1,
10198                 __isl_take isl_ast_expr *expr2);
10199         __isl_give isl_ast_expr *isl_ast_expr_access(
10200                 __isl_take isl_ast_expr *array,
10201                 __isl_take isl_ast_expr_list *indices);
10202         __isl_give isl_ast_expr *isl_ast_expr_call(
10203                 __isl_take isl_ast_expr *function,
10204                 __isl_take isl_ast_expr_list *arguments);
10206 The function C<isl_ast_expr_address_of> can be applied to an
10207 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
10208 to represent the address of the C<isl_ast_expr_access>.
10209 The second argument of the functions C<isl_ast_expr_pdiv_q> and
10210 C<isl_ast_expr_pdiv_r> should always evaluate to a positive number.
10211 The function
10212 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
10213 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
10215         #include <isl/ast_build.h>
10216         __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
10217                 __isl_keep isl_ast_build *build,
10218                 __isl_take isl_set *set);
10219         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
10220                 __isl_keep isl_ast_build *build,
10221                 __isl_take isl_pw_aff *pa);
10222         __isl_give isl_ast_expr *
10223         isl_ast_build_access_from_pw_multi_aff(
10224                 __isl_keep isl_ast_build *build,
10225                 __isl_take isl_pw_multi_aff *pma);
10226         __isl_give isl_ast_expr *
10227         isl_ast_build_access_from_multi_pw_aff(
10228                 __isl_keep isl_ast_build *build,
10229                 __isl_take isl_multi_pw_aff *mpa);
10230         __isl_give isl_ast_expr *
10231         isl_ast_build_call_from_pw_multi_aff(
10232                 __isl_keep isl_ast_build *build,
10233                 __isl_take isl_pw_multi_aff *pma);
10234         __isl_give isl_ast_expr *
10235         isl_ast_build_call_from_multi_pw_aff(
10236                 __isl_keep isl_ast_build *build,
10237                 __isl_take isl_multi_pw_aff *mpa);
10239 The set C<set> and
10240 the domains of C<pa>, C<mpa> and C<pma> should correspond
10241 to the schedule space of C<build>.
10242 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
10243 the function being called.
10244 If the accessed space is a nested relation, then it is taken
10245 to represent an access of the member specified by the range
10246 of this nested relation of the structure specified by the domain
10247 of the nested relation.
10249 The following functions can be used to modify an C<isl_ast_expr>.
10251         #include <isl/ast.h>
10252         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
10253                 __isl_take isl_ast_expr *expr, int pos,
10254                 __isl_take isl_ast_expr *arg);
10256 Replace the argument of C<expr> at position C<pos> by C<arg>.
10258         #include <isl/ast.h>
10259         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
10260                 __isl_take isl_ast_expr *expr,
10261                 __isl_take isl_id_to_ast_expr *id2expr);
10263 The function C<isl_ast_expr_substitute_ids> replaces the
10264 subexpressions of C<expr> of type C<isl_ast_expr_id>
10265 by the corresponding expression in C<id2expr>, if there is any.
10268 User specified data can be attached to an C<isl_ast_node> and obtained
10269 from the same C<isl_ast_node> using the following functions.
10271         #include <isl/ast.h>
10272         __isl_give isl_ast_node *isl_ast_node_set_annotation(
10273                 __isl_take isl_ast_node *node,
10274                 __isl_take isl_id *annotation);
10275         __isl_give isl_id *isl_ast_node_get_annotation(
10276                 __isl_keep isl_ast_node *node);
10278 Basic printing can be performed using the following functions.
10280         #include <isl/ast.h>
10281         __isl_give isl_printer *isl_printer_print_ast_expr(
10282                 __isl_take isl_printer *p,
10283                 __isl_keep isl_ast_expr *expr);
10284         __isl_give isl_printer *isl_printer_print_ast_node(
10285                 __isl_take isl_printer *p,
10286                 __isl_keep isl_ast_node *node);
10287         __isl_give char *isl_ast_expr_to_str(
10288                 __isl_keep isl_ast_expr *expr);
10289         __isl_give char *isl_ast_node_to_str(
10290                 __isl_keep isl_ast_node *node);
10291         __isl_give char *isl_ast_expr_to_C_str(
10292                 __isl_keep isl_ast_expr *expr);
10293         __isl_give char *isl_ast_node_to_C_str(
10294                 __isl_keep isl_ast_node *node);
10296 The functions C<isl_ast_expr_to_C_str> and
10297 C<isl_ast_node_to_C_str> are convenience functions
10298 that return a string representation of the input in C format.
10300 More advanced printing can be performed using the following functions.
10302         #include <isl/ast.h>
10303         __isl_give isl_printer *isl_ast_op_type_set_print_name(
10304                 __isl_take isl_printer *p,
10305                 enum isl_ast_op_type type,
10306                 __isl_keep const char *name);
10307         isl_stat isl_options_set_ast_print_macro_once(
10308                 isl_ctx *ctx, int val);
10309         int isl_options_get_ast_print_macro_once(isl_ctx *ctx);
10310         __isl_give isl_printer *isl_ast_op_type_print_macro(
10311                 enum isl_ast_op_type type,
10312                 __isl_take isl_printer *p);
10313         __isl_give isl_printer *isl_ast_expr_print_macros(
10314                 __isl_keep isl_ast_expr *expr,
10315                 __isl_take isl_printer *p);
10316         __isl_give isl_printer *isl_ast_node_print_macros(
10317                 __isl_keep isl_ast_node *node,
10318                 __isl_take isl_printer *p);
10319         __isl_give isl_printer *isl_ast_node_print(
10320                 __isl_keep isl_ast_node *node,
10321                 __isl_take isl_printer *p,
10322                 __isl_take isl_ast_print_options *options);
10323         __isl_give isl_printer *isl_ast_node_for_print(
10324                 __isl_keep isl_ast_node *node,
10325                 __isl_take isl_printer *p,
10326                 __isl_take isl_ast_print_options *options);
10327         __isl_give isl_printer *isl_ast_node_if_print(
10328                 __isl_keep isl_ast_node *node,
10329                 __isl_take isl_printer *p,
10330                 __isl_take isl_ast_print_options *options);
10332 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
10333 C<isl> may print out an AST that makes use of macros such
10334 as C<floord>, C<min> and C<max>.
10335 The names of these macros may be modified by a call
10336 to C<isl_ast_op_type_set_print_name>.  The user-specified
10337 names are associated to the printer object.
10338 C<isl_ast_op_type_print_macro> prints out the macro
10339 corresponding to a specific C<isl_ast_op_type>.
10340 If the print-macro-once option is set, then a given macro definition
10341 is only printed once to any given printer object.
10342 C<isl_ast_expr_print_macros> scans the C<isl_ast_expr>
10343 for subexpressions where these macros would be used and prints
10344 out the required macro definitions.
10345 Essentially, C<isl_ast_expr_print_macros> calls
10346 C<isl_ast_expr_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
10347 as function argument.
10348 C<isl_ast_node_print_macros> does the same
10349 for expressions in its C<isl_ast_node> argument.
10350 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
10351 C<isl_ast_node_if_print> print an C<isl_ast_node>
10352 in C<ISL_FORMAT_C>, but allow for some extra control
10353 through an C<isl_ast_print_options> object.
10354 This object can be created using the following functions.
10356         #include <isl/ast.h>
10357         __isl_give isl_ast_print_options *
10358         isl_ast_print_options_alloc(isl_ctx *ctx);
10359         __isl_give isl_ast_print_options *
10360         isl_ast_print_options_copy(
10361                 __isl_keep isl_ast_print_options *options);
10362         __isl_null isl_ast_print_options *
10363         isl_ast_print_options_free(
10364                 __isl_take isl_ast_print_options *options);
10366         __isl_give isl_ast_print_options *
10367         isl_ast_print_options_set_print_user(
10368                 __isl_take isl_ast_print_options *options,
10369                 __isl_give isl_printer *(*print_user)(
10370                         __isl_take isl_printer *p,
10371                         __isl_take isl_ast_print_options *options,
10372                         __isl_keep isl_ast_node *node, void *user),
10373                 void *user);
10374         __isl_give isl_ast_print_options *
10375         isl_ast_print_options_set_print_for(
10376                 __isl_take isl_ast_print_options *options,
10377                 __isl_give isl_printer *(*print_for)(
10378                         __isl_take isl_printer *p,
10379                         __isl_take isl_ast_print_options *options,
10380                         __isl_keep isl_ast_node *node, void *user),
10381                 void *user);
10383 The callback set by C<isl_ast_print_options_set_print_user>
10384 is called whenever a node of type C<isl_ast_node_user> needs to
10385 be printed.
10386 The callback set by C<isl_ast_print_options_set_print_for>
10387 is called whenever a node of type C<isl_ast_node_for> needs to
10388 be printed.
10389 Note that C<isl_ast_node_for_print> will I<not> call the
10390 callback set by C<isl_ast_print_options_set_print_for> on the node
10391 on which C<isl_ast_node_for_print> is called, but only on nested
10392 nodes of type C<isl_ast_node_for>.  It is therefore safe to
10393 call C<isl_ast_node_for_print> from within the callback set by
10394 C<isl_ast_print_options_set_print_for>.
10396 The following option determines the type to be used for iterators
10397 while printing the AST.
10399         isl_stat isl_options_set_ast_iterator_type(
10400                 isl_ctx *ctx, const char *val);
10401         const char *isl_options_get_ast_iterator_type(
10402                 isl_ctx *ctx);
10404 The AST printer only prints body nodes as blocks if these
10405 blocks cannot be safely omitted.
10406 For example, a C<for> node with one body node will not be
10407 surrounded with braces in C<ISL_FORMAT_C>.
10408 A block will always be printed by setting the following option.
10410         isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
10411                 int val);
10412         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
10414 =head3 Options
10416         #include <isl/ast_build.h>
10417         isl_stat isl_options_set_ast_build_atomic_upper_bound(
10418                 isl_ctx *ctx, int val);
10419         int isl_options_get_ast_build_atomic_upper_bound(
10420                 isl_ctx *ctx);
10421         isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
10422                 int val);
10423         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
10424         isl_stat isl_options_set_ast_build_detect_min_max(
10425                 isl_ctx *ctx, int val);
10426         int isl_options_get_ast_build_detect_min_max(
10427                 isl_ctx *ctx);
10428         isl_stat isl_options_set_ast_build_exploit_nested_bounds(
10429                 isl_ctx *ctx, int val);
10430         int isl_options_get_ast_build_exploit_nested_bounds(
10431                 isl_ctx *ctx);
10432         isl_stat isl_options_set_ast_build_group_coscheduled(
10433                 isl_ctx *ctx, int val);
10434         int isl_options_get_ast_build_group_coscheduled(
10435                 isl_ctx *ctx);
10436         isl_stat isl_options_set_ast_build_separation_bounds(
10437                 isl_ctx *ctx, int val);
10438         int isl_options_get_ast_build_separation_bounds(
10439                 isl_ctx *ctx);
10440         isl_stat isl_options_set_ast_build_scale_strides(
10441                 isl_ctx *ctx, int val);
10442         int isl_options_get_ast_build_scale_strides(
10443                 isl_ctx *ctx);
10444         isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
10445                 int val);
10446         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
10447         isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
10448                 int val);
10449         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
10451 =over
10453 =item * ast_build_atomic_upper_bound
10455 Generate loop upper bounds that consist of the current loop iterator,
10456 an operator and an expression not involving the iterator.
10457 If this option is not set, then the current loop iterator may appear
10458 several times in the upper bound.
10459 For example, when this option is turned off, AST generation
10460 for the schedule
10462         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
10464 produces
10466         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
10467           A(c0);
10469 When the option is turned on, the following AST is generated
10471         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
10472           A(c0);
10474 =item * ast_build_prefer_pdiv
10476 If this option is turned off, then the AST generation will
10477 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
10478 operators, but no C<isl_ast_op_pdiv_q> or
10479 C<isl_ast_op_pdiv_r> operators.
10480 If this option is turned on, then C<isl> will try to convert
10481 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
10482 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
10484 =item * ast_build_detect_min_max
10486 If this option is turned on, then C<isl> will try and detect
10487 min or max-expressions when building AST expressions from
10488 piecewise affine expressions.
10490 =item * ast_build_exploit_nested_bounds
10492 Simplify conditions based on bounds of nested for loops.
10493 In particular, remove conditions that are implied by the fact
10494 that one or more nested loops have at least one iteration,
10495 meaning that the upper bound is at least as large as the lower bound.
10496 For example, when this option is turned off, AST generation
10497 for the schedule
10499         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
10500                                         0 <= j <= M }
10502 produces
10504         if (M >= 0)
10505           for (int c0 = 0; c0 <= N; c0 += 1)
10506             for (int c1 = 0; c1 <= M; c1 += 1)
10507               A(c0, c1);
10509 When the option is turned on, the following AST is generated
10511         for (int c0 = 0; c0 <= N; c0 += 1)
10512           for (int c1 = 0; c1 <= M; c1 += 1)
10513             A(c0, c1);
10515 =item * ast_build_group_coscheduled
10517 If two domain elements are assigned the same schedule point, then
10518 they may be executed in any order and they may even appear in different
10519 loops.  If this options is set, then the AST generator will make
10520 sure that coscheduled domain elements do not appear in separate parts
10521 of the AST.  This is useful in case of nested AST generation
10522 if the outer AST generation is given only part of a schedule
10523 and the inner AST generation should handle the domains that are
10524 coscheduled by this initial part of the schedule together.
10525 For example if an AST is generated for a schedule
10527         { A[i] -> [0]; B[i] -> [0] }
10529 then the C<isl_ast_build_set_create_leaf> callback described
10530 below may get called twice, once for each domain.
10531 Setting this option ensures that the callback is only called once
10532 on both domains together.
10534 =item * ast_build_separation_bounds
10536 This option specifies which bounds to use during separation.
10537 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
10538 then all (possibly implicit) bounds on the current dimension will
10539 be used during separation.
10540 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
10541 then only those bounds that are explicitly available will
10542 be used during separation.
10544 =item * ast_build_scale_strides
10546 This option specifies whether the AST generator is allowed
10547 to scale down iterators of strided loops.
10549 =item * ast_build_allow_else
10551 This option specifies whether the AST generator is allowed
10552 to construct if statements with else branches.
10554 =item * ast_build_allow_or
10556 This option specifies whether the AST generator is allowed
10557 to construct if conditions with disjunctions.
10559 =back
10561 =head3 AST Generation Options (Schedule Tree)
10563 In case of AST construction from a schedule tree, the options
10564 that control how an AST is created from the individual schedule
10565 dimensions are stored in the band nodes of the tree
10566 (see L</"Schedule Trees">).
10568 In particular, a schedule dimension can be handled in four
10569 different ways, atomic, separate, unroll or the default.
10570 This loop AST generation type can be set using
10571 C<isl_schedule_node_band_member_set_ast_loop_type>.
10572 Alternatively,
10573 the first three can be selected by including a one-dimensional
10574 element with as value the position of the schedule dimension
10575 within the band and as name one of C<atomic>, C<separate>
10576 or C<unroll> in the options
10577 set by C<isl_schedule_node_band_set_ast_build_options>.
10578 Only one of these three may be specified for
10579 any given schedule dimension within a band node.
10580 If none of these is specified, then the default
10581 is used.  The meaning of the options is as follows.
10583 =over
10585 =item C<atomic>
10587 When this option is specified, the AST generator will make
10588 sure that a given domains space only appears in a single
10589 loop at the specified level.
10591 For example, for the schedule tree
10593         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10594         child:
10595           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10596           options: "{ atomic[x] }"
10598 the following AST will be generated
10600         for (int c0 = 0; c0 <= 10; c0 += 1) {
10601           if (c0 >= 1)
10602             b(c0 - 1);
10603           if (c0 <= 9)
10604             a(c0);
10605         }
10607 On the other hand, for the schedule tree
10609         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10610         child:
10611           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10612           options: "{ separate[x] }"
10614 the following AST will be generated
10616         {
10617           a(0);
10618           for (int c0 = 1; c0 <= 9; c0 += 1) {
10619             b(c0 - 1);
10620             a(c0);
10621           }
10622           b(9);
10623         }
10625 If neither C<atomic> nor C<separate> is specified, then the AST generator
10626 may produce either of these two results or some intermediate form.
10628 =item C<separate>
10630 When this option is specified, the AST generator will
10631 split the domain of the specified schedule dimension
10632 into pieces with a fixed set of statements for which
10633 instances need to be executed by the iterations in
10634 the schedule domain part.  This option tends to avoid
10635 the generation of guards inside the corresponding loops.
10636 See also the C<atomic> option.
10638 =item C<unroll>
10640 When this option is specified, the AST generator will
10641 I<completely> unroll the corresponding schedule dimension.
10642 It is the responsibility of the user to ensure that such
10643 unrolling is possible.
10644 To obtain a partial unrolling, the user should apply an additional
10645 strip-mining to the schedule and fully unroll the inner schedule
10646 dimension.
10648 =back
10650 The C<isolate> option is a bit more involved.  It allows the user
10651 to isolate a range of schedule dimension values from smaller and
10652 greater values.  Additionally, the user may specify a different
10653 atomic/separate/unroll choice for the isolated part and the remaining
10654 parts.  The typical use case of the C<isolate> option is to isolate
10655 full tiles from partial tiles.
10656 The part that needs to be isolated may depend on outer schedule dimensions.
10657 The option therefore needs to be able to reference those outer schedule
10658 dimensions.  In particular, the space of the C<isolate> option is that
10659 of a wrapped map with as domain the flat product of all outer band nodes
10660 and as range the space of the current band node.
10661 The atomic/separate/unroll choice for the isolated part is determined
10662 by an option that lives in an unnamed wrapped space with as domain
10663 a zero-dimensional C<isolate> space and as range the regular
10664 C<atomic>, C<separate> or C<unroll> space.
10665 This option may also be set directly using
10666 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
10667 The atomic/separate/unroll choice for the remaining part is determined
10668 by the regular C<atomic>, C<separate> or C<unroll> option.
10669 Since the C<isolate> option references outer schedule dimensions,
10670 its use in a band node causes any tree containing the node
10671 to be considered anchored.
10673 As an example, consider the isolation of full tiles from partial tiles
10674 in a tiling of a triangular domain.  The original schedule is as follows.
10676         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10677         child:
10678           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10679                 { A[i,j] -> [floor(j/10)] }, \
10680                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10682 The output is
10684         for (int c0 = 0; c0 <= 10; c0 += 1)
10685           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10686             for (int c2 = 10 * c0;
10687                  c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10688               for (int c3 = 10 * c1;
10689                    c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10690                 A(c2, c3);
10692 Isolating the full tiles, we have the following input
10694         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10695         child:
10696           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10697                 { A[i,j] -> [floor(j/10)] }, \
10698                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10699           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10700                 10a+9+10b+9 <= 100 }"
10702 and output
10704         {
10705           for (int c0 = 0; c0 <= 8; c0 += 1) {
10706             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10707               for (int c2 = 10 * c0;
10708                    c2 <= 10 * c0 + 9; c2 += 1)
10709                 for (int c3 = 10 * c1;
10710                      c3 <= 10 * c1 + 9; c3 += 1)
10711                   A(c2, c3);
10712             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10713               for (int c2 = 10 * c0;
10714                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10715                 for (int c3 = 10 * c1;
10716                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10717                   A(c2, c3);
10718           }
10719           for (int c0 = 9; c0 <= 10; c0 += 1)
10720             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10721               for (int c2 = 10 * c0;
10722                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10723                 for (int c3 = 10 * c1;
10724                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10725                   A(c2, c3);
10726         }
10728 We may then additionally unroll the innermost loop of the isolated part
10730         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10731         child:
10732           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10733                 { A[i,j] -> [floor(j/10)] }, \
10734                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10735           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10736                 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
10738 to obtain
10740         {
10741           for (int c0 = 0; c0 <= 8; c0 += 1) {
10742             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10743               for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
10744                 A(c2, 10 * c1);
10745                 A(c2, 10 * c1 + 1);
10746                 A(c2, 10 * c1 + 2);
10747                 A(c2, 10 * c1 + 3);
10748                 A(c2, 10 * c1 + 4);
10749                 A(c2, 10 * c1 + 5);
10750                 A(c2, 10 * c1 + 6);
10751                 A(c2, 10 * c1 + 7);
10752                 A(c2, 10 * c1 + 8);
10753                 A(c2, 10 * c1 + 9);
10754               }
10755             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10756               for (int c2 = 10 * c0;
10757                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10758                 for (int c3 = 10 * c1;
10759                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10760                   A(c2, c3);
10761           }
10762           for (int c0 = 9; c0 <= 10; c0 += 1)
10763             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10764               for (int c2 = 10 * c0;
10765                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10766                 for (int c3 = 10 * c1;
10767                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10768                   A(c2, c3);
10769         }
10772 =head3 AST Generation Options (Schedule Map)
10774 In case of AST construction using
10775 C<isl_ast_build_node_from_schedule_map>, the options
10776 that control how an AST is created from the individual schedule
10777 dimensions are stored in the C<isl_ast_build>.
10778 They can be set using the following function.
10780         #include <isl/ast_build.h>
10781         __isl_give isl_ast_build *
10782         isl_ast_build_set_options(
10783                 __isl_take isl_ast_build *build,
10784                 __isl_take isl_union_map *options);
10786 The options are encoded in an C<isl_union_map>.
10787 The domain of this union relation refers to the schedule domain,
10788 i.e., the range of the schedule passed
10789 to C<isl_ast_build_node_from_schedule_map>.
10790 In the case of nested AST generation (see L</"Nested AST Generation">),
10791 the domain of C<options> should refer to the extra piece of the schedule.
10792 That is, it should be equal to the range of the wrapped relation in the
10793 range of the schedule.
10794 The range of the options can consist of elements in one or more spaces,
10795 the names of which determine the effect of the option.
10796 The values of the range typically also refer to the schedule dimension
10797 to which the option applies, with value C<0> representing
10798 the outermost schedule dimension.  In case of nested AST generation
10799 (see L</"Nested AST Generation">), these values refer to the position
10800 of the schedule dimension within the innermost AST generation.
10801 The constraints on the domain elements of
10802 the option should only refer to this dimension and earlier dimensions.
10803 We consider the following spaces.
10805 =over
10807 =item C<separation_class>
10809 B<This option has been deprecated.  Use the isolate option on
10810 schedule trees instead.>
10812 This space is a wrapped relation between two one dimensional spaces.
10813 The input space represents the schedule dimension to which the option
10814 applies and the output space represents the separation class.
10815 While constructing a loop corresponding to the specified schedule
10816 dimension(s), the AST generator will try to generate separate loops
10817 for domain elements that are assigned different classes.
10818 If only some of the elements are assigned a class, then those elements
10819 that are not assigned any class will be treated as belonging to a class
10820 that is separate from the explicitly assigned classes.
10821 The typical use case for this option is to separate full tiles from
10822 partial tiles.
10823 The other options, described below, are applied after the separation
10824 into classes.
10826 As an example, consider the separation into full and partial tiles
10827 of a tiling of a triangular domain.
10828 Take, for example, the domain
10830         { A[i,j] : 0 <= i,j and i + j <= 100 }
10832 and a tiling into tiles of 10 by 10.  The input to the AST generator
10833 is then the schedule
10835         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
10836                                                 i + j <= 100 }
10838 Without any options, the following AST is generated
10840         for (int c0 = 0; c0 <= 10; c0 += 1)
10841           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10842             for (int c2 = 10 * c0;
10843                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10844                  c2 += 1)
10845               for (int c3 = 10 * c1;
10846                    c3 <= min(10 * c1 + 9, -c2 + 100);
10847                    c3 += 1)
10848                 A(c2, c3);
10850 Separation into full and partial tiles can be obtained by assigning
10851 a class, say C<0>, to the full tiles.  The full tiles are represented by those
10852 values of the first and second schedule dimensions for which there are
10853 values of the third and fourth dimensions to cover an entire tile.
10854 That is, we need to specify the following option
10856         { [a,b,c,d] -> separation_class[[0]->[0]] :
10857                 exists b': 0 <= 10a,10b' and
10858                            10a+9+10b'+9 <= 100;
10859           [a,b,c,d] -> separation_class[[1]->[0]] :
10860                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
10862 which simplifies to
10864         { [a, b, c, d] -> separation_class[[1] -> [0]] :
10865                 a >= 0 and b >= 0 and b <= 8 - a;
10866           [a, b, c, d] -> separation_class[[0] -> [0]] :
10867                 a >= 0 and a <= 8 }
10869 With this option, the generated AST is as follows
10871         {
10872           for (int c0 = 0; c0 <= 8; c0 += 1) {
10873             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10874               for (int c2 = 10 * c0;
10875                    c2 <= 10 * c0 + 9; c2 += 1)
10876                 for (int c3 = 10 * c1;
10877                      c3 <= 10 * c1 + 9; c3 += 1)
10878                   A(c2, c3);
10879             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10880               for (int c2 = 10 * c0;
10881                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10882                    c2 += 1)
10883                 for (int c3 = 10 * c1;
10884                      c3 <= min(-c2 + 100, 10 * c1 + 9);
10885                      c3 += 1)
10886                   A(c2, c3);
10887           }
10888           for (int c0 = 9; c0 <= 10; c0 += 1)
10889             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10890               for (int c2 = 10 * c0;
10891                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10892                    c2 += 1)
10893                 for (int c3 = 10 * c1;
10894                      c3 <= min(10 * c1 + 9, -c2 + 100);
10895                      c3 += 1)
10896                   A(c2, c3);
10897         }
10899 =item C<separate>
10901 This is a single-dimensional space representing the schedule dimension(s)
10902 to which ``separation'' should be applied.  Separation tries to split
10903 a loop into several pieces if this can avoid the generation of guards
10904 inside the loop.
10905 See also the C<atomic> option.
10907 =item C<atomic>
10909 This is a single-dimensional space representing the schedule dimension(s)
10910 for which the domains should be considered ``atomic''.  That is, the
10911 AST generator will make sure that any given domain space will only appear
10912 in a single loop at the specified level.
10914 Consider the following schedule
10916         { a[i] -> [i] : 0 <= i < 10;
10917           b[i] -> [i+1] : 0 <= i < 10 }
10919 If the following option is specified
10921         { [i] -> separate[x] }
10923 then the following AST will be generated
10925         {
10926           a(0);
10927           for (int c0 = 1; c0 <= 9; c0 += 1) {
10928             a(c0);
10929             b(c0 - 1);
10930           }
10931           b(9);
10932         }
10934 If, on the other hand, the following option is specified
10936         { [i] -> atomic[x] }
10938 then the following AST will be generated
10940         for (int c0 = 0; c0 <= 10; c0 += 1) {
10941           if (c0 <= 9)
10942             a(c0);
10943           if (c0 >= 1)
10944             b(c0 - 1);
10945         }
10947 If neither C<atomic> nor C<separate> is specified, then the AST generator
10948 may produce either of these two results or some intermediate form.
10950 =item C<unroll>
10952 This is a single-dimensional space representing the schedule dimension(s)
10953 that should be I<completely> unrolled.
10954 To obtain a partial unrolling, the user should apply an additional
10955 strip-mining to the schedule and fully unroll the inner loop.
10957 =back
10959 =head3 Fine-grained Control over AST Generation
10961 Besides specifying the constraints on the parameters,
10962 an C<isl_ast_build> object can be used to control
10963 various aspects of the AST generation process.
10964 In case of AST construction using
10965 C<isl_ast_build_node_from_schedule_map>,
10966 the most prominent way of control is through ``options'',
10967 as explained above.
10969 Additional control is available through the following functions.
10971         #include <isl/ast_build.h>
10972         __isl_give isl_ast_build *
10973         isl_ast_build_set_iterators(
10974                 __isl_take isl_ast_build *build,
10975                 __isl_take isl_id_list *iterators);
10977 The function C<isl_ast_build_set_iterators> allows the user to
10978 specify a list of iterator C<isl_id>s to be used as iterators.
10979 If the input schedule is injective, then
10980 the number of elements in this list should be as large as the dimension
10981 of the schedule space, but no direct correspondence should be assumed
10982 between dimensions and elements.
10983 If the input schedule is not injective, then an additional number
10984 of C<isl_id>s equal to the largest dimension of the input domains
10985 may be required.
10986 If the number of provided C<isl_id>s is insufficient, then additional
10987 names are automatically generated.
10989         #include <isl/ast_build.h>
10990         __isl_give isl_ast_build *
10991         isl_ast_build_set_create_leaf(
10992                 __isl_take isl_ast_build *build,
10993                 __isl_give isl_ast_node *(*fn)(
10994                         __isl_take isl_ast_build *build,
10995                         void *user), void *user);
10998 C<isl_ast_build_set_create_leaf> function allows for the
10999 specification of a callback that should be called whenever the AST
11000 generator arrives at an element of the schedule domain.
11001 The callback should return an AST node that should be inserted
11002 at the corresponding position of the AST.  The default action (when
11003 the callback is not set) is to continue generating parts of the AST to scan
11004 all the domain elements associated to the schedule domain element
11005 and to insert user nodes, ``calling'' the domain element, for each of them.
11006 The C<build> argument contains the current state of the C<isl_ast_build>.
11007 To ease nested AST generation (see L</"Nested AST Generation">),
11008 all control information that is
11009 specific to the current AST generation such as the options and
11010 the callbacks has been removed from this C<isl_ast_build>.
11011 The callback would typically return the result of a nested
11012 AST generation or a
11013 user defined node created using the following function.
11015         #include <isl/ast.h>
11016         __isl_give isl_ast_node *isl_ast_node_alloc_user(
11017                 __isl_take isl_ast_expr *expr);
11019         #include <isl/ast_build.h>
11020         __isl_give isl_ast_build *
11021         isl_ast_build_set_at_each_domain(
11022                 __isl_take isl_ast_build *build,
11023                 __isl_give isl_ast_node *(*fn)(
11024                         __isl_take isl_ast_node *node,
11025                         __isl_keep isl_ast_build *build,
11026                         void *user), void *user);
11027         __isl_give isl_ast_build *
11028         isl_ast_build_set_before_each_for(
11029                 __isl_take isl_ast_build *build,
11030                 __isl_give isl_id *(*fn)(
11031                         __isl_keep isl_ast_build *build,
11032                         void *user), void *user);
11033         __isl_give isl_ast_build *
11034         isl_ast_build_set_after_each_for(
11035                 __isl_take isl_ast_build *build,
11036                 __isl_give isl_ast_node *(*fn)(
11037                         __isl_take isl_ast_node *node,
11038                         __isl_keep isl_ast_build *build,
11039                         void *user), void *user);
11040         __isl_give isl_ast_build *
11041         isl_ast_build_set_before_each_mark(
11042                 __isl_take isl_ast_build *build,
11043                 isl_stat (*fn)(__isl_keep isl_id *mark,
11044                         __isl_keep isl_ast_build *build,
11045                         void *user), void *user);
11046         __isl_give isl_ast_build *
11047         isl_ast_build_set_after_each_mark(
11048                 __isl_take isl_ast_build *build,
11049                 __isl_give isl_ast_node *(*fn)(
11050                         __isl_take isl_ast_node *node,
11051                         __isl_keep isl_ast_build *build,
11052                         void *user), void *user);
11054 The callback set by C<isl_ast_build_set_at_each_domain> will
11055 be called for each domain AST node.
11056 The callbacks set by C<isl_ast_build_set_before_each_for>
11057 and C<isl_ast_build_set_after_each_for> will be called
11058 for each for AST node.  The first will be called in depth-first
11059 pre-order, while the second will be called in depth-first post-order.
11060 Since C<isl_ast_build_set_before_each_for> is called before the for
11061 node is actually constructed, it is only passed an C<isl_ast_build>.
11062 The returned C<isl_id> will be added as an annotation (using
11063 C<isl_ast_node_set_annotation>) to the constructed for node.
11064 In particular, if the user has also specified an C<after_each_for>
11065 callback, then the annotation can be retrieved from the node passed to
11066 that callback using C<isl_ast_node_get_annotation>.
11067 The callbacks set by C<isl_ast_build_set_before_each_mark>
11068 and C<isl_ast_build_set_after_each_mark> will be called for each
11069 mark AST node that is created, i.e., for each mark schedule node
11070 in the input schedule tree.  The first will be called in depth-first
11071 pre-order, while the second will be called in depth-first post-order.
11072 Since the callback set by C<isl_ast_build_set_before_each_mark>
11073 is called before the mark AST node is actually constructed, it is passed
11074 the identifier of the mark node.
11075 All callbacks should C<NULL> (or C<isl_stat_error>) on failure.
11076 The given C<isl_ast_build> can be used to create new
11077 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
11078 or C<isl_ast_build_call_from_pw_multi_aff>.
11080 =head3 Nested AST Generation
11082 C<isl> allows the user to create an AST within the context
11083 of another AST.  These nested ASTs are created using the
11084 same C<isl_ast_build_node_from_schedule_map> function that is used to create
11085 the outer AST.  The C<build> argument should be an C<isl_ast_build>
11086 passed to a callback set by
11087 C<isl_ast_build_set_create_leaf>.
11088 The space of the range of the C<schedule> argument should refer
11089 to this build.  In particular, the space should be a wrapped
11090 relation and the domain of this wrapped relation should be the
11091 same as that of the range of the schedule returned by
11092 C<isl_ast_build_get_schedule> below.
11093 In practice, the new schedule is typically
11094 created by calling C<isl_union_map_range_product> on the old schedule
11095 and some extra piece of the schedule.
11096 The space of the schedule domain is also available from
11097 the C<isl_ast_build>.
11099         #include <isl/ast_build.h>
11100         __isl_give isl_union_map *isl_ast_build_get_schedule(
11101                 __isl_keep isl_ast_build *build);
11102         __isl_give isl_space *isl_ast_build_get_schedule_space(
11103                 __isl_keep isl_ast_build *build);
11104         __isl_give isl_ast_build *isl_ast_build_restrict(
11105                 __isl_take isl_ast_build *build,
11106                 __isl_take isl_set *set);
11108 The C<isl_ast_build_get_schedule> function returns a (partial)
11109 schedule for the domains elements for which part of the AST still needs to
11110 be generated in the current build.
11111 In particular, the domain elements are mapped to those iterations of the loops
11112 enclosing the current point of the AST generation inside which
11113 the domain elements are executed.
11114 No direct correspondence between
11115 the input schedule and this schedule should be assumed.
11116 The space obtained from C<isl_ast_build_get_schedule_space> can be used
11117 to create a set for C<isl_ast_build_restrict> to intersect
11118 with the current build.  In particular, the set passed to
11119 C<isl_ast_build_restrict> can have additional parameters.
11120 The ids of the set dimensions in the space returned by
11121 C<isl_ast_build_get_schedule_space> correspond to the
11122 iterators of the already generated loops.
11123 The user should not rely on the ids of the output dimensions
11124 of the relations in the union relation returned by
11125 C<isl_ast_build_get_schedule> having any particular value.
11127 =head1 Applications
11129 Although C<isl> is mainly meant to be used as a library,
11130 it also contains some basic applications that use some
11131 of the functionality of C<isl>.
11132 For applications that take one or more polytopes or polyhedra
11133 as input, this input may be specified in either the L<isl format>
11134 or the L<PolyLib format>.
11136 =head2 C<isl_polyhedron_sample>
11138 C<isl_polyhedron_sample> takes a polyhedron as input and prints
11139 an integer element of the polyhedron, if there is any.
11140 The first column in the output is the denominator and is always
11141 equal to 1.  If the polyhedron contains no integer points,
11142 then a vector of length zero is printed.
11144 =head2 C<isl_pip>
11146 C<isl_pip> takes the same input as the C<example> program
11147 from the C<piplib> distribution, i.e., a set of constraints
11148 on the parameters, a line containing only -1 and finally a set
11149 of constraints on a parametric polyhedron.
11150 The coefficients of the parameters appear in the last columns
11151 (but before the final constant column).
11152 The output is the lexicographic minimum of the parametric polyhedron.
11153 As C<isl> currently does not have its own output format, the output
11154 is just a dump of the internal state.
11156 =head2 C<isl_polyhedron_minimize>
11158 C<isl_polyhedron_minimize> computes the minimum of some linear
11159 or affine objective function over the integer points in a polyhedron.
11160 If an affine objective function
11161 is given, then the constant should appear in the last column.
11163 =head2 C<isl_polytope_scan>
11165 Given a polytope, C<isl_polytope_scan> prints
11166 all integer points in the polytope.
11168 =head2 C<isl_flow>
11170 Given an C<isl_union_access_info> object as input,
11171 C<isl_flow> prints out the corresponding dependences,
11172 as computed by C<isl_union_access_info_compute_flow>.
11174 =head2 C<isl_codegen>
11176 Given either a schedule tree or a sequence consisting of
11177 a schedule map, a context set and an options relation,
11178 C<isl_codegen> prints out an AST that scans the domain elements
11179 of the schedule in the order of their image(s) taking into account
11180 the constraints in the context set.
11182 =head2 C<isl_schedule>
11184 Given an C<isl_schedule_constraints> object as input,
11185 C<isl_schedule> prints out a schedule that satisfies the given
11186 constraints.