doc: make reason for isolate option resulting in anchored trees more explicit
[isl.git] / doc / user.pod
blob63e979eafdc6edede65891189cc060abd7262360
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 =head1 License
258 C<isl> is released under the MIT license.
260 =over
262 Permission is hereby granted, free of charge, to any person obtaining a copy of
263 this software and associated documentation files (the "Software"), to deal in
264 the Software without restriction, including without limitation the rights to
265 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
266 of the Software, and to permit persons to whom the Software is furnished to do
267 so, subject to the following conditions:
269 The above copyright notice and this permission notice shall be included in all
270 copies or substantial portions of the Software.
272 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
273 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
274 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
275 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
276 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
277 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
278 SOFTWARE.
280 =back
282 Note that by default C<isl> requires C<GMP>, which is released
283 under the GNU Lesser General Public License (LGPL).  This means
284 that code linked against C<isl> is also linked against LGPL code.
286 When configuring with C<--with-int=imath> or C<--with-int=imath-32>, C<isl>
287 will link against C<imath>, a library for exact integer arithmetic released
288 under the MIT license.
290 =head1 Installation
292 The source of C<isl> can be obtained either as a tarball
293 or from the git repository.  Both are available from
294 L<http://isl.gforge.inria.fr/>.
295 The installation process depends on how you obtained
296 the source.
298 =head2 Installation from the git repository
300 =over
302 =item 1 Clone or update the repository
304 The first time the source is obtained, you need to clone
305 the repository.
307         git clone git://repo.or.cz/isl.git
309 To obtain updates, you need to pull in the latest changes
311         git pull
313 =item 2 Optionally get C<imath> submodule
315 To build C<isl> with C<imath>, you need to obtain the C<imath>
316 submodule by running in the git source tree of C<isl>
318        git submodule init
319        git submodule update
321 This will fetch the required version of C<imath> in a subdirectory of C<isl>.
323 =item 2 Generate C<configure>
325         ./autogen.sh
327 =back
329 After performing the above steps, continue
330 with the L<Common installation instructions>.
332 =head2 Common installation instructions
334 =over
336 =item 1 Obtain C<GMP>
338 By default, building C<isl> requires C<GMP>, including its headers files.
339 Your distribution may not provide these header files by default
340 and you may need to install a package called C<gmp-devel> or something
341 similar.  Alternatively, C<GMP> can be built from
342 source, available from L<http://gmplib.org/>.
343 C<GMP> is not needed if you build C<isl> with C<imath>.
345 =item 2 Configure
347 C<isl> uses the standard C<autoconf> C<configure> script.
348 To run it, just type
350         ./configure
352 optionally followed by some configure options.
353 A complete list of options can be obtained by running
355         ./configure --help
357 Below we discuss some of the more common options.
359 =over
361 =item C<--prefix>
363 Installation prefix for C<isl>
365 =item C<--with-int=[gmp|imath|imath-32]>
367 Select the integer library to be used by C<isl>, the default is C<gmp>.
368 With C<imath-32>, C<isl> will use 32 bit integers, but fall back to C<imath>
369 for values out of the 32 bit range. In most applications, C<isl> will run
370 fastest with the C<imath-32> option, followed by C<gmp> and C<imath>, the
371 slowest.
373 =item C<--with-gmp-prefix>
375 Installation prefix for C<GMP> (architecture-independent files).
377 =item C<--with-gmp-exec-prefix>
379 Installation prefix for C<GMP> (architecture-dependent files).
381 =back
383 =item 3 Compile
385         make
387 =item 4 Install (optional)
389         make install
391 =back
393 =head1 Integer Set Library
395 =head2 Memory Management
397 Since a high-level operation on isl objects usually involves
398 several substeps and since the user is usually not interested in
399 the intermediate results, most functions that return a new object
400 will also release all the objects passed as arguments.
401 If the user still wants to use one or more of these arguments
402 after the function call, she should pass along a copy of the
403 object rather than the object itself.
404 The user is then responsible for making sure that the original
405 object gets used somewhere else or is explicitly freed.
407 The arguments and return values of all documented functions are
408 annotated to make clear which arguments are released and which
409 arguments are preserved.  In particular, the following annotations
410 are used
412 =over
414 =item C<__isl_give>
416 C<__isl_give> means that a new object is returned.
417 The user should make sure that the returned pointer is
418 used exactly once as a value for an C<__isl_take> argument.
419 In between, it can be used as a value for as many
420 C<__isl_keep> arguments as the user likes.
421 There is one exception, and that is the case where the
422 pointer returned is C<NULL>.  Is this case, the user
423 is free to use it as an C<__isl_take> argument or not.
424 When applied to a C<char *>, the returned pointer needs to be
425 freed using C<free>.
427 =item C<__isl_null>
429 C<__isl_null> means that a C<NULL> value is returned.
431 =item C<__isl_take>
433 C<__isl_take> means that the object the argument points to
434 is taken over by the function and may no longer be used
435 by the user as an argument to any other function.
436 The pointer value must be one returned by a function
437 returning an C<__isl_give> pointer.
438 If the user passes in a C<NULL> value, then this will
439 be treated as an error in the sense that the function will
440 not perform its usual operation.  However, it will still
441 make sure that all the other C<__isl_take> arguments
442 are released.
444 =item C<__isl_keep>
446 C<__isl_keep> means that the function will only use the object
447 temporarily.  After the function has finished, the user
448 can still use it as an argument to other functions.
449 A C<NULL> value will be treated in the same way as
450 a C<NULL> value for an C<__isl_take> argument.
451 This annotation may also be used on return values of
452 type C<const char *>, in which case the returned pointer should
453 not be freed by the user and is only valid until the object
454 from which it was derived is updated or freed.
456 =back
458 =head2 Initialization
460 All manipulations of integer sets and relations occur within
461 the context of an C<isl_ctx>.
462 A given C<isl_ctx> can only be used within a single thread.
463 All arguments of a function are required to have been allocated
464 within the same context.
465 There are currently no functions available for moving an object
466 from one C<isl_ctx> to another C<isl_ctx>.  This means that
467 there is currently no way of safely moving an object from one
468 thread to another, unless the whole C<isl_ctx> is moved.
470 An C<isl_ctx> can be allocated using C<isl_ctx_alloc> and
471 freed using C<isl_ctx_free>.
472 All objects allocated within an C<isl_ctx> should be freed
473 before the C<isl_ctx> itself is freed.
475         isl_ctx *isl_ctx_alloc();
476         void isl_ctx_free(isl_ctx *ctx);
478 The user can impose a bound on the number of low-level I<operations>
479 that can be performed by an C<isl_ctx>.  This bound can be set and
480 retrieved using the following functions.  A bound of zero means that
481 no bound is imposed.  The number of operations performed can be
482 reset using C<isl_ctx_reset_operations>.  Note that the number
483 of low-level operations needed to perform a high-level computation
484 may differ significantly across different versions
485 of C<isl>, but it should be the same across different platforms
486 for the same version of C<isl>.
488 Warning: This feature is experimental.  C<isl> has good support to abort and
489 bail out during the computation, but this feature may exercise error code paths
490 that are normally not used that much. Consequently, it is not unlikely that
491 hidden bugs will be exposed.
493         void isl_ctx_set_max_operations(isl_ctx *ctx,
494                 unsigned long max_operations);
495         unsigned long isl_ctx_get_max_operations(isl_ctx *ctx);
496         void isl_ctx_reset_operations(isl_ctx *ctx);
498 In order to be able to create an object in the same context
499 as another object, most object types (described later in
500 this document) provide a function to obtain the context
501 in which the object was created.
503         #include <isl/val.h>
504         isl_ctx *isl_val_get_ctx(__isl_keep isl_val *val);
505         isl_ctx *isl_multi_val_get_ctx(
506                 __isl_keep isl_multi_val *mv);
508         #include <isl/id.h>
509         isl_ctx *isl_id_get_ctx(__isl_keep isl_id *id);
511         #include <isl/local_space.h>
512         isl_ctx *isl_local_space_get_ctx(
513                 __isl_keep isl_local_space *ls);
515         #include <isl/set.h>
516         isl_ctx *isl_set_list_get_ctx(
517                 __isl_keep isl_set_list *list);
519         #include <isl/aff.h>
520         isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff);
521         isl_ctx *isl_multi_aff_get_ctx(
522                 __isl_keep isl_multi_aff *maff);
523         isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pa);
524         isl_ctx *isl_pw_multi_aff_get_ctx(
525                 __isl_keep isl_pw_multi_aff *pma);
526         isl_ctx *isl_multi_pw_aff_get_ctx(
527                 __isl_keep isl_multi_pw_aff *mpa);
528         isl_ctx *isl_union_pw_aff_get_ctx(
529                 __isl_keep isl_union_pw_aff *upa);
530         isl_ctx *isl_union_pw_multi_aff_get_ctx(
531                 __isl_keep isl_union_pw_multi_aff *upma);
532         isl_ctx *isl_multi_union_pw_aff_get_ctx(
533                 __isl_keep isl_multi_union_pw_aff *mupa);
535         #include <isl/id_to_ast_expr.h>
536         isl_ctx *isl_id_to_ast_expr_get_ctx(
537                 __isl_keep isl_id_to_ast_expr *id2expr);
539         #include <isl/point.h>
540         isl_ctx *isl_point_get_ctx(__isl_keep isl_point *pnt);
542         #include <isl/vec.h>
543         isl_ctx *isl_vec_get_ctx(__isl_keep isl_vec *vec);
545         #include <isl/mat.h>
546         isl_ctx *isl_mat_get_ctx(__isl_keep isl_mat *mat);
548         #include <isl/vertices.h>
549         isl_ctx *isl_vertices_get_ctx(
550                 __isl_keep isl_vertices *vertices);
551         isl_ctx *isl_vertex_get_ctx(__isl_keep isl_vertex *vertex);
552         isl_ctx *isl_cell_get_ctx(__isl_keep isl_cell *cell);
554         #include <isl/flow.h>
555         isl_ctx *isl_restriction_get_ctx(
556                 __isl_keep isl_restriction *restr);
557         isl_ctx *isl_union_access_info_get_ctx(
558                 __isl_keep isl_union_access_info *access);
559         isl_ctx *isl_union_flow_get_ctx(
560                 __isl_keep isl_union_flow *flow);
562         #include <isl/schedule.h>
563         isl_ctx *isl_schedule_get_ctx(
564                 __isl_keep isl_schedule *sched);
565         isl_ctx *isl_schedule_constraints_get_ctx(
566                 __isl_keep isl_schedule_constraints *sc);
568         #include <isl/schedule_node.h>
569         isl_ctx *isl_schedule_node_get_ctx(
570                 __isl_keep isl_schedule_node *node);
572         #include <isl/band.h>
573         isl_ctx *isl_band_get_ctx(__isl_keep isl_band *band);
575         #include <isl/ast_build.h>
576         isl_ctx *isl_ast_build_get_ctx(
577                 __isl_keep isl_ast_build *build);
579         #include <isl/ast.h>
580         isl_ctx *isl_ast_expr_get_ctx(
581                 __isl_keep isl_ast_expr *expr);
582         isl_ctx *isl_ast_node_get_ctx(
583                 __isl_keep isl_ast_node *node);
585 =head2 Return Types
587 C<isl> uses two special return types for functions that either return
588 a boolean or that in principle do not return anything.
589 In particular, the C<isl_bool> type has three possible values:
590 C<isl_bool_true> (a positive integer value), indicating I<true> or I<yes>;
591 C<isl_bool_false> (the integer value zero), indicating I<false> or I<no>; and
592 C<isl_bool_error> (a negative integer value), indicating that something
593 went wrong.  The following function can be used to negate an C<isl_bool>,
594 where the negation of C<isl_bool_error> is C<isl_bool_error> again.
596         #include <isl/val.h>
597         isl_bool isl_bool_not(isl_bool b);
599 The C<isl_stat> type has two possible values:
600 C<isl_stat_ok> (the integer value zero), indicating a successful
601 operation; and
602 C<isl_stat_error> (a negative integer value), indicating that something
603 went wrong.
604 See L</"Error Handling"> for more information on
605 C<isl_bool_error> and C<isl_stat_error>.
607 =head2 Values
609 An C<isl_val> represents an integer value, a rational value
610 or one of three special values, infinity, negative infinity and NaN.
611 Some predefined values can be created using the following functions.
613         #include <isl/val.h>
614         __isl_give isl_val *isl_val_zero(isl_ctx *ctx);
615         __isl_give isl_val *isl_val_one(isl_ctx *ctx);
616         __isl_give isl_val *isl_val_negone(isl_ctx *ctx);
617         __isl_give isl_val *isl_val_nan(isl_ctx *ctx);
618         __isl_give isl_val *isl_val_infty(isl_ctx *ctx);
619         __isl_give isl_val *isl_val_neginfty(isl_ctx *ctx);
621 Specific integer values can be created using the following functions.
623         #include <isl/val.h>
624         __isl_give isl_val *isl_val_int_from_si(isl_ctx *ctx,
625                 long i);
626         __isl_give isl_val *isl_val_int_from_ui(isl_ctx *ctx,
627                 unsigned long u);
628         __isl_give isl_val *isl_val_int_from_chunks(isl_ctx *ctx,
629                 size_t n, size_t size, const void *chunks);
631 The function C<isl_val_int_from_chunks> constructs an C<isl_val>
632 from the C<n> I<digits>, each consisting of C<size> bytes, stored at C<chunks>.
633 The least significant digit is assumed to be stored first.
635 Value objects can be copied and freed using the following functions.
637         #include <isl/val.h>
638         __isl_give isl_val *isl_val_copy(__isl_keep isl_val *v);
639         __isl_null isl_val *isl_val_free(__isl_take isl_val *v);
641 They can be inspected using the following functions.
643         #include <isl/val.h>
644         long isl_val_get_num_si(__isl_keep isl_val *v);
645         long isl_val_get_den_si(__isl_keep isl_val *v);
646         __isl_give isl_val *isl_val_get_den_val(
647                 __isl_keep isl_val *v);
648         double isl_val_get_d(__isl_keep isl_val *v);
649         size_t isl_val_n_abs_num_chunks(__isl_keep isl_val *v,
650                 size_t size);
651         int isl_val_get_abs_num_chunks(__isl_keep isl_val *v,
652                 size_t size, void *chunks);
654 C<isl_val_n_abs_num_chunks> returns the number of I<digits>
655 of C<size> bytes needed to store the absolute value of the
656 numerator of C<v>.
657 C<isl_val_get_abs_num_chunks> stores these digits at C<chunks>,
658 which is assumed to have been preallocated by the caller.
659 The least significant digit is stored first.
660 Note that C<isl_val_get_num_si>, C<isl_val_get_den_si>,
661 C<isl_val_get_d>, C<isl_val_n_abs_num_chunks>
662 and C<isl_val_get_abs_num_chunks> can only be applied to rational values.
664 An C<isl_val> can be modified using the following function.
666         #include <isl/val.h>
667         __isl_give isl_val *isl_val_set_si(__isl_take isl_val *v,
668                 long i);
670 The following unary properties are defined on C<isl_val>s.
672         #include <isl/val.h>
673         int isl_val_sgn(__isl_keep isl_val *v);
674         isl_bool isl_val_is_zero(__isl_keep isl_val *v);
675         isl_bool isl_val_is_one(__isl_keep isl_val *v);
676         isl_bool isl_val_is_negone(__isl_keep isl_val *v);
677         isl_bool isl_val_is_nonneg(__isl_keep isl_val *v);
678         isl_bool isl_val_is_nonpos(__isl_keep isl_val *v);
679         isl_bool isl_val_is_pos(__isl_keep isl_val *v);
680         isl_bool isl_val_is_neg(__isl_keep isl_val *v);
681         isl_bool isl_val_is_int(__isl_keep isl_val *v);
682         isl_bool isl_val_is_rat(__isl_keep isl_val *v);
683         isl_bool isl_val_is_nan(__isl_keep isl_val *v);
684         isl_bool isl_val_is_infty(__isl_keep isl_val *v);
685         isl_bool isl_val_is_neginfty(__isl_keep isl_val *v);
687 Note that the sign of NaN is undefined.
689 The following binary properties are defined on pairs of C<isl_val>s.
691         #include <isl/val.h>
692         isl_bool isl_val_lt(__isl_keep isl_val *v1,
693                 __isl_keep isl_val *v2);
694         isl_bool isl_val_le(__isl_keep isl_val *v1,
695                 __isl_keep isl_val *v2);
696         isl_bool isl_val_gt(__isl_keep isl_val *v1,
697                 __isl_keep isl_val *v2);
698         isl_bool isl_val_ge(__isl_keep isl_val *v1,
699                 __isl_keep isl_val *v2);
700         isl_bool isl_val_eq(__isl_keep isl_val *v1,
701                 __isl_keep isl_val *v2);
702         isl_bool isl_val_ne(__isl_keep isl_val *v1,
703                 __isl_keep isl_val *v2);
704         isl_bool isl_val_abs_eq(__isl_keep isl_val *v1,
705                 __isl_keep isl_val *v2);
707 The function C<isl_val_abs_eq> checks whether its two arguments
708 are equal in absolute value.
710 For integer C<isl_val>s we additionally have the following binary property.
712         #include <isl/val.h>
713         isl_bool isl_val_is_divisible_by(__isl_keep isl_val *v1,
714                 __isl_keep isl_val *v2);
716 An C<isl_val> can also be compared to an integer using the following
717 function.  The result is undefined for NaN.
719         #include <isl/val.h>
720         int isl_val_cmp_si(__isl_keep isl_val *v, long i);
722 The following unary operations are available on C<isl_val>s.
724         #include <isl/val.h>
725         __isl_give isl_val *isl_val_abs(__isl_take isl_val *v);
726         __isl_give isl_val *isl_val_neg(__isl_take isl_val *v);
727         __isl_give isl_val *isl_val_floor(__isl_take isl_val *v);
728         __isl_give isl_val *isl_val_ceil(__isl_take isl_val *v);
729         __isl_give isl_val *isl_val_trunc(__isl_take isl_val *v);
730         __isl_give isl_val *isl_val_inv(__isl_take isl_val *v);
731         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
733 The following binary operations are available on C<isl_val>s.
735         #include <isl/val.h>
736         __isl_give isl_val *isl_val_min(__isl_take isl_val *v1,
737                 __isl_take isl_val *v2);
738         __isl_give isl_val *isl_val_max(__isl_take isl_val *v1,
739                 __isl_take isl_val *v2);
740         __isl_give isl_val *isl_val_add(__isl_take isl_val *v1,
741                 __isl_take isl_val *v2);
742         __isl_give isl_val *isl_val_add_ui(__isl_take isl_val *v1,
743                 unsigned long v2);
744         __isl_give isl_val *isl_val_sub(__isl_take isl_val *v1,
745                 __isl_take isl_val *v2);
746         __isl_give isl_val *isl_val_sub_ui(__isl_take isl_val *v1,
747                 unsigned long v2);
748         __isl_give isl_val *isl_val_mul(__isl_take isl_val *v1,
749                 __isl_take isl_val *v2);
750         __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1,
751                 unsigned long v2);
752         __isl_give isl_val *isl_val_div(__isl_take isl_val *v1,
753                 __isl_take isl_val *v2);
755 On integer values, we additionally have the following operations.
757         #include <isl/val.h>
758         __isl_give isl_val *isl_val_2exp(__isl_take isl_val *v);
759         __isl_give isl_val *isl_val_mod(__isl_take isl_val *v1,
760                 __isl_take isl_val *v2);
761         __isl_give isl_val *isl_val_gcd(__isl_take isl_val *v1,
762                 __isl_take isl_val *v2);
763         __isl_give isl_val *isl_val_gcdext(__isl_take isl_val *v1,
764                 __isl_take isl_val *v2, __isl_give isl_val **x,
765                 __isl_give isl_val **y);
767 The function C<isl_val_gcdext> returns the greatest common divisor g
768 of C<v1> and C<v2> as well as two integers C<*x> and C<*y> such
769 that C<*x> * C<v1> + C<*y> * C<v2> = g.
771 =head3 GMP specific functions
773 These functions are only available if C<isl> has been compiled with C<GMP>
774 support.
776 Specific integer and rational values can be created from C<GMP> values using
777 the following functions.
779         #include <isl/val_gmp.h>
780         __isl_give isl_val *isl_val_int_from_gmp(isl_ctx *ctx,
781                 mpz_t z);
782         __isl_give isl_val *isl_val_from_gmp(isl_ctx *ctx,
783                 const mpz_t n, const mpz_t d);
785 The numerator and denominator of a rational value can be extracted as
786 C<GMP> values using the following functions.
788         #include <isl/val_gmp.h>
789         int isl_val_get_num_gmp(__isl_keep isl_val *v, mpz_t z);
790         int isl_val_get_den_gmp(__isl_keep isl_val *v, mpz_t z);
792 =head2 Sets and Relations
794 C<isl> uses six types of objects for representing sets and relations,
795 C<isl_basic_set>, C<isl_basic_map>, C<isl_set>, C<isl_map>,
796 C<isl_union_set> and C<isl_union_map>.
797 C<isl_basic_set> and C<isl_basic_map> represent sets and relations that
798 can be described as a conjunction of affine constraints, while
799 C<isl_set> and C<isl_map> represent unions of
800 C<isl_basic_set>s and C<isl_basic_map>s, respectively.
801 However, all C<isl_basic_set>s or C<isl_basic_map>s in the union need
802 to live in the same space.  C<isl_union_set>s and C<isl_union_map>s
803 represent unions of C<isl_set>s or C<isl_map>s in I<different> spaces,
804 where spaces are considered different if they have a different number
805 of dimensions and/or different names (see L<"Spaces">).
806 The difference between sets and relations (maps) is that sets have
807 one set of variables, while relations have two sets of variables,
808 input variables and output variables.
810 =head2 Error Handling
812 C<isl> supports different ways to react in case a runtime error is triggered.
813 Runtime errors arise, e.g., if a function such as C<isl_map_intersect> is called
814 with two maps that have incompatible spaces. There are three possible ways
815 to react on error: to warn, to continue or to abort.
817 The default behavior is to warn. In this mode, C<isl> prints a warning, stores
818 the last error in the corresponding C<isl_ctx> and the function in which the
819 error was triggered returns a value indicating that some error has
820 occurred.  In case of functions returning a pointer, this value is
821 C<NULL>.  In case of functions returning an C<isl_bool> or an
822 C<isl_stat>, this valus is C<isl_bool_error> or C<isl_stat_error>.
823 An error does not corrupt internal state,
824 such that isl can continue to be used. C<isl> also provides functions to
825 read the last error and to reset the memory that stores the last error. The
826 last error is only stored for information purposes. Its presence does not
827 change the behavior of C<isl>. Hence, resetting an error is not required to
828 continue to use isl, but only to observe new errors.
830         #include <isl/ctx.h>
831         enum isl_error isl_ctx_last_error(isl_ctx *ctx);
832         void isl_ctx_reset_error(isl_ctx *ctx);
834 Another option is to continue on error. This is similar to warn on error mode,
835 except that C<isl> does not print any warning. This allows a program to
836 implement its own error reporting.
838 The last option is to directly abort the execution of the program from within
839 the isl library. This makes it obviously impossible to recover from an error,
840 but it allows to directly spot the error location. By aborting on error,
841 debuggers break at the location the error occurred and can provide a stack
842 trace. Other tools that automatically provide stack traces on abort or that do
843 not want to continue execution after an error was triggered may also prefer to
844 abort on error.
846 The on error behavior of isl can be specified by calling
847 C<isl_options_set_on_error> or by setting the command line option
848 C<--isl-on-error>. Valid arguments for the function call are
849 C<ISL_ON_ERROR_WARN>, C<ISL_ON_ERROR_CONTINUE> and C<ISL_ON_ERROR_ABORT>. The
850 choices for the command line option are C<warn>, C<continue> and C<abort>.
851 It is also possible to query the current error mode.
853         #include <isl/options.h>
854         isl_stat isl_options_set_on_error(isl_ctx *ctx, int val);
855         int isl_options_get_on_error(isl_ctx *ctx);
857 =head2 Identifiers
859 Identifiers are used to identify both individual dimensions
860 and tuples of dimensions.  They consist of an optional name and an optional
861 user pointer.  The name and the user pointer cannot both be C<NULL>, however.
862 Identifiers with the same name but different pointer values
863 are considered to be distinct.
864 Similarly, identifiers with different names but the same pointer value
865 are also considered to be distinct.
866 Equal identifiers are represented using the same object.
867 Pairs of identifiers can therefore be tested for equality using the
868 C<==> operator.
869 Identifiers can be constructed, copied, freed, inspected and printed
870 using the following functions.
872         #include <isl/id.h>
873         __isl_give isl_id *isl_id_alloc(isl_ctx *ctx,
874                 __isl_keep const char *name, void *user);
875         __isl_give isl_id *isl_id_set_free_user(
876                 __isl_take isl_id *id,
877                 void (*free_user)(void *user));
878         __isl_give isl_id *isl_id_copy(isl_id *id);
879         __isl_null isl_id *isl_id_free(__isl_take isl_id *id);
881         void *isl_id_get_user(__isl_keep isl_id *id);
882         __isl_keep const char *isl_id_get_name(__isl_keep isl_id *id);
884         __isl_give isl_printer *isl_printer_print_id(
885                 __isl_take isl_printer *p, __isl_keep isl_id *id);
887 The callback set by C<isl_id_set_free_user> is called on the user
888 pointer when the last reference to the C<isl_id> is freed.
889 Note that C<isl_id_get_name> returns a pointer to some internal
890 data structure, so the result can only be used while the
891 corresponding C<isl_id> is alive.
893 =head2 Spaces
895 Whenever a new set, relation or similar object is created from scratch,
896 the space in which it lives needs to be specified using an C<isl_space>.
897 Each space involves zero or more parameters and zero, one or two
898 tuples of set or input/output dimensions.  The parameters and dimensions
899 are identified by an C<isl_dim_type> and a position.
900 The type C<isl_dim_param> refers to parameters,
901 the type C<isl_dim_set> refers to set dimensions (for spaces
902 with a single tuple of dimensions) and the types C<isl_dim_in>
903 and C<isl_dim_out> refer to input and output dimensions
904 (for spaces with two tuples of dimensions).
905 Local spaces (see L</"Local Spaces">) also contain dimensions
906 of type C<isl_dim_div>.
907 Note that parameters are only identified by their position within
908 a given object.  Across different objects, parameters are (usually)
909 identified by their names or identifiers.  Only unnamed parameters
910 are identified by their positions across objects.  The use of unnamed
911 parameters is discouraged.
913         #include <isl/space.h>
914         __isl_give isl_space *isl_space_alloc(isl_ctx *ctx,
915                 unsigned nparam, unsigned n_in, unsigned n_out);
916         __isl_give isl_space *isl_space_params_alloc(isl_ctx *ctx,
917                 unsigned nparam);
918         __isl_give isl_space *isl_space_set_alloc(isl_ctx *ctx,
919                 unsigned nparam, unsigned dim);
920         __isl_give isl_space *isl_space_copy(__isl_keep isl_space *space);
921         __isl_null isl_space *isl_space_free(__isl_take isl_space *space);
923 The space used for creating a parameter domain
924 needs to be created using C<isl_space_params_alloc>.
925 For other sets, the space
926 needs to be created using C<isl_space_set_alloc>, while
927 for a relation, the space
928 needs to be created using C<isl_space_alloc>.
930 To check whether a given space is that of a set or a map
931 or whether it is a parameter space, use these functions:
933         #include <isl/space.h>
934         isl_bool isl_space_is_params(__isl_keep isl_space *space);
935         isl_bool isl_space_is_set(__isl_keep isl_space *space);
936         isl_bool isl_space_is_map(__isl_keep isl_space *space);
938 Spaces can be compared using the following functions:
940         #include <isl/space.h>
941         isl_bool isl_space_is_equal(__isl_keep isl_space *space1,
942                 __isl_keep isl_space *space2);
943         isl_bool isl_space_is_domain(__isl_keep isl_space *space1,
944                 __isl_keep isl_space *space2);
945         isl_bool isl_space_is_range(__isl_keep isl_space *space1,
946                 __isl_keep isl_space *space2);
947         isl_bool isl_space_tuple_is_equal(
948                 __isl_keep isl_space *space1,
949                 enum isl_dim_type type1,
950                 __isl_keep isl_space *space2,
951                 enum isl_dim_type type2);
953 C<isl_space_is_domain> checks whether the first argument is equal
954 to the domain of the second argument.  This requires in particular that
955 the first argument is a set space and that the second argument
956 is a map space.  C<isl_space_tuple_is_equal> checks whether the given
957 tuples (C<isl_dim_in>, C<isl_dim_out> or C<isl_dim_set>) of the given
958 spaces are the same.  That is, it checks if they have the same
959 identifier (if any), the same dimension and the same internal structure
960 (if any).
962 It is often useful to create objects that live in the
963 same space as some other object.  This can be accomplished
964 by creating the new objects
965 (see L</"Creating New Sets and Relations"> or
966 L</"Functions">) based on the space
967 of the original object.
969         #include <isl/set.h>
970         __isl_give isl_space *isl_basic_set_get_space(
971                 __isl_keep isl_basic_set *bset);
972         __isl_give isl_space *isl_set_get_space(__isl_keep isl_set *set);
974         #include <isl/union_set.h>
975         __isl_give isl_space *isl_union_set_get_space(
976                 __isl_keep isl_union_set *uset);
978         #include <isl/map.h>
979         __isl_give isl_space *isl_basic_map_get_space(
980                 __isl_keep isl_basic_map *bmap);
981         __isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
983         #include <isl/union_map.h>
984         __isl_give isl_space *isl_union_map_get_space(
985                 __isl_keep isl_union_map *umap);
987         #include <isl/constraint.h>
988         __isl_give isl_space *isl_constraint_get_space(
989                 __isl_keep isl_constraint *constraint);
991         #include <isl/polynomial.h>
992         __isl_give isl_space *isl_qpolynomial_get_domain_space(
993                 __isl_keep isl_qpolynomial *qp);
994         __isl_give isl_space *isl_qpolynomial_get_space(
995                 __isl_keep isl_qpolynomial *qp);
996         __isl_give isl_space *
997         isl_qpolynomial_fold_get_domain_space(
998                 __isl_keep isl_qpolynomial_fold *fold);
999         __isl_give isl_space *isl_qpolynomial_fold_get_space(
1000                 __isl_keep isl_qpolynomial_fold *fold);
1001         __isl_give isl_space *isl_pw_qpolynomial_get_domain_space(
1002                 __isl_keep isl_pw_qpolynomial *pwqp);
1003         __isl_give isl_space *isl_pw_qpolynomial_get_space(
1004                 __isl_keep isl_pw_qpolynomial *pwqp);
1005         __isl_give isl_space *isl_pw_qpolynomial_fold_get_domain_space(
1006                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1007         __isl_give isl_space *isl_pw_qpolynomial_fold_get_space(
1008                 __isl_keep isl_pw_qpolynomial_fold *pwf);
1009         __isl_give isl_space *isl_union_pw_qpolynomial_get_space(
1010                 __isl_keep isl_union_pw_qpolynomial *upwqp);
1011         __isl_give isl_space *isl_union_pw_qpolynomial_fold_get_space(
1012                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
1014         #include <isl/val.h>
1015         __isl_give isl_space *isl_multi_val_get_space(
1016                 __isl_keep isl_multi_val *mv);
1018         #include <isl/aff.h>
1019         __isl_give isl_space *isl_aff_get_domain_space(
1020                 __isl_keep isl_aff *aff);
1021         __isl_give isl_space *isl_aff_get_space(
1022                 __isl_keep isl_aff *aff);
1023         __isl_give isl_space *isl_pw_aff_get_domain_space(
1024                 __isl_keep isl_pw_aff *pwaff);
1025         __isl_give isl_space *isl_pw_aff_get_space(
1026                 __isl_keep isl_pw_aff *pwaff);
1027         __isl_give isl_space *isl_multi_aff_get_domain_space(
1028                 __isl_keep isl_multi_aff *maff);
1029         __isl_give isl_space *isl_multi_aff_get_space(
1030                 __isl_keep isl_multi_aff *maff);
1031         __isl_give isl_space *isl_pw_multi_aff_get_domain_space(
1032                 __isl_keep isl_pw_multi_aff *pma);
1033         __isl_give isl_space *isl_pw_multi_aff_get_space(
1034                 __isl_keep isl_pw_multi_aff *pma);
1035         __isl_give isl_space *isl_union_pw_aff_get_space(
1036                 __isl_keep isl_union_pw_aff *upa);
1037         __isl_give isl_space *isl_union_pw_multi_aff_get_space(
1038                 __isl_keep isl_union_pw_multi_aff *upma);
1039         __isl_give isl_space *isl_multi_pw_aff_get_domain_space(
1040                 __isl_keep isl_multi_pw_aff *mpa);
1041         __isl_give isl_space *isl_multi_pw_aff_get_space(
1042                 __isl_keep isl_multi_pw_aff *mpa);
1043         __isl_give isl_space *
1044         isl_multi_union_pw_aff_get_domain_space(
1045                 __isl_keep isl_multi_union_pw_aff *mupa);
1046         __isl_give isl_space *
1047         isl_multi_union_pw_aff_get_space(
1048                 __isl_keep isl_multi_union_pw_aff *mupa);
1050         #include <isl/point.h>
1051         __isl_give isl_space *isl_point_get_space(
1052                 __isl_keep isl_point *pnt);
1054 The number of dimensions of a given type of space
1055 may be read off from a space or an object that lives
1056 in a space using the following functions.
1057 In case of C<isl_space_dim>, type may be
1058 C<isl_dim_param>, C<isl_dim_in> (only for relations),
1059 C<isl_dim_out> (only for relations), C<isl_dim_set>
1060 (only for sets) or C<isl_dim_all>.
1062         #include <isl/space.h>
1063         unsigned isl_space_dim(__isl_keep isl_space *space,
1064                 enum isl_dim_type type);
1066         #include <isl/local_space.h>
1067         int isl_local_space_dim(__isl_keep isl_local_space *ls,
1068                 enum isl_dim_type type);
1070         #include <isl/set.h>
1071         unsigned isl_basic_set_dim(__isl_keep isl_basic_set *bset,
1072                 enum isl_dim_type type);
1073         unsigned isl_set_dim(__isl_keep isl_set *set,
1074                 enum isl_dim_type type);
1076         #include <isl/union_set.h>
1077         unsigned isl_union_set_dim(__isl_keep isl_union_set *uset,
1078                 enum isl_dim_type type);
1080         #include <isl/map.h>
1081         unsigned isl_basic_map_dim(__isl_keep isl_basic_map *bmap,
1082                 enum isl_dim_type type);
1083         unsigned isl_map_dim(__isl_keep isl_map *map,
1084                 enum isl_dim_type type);
1086         #include <isl/union_map.h>
1087         unsigned isl_union_map_dim(__isl_keep isl_union_map *umap,
1088                 enum isl_dim_type type);
1090         #include <isl/val.h>
1091         unsigned isl_multi_val_dim(__isl_keep isl_multi_val *mv,
1092                 enum isl_dim_type type);
1094         #include <isl/aff.h>
1095         int isl_aff_dim(__isl_keep isl_aff *aff,
1096                 enum isl_dim_type type);
1097         unsigned isl_multi_aff_dim(__isl_keep isl_multi_aff *maff,
1098                 enum isl_dim_type type);
1099         unsigned isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff,
1100                 enum isl_dim_type type);
1101         unsigned isl_pw_multi_aff_dim(
1102                 __isl_keep isl_pw_multi_aff *pma,
1103                 enum isl_dim_type type);
1104         unsigned isl_multi_pw_aff_dim(
1105                 __isl_keep isl_multi_pw_aff *mpa,
1106                 enum isl_dim_type type);
1107         unsigned isl_union_pw_aff_dim(
1108                 __isl_keep isl_union_pw_aff *upa,
1109                 enum isl_dim_type type);
1110         unsigned isl_union_pw_multi_aff_dim(
1111                 __isl_keep isl_union_pw_multi_aff *upma,
1112                 enum isl_dim_type type);
1113         unsigned isl_multi_union_pw_aff_dim(
1114                 __isl_keep isl_multi_union_pw_aff *mupa,
1115                 enum isl_dim_type type);
1117         #include <isl/polynomial.h>
1118         unsigned isl_union_pw_qpolynomial_dim(
1119                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1120                 enum isl_dim_type type);
1121         unsigned isl_union_pw_qpolynomial_fold_dim(
1122                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1123                 enum isl_dim_type type);
1125 Note that an C<isl_union_set>, an C<isl_union_map>,
1126 an C<isl_union_pw_multi_aff>,
1127 an C<isl_union_pw_qpolynomial> and
1128 an C<isl_union_pw_qpolynomial_fold>
1129 only have parameters.
1131 The identifiers or names of the individual dimensions of spaces
1132 may be set or read off using the following functions on spaces
1133 or objects that live in spaces.
1134 These functions are mostly useful to obtain the identifiers, positions
1135 or names of the parameters.  Identifiers of individual dimensions are
1136 essentially only useful for printing.  They are ignored by all other
1137 operations and may not be preserved across those operations.
1139         #include <isl/space.h>
1140         __isl_give isl_space *isl_space_set_dim_id(
1141                 __isl_take isl_space *space,
1142                 enum isl_dim_type type, unsigned pos,
1143                 __isl_take isl_id *id);
1144         isl_bool isl_space_has_dim_id(__isl_keep isl_space *space,
1145                 enum isl_dim_type type, unsigned pos);
1146         __isl_give isl_id *isl_space_get_dim_id(
1147                 __isl_keep isl_space *space,
1148                 enum isl_dim_type type, unsigned pos);
1149         __isl_give isl_space *isl_space_set_dim_name(
1150                 __isl_take isl_space *space,
1151                  enum isl_dim_type type, unsigned pos,
1152                  __isl_keep const char *name);
1153         isl_bool isl_space_has_dim_name(__isl_keep isl_space *space,
1154                 enum isl_dim_type type, unsigned pos);
1155         __isl_keep const char *isl_space_get_dim_name(
1156                 __isl_keep isl_space *space,
1157                 enum isl_dim_type type, unsigned pos);
1159         #include <isl/local_space.h>
1160         __isl_give isl_local_space *isl_local_space_set_dim_id(
1161                 __isl_take isl_local_space *ls,
1162                 enum isl_dim_type type, unsigned pos,
1163                 __isl_take isl_id *id);
1164         isl_bool isl_local_space_has_dim_id(
1165                 __isl_keep isl_local_space *ls,
1166                 enum isl_dim_type type, unsigned pos);
1167         __isl_give isl_id *isl_local_space_get_dim_id(
1168                 __isl_keep isl_local_space *ls,
1169                 enum isl_dim_type type, unsigned pos);
1170         __isl_give isl_local_space *isl_local_space_set_dim_name(
1171                 __isl_take isl_local_space *ls,
1172                 enum isl_dim_type type, unsigned pos, const char *s);
1173         isl_bool isl_local_space_has_dim_name(
1174                 __isl_keep isl_local_space *ls,
1175                 enum isl_dim_type type, unsigned pos)
1176         const char *isl_local_space_get_dim_name(
1177                 __isl_keep isl_local_space *ls,
1178                 enum isl_dim_type type, unsigned pos);
1180         #include <isl/constraint.h>
1181         const char *isl_constraint_get_dim_name(
1182                 __isl_keep isl_constraint *constraint,
1183                 enum isl_dim_type type, unsigned pos);
1185         #include <isl/set.h>
1186         __isl_give isl_id *isl_basic_set_get_dim_id(
1187                 __isl_keep isl_basic_set *bset,
1188                 enum isl_dim_type type, unsigned pos);
1189         __isl_give isl_set *isl_set_set_dim_id(
1190                 __isl_take isl_set *set, enum isl_dim_type type,
1191                 unsigned pos, __isl_take isl_id *id);
1192         isl_bool isl_set_has_dim_id(__isl_keep isl_set *set,
1193                 enum isl_dim_type type, unsigned pos);
1194         __isl_give isl_id *isl_set_get_dim_id(
1195                 __isl_keep isl_set *set, enum isl_dim_type type,
1196                 unsigned pos);
1197         const char *isl_basic_set_get_dim_name(
1198                 __isl_keep isl_basic_set *bset,
1199                 enum isl_dim_type type, unsigned pos);
1200         isl_bool isl_set_has_dim_name(__isl_keep isl_set *set,
1201                 enum isl_dim_type type, unsigned pos);
1202         const char *isl_set_get_dim_name(
1203                 __isl_keep isl_set *set,
1204                 enum isl_dim_type type, unsigned pos);
1206         #include <isl/map.h>
1207         __isl_give isl_map *isl_map_set_dim_id(
1208                 __isl_take isl_map *map, enum isl_dim_type type,
1209                 unsigned pos, __isl_take isl_id *id);
1210         isl_bool isl_basic_map_has_dim_id(
1211                 __isl_keep isl_basic_map *bmap,
1212                 enum isl_dim_type type, unsigned pos);
1213         isl_bool isl_map_has_dim_id(__isl_keep isl_map *map,
1214                 enum isl_dim_type type, unsigned pos);
1215         __isl_give isl_id *isl_map_get_dim_id(
1216                 __isl_keep isl_map *map, enum isl_dim_type type,
1217                 unsigned pos);
1218         __isl_give isl_id *isl_union_map_get_dim_id(
1219                 __isl_keep isl_union_map *umap,
1220                 enum isl_dim_type type, unsigned pos);
1221         const char *isl_basic_map_get_dim_name(
1222                 __isl_keep isl_basic_map *bmap,
1223                 enum isl_dim_type type, unsigned pos);
1224         isl_bool isl_map_has_dim_name(__isl_keep isl_map *map,
1225                 enum isl_dim_type type, unsigned pos);
1226         const char *isl_map_get_dim_name(
1227                 __isl_keep isl_map *map,
1228                 enum isl_dim_type type, unsigned pos);
1230         #include <isl/val.h>
1231         __isl_give isl_multi_val *isl_multi_val_set_dim_id(
1232                 __isl_take isl_multi_val *mv,
1233                 enum isl_dim_type type, unsigned pos,
1234                 __isl_take isl_id *id);
1235         __isl_give isl_id *isl_multi_val_get_dim_id(
1236                 __isl_keep isl_multi_val *mv,
1237                 enum isl_dim_type type, unsigned pos);
1238         __isl_give isl_multi_val *isl_multi_val_set_dim_name(
1239                 __isl_take isl_multi_val *mv,
1240                 enum isl_dim_type type, unsigned pos, const char *s);
1242         #include <isl/aff.h>
1243         __isl_give isl_aff *isl_aff_set_dim_id(
1244                 __isl_take isl_aff *aff, enum isl_dim_type type,
1245                 unsigned pos, __isl_take isl_id *id);
1246         __isl_give isl_multi_aff *isl_multi_aff_set_dim_id(
1247                 __isl_take isl_multi_aff *maff,
1248                 enum isl_dim_type type, unsigned pos,
1249                 __isl_take isl_id *id);
1250         __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(
1251                 __isl_take isl_pw_aff *pma,
1252                 enum isl_dim_type type, unsigned pos,
1253                 __isl_take isl_id *id);
1254         __isl_give isl_multi_pw_aff *
1255         isl_multi_pw_aff_set_dim_id(
1256                 __isl_take isl_multi_pw_aff *mpa,
1257                 enum isl_dim_type type, unsigned pos,
1258                 __isl_take isl_id *id);
1259         __isl_give isl_multi_union_pw_aff *
1260         isl_multi_union_pw_aff_set_dim_id(
1261                 __isl_take isl_multi_union_pw_aff *mupa,
1262                 enum isl_dim_type type, unsigned pos,
1263                 __isl_take isl_id *id);
1264         __isl_give isl_id *isl_multi_aff_get_dim_id(
1265                 __isl_keep isl_multi_aff *ma,
1266                 enum isl_dim_type type, unsigned pos);
1267         isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa,
1268                 enum isl_dim_type type, unsigned pos);
1269         __isl_give isl_id *isl_pw_aff_get_dim_id(
1270                 __isl_keep isl_pw_aff *pa,
1271                 enum isl_dim_type type, unsigned pos);
1272         __isl_give isl_id *isl_pw_multi_aff_get_dim_id(
1273                 __isl_keep isl_pw_multi_aff *pma,
1274                 enum isl_dim_type type, unsigned pos);
1275         __isl_give isl_id *isl_multi_pw_aff_get_dim_id(
1276                 __isl_keep isl_multi_pw_aff *mpa,
1277                 enum isl_dim_type type, unsigned pos);
1278         __isl_give isl_id *isl_multi_union_pw_aff_get_dim_id(
1279                 __isl_keep isl_multi_union_pw_aff *mupa,
1280                 enum isl_dim_type type, unsigned pos);
1281         __isl_give isl_aff *isl_aff_set_dim_name(
1282                 __isl_take isl_aff *aff, enum isl_dim_type type,
1283                 unsigned pos, const char *s);
1284         __isl_give isl_multi_aff *isl_multi_aff_set_dim_name(
1285                 __isl_take isl_multi_aff *maff,
1286                 enum isl_dim_type type, unsigned pos, const char *s);
1287         __isl_give isl_multi_pw_aff *
1288         isl_multi_pw_aff_set_dim_name(
1289                 __isl_take isl_multi_pw_aff *mpa,
1290                 enum isl_dim_type type, unsigned pos, const char *s);
1291         __isl_give isl_union_pw_aff *
1292         isl_union_pw_aff_set_dim_name(
1293                 __isl_take isl_union_pw_aff *upa,
1294                 enum isl_dim_type type, unsigned pos,
1295                 const char *s);
1296         __isl_give isl_union_pw_multi_aff *
1297         isl_union_pw_multi_aff_set_dim_name(
1298                 __isl_take isl_union_pw_multi_aff *upma,
1299                 enum isl_dim_type type, unsigned pos,
1300                 const char *s);
1301         __isl_give isl_multi_union_pw_aff *
1302         isl_multi_union_pw_aff_set_dim_name(
1303                 __isl_take isl_multi_union_pw_aff *mupa,
1304                 enum isl_dim_type type, unsigned pos,
1305         const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff,
1306                 enum isl_dim_type type, unsigned pos);
1307         const char *isl_pw_aff_get_dim_name(
1308                 __isl_keep isl_pw_aff *pa,
1309                 enum isl_dim_type type, unsigned pos);
1310         const char *isl_pw_multi_aff_get_dim_name(
1311                 __isl_keep isl_pw_multi_aff *pma,
1312                 enum isl_dim_type type, unsigned pos);
1314         #include <isl/polynomial.h>
1315         __isl_give isl_qpolynomial *isl_qpolynomial_set_dim_name(
1316                 __isl_take isl_qpolynomial *qp,
1317                 enum isl_dim_type type, unsigned pos,
1318                 const char *s);
1319         __isl_give isl_pw_qpolynomial *
1320         isl_pw_qpolynomial_set_dim_name(
1321                 __isl_take isl_pw_qpolynomial *pwqp,
1322                 enum isl_dim_type type, unsigned pos,
1323                 const char *s);
1324         __isl_give isl_pw_qpolynomial_fold *
1325         isl_pw_qpolynomial_fold_set_dim_name(
1326                 __isl_take isl_pw_qpolynomial_fold *pwf,
1327                 enum isl_dim_type type, unsigned pos,
1328                 const char *s);
1329         __isl_give isl_union_pw_qpolynomial *
1330         isl_union_pw_qpolynomial_set_dim_name(
1331                 __isl_take isl_union_pw_qpolynomial *upwqp,
1332                 enum isl_dim_type type, unsigned pos,
1333                 const char *s);
1334         __isl_give isl_union_pw_qpolynomial_fold *
1335         isl_union_pw_qpolynomial_fold_set_dim_name(
1336                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
1337                 enum isl_dim_type type, unsigned pos,
1338                 const char *s);
1340 Note that C<isl_space_get_name> returns a pointer to some internal
1341 data structure, so the result can only be used while the
1342 corresponding C<isl_space> is alive.
1343 Also note that every function that operates on two sets or relations
1344 requires that both arguments have the same parameters.  This also
1345 means that if one of the arguments has named parameters, then the
1346 other needs to have named parameters too and the names need to match.
1347 Pairs of C<isl_set>, C<isl_map>, C<isl_union_set> and/or C<isl_union_map>
1348 arguments may have different parameters (as long as they are named),
1349 in which case the result will have as parameters the union of the parameters of
1350 the arguments.
1352 Given the identifier or name of a dimension (typically a parameter),
1353 its position can be obtained from the following functions.
1355         #include <isl/space.h>
1356         int isl_space_find_dim_by_id(__isl_keep isl_space *space,
1357                 enum isl_dim_type type, __isl_keep isl_id *id);
1358         int isl_space_find_dim_by_name(__isl_keep isl_space *space,
1359                 enum isl_dim_type type, const char *name);
1361         #include <isl/local_space.h>
1362         int isl_local_space_find_dim_by_name(
1363                 __isl_keep isl_local_space *ls,
1364                 enum isl_dim_type type, const char *name);
1366         #include <isl/val.h>
1367         int isl_multi_val_find_dim_by_id(
1368                 __isl_keep isl_multi_val *mv,
1369                 enum isl_dim_type type, __isl_keep isl_id *id);
1370         int isl_multi_val_find_dim_by_name(
1371                 __isl_keep isl_multi_val *mv,
1372                 enum isl_dim_type type, const char *name);
1374         #include <isl/set.h>
1375         int isl_set_find_dim_by_id(__isl_keep isl_set *set,
1376                 enum isl_dim_type type, __isl_keep isl_id *id);
1377         int isl_set_find_dim_by_name(__isl_keep isl_set *set,
1378                 enum isl_dim_type type, const char *name);
1380         #include <isl/map.h>
1381         int isl_map_find_dim_by_id(__isl_keep isl_map *map,
1382                 enum isl_dim_type type, __isl_keep isl_id *id);
1383         int isl_basic_map_find_dim_by_name(
1384                 __isl_keep isl_basic_map *bmap,
1385                 enum isl_dim_type type, const char *name);
1386         int isl_map_find_dim_by_name(__isl_keep isl_map *map,
1387                 enum isl_dim_type type, const char *name);
1388         int isl_union_map_find_dim_by_name(
1389                 __isl_keep isl_union_map *umap,
1390                 enum isl_dim_type type, const char *name);
1392         #include <isl/aff.h>
1393         int isl_multi_aff_find_dim_by_id(
1394                 __isl_keep isl_multi_aff *ma,
1395                 enum isl_dim_type type, __isl_keep isl_id *id);
1396         int isl_multi_pw_aff_find_dim_by_id(
1397                 __isl_keep isl_multi_pw_aff *mpa,
1398                 enum isl_dim_type type, __isl_keep isl_id *id);
1399         int isl_multi_union_pw_aff_find_dim_by_id(
1400                 __isl_keep isl_union_multi_pw_aff *mupa,
1401                 enum isl_dim_type type, __isl_keep isl_id *id);
1402         int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff,
1403                 enum isl_dim_type type, const char *name);
1404         int isl_multi_aff_find_dim_by_name(
1405                 __isl_keep isl_multi_aff *ma,
1406                 enum isl_dim_type type, const char *name);
1407         int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa,
1408                 enum isl_dim_type type, const char *name);
1409         int isl_multi_pw_aff_find_dim_by_name(
1410                 __isl_keep isl_multi_pw_aff *mpa,
1411                 enum isl_dim_type type, const char *name);
1412         int isl_pw_multi_aff_find_dim_by_name(
1413                 __isl_keep isl_pw_multi_aff *pma,
1414                 enum isl_dim_type type, const char *name);
1415         int isl_union_pw_aff_find_dim_by_name(
1416                 __isl_keep isl_union_pw_aff *upa,
1417                 enum isl_dim_type type, const char *name);
1418         int isl_union_pw_multi_aff_find_dim_by_name(
1419                 __isl_keep isl_union_pw_multi_aff *upma,
1420                 enum isl_dim_type type, const char *name);
1421         int isl_multi_union_pw_aff_find_dim_by_name(
1422                 __isl_keep isl_multi_union_pw_aff *mupa,
1423                 enum isl_dim_type type, const char *name);
1425         #include <isl/polynomial.h>
1426         int isl_pw_qpolynomial_find_dim_by_name(
1427                 __isl_keep isl_pw_qpolynomial *pwqp,
1428                 enum isl_dim_type type, const char *name);
1429         int isl_pw_qpolynomial_fold_find_dim_by_name(
1430                 __isl_keep isl_pw_qpolynomial_fold *pwf,
1431                 enum isl_dim_type type, const char *name);
1432         int isl_union_pw_qpolynomial_find_dim_by_name(
1433                 __isl_keep isl_union_pw_qpolynomial *upwqp,
1434                 enum isl_dim_type type, const char *name);
1435         int isl_union_pw_qpolynomial_fold_find_dim_by_name(
1436                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
1437                 enum isl_dim_type type, const char *name);
1439 The identifiers or names of entire spaces may be set or read off
1440 using the following functions.
1442         #include <isl/space.h>
1443         __isl_give isl_space *isl_space_set_tuple_id(
1444                 __isl_take isl_space *space,
1445                 enum isl_dim_type type, __isl_take isl_id *id);
1446         __isl_give isl_space *isl_space_reset_tuple_id(
1447                 __isl_take isl_space *space, enum isl_dim_type type);
1448         isl_bool isl_space_has_tuple_id(
1449                 __isl_keep isl_space *space,
1450                 enum isl_dim_type type);
1451         __isl_give isl_id *isl_space_get_tuple_id(
1452                 __isl_keep isl_space *space, enum isl_dim_type type);
1453         __isl_give isl_space *isl_space_set_tuple_name(
1454                 __isl_take isl_space *space,
1455                 enum isl_dim_type type, const char *s);
1456         isl_bool isl_space_has_tuple_name(
1457                 __isl_keep isl_space *space,
1458                 enum isl_dim_type type);
1459         const char *isl_space_get_tuple_name(__isl_keep isl_space *space,
1460                 enum isl_dim_type type);
1462         #include <isl/local_space.h>
1463         __isl_give isl_local_space *isl_local_space_set_tuple_id(
1464                 __isl_take isl_local_space *ls,
1465                 enum isl_dim_type type, __isl_take isl_id *id);
1467         #include <isl/set.h>
1468         __isl_give isl_basic_set *isl_basic_set_set_tuple_id(
1469                 __isl_take isl_basic_set *bset,
1470                 __isl_take isl_id *id);
1471         __isl_give isl_set *isl_set_set_tuple_id(
1472                 __isl_take isl_set *set, __isl_take isl_id *id);
1473         __isl_give isl_set *isl_set_reset_tuple_id(
1474                 __isl_take isl_set *set);
1475         isl_bool isl_set_has_tuple_id(__isl_keep isl_set *set);
1476         __isl_give isl_id *isl_set_get_tuple_id(
1477                 __isl_keep isl_set *set);
1478         __isl_give isl_basic_set *isl_basic_set_set_tuple_name(
1479                 __isl_take isl_basic_set *set, const char *s);
1480         __isl_give isl_set *isl_set_set_tuple_name(
1481                 __isl_take isl_set *set, const char *s);
1482         const char *isl_basic_set_get_tuple_name(
1483                 __isl_keep isl_basic_set *bset);
1484         isl_bool isl_set_has_tuple_name(__isl_keep isl_set *set);
1485         const char *isl_set_get_tuple_name(
1486                 __isl_keep isl_set *set);
1488         #include <isl/map.h>
1489         __isl_give isl_basic_map *isl_basic_map_set_tuple_id(
1490                 __isl_take isl_basic_map *bmap,
1491                 enum isl_dim_type type, __isl_take isl_id *id);
1492         __isl_give isl_map *isl_map_set_tuple_id(
1493                 __isl_take isl_map *map, enum isl_dim_type type,
1494                 __isl_take isl_id *id);
1495         __isl_give isl_map *isl_map_reset_tuple_id(
1496                 __isl_take isl_map *map, enum isl_dim_type type);
1497         isl_bool isl_map_has_tuple_id(__isl_keep isl_map *map,
1498                 enum isl_dim_type type);
1499         __isl_give isl_id *isl_map_get_tuple_id(
1500                 __isl_keep isl_map *map, enum isl_dim_type type);
1501         __isl_give isl_map *isl_map_set_tuple_name(
1502                 __isl_take isl_map *map,
1503                 enum isl_dim_type type, const char *s);
1504         const char *isl_basic_map_get_tuple_name(
1505                 __isl_keep isl_basic_map *bmap,
1506                 enum isl_dim_type type);
1507         __isl_give isl_basic_map *isl_basic_map_set_tuple_name(
1508                 __isl_take isl_basic_map *bmap,
1509                 enum isl_dim_type type, const char *s);
1510         isl_bool isl_map_has_tuple_name(__isl_keep isl_map *map,
1511                 enum isl_dim_type type);
1512         const char *isl_map_get_tuple_name(
1513                 __isl_keep isl_map *map,
1514                 enum isl_dim_type type);
1516         #include <isl/val.h>
1517         __isl_give isl_multi_val *isl_multi_val_set_tuple_id(
1518                 __isl_take isl_multi_val *mv,
1519                 enum isl_dim_type type, __isl_take isl_id *id);
1520         __isl_give isl_multi_val *isl_multi_val_reset_tuple_id(
1521                 __isl_take isl_multi_val *mv,
1522                 enum isl_dim_type type);
1523         isl_bool isl_multi_val_has_tuple_id(
1524                 __isl_keep isl_multi_val *mv,
1525                 enum isl_dim_type type);
1526         __isl_give isl_id *isl_multi_val_get_tuple_id(
1527                 __isl_keep isl_multi_val *mv,
1528                 enum isl_dim_type type);
1529         __isl_give isl_multi_val *isl_multi_val_set_tuple_name(
1530                 __isl_take isl_multi_val *mv,
1531                 enum isl_dim_type type, const char *s);
1532         const char *isl_multi_val_get_tuple_name(
1533                 __isl_keep isl_multi_val *mv,
1534                 enum isl_dim_type type);
1536         #include <isl/aff.h>
1537         __isl_give isl_aff *isl_aff_set_tuple_id(
1538                 __isl_take isl_aff *aff,
1539                 enum isl_dim_type type, __isl_take isl_id *id);
1540         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_id(
1541                 __isl_take isl_multi_aff *maff,
1542                 enum isl_dim_type type, __isl_take isl_id *id);
1543         __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(
1544                 __isl_take isl_pw_aff *pwaff,
1545                 enum isl_dim_type type, __isl_take isl_id *id);
1546         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id(
1547                 __isl_take isl_pw_multi_aff *pma,
1548                 enum isl_dim_type type, __isl_take isl_id *id);
1549         __isl_give isl_multi_union_pw_aff *
1550         isl_multi_union_pw_aff_set_tuple_id(
1551                 __isl_take isl_multi_union_pw_aff *mupa,
1552                 enum isl_dim_type type, __isl_take isl_id *id);
1553         __isl_give isl_multi_aff *isl_multi_aff_reset_tuple_id(
1554                 __isl_take isl_multi_aff *ma,
1555                 enum isl_dim_type type);
1556         __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(
1557                 __isl_take isl_pw_aff *pa,
1558                 enum isl_dim_type type);
1559         __isl_give isl_multi_pw_aff *
1560         isl_multi_pw_aff_reset_tuple_id(
1561                 __isl_take isl_multi_pw_aff *mpa,
1562                 enum isl_dim_type type);
1563         __isl_give isl_pw_multi_aff *
1564         isl_pw_multi_aff_reset_tuple_id(
1565                 __isl_take isl_pw_multi_aff *pma,
1566                 enum isl_dim_type type);
1567         __isl_give isl_multi_union_pw_aff *
1568         isl_multi_union_pw_aff_reset_tuple_id(
1569                 __isl_take isl_multi_union_pw_aff *mupa,
1570                 enum isl_dim_type type);
1571         isl_bool isl_multi_aff_has_tuple_id(
1572                 __isl_keep isl_multi_aff *ma,
1573                 enum isl_dim_type type);
1574         __isl_give isl_id *isl_multi_aff_get_tuple_id(
1575                 __isl_keep isl_multi_aff *ma,
1576                 enum isl_dim_type type);
1577         isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa,
1578                 enum isl_dim_type type);
1579         __isl_give isl_id *isl_pw_aff_get_tuple_id(
1580                 __isl_keep isl_pw_aff *pa,
1581                 enum isl_dim_type type);
1582         isl_bool isl_pw_multi_aff_has_tuple_id(
1583                 __isl_keep isl_pw_multi_aff *pma,
1584                 enum isl_dim_type type);
1585         __isl_give isl_id *isl_pw_multi_aff_get_tuple_id(
1586                 __isl_keep isl_pw_multi_aff *pma,
1587                 enum isl_dim_type type);
1588         isl_bool isl_multi_pw_aff_has_tuple_id(
1589                 __isl_keep isl_multi_pw_aff *mpa,
1590                 enum isl_dim_type type);
1591         __isl_give isl_id *isl_multi_pw_aff_get_tuple_id(
1592                 __isl_keep isl_multi_pw_aff *mpa,
1593                 enum isl_dim_type type);
1594         isl_bool isl_multi_union_pw_aff_has_tuple_id(
1595                 __isl_keep isl_multi_union_pw_aff *mupa,
1596                 enum isl_dim_type type);
1597         __isl_give isl_id *isl_multi_union_pw_aff_get_tuple_id(
1598                 __isl_keep isl_multi_union_pw_aff *mupa,
1599                 enum isl_dim_type type);
1600         __isl_give isl_multi_aff *isl_multi_aff_set_tuple_name(
1601                 __isl_take isl_multi_aff *maff,
1602                 enum isl_dim_type type, const char *s);
1603         __isl_give isl_multi_pw_aff *
1604         isl_multi_pw_aff_set_tuple_name(
1605                 __isl_take isl_multi_pw_aff *mpa,
1606                 enum isl_dim_type type, const char *s);
1607         __isl_give isl_multi_union_pw_aff *
1608         isl_multi_union_pw_aff_set_tuple_name(
1609                 __isl_take isl_multi_union_pw_aff *mupa,
1610                 enum isl_dim_type type, const char *s);
1611         const char *isl_multi_aff_get_tuple_name(
1612                 __isl_keep isl_multi_aff *multi,
1613                 enum isl_dim_type type);
1614         isl_bool isl_pw_multi_aff_has_tuple_name(
1615                 __isl_keep isl_pw_multi_aff *pma,
1616                 enum isl_dim_type type);
1617         const char *isl_pw_multi_aff_get_tuple_name(
1618                 __isl_keep isl_pw_multi_aff *pma,
1619                 enum isl_dim_type type);
1620         const char *isl_multi_union_pw_aff_get_tuple_name(
1621                 __isl_keep isl_multi_union_pw_aff *mupa,
1622                 enum isl_dim_type type);
1624 The C<type> argument needs to be one of C<isl_dim_in>, C<isl_dim_out>
1625 or C<isl_dim_set>.  As with C<isl_space_get_name>,
1626 the C<isl_space_get_tuple_name> function returns a pointer to some internal
1627 data structure.
1628 Binary operations require the corresponding spaces of their arguments
1629 to have the same name.
1631 To keep the names of all parameters and tuples, but reset the user pointers
1632 of all the corresponding identifiers, use the following function.
1634         #include <isl/space.h>
1635         __isl_give isl_space *isl_space_reset_user(
1636                 __isl_take isl_space *space);
1638         #include <isl/set.h>
1639         __isl_give isl_set *isl_set_reset_user(
1640                 __isl_take isl_set *set);
1642         #include <isl/map.h>
1643         __isl_give isl_map *isl_map_reset_user(
1644                 __isl_take isl_map *map);
1646         #include <isl/union_set.h>
1647         __isl_give isl_union_set *isl_union_set_reset_user(
1648                 __isl_take isl_union_set *uset);
1650         #include <isl/union_map.h>
1651         __isl_give isl_union_map *isl_union_map_reset_user(
1652                 __isl_take isl_union_map *umap);
1654         #include <isl/val.h>
1655         __isl_give isl_multi_val *isl_multi_val_reset_user(
1656                 __isl_take isl_multi_val *mv);
1658         #include <isl/aff.h>
1659         __isl_give isl_multi_aff *isl_multi_aff_reset_user(
1660                 __isl_take isl_multi_aff *ma);
1661         __isl_give isl_pw_aff *isl_pw_aff_reset_user(
1662                 __isl_take isl_pw_aff *pa);
1663         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_reset_user(
1664                 __isl_take isl_multi_pw_aff *mpa);
1665         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user(
1666                 __isl_take isl_pw_multi_aff *pma);
1667         __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user(
1668                 __isl_take isl_union_pw_aff *upa);
1669         __isl_give isl_multi_union_pw_aff *
1670         isl_multi_union_pw_aff_reset_user(
1671                 __isl_take isl_multi_union_pw_aff *mupa);
1672         __isl_give isl_union_pw_multi_aff *
1673         isl_union_pw_multi_aff_reset_user(
1674                 __isl_take isl_union_pw_multi_aff *upma);
1676         #include <isl/polynomial.h>
1677         __isl_give isl_pw_qpolynomial *
1678         isl_pw_qpolynomial_reset_user(
1679                 __isl_take isl_pw_qpolynomial *pwqp);
1680         __isl_give isl_union_pw_qpolynomial *
1681         isl_union_pw_qpolynomial_reset_user(
1682                 __isl_take isl_union_pw_qpolynomial *upwqp);
1683         __isl_give isl_pw_qpolynomial_fold *
1684         isl_pw_qpolynomial_fold_reset_user(
1685                 __isl_take isl_pw_qpolynomial_fold *pwf);
1686         __isl_give isl_union_pw_qpolynomial_fold *
1687         isl_union_pw_qpolynomial_fold_reset_user(
1688                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
1690 Spaces can be nested.  In particular, the domain of a set or
1691 the domain or range of a relation can be a nested relation.
1692 This process is also called I<wrapping>.
1693 The functions for detecting, constructing and deconstructing
1694 such nested spaces can be found in the wrapping properties
1695 of L</"Unary Properties">, the wrapping operations
1696 of L</"Unary Operations"> and the Cartesian product operations
1697 of L</"Basic Operations">.
1699 Spaces can be created from other spaces
1700 using the functions described in L</"Unary Operations">
1701 and L</"Binary Operations">.
1703 =head2 Local Spaces
1705 A local space is essentially a space with
1706 zero or more existentially quantified variables.
1707 The local space of various objects can be obtained
1708 using the following functions.
1710         #include <isl/constraint.h>
1711         __isl_give isl_local_space *isl_constraint_get_local_space(
1712                 __isl_keep isl_constraint *constraint);
1714         #include <isl/set.h>
1715         __isl_give isl_local_space *isl_basic_set_get_local_space(
1716                 __isl_keep isl_basic_set *bset);
1718         #include <isl/map.h>
1719         __isl_give isl_local_space *isl_basic_map_get_local_space(
1720                 __isl_keep isl_basic_map *bmap);
1722         #include <isl/aff.h>
1723         __isl_give isl_local_space *isl_aff_get_domain_local_space(
1724                 __isl_keep isl_aff *aff);
1725         __isl_give isl_local_space *isl_aff_get_local_space(
1726                 __isl_keep isl_aff *aff);
1728 A new local space can be created from a space using
1730         #include <isl/local_space.h>
1731         __isl_give isl_local_space *isl_local_space_from_space(
1732                 __isl_take isl_space *space);
1734 They can be inspected, modified, copied and freed using the following functions.
1736         #include <isl/local_space.h>
1737         isl_bool isl_local_space_is_params(
1738                 __isl_keep isl_local_space *ls);
1739         isl_bool isl_local_space_is_set(
1740                 __isl_keep isl_local_space *ls);
1741         __isl_give isl_space *isl_local_space_get_space(
1742                 __isl_keep isl_local_space *ls);
1743         __isl_give isl_aff *isl_local_space_get_div(
1744                 __isl_keep isl_local_space *ls, int pos);
1745         __isl_give isl_local_space *isl_local_space_copy(
1746                 __isl_keep isl_local_space *ls);
1747         __isl_null isl_local_space *isl_local_space_free(
1748                 __isl_take isl_local_space *ls);
1750 Note that C<isl_local_space_get_div> can only be used on local spaces
1751 of sets.
1753 Two local spaces can be compared using
1755         isl_bool isl_local_space_is_equal(
1756                 __isl_keep isl_local_space *ls1,
1757                 __isl_keep isl_local_space *ls2);
1759 Local spaces can be created from other local spaces
1760 using the functions described in L</"Unary Operations">
1761 and L</"Binary Operations">.
1763 =head2 Creating New Sets and Relations
1765 C<isl> has functions for creating some standard sets and relations.
1767 =over
1769 =item * Empty sets and relations
1771         __isl_give isl_basic_set *isl_basic_set_empty(
1772                 __isl_take isl_space *space);
1773         __isl_give isl_basic_map *isl_basic_map_empty(
1774                 __isl_take isl_space *space);
1775         __isl_give isl_set *isl_set_empty(
1776                 __isl_take isl_space *space);
1777         __isl_give isl_map *isl_map_empty(
1778                 __isl_take isl_space *space);
1779         __isl_give isl_union_set *isl_union_set_empty(
1780                 __isl_take isl_space *space);
1781         __isl_give isl_union_map *isl_union_map_empty(
1782                 __isl_take isl_space *space);
1784 For C<isl_union_set>s and C<isl_union_map>s, the space
1785 is only used to specify the parameters.
1787 =item * Universe sets and relations
1789         __isl_give isl_basic_set *isl_basic_set_universe(
1790                 __isl_take isl_space *space);
1791         __isl_give isl_basic_map *isl_basic_map_universe(
1792                 __isl_take isl_space *space);
1793         __isl_give isl_set *isl_set_universe(
1794                 __isl_take isl_space *space);
1795         __isl_give isl_map *isl_map_universe(
1796                 __isl_take isl_space *space);
1797         __isl_give isl_union_set *isl_union_set_universe(
1798                 __isl_take isl_union_set *uset);
1799         __isl_give isl_union_map *isl_union_map_universe(
1800                 __isl_take isl_union_map *umap);
1802 The sets and relations constructed by the functions above
1803 contain all integer values, while those constructed by the
1804 functions below only contain non-negative values.
1806         __isl_give isl_basic_set *isl_basic_set_nat_universe(
1807                 __isl_take isl_space *space);
1808         __isl_give isl_basic_map *isl_basic_map_nat_universe(
1809                 __isl_take isl_space *space);
1810         __isl_give isl_set *isl_set_nat_universe(
1811                 __isl_take isl_space *space);
1812         __isl_give isl_map *isl_map_nat_universe(
1813                 __isl_take isl_space *space);
1815 =item * Identity relations
1817         __isl_give isl_basic_map *isl_basic_map_identity(
1818                 __isl_take isl_space *space);
1819         __isl_give isl_map *isl_map_identity(
1820                 __isl_take isl_space *space);
1822 The number of input and output dimensions in C<space> needs
1823 to be the same.
1825 =item * Lexicographic order
1827         __isl_give isl_map *isl_map_lex_lt(
1828                 __isl_take isl_space *set_space);
1829         __isl_give isl_map *isl_map_lex_le(
1830                 __isl_take isl_space *set_space);
1831         __isl_give isl_map *isl_map_lex_gt(
1832                 __isl_take isl_space *set_space);
1833         __isl_give isl_map *isl_map_lex_ge(
1834                 __isl_take isl_space *set_space);
1835         __isl_give isl_map *isl_map_lex_lt_first(
1836                 __isl_take isl_space *space, unsigned n);
1837         __isl_give isl_map *isl_map_lex_le_first(
1838                 __isl_take isl_space *space, unsigned n);
1839         __isl_give isl_map *isl_map_lex_gt_first(
1840                 __isl_take isl_space *space, unsigned n);
1841         __isl_give isl_map *isl_map_lex_ge_first(
1842                 __isl_take isl_space *space, unsigned n);
1844 The first four functions take a space for a B<set>
1845 and return relations that express that the elements in the domain
1846 are lexicographically less
1847 (C<isl_map_lex_lt>), less or equal (C<isl_map_lex_le>),
1848 greater (C<isl_map_lex_gt>) or greater or equal (C<isl_map_lex_ge>)
1849 than the elements in the range.
1850 The last four functions take a space for a map
1851 and return relations that express that the first C<n> dimensions
1852 in the domain are lexicographically less
1853 (C<isl_map_lex_lt_first>), less or equal (C<isl_map_lex_le_first>),
1854 greater (C<isl_map_lex_gt_first>) or greater or equal (C<isl_map_lex_ge_first>)
1855 than the first C<n> dimensions in the range.
1857 =back
1859 A basic set or relation can be converted to a set or relation
1860 using the following functions.
1862         __isl_give isl_set *isl_set_from_basic_set(
1863                 __isl_take isl_basic_set *bset);
1864         __isl_give isl_map *isl_map_from_basic_map(
1865                 __isl_take isl_basic_map *bmap);
1867 Sets and relations can be converted to union sets and relations
1868 using the following functions.
1870         __isl_give isl_union_set *isl_union_set_from_basic_set(
1871                 __isl_take isl_basic_set *bset);
1872         __isl_give isl_union_map *isl_union_map_from_basic_map(
1873                 __isl_take isl_basic_map *bmap);
1874         __isl_give isl_union_set *isl_union_set_from_set(
1875                 __isl_take isl_set *set);
1876         __isl_give isl_union_map *isl_union_map_from_map(
1877                 __isl_take isl_map *map);
1879 The inverse conversions below can only be used if the input
1880 union set or relation is known to contain elements in exactly one
1881 space.
1883         __isl_give isl_set *isl_set_from_union_set(
1884                 __isl_take isl_union_set *uset);
1885         __isl_give isl_map *isl_map_from_union_map(
1886                 __isl_take isl_union_map *umap);
1888 Sets and relations can be copied and freed again using the following
1889 functions.
1891         __isl_give isl_basic_set *isl_basic_set_copy(
1892                 __isl_keep isl_basic_set *bset);
1893         __isl_give isl_set *isl_set_copy(__isl_keep isl_set *set);
1894         __isl_give isl_union_set *isl_union_set_copy(
1895                 __isl_keep isl_union_set *uset);
1896         __isl_give isl_basic_map *isl_basic_map_copy(
1897                 __isl_keep isl_basic_map *bmap);
1898         __isl_give isl_map *isl_map_copy(__isl_keep isl_map *map);
1899         __isl_give isl_union_map *isl_union_map_copy(
1900                 __isl_keep isl_union_map *umap);
1901         __isl_null isl_basic_set *isl_basic_set_free(
1902                 __isl_take isl_basic_set *bset);
1903         __isl_null isl_set *isl_set_free(__isl_take isl_set *set);
1904         __isl_null isl_union_set *isl_union_set_free(
1905                 __isl_take isl_union_set *uset);
1906         __isl_null isl_basic_map *isl_basic_map_free(
1907                 __isl_take isl_basic_map *bmap);
1908         __isl_null isl_map *isl_map_free(__isl_take isl_map *map);
1909         __isl_null isl_union_map *isl_union_map_free(
1910                 __isl_take isl_union_map *umap);
1912 Other sets and relations can be constructed by starting
1913 from a universe set or relation, adding equality and/or
1914 inequality constraints and then projecting out the
1915 existentially quantified variables, if any.
1916 Constraints can be constructed, manipulated and
1917 added to (or removed from) (basic) sets and relations
1918 using the following functions.
1920         #include <isl/constraint.h>
1921         __isl_give isl_constraint *isl_constraint_alloc_equality(
1922                 __isl_take isl_local_space *ls);
1923         __isl_give isl_constraint *isl_constraint_alloc_inequality(
1924                 __isl_take isl_local_space *ls);
1925         __isl_give isl_constraint *isl_constraint_set_constant_si(
1926                 __isl_take isl_constraint *constraint, int v);
1927         __isl_give isl_constraint *isl_constraint_set_constant_val(
1928                 __isl_take isl_constraint *constraint,
1929                 __isl_take isl_val *v);
1930         __isl_give isl_constraint *isl_constraint_set_coefficient_si(
1931                 __isl_take isl_constraint *constraint,
1932                 enum isl_dim_type type, int pos, int v);
1933         __isl_give isl_constraint *
1934         isl_constraint_set_coefficient_val(
1935                 __isl_take isl_constraint *constraint,
1936                 enum isl_dim_type type, int pos,
1937                 __isl_take isl_val *v);
1938         __isl_give isl_basic_map *isl_basic_map_add_constraint(
1939                 __isl_take isl_basic_map *bmap,
1940                 __isl_take isl_constraint *constraint);
1941         __isl_give isl_basic_set *isl_basic_set_add_constraint(
1942                 __isl_take isl_basic_set *bset,
1943                 __isl_take isl_constraint *constraint);
1944         __isl_give isl_map *isl_map_add_constraint(
1945                 __isl_take isl_map *map,
1946                 __isl_take isl_constraint *constraint);
1947         __isl_give isl_set *isl_set_add_constraint(
1948                 __isl_take isl_set *set,
1949                 __isl_take isl_constraint *constraint);
1951 For example, to create a set containing the even integers
1952 between 10 and 42, you would use the following code.
1954         isl_space *space;
1955         isl_local_space *ls;
1956         isl_constraint *c;
1957         isl_basic_set *bset;
1959         space = isl_space_set_alloc(ctx, 0, 2);
1960         bset = isl_basic_set_universe(isl_space_copy(space));
1961         ls = isl_local_space_from_space(space);
1963         c = isl_constraint_alloc_equality(isl_local_space_copy(ls));
1964         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1965         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 1, 2);
1966         bset = isl_basic_set_add_constraint(bset, c);
1968         c = isl_constraint_alloc_inequality(isl_local_space_copy(ls));
1969         c = isl_constraint_set_constant_si(c, -10);
1970         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, 1);
1971         bset = isl_basic_set_add_constraint(bset, c);
1973         c = isl_constraint_alloc_inequality(ls);
1974         c = isl_constraint_set_constant_si(c, 42);
1975         c = isl_constraint_set_coefficient_si(c, isl_dim_set, 0, -1);
1976         bset = isl_basic_set_add_constraint(bset, c);
1978         bset = isl_basic_set_project_out(bset, isl_dim_set, 1, 1);
1980 Or, alternatively,
1982         isl_basic_set *bset;
1983         bset = isl_basic_set_read_from_str(ctx,
1984                 "{[i] : exists (a : i = 2a and i >= 10 and i <= 42)}");
1986 A basic set or relation can also be constructed from two matrices
1987 describing the equalities and the inequalities.
1989         __isl_give isl_basic_set *isl_basic_set_from_constraint_matrices(
1990                 __isl_take isl_space *space,
1991                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1992                 enum isl_dim_type c1,
1993                 enum isl_dim_type c2, enum isl_dim_type c3,
1994                 enum isl_dim_type c4);
1995         __isl_give isl_basic_map *isl_basic_map_from_constraint_matrices(
1996                 __isl_take isl_space *space,
1997                 __isl_take isl_mat *eq, __isl_take isl_mat *ineq,
1998                 enum isl_dim_type c1,
1999                 enum isl_dim_type c2, enum isl_dim_type c3,
2000                 enum isl_dim_type c4, enum isl_dim_type c5);
2002 The C<isl_dim_type> arguments indicate the order in which
2003 different kinds of variables appear in the input matrices
2004 and should be a permutation of C<isl_dim_cst>, C<isl_dim_param>,
2005 C<isl_dim_set> and C<isl_dim_div> for sets and
2006 of C<isl_dim_cst>, C<isl_dim_param>,
2007 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div> for relations.
2009 A (basic or union) set or relation can also be constructed from a
2010 (union) (piecewise) (multiple) affine expression
2011 or a list of affine expressions
2012 (See L</"Functions">), provided these affine expressions do not
2013 involve any NaN.
2015         __isl_give isl_basic_map *isl_basic_map_from_aff(
2016                 __isl_take isl_aff *aff);
2017         __isl_give isl_map *isl_map_from_aff(
2018                 __isl_take isl_aff *aff);
2019         __isl_give isl_set *isl_set_from_pw_aff(
2020                 __isl_take isl_pw_aff *pwaff);
2021         __isl_give isl_map *isl_map_from_pw_aff(
2022                 __isl_take isl_pw_aff *pwaff);
2023         __isl_give isl_basic_map *isl_basic_map_from_aff_list(
2024                 __isl_take isl_space *domain_space,
2025                 __isl_take isl_aff_list *list);
2026         __isl_give isl_basic_map *isl_basic_map_from_multi_aff(
2027                 __isl_take isl_multi_aff *maff)
2028         __isl_give isl_map *isl_map_from_multi_aff(
2029                 __isl_take isl_multi_aff *maff)
2030         __isl_give isl_set *isl_set_from_pw_multi_aff(
2031                 __isl_take isl_pw_multi_aff *pma);
2032         __isl_give isl_map *isl_map_from_pw_multi_aff(
2033                 __isl_take isl_pw_multi_aff *pma);
2034         __isl_give isl_set *isl_set_from_multi_pw_aff(
2035                 __isl_take isl_multi_pw_aff *mpa);
2036         __isl_give isl_map *isl_map_from_multi_pw_aff(
2037                 __isl_take isl_multi_pw_aff *mpa);
2038         __isl_give isl_union_map *isl_union_map_from_union_pw_aff(
2039                 __isl_take isl_union_pw_aff *upa);
2040         __isl_give isl_union_map *
2041         isl_union_map_from_union_pw_multi_aff(
2042                 __isl_take isl_union_pw_multi_aff *upma);
2043         __isl_give isl_union_map *
2044         isl_union_map_from_multi_union_pw_aff(
2045                 __isl_take isl_multi_union_pw_aff *mupa);
2047 The C<domain_space> argument describes the domain of the resulting
2048 basic relation.  It is required because the C<list> may consist
2049 of zero affine expressions.
2050 The C<mupa> passed to C<isl_union_map_from_multi_union_pw_aff>
2051 is not allowed to be zero-dimensional.  The domain of the result
2052 is the shared domain of the union piecewise affine elements.
2054 =head2 Inspecting Sets and Relations
2056 Usually, the user should not have to care about the actual constraints
2057 of the sets and maps, but should instead apply the abstract operations
2058 explained in the following sections.
2059 Occasionally, however, it may be required to inspect the individual
2060 coefficients of the constraints.  This section explains how to do so.
2061 In these cases, it may also be useful to have C<isl> compute
2062 an explicit representation of the existentially quantified variables.
2064         __isl_give isl_set *isl_set_compute_divs(
2065                 __isl_take isl_set *set);
2066         __isl_give isl_map *isl_map_compute_divs(
2067                 __isl_take isl_map *map);
2068         __isl_give isl_union_set *isl_union_set_compute_divs(
2069                 __isl_take isl_union_set *uset);
2070         __isl_give isl_union_map *isl_union_map_compute_divs(
2071                 __isl_take isl_union_map *umap);
2073 This explicit representation defines the existentially quantified
2074 variables as integer divisions of the other variables, possibly
2075 including earlier existentially quantified variables.
2076 An explicitly represented existentially quantified variable therefore
2077 has a unique value when the values of the other variables are known.
2078 If, furthermore, the same existentials, i.e., existentials
2079 with the same explicit representations, should appear in the
2080 same order in each of the disjuncts of a set or map, then the user should call
2081 either of the following functions.
2083         __isl_give isl_set *isl_set_align_divs(
2084                 __isl_take isl_set *set);
2085         __isl_give isl_map *isl_map_align_divs(
2086                 __isl_take isl_map *map);
2088 Alternatively, the existentially quantified variables can be removed
2089 using the following functions, which compute an overapproximation.
2091         __isl_give isl_basic_set *isl_basic_set_remove_divs(
2092                 __isl_take isl_basic_set *bset);
2093         __isl_give isl_basic_map *isl_basic_map_remove_divs(
2094                 __isl_take isl_basic_map *bmap);
2095         __isl_give isl_set *isl_set_remove_divs(
2096                 __isl_take isl_set *set);
2097         __isl_give isl_map *isl_map_remove_divs(
2098                 __isl_take isl_map *map);
2100 It is also possible to only remove those divs that are defined
2101 in terms of a given range of dimensions or only those for which
2102 no explicit representation is known.
2104         __isl_give isl_basic_set *
2105         isl_basic_set_remove_divs_involving_dims(
2106                 __isl_take isl_basic_set *bset,
2107                 enum isl_dim_type type,
2108                 unsigned first, unsigned n);
2109         __isl_give isl_basic_map *
2110         isl_basic_map_remove_divs_involving_dims(
2111                 __isl_take isl_basic_map *bmap,
2112                 enum isl_dim_type type,
2113                 unsigned first, unsigned n);
2114         __isl_give isl_set *isl_set_remove_divs_involving_dims(
2115                 __isl_take isl_set *set, enum isl_dim_type type,
2116                 unsigned first, unsigned n);
2117         __isl_give isl_map *isl_map_remove_divs_involving_dims(
2118                 __isl_take isl_map *map, enum isl_dim_type type,
2119                 unsigned first, unsigned n);
2121         __isl_give isl_basic_set *
2122         isl_basic_set_remove_unknown_divs(
2123                 __isl_take isl_basic_set *bset);
2124         __isl_give isl_set *isl_set_remove_unknown_divs(
2125                 __isl_take isl_set *set);
2126         __isl_give isl_map *isl_map_remove_unknown_divs(
2127                 __isl_take isl_map *map);
2129 To iterate over all the sets or maps in a union set or map, use
2131         isl_stat isl_union_set_foreach_set(
2132                 __isl_keep isl_union_set *uset,
2133                 isl_stat (*fn)(__isl_take isl_set *set, void *user),
2134                 void *user);
2135         isl_stat isl_union_map_foreach_map(
2136                 __isl_keep isl_union_map *umap,
2137                 isl_stat (*fn)(__isl_take isl_map *map, void *user),
2138                 void *user);
2140 These functions call the callback function once for each
2141 (pair of) space(s) for which there are elements in the input.
2142 The argument to the callback contains all elements in the input
2143 with that (pair of) space(s).
2145 The number of sets or maps in a union set or map can be obtained
2146 from
2148         int isl_union_set_n_set(__isl_keep isl_union_set *uset);
2149         int isl_union_map_n_map(__isl_keep isl_union_map *umap);
2151 To extract the set or map in a given space from a union, use
2153         __isl_give isl_set *isl_union_set_extract_set(
2154                 __isl_keep isl_union_set *uset,
2155                 __isl_take isl_space *space);
2156         __isl_give isl_map *isl_union_map_extract_map(
2157                 __isl_keep isl_union_map *umap,
2158                 __isl_take isl_space *space);
2160 To iterate over all the basic sets or maps in a set or map, use
2162         isl_stat isl_set_foreach_basic_set(__isl_keep isl_set *set,
2163                 isl_stat (*fn)(__isl_take isl_basic_set *bset,
2164                         void *user),
2165                 void *user);
2166         isl_stat isl_map_foreach_basic_map(__isl_keep isl_map *map,
2167                 isl_stat (*fn)(__isl_take isl_basic_map *bmap,
2168                         void *user),
2169                 void *user);
2171 The callback function C<fn> should return 0 if successful and
2172 -1 if an error occurs.  In the latter case, or if any other error
2173 occurs, the above functions will return -1.
2175 It should be noted that C<isl> does not guarantee that
2176 the basic sets or maps passed to C<fn> are disjoint.
2177 If this is required, then the user should call one of
2178 the following functions first.
2180         __isl_give isl_set *isl_set_make_disjoint(
2181                 __isl_take isl_set *set);
2182         __isl_give isl_map *isl_map_make_disjoint(
2183                 __isl_take isl_map *map);
2185 The number of basic sets in a set can be obtained
2186 or the number of basic maps in a map can be obtained
2187 from
2189         #include <isl/set.h>
2190         int isl_set_n_basic_set(__isl_keep isl_set *set);
2192         #include <isl/map.h>
2193         int isl_map_n_basic_map(__isl_keep isl_map *map);
2195 It is also possible to obtain a list of basic sets from a set
2197         #include <isl/set.h>
2198         __isl_give isl_basic_set_list *isl_set_get_basic_set_list(
2199                 __isl_keep isl_set *set);
2201 The returned list can be manipulated using the functions in L<"Lists">.
2203 To iterate over the constraints of a basic set or map, use
2205         #include <isl/constraint.h>
2207         int isl_basic_set_n_constraint(
2208                 __isl_keep isl_basic_set *bset);
2209         isl_stat isl_basic_set_foreach_constraint(
2210                 __isl_keep isl_basic_set *bset,
2211                 isl_stat (*fn)(__isl_take isl_constraint *c,
2212                         void *user),
2213                 void *user);
2214         int isl_basic_map_n_constraint(
2215                 __isl_keep isl_basic_map *bmap);
2216         isl_stat isl_basic_map_foreach_constraint(
2217                 __isl_keep isl_basic_map *bmap,
2218                 isl_stat (*fn)(__isl_take isl_constraint *c,
2219                         void *user),
2220                 void *user);
2221         __isl_null isl_constraint *isl_constraint_free(
2222                 __isl_take isl_constraint *c);
2224 Again, the callback function C<fn> should return 0 if successful and
2225 -1 if an error occurs.  In the latter case, or if any other error
2226 occurs, the above functions will return -1.
2227 The constraint C<c> represents either an equality or an inequality.
2228 Use the following function to find out whether a constraint
2229 represents an equality.  If not, it represents an inequality.
2231         isl_bool isl_constraint_is_equality(
2232                 __isl_keep isl_constraint *constraint);
2234 It is also possible to obtain a list of constraints from a basic
2235 map or set
2237         #include <isl/constraint.h>
2238         __isl_give isl_constraint_list *
2239         isl_basic_map_get_constraint_list(
2240                 __isl_keep isl_basic_map *bmap);
2241         __isl_give isl_constraint_list *
2242         isl_basic_set_get_constraint_list(
2243                 __isl_keep isl_basic_set *bset);
2245 These functions require that all existentially quantified variables
2246 have an explicit representation.
2247 The returned list can be manipulated using the functions in L<"Lists">.
2249 The coefficients of the constraints can be inspected using
2250 the following functions.
2252         isl_bool isl_constraint_is_lower_bound(
2253                 __isl_keep isl_constraint *constraint,
2254                 enum isl_dim_type type, unsigned pos);
2255         isl_bool isl_constraint_is_upper_bound(
2256                 __isl_keep isl_constraint *constraint,
2257                 enum isl_dim_type type, unsigned pos);
2258         __isl_give isl_val *isl_constraint_get_constant_val(
2259                 __isl_keep isl_constraint *constraint);
2260         __isl_give isl_val *isl_constraint_get_coefficient_val(
2261                 __isl_keep isl_constraint *constraint,
2262                 enum isl_dim_type type, int pos);
2264 The explicit representations of the existentially quantified
2265 variables can be inspected using the following function.
2266 Note that the user is only allowed to use this function
2267 if the inspected set or map is the result of a call
2268 to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
2269 The existentially quantified variable is equal to the floor
2270 of the returned affine expression.  The affine expression
2271 itself can be inspected using the functions in
2272 L</"Functions">.
2274         __isl_give isl_aff *isl_constraint_get_div(
2275                 __isl_keep isl_constraint *constraint, int pos);
2277 To obtain the constraints of a basic set or map in matrix
2278 form, use the following functions.
2280         __isl_give isl_mat *isl_basic_set_equalities_matrix(
2281                 __isl_keep isl_basic_set *bset,
2282                 enum isl_dim_type c1, enum isl_dim_type c2,
2283                 enum isl_dim_type c3, enum isl_dim_type c4);
2284         __isl_give isl_mat *isl_basic_set_inequalities_matrix(
2285                 __isl_keep isl_basic_set *bset,
2286                 enum isl_dim_type c1, enum isl_dim_type c2,
2287                 enum isl_dim_type c3, enum isl_dim_type c4);
2288         __isl_give isl_mat *isl_basic_map_equalities_matrix(
2289                 __isl_keep isl_basic_map *bmap,
2290                 enum isl_dim_type c1,
2291                 enum isl_dim_type c2, enum isl_dim_type c3,
2292                 enum isl_dim_type c4, enum isl_dim_type c5);
2293         __isl_give isl_mat *isl_basic_map_inequalities_matrix(
2294                 __isl_keep isl_basic_map *bmap,
2295                 enum isl_dim_type c1,
2296                 enum isl_dim_type c2, enum isl_dim_type c3,
2297                 enum isl_dim_type c4, enum isl_dim_type c5);
2299 The C<isl_dim_type> arguments dictate the order in which
2300 different kinds of variables appear in the resulting matrix.
2301 For set inputs, they should be a permutation of
2302 C<isl_dim_cst>, C<isl_dim_param>, C<isl_dim_set> and C<isl_dim_div>.
2303 For map inputs, they should be a permutation of
2304 C<isl_dim_cst>, C<isl_dim_param>,
2305 C<isl_dim_in>, C<isl_dim_out> and C<isl_dim_div>.
2307 =head2 Points
2309 Points are elements of a set.  They can be used to construct
2310 simple sets (boxes) or they can be used to represent the
2311 individual elements of a set.
2312 The zero point (the origin) can be created using
2314         __isl_give isl_point *isl_point_zero(__isl_take isl_space *space);
2316 The coordinates of a point can be inspected, set and changed
2317 using
2319         __isl_give isl_val *isl_point_get_coordinate_val(
2320                 __isl_keep isl_point *pnt,
2321                 enum isl_dim_type type, int pos);
2322         __isl_give isl_point *isl_point_set_coordinate_val(
2323                 __isl_take isl_point *pnt,
2324                 enum isl_dim_type type, int pos,
2325                 __isl_take isl_val *v);
2327         __isl_give isl_point *isl_point_add_ui(
2328                 __isl_take isl_point *pnt,
2329                 enum isl_dim_type type, int pos, unsigned val);
2330         __isl_give isl_point *isl_point_sub_ui(
2331                 __isl_take isl_point *pnt,
2332                 enum isl_dim_type type, int pos, unsigned val);
2334 Points can be copied or freed using
2336         __isl_give isl_point *isl_point_copy(
2337                 __isl_keep isl_point *pnt);
2338         void isl_point_free(__isl_take isl_point *pnt);
2340 A singleton set can be created from a point using
2342         __isl_give isl_basic_set *isl_basic_set_from_point(
2343                 __isl_take isl_point *pnt);
2344         __isl_give isl_set *isl_set_from_point(
2345                 __isl_take isl_point *pnt);
2346         __isl_give isl_union_set *isl_union_set_from_point(
2347                 __isl_take isl_point *pnt);
2349 and a box can be created from two opposite extremal points using
2351         __isl_give isl_basic_set *isl_basic_set_box_from_points(
2352                 __isl_take isl_point *pnt1,
2353                 __isl_take isl_point *pnt2);
2354         __isl_give isl_set *isl_set_box_from_points(
2355                 __isl_take isl_point *pnt1,
2356                 __isl_take isl_point *pnt2);
2358 All elements of a B<bounded> (union) set can be enumerated using
2359 the following functions.
2361         isl_stat isl_set_foreach_point(__isl_keep isl_set *set,
2362                 isl_stat (*fn)(__isl_take isl_point *pnt,
2363                         void *user),
2364                 void *user);
2365         isl_stat isl_union_set_foreach_point(
2366                 __isl_keep isl_union_set *uset,
2367                 isl_stat (*fn)(__isl_take isl_point *pnt,
2368                         void *user),
2369                 void *user);
2371 The function C<fn> is called for each integer point in
2372 C<set> with as second argument the last argument of
2373 the C<isl_set_foreach_point> call.  The function C<fn>
2374 should return C<0> on success and C<-1> on failure.
2375 In the latter case, C<isl_set_foreach_point> will stop
2376 enumerating and return C<-1> as well.
2377 If the enumeration is performed successfully and to completion,
2378 then C<isl_set_foreach_point> returns C<0>.
2380 To obtain a single point of a (basic or union) set, use
2382         __isl_give isl_point *isl_basic_set_sample_point(
2383                 __isl_take isl_basic_set *bset);
2384         __isl_give isl_point *isl_set_sample_point(
2385                 __isl_take isl_set *set);
2386         __isl_give isl_point *isl_union_set_sample_point(
2387                 __isl_take isl_union_set *uset);
2389 If C<set> does not contain any (integer) points, then the
2390 resulting point will be ``void'', a property that can be
2391 tested using
2393         isl_bool isl_point_is_void(__isl_keep isl_point *pnt);
2395 =head2 Functions
2397 Besides sets and relation, C<isl> also supports various types of functions.
2398 Each of these types is derived from the value type (see L</"Values">)
2399 or from one of two primitive function types
2400 through the application of zero or more type constructors.
2401 We first describe the primitive type and then we describe
2402 the types derived from these primitive types.
2404 =head3 Primitive Functions
2406 C<isl> support two primitive function types, quasi-affine
2407 expressions and quasipolynomials.
2408 A quasi-affine expression is defined either over a parameter
2409 space or over a set and is composed of integer constants,
2410 parameters and set variables, addition, subtraction and
2411 integer division by an integer constant.
2412 For example, the quasi-affine expression
2414         [n] -> { [x] -> [2*floor((4 n + x)/9] }
2416 maps C<x> to C<2*floor((4 n + x)/9>.
2417 A quasipolynomial is a polynomial expression in quasi-affine
2418 expression.  That is, it additionally allows for multiplication.
2419 Note, though, that it is not allowed to construct an integer
2420 division of an expression involving multiplications.
2421 Here is an example of a quasipolynomial that is not
2422 quasi-affine expression
2424         [n] -> { [x] -> (n*floor((4 n + x)/9) }
2426 Note that the external representations of quasi-affine expressions
2427 and quasipolynomials are different.  Quasi-affine expressions
2428 use a notation with square brackets just like binary relations,
2429 while quasipolynomials do not.  This might change at some point.
2431 If a primitive function is defined over a parameter space,
2432 then the space of the function itself is that of a set.
2433 If it is defined over a set, then the space of the function
2434 is that of a relation.  In both cases, the set space (or
2435 the output space) is single-dimensional, anonymous and unstructured.
2436 To create functions with multiple dimensions or with other kinds
2437 of set or output spaces, use multiple expressions
2438 (see L</"Multiple Expressions">).
2440 =over
2442 =item * Quasi-affine Expressions
2444 Besides the expressions described above, a quasi-affine
2445 expression can also be set to NaN.  Such expressions
2446 typically represent a failure to represent a result
2447 as a quasi-affine expression.
2449 The zero quasi affine expression or the quasi affine expression
2450 that is equal to a given value or
2451 a specified dimension on a given domain can be created using
2453         #include <isl/aff.h>
2454         __isl_give isl_aff *isl_aff_zero_on_domain(
2455                 __isl_take isl_local_space *ls);
2456         __isl_give isl_aff *isl_aff_val_on_domain(
2457                 __isl_take isl_local_space *ls,
2458                 __isl_take isl_val *val);
2459         __isl_give isl_aff *isl_aff_var_on_domain(
2460                 __isl_take isl_local_space *ls,
2461                 enum isl_dim_type type, unsigned pos);
2462         __isl_give isl_aff *isl_aff_nan_on_domain(
2463                 __isl_take isl_local_space *ls);
2465 Quasi affine expressions can be copied and freed using
2467         #include <isl/aff.h>
2468         __isl_give isl_aff *isl_aff_copy(
2469                 __isl_keep isl_aff *aff);
2470         __isl_null isl_aff *isl_aff_free(
2471                 __isl_take isl_aff *aff);
2473 A (rational) bound on a dimension can be extracted from an C<isl_constraint>
2474 using the following function.  The constraint is required to have
2475 a non-zero coefficient for the specified dimension.
2477         #include <isl/constraint.h>
2478         __isl_give isl_aff *isl_constraint_get_bound(
2479                 __isl_keep isl_constraint *constraint,
2480                 enum isl_dim_type type, int pos);
2482 The entire affine expression of the constraint can also be extracted
2483 using the following function.
2485         #include <isl/constraint.h>
2486         __isl_give isl_aff *isl_constraint_get_aff(
2487                 __isl_keep isl_constraint *constraint);
2489 Conversely, an equality constraint equating
2490 the affine expression to zero or an inequality constraint enforcing
2491 the affine expression to be non-negative, can be constructed using
2493         __isl_give isl_constraint *isl_equality_from_aff(
2494                 __isl_take isl_aff *aff);
2495         __isl_give isl_constraint *isl_inequality_from_aff(
2496                 __isl_take isl_aff *aff);
2498 The coefficients and the integer divisions of an affine expression
2499 can be inspected using the following functions.
2501         #include <isl/aff.h>
2502         __isl_give isl_val *isl_aff_get_constant_val(
2503                 __isl_keep isl_aff *aff);
2504         __isl_give isl_val *isl_aff_get_coefficient_val(
2505                 __isl_keep isl_aff *aff,
2506                 enum isl_dim_type type, int pos);
2507         int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff,
2508                 enum isl_dim_type type, int pos);
2509         __isl_give isl_val *isl_aff_get_denominator_val(
2510                 __isl_keep isl_aff *aff);
2511         __isl_give isl_aff *isl_aff_get_div(
2512                 __isl_keep isl_aff *aff, int pos);
2514 They can be modified using the following functions.
2516         #include <isl/aff.h>
2517         __isl_give isl_aff *isl_aff_set_constant_si(
2518                 __isl_take isl_aff *aff, int v);
2519         __isl_give isl_aff *isl_aff_set_constant_val(
2520                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2521         __isl_give isl_aff *isl_aff_set_coefficient_si(
2522                 __isl_take isl_aff *aff,
2523                 enum isl_dim_type type, int pos, int v);
2524         __isl_give isl_aff *isl_aff_set_coefficient_val(
2525                 __isl_take isl_aff *aff,
2526                 enum isl_dim_type type, int pos,
2527                 __isl_take isl_val *v);
2529         __isl_give isl_aff *isl_aff_add_constant_si(
2530                 __isl_take isl_aff *aff, int v);
2531         __isl_give isl_aff *isl_aff_add_constant_val(
2532                 __isl_take isl_aff *aff, __isl_take isl_val *v);
2533         __isl_give isl_aff *isl_aff_add_constant_num_si(
2534                 __isl_take isl_aff *aff, int v);
2535         __isl_give isl_aff *isl_aff_add_coefficient_si(
2536                 __isl_take isl_aff *aff,
2537                 enum isl_dim_type type, int pos, int v);
2538         __isl_give isl_aff *isl_aff_add_coefficient_val(
2539                 __isl_take isl_aff *aff,
2540                 enum isl_dim_type type, int pos,
2541                 __isl_take isl_val *v);
2543 Note that C<isl_aff_set_constant_si> and C<isl_aff_set_coefficient_si>
2544 set the I<numerator> of the constant or coefficient, while
2545 C<isl_aff_set_constant_val> and C<isl_aff_set_coefficient_val> set
2546 the constant or coefficient as a whole.
2547 The C<add_constant> and C<add_coefficient> functions add an integer
2548 or rational value to
2549 the possibly rational constant or coefficient.
2550 The C<add_constant_num> functions add an integer value to
2551 the numerator.
2553 =item * Quasipolynomials
2555 Some simple quasipolynomials can be created using the following functions.
2557         #include <isl/polynomial.h>
2558         __isl_give isl_qpolynomial *isl_qpolynomial_zero_on_domain(
2559                 __isl_take isl_space *domain);
2560         __isl_give isl_qpolynomial *isl_qpolynomial_one_on_domain(
2561                 __isl_take isl_space *domain);
2562         __isl_give isl_qpolynomial *isl_qpolynomial_infty_on_domain(
2563                 __isl_take isl_space *domain);
2564         __isl_give isl_qpolynomial *isl_qpolynomial_neginfty_on_domain(
2565                 __isl_take isl_space *domain);
2566         __isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(
2567                 __isl_take isl_space *domain);
2568         __isl_give isl_qpolynomial *isl_qpolynomial_val_on_domain(
2569                 __isl_take isl_space *domain,
2570                 __isl_take isl_val *val);
2571         __isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
2572                 __isl_take isl_space *domain,
2573                 enum isl_dim_type type, unsigned pos);
2574         __isl_give isl_qpolynomial *isl_qpolynomial_from_aff(
2575                 __isl_take isl_aff *aff);
2577 Recall that the space in which a quasipolynomial lives is a map space
2578 with a one-dimensional range.  The C<domain> argument in some of
2579 the functions above corresponds to the domain of this map space.
2581 Quasipolynomials can be copied and freed again using the following
2582 functions.
2584         #include <isl/polynomial.h>
2585         __isl_give isl_qpolynomial *isl_qpolynomial_copy(
2586                 __isl_keep isl_qpolynomial *qp);
2587         __isl_null isl_qpolynomial *isl_qpolynomial_free(
2588                 __isl_take isl_qpolynomial *qp);
2590 The constant term of a quasipolynomial can be extracted using
2592         __isl_give isl_val *isl_qpolynomial_get_constant_val(
2593                 __isl_keep isl_qpolynomial *qp);
2595 To iterate over all terms in a quasipolynomial,
2598         isl_stat isl_qpolynomial_foreach_term(
2599                 __isl_keep isl_qpolynomial *qp,
2600                 isl_stat (*fn)(__isl_take isl_term *term,
2601                           void *user), void *user);
2603 The terms themselves can be inspected and freed using
2604 these functions
2606         unsigned isl_term_dim(__isl_keep isl_term *term,
2607                 enum isl_dim_type type);
2608         __isl_give isl_val *isl_term_get_coefficient_val(
2609                 __isl_keep isl_term *term);
2610         int isl_term_get_exp(__isl_keep isl_term *term,
2611                 enum isl_dim_type type, unsigned pos);
2612         __isl_give isl_aff *isl_term_get_div(
2613                 __isl_keep isl_term *term, unsigned pos);
2614         void isl_term_free(__isl_take isl_term *term);
2616 Each term is a product of parameters, set variables and
2617 integer divisions.  The function C<isl_term_get_exp>
2618 returns the exponent of a given dimensions in the given term.
2620 =back
2622 =head3 Reductions
2624 A reduction represents a maximum or a minimum of its
2625 base expressions.
2626 The only reduction type defined by C<isl> is
2627 C<isl_qpolynomial_fold>.
2629 There are currently no functions to directly create such
2630 objects, but they do appear in the piecewise quasipolynomial
2631 reductions returned by the C<isl_pw_qpolynomial_bound> function.
2633 L</"Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions">.
2635 Reductions can be copied and freed using
2636 the following functions.
2638         #include <isl/polynomial.h>
2639         __isl_give isl_qpolynomial_fold *
2640         isl_qpolynomial_fold_copy(
2641                 __isl_keep isl_qpolynomial_fold *fold);
2642         void isl_qpolynomial_fold_free(
2643                 __isl_take isl_qpolynomial_fold *fold);
2645 To iterate over all quasipolynomials in a reduction, use
2647         isl_stat isl_qpolynomial_fold_foreach_qpolynomial(
2648                 __isl_keep isl_qpolynomial_fold *fold,
2649                 isl_stat (*fn)(__isl_take isl_qpolynomial *qp,
2650                           void *user), void *user);
2652 =head3 Multiple Expressions
2654 A multiple expression represents a sequence of zero or
2655 more base expressions, all defined on the same domain space.
2656 The domain space of the multiple expression is the same
2657 as that of the base expressions, but the range space
2658 can be any space.  In case the base expressions have
2659 a set space, the corresponding multiple expression
2660 also has a set space.
2661 Objects of the value type do not have an associated space.
2662 The space of a multiple value is therefore always a set space.
2663 Similarly, the space of a multiple union piecewise
2664 affine expression is always a set space.
2666 The multiple expression types defined by C<isl>
2667 are C<isl_multi_val>, C<isl_multi_aff>, C<isl_multi_pw_aff>,
2668 C<isl_multi_union_pw_aff>.
2670 A multiple expression with the value zero for
2671 each output (or set) dimension can be created
2672 using the following functions.
2674         #include <isl/val.h>
2675         __isl_give isl_multi_val *isl_multi_val_zero(
2676                 __isl_take isl_space *space);
2678         #include <isl/aff.h>
2679         __isl_give isl_multi_aff *isl_multi_aff_zero(
2680                 __isl_take isl_space *space);
2681         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_zero(
2682                 __isl_take isl_space *space);
2683         __isl_give isl_multi_union_pw_aff *
2684         isl_multi_union_pw_aff_zero(
2685                 __isl_take isl_space *space);
2687 Since there is no canonical way of representing a zero
2688 value of type C<isl_union_pw_aff>, the space passed
2689 to C<isl_multi_union_pw_aff_zero> needs to be zero-dimensional.
2691 An identity function can be created using the following
2692 functions.  The space needs to be that of a relation
2693 with the same number of input and output dimensions.
2695         #include <isl/aff.h>
2696         __isl_give isl_multi_aff *isl_multi_aff_identity(
2697                 __isl_take isl_space *space);
2698         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_identity(
2699                 __isl_take isl_space *space);
2701 A function that performs a projection on a universe
2702 relation or set can be created using the following functions.
2703 See also the corresponding
2704 projection operations in L</"Unary Operations">.
2706         #include <isl/aff.h>
2707         __isl_give isl_multi_aff *isl_multi_aff_domain_map(
2708                 __isl_take isl_space *space);
2709         __isl_give isl_multi_aff *isl_multi_aff_range_map(
2710                 __isl_take isl_space *space);
2711         __isl_give isl_multi_aff *isl_multi_aff_project_out_map(
2712                 __isl_take isl_space *space,
2713                 enum isl_dim_type type,
2714                 unsigned first, unsigned n);
2716 A multiple expression can be created from a single
2717 base expression using the following functions.
2718 The space of the created multiple expression is the same
2719 as that of the base expression, except for
2720 C<isl_multi_union_pw_aff_from_union_pw_aff> where the input
2721 lives in a parameter space and the output lives
2722 in a single-dimensional set space.
2724         #include <isl/aff.h>
2725         __isl_give isl_multi_aff *isl_multi_aff_from_aff(
2726                 __isl_take isl_aff *aff);
2727         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff(
2728                 __isl_take isl_pw_aff *pa);
2729         __isl_give isl_multi_union_pw_aff *
2730         isl_multi_union_pw_aff_from_union_pw_aff(
2731                 __isl_take isl_union_pw_aff *upa);
2733 A multiple expression can be created from a list
2734 of base expression in a specified space.
2735 The domain of this space needs to be the same
2736 as the domains of the base expressions in the list.
2737 If the base expressions have a set space (or no associated space),
2738 then this space also needs to be a set space.
2740         #include <isl/val.h>
2741         __isl_give isl_multi_val *isl_multi_val_from_val_list(
2742                 __isl_take isl_space *space,
2743                 __isl_take isl_val_list *list);
2745         #include <isl/aff.h>
2746         __isl_give isl_multi_aff *isl_multi_aff_from_aff_list(
2747                 __isl_take isl_space *space,
2748                 __isl_take isl_aff_list *list);
2749         __isl_give isl_multi_pw_aff *
2750         isl_multi_pw_aff_from_pw_aff_list(
2751                 __isl_take isl_space *space,
2752                 __isl_take isl_pw_aff_list *list);
2753         __isl_give isl_multi_union_pw_aff *
2754         isl_multi_union_pw_aff_from_union_pw_aff_list(
2755                 __isl_take isl_space *space,
2756                 __isl_take isl_union_pw_aff_list *list);
2758 As a convenience, a multiple piecewise expression can
2759 also be created from a multiple expression.
2760 Each piecewise expression in the result has a single
2761 universe cell.
2763         #include <isl/aff.h>
2764         __isl_give isl_multi_pw_aff *
2765         isl_multi_pw_aff_from_multi_aff(
2766                 __isl_take isl_multi_aff *ma);
2768 Similarly, a multiple union expression can be
2769 created from a multiple expression.
2771         #include <isl/aff.h>
2772         __isl_give isl_multi_union_pw_aff *
2773         isl_multi_union_pw_aff_from_multi_aff(
2774                 __isl_take isl_multi_aff *ma);
2775         __isl_give isl_multi_union_pw_aff *
2776         isl_multi_union_pw_aff_from_multi_pw_aff(
2777                 __isl_take isl_multi_pw_aff *mpa);
2779 A multiple quasi-affine expression can be created from
2780 a multiple value with a given domain space using the following
2781 function.
2783         #include <isl/aff.h>
2784         __isl_give isl_multi_aff *
2785         isl_multi_aff_multi_val_on_space(
2786                 __isl_take isl_space *space,
2787                 __isl_take isl_multi_val *mv);
2789 Similarly,
2790 a multiple union piecewise affine expression can be created from
2791 a multiple value with a given domain or
2792 a multiple affine expression with a given domain
2793 using the following functions.
2795         #include <isl/aff.h>
2796         __isl_give isl_multi_union_pw_aff *
2797         isl_multi_union_pw_aff_multi_val_on_domain(
2798                 __isl_take isl_union_set *domain,
2799                 __isl_take isl_multi_val *mv);
2800         __isl_give isl_multi_union_pw_aff *
2801         isl_multi_union_pw_aff_multi_aff_on_domain(
2802                 __isl_take isl_union_set *domain,
2803                 __isl_take isl_multi_aff *ma);
2805 Multiple expressions can be copied and freed using
2806 the following functions.
2808         #include <isl/val.h>
2809         __isl_give isl_multi_val *isl_multi_val_copy(
2810                 __isl_keep isl_multi_val *mv);
2811         __isl_null isl_multi_val *isl_multi_val_free(
2812                 __isl_take isl_multi_val *mv);
2814         #include <isl/aff.h>
2815         __isl_give isl_multi_aff *isl_multi_aff_copy(
2816                 __isl_keep isl_multi_aff *maff);
2817         __isl_null isl_multi_aff *isl_multi_aff_free(
2818                 __isl_take isl_multi_aff *maff);
2819         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_copy(
2820                 __isl_keep isl_multi_pw_aff *mpa);
2821         __isl_null isl_multi_pw_aff *isl_multi_pw_aff_free(
2822                 __isl_take isl_multi_pw_aff *mpa);
2823         __isl_give isl_multi_union_pw_aff *
2824         isl_multi_union_pw_aff_copy(
2825                 __isl_keep isl_multi_union_pw_aff *mupa);
2826         __isl_null isl_multi_union_pw_aff *
2827         isl_multi_union_pw_aff_free(
2828                 __isl_take isl_multi_union_pw_aff *mupa);
2830 The base expression at a given position of a multiple
2831 expression can be extracted using the following functions.
2833         #include <isl/val.h>
2834         __isl_give isl_val *isl_multi_val_get_val(
2835                 __isl_keep isl_multi_val *mv, int pos);
2837         #include <isl/aff.h>
2838         __isl_give isl_aff *isl_multi_aff_get_aff(
2839                 __isl_keep isl_multi_aff *multi, int pos);
2840         __isl_give isl_pw_aff *isl_multi_pw_aff_get_pw_aff(
2841                 __isl_keep isl_multi_pw_aff *mpa, int pos);
2842         __isl_give isl_union_pw_aff *
2843         isl_multi_union_pw_aff_get_union_pw_aff(
2844                 __isl_keep isl_multi_union_pw_aff *mupa, int pos);
2846 It can be replaced using the following functions.
2848         #include <isl/val.h>
2849         __isl_give isl_multi_val *isl_multi_val_set_val(
2850                 __isl_take isl_multi_val *mv, int pos,
2851                 __isl_take isl_val *val);
2853         #include <isl/aff.h>
2854         __isl_give isl_multi_aff *isl_multi_aff_set_aff(
2855                 __isl_take isl_multi_aff *multi, int pos,
2856                 __isl_take isl_aff *aff);
2857         __isl_give isl_multi_union_pw_aff *
2858         isl_multi_union_pw_aff_set_union_pw_aff(
2859                 __isl_take isl_multi_union_pw_aff *mupa, int pos,
2860                 __isl_take isl_union_pw_aff *upa);
2862 As a convenience, a sequence of base expressions that have
2863 their domains in a given space can be extracted from a sequence
2864 of union expressions using the following function.
2866         #include <isl/aff.h>
2867         __isl_give isl_multi_pw_aff *
2868         isl_multi_union_pw_aff_extract_multi_pw_aff(
2869                 __isl_keep isl_multi_union_pw_aff *mupa,
2870                 __isl_take isl_space *space);
2872 Note that there is a difference between C<isl_multi_union_pw_aff>
2873 and C<isl_union_pw_multi_aff> objects.  The first is a sequence
2874 of unions of piecewise expressions, while the second is a union
2875 of piecewise sequences.  In particular, multiple affine expressions
2876 in an C<isl_union_pw_multi_aff> may live in different spaces,
2877 while there is only a single multiple expression in
2878 an C<isl_multi_union_pw_aff>, which can therefore only live
2879 in a single space.  This means that not every
2880 C<isl_union_pw_multi_aff> can be converted to
2881 an C<isl_multi_union_pw_aff>.  Conversely, a zero-dimensional
2882 C<isl_multi_union_pw_aff> carries no information
2883 about any possible domain and therefore cannot be converted
2884 to an C<isl_union_pw_multi_aff>.  Moreover, the elements
2885 of an C<isl_multi_union_pw_aff> may be defined over different domains,
2886 while each multiple expression inside an C<isl_union_pw_multi_aff>
2887 has a single domain.  The conversion of an C<isl_union_pw_multi_aff>
2888 of dimension greater than one may therefore not be exact.
2889 The following functions can
2890 be used to perform these conversions when they are possible.
2892         #include <isl/aff.h>
2893         __isl_give isl_multi_union_pw_aff *
2894         isl_multi_union_pw_aff_from_union_pw_multi_aff(
2895                 __isl_take isl_union_pw_multi_aff *upma);
2896         __isl_give isl_union_pw_multi_aff *
2897         isl_union_pw_multi_aff_from_multi_union_pw_aff(
2898                 __isl_take isl_multi_union_pw_aff *mupa);
2900 =head3 Piecewise Expressions
2902 A piecewise expression is an expression that is described
2903 using zero or more base expression defined over the same
2904 number of cells in the domain space of the base expressions.
2905 All base expressions are defined over the same
2906 domain space and the cells are disjoint.
2907 The space of a piecewise expression is the same as
2908 that of the base expressions.
2909 If the union of the cells is a strict subset of the domain
2910 space, then the value of the piecewise expression outside
2911 this union is different for types derived from quasi-affine
2912 expressions and those derived from quasipolynomials.
2913 Piecewise expressions derived from quasi-affine expressions
2914 are considered to be undefined outside the union of their cells.
2915 Piecewise expressions derived from quasipolynomials
2916 are considered to be zero outside the union of their cells.
2918 Piecewise quasipolynomials are mainly used by the C<barvinok>
2919 library for representing the number of elements in a parametric set or map.
2920 For example, the piecewise quasipolynomial
2922         [n] -> { [x] -> ((1 + n) - x) : x <= n and x >= 0 }
2924 represents the number of points in the map
2926         [n] -> { [x] -> [y] : x,y >= 0 and 0 <= x + y <= n }
2928 The piecewise expression types defined by C<isl>
2929 are C<isl_pw_aff>, C<isl_pw_multi_aff>,
2930 C<isl_pw_qpolynomial> and C<isl_pw_qpolynomial_fold>.
2932 A piecewise expression with no cells can be created using
2933 the following functions.
2935         #include <isl/aff.h>
2936         __isl_give isl_pw_aff *isl_pw_aff_empty(
2937                 __isl_take isl_space *space);
2938         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(
2939                 __isl_take isl_space *space);
2941 A piecewise expression with a single universe cell can be
2942 created using the following functions.
2944         #include <isl/aff.h>
2945         __isl_give isl_pw_aff *isl_pw_aff_from_aff(
2946                 __isl_take isl_aff *aff);
2947         __isl_give isl_pw_multi_aff *
2948         isl_pw_multi_aff_from_multi_aff(
2949                 __isl_take isl_multi_aff *ma);
2951         #include <isl/polynomial.h>
2952         __isl_give isl_pw_qpolynomial *
2953         isl_pw_qpolynomial_from_qpolynomial(
2954                 __isl_take isl_qpolynomial *qp);
2956 A piecewise expression with a single specified cell can be
2957 created using the following functions.
2959         #include <isl/aff.h>
2960         __isl_give isl_pw_aff *isl_pw_aff_alloc(
2961                 __isl_take isl_set *set, __isl_take isl_aff *aff);
2962         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(
2963                 __isl_take isl_set *set,
2964                 __isl_take isl_multi_aff *maff);
2966         #include <isl/polynomial.h>
2967         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_alloc(
2968                 __isl_take isl_set *set,
2969                 __isl_take isl_qpolynomial *qp);
2971 The following convenience functions first create a base expression and
2972 then create a piecewise expression over a universe domain.
2974         #include <isl/aff.h>
2975         __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain(
2976                 __isl_take isl_local_space *ls);
2977         __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(
2978                 __isl_take isl_local_space *ls,
2979                 enum isl_dim_type type, unsigned pos);
2980         __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(
2981                 __isl_take isl_local_space *ls);
2982         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(
2983                 __isl_take isl_space *space);
2984         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity(
2985                 __isl_take isl_space *space);
2986         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map(
2987                 __isl_take isl_space *space);
2988         __isl_give isl_pw_multi_aff *
2989         isl_pw_multi_aff_project_out_map(
2990                 __isl_take isl_space *space,
2991                 enum isl_dim_type type,
2992                 unsigned first, unsigned n);
2994         #include <isl/polynomial.h>
2995         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_zero(
2996                 __isl_take isl_space *space);
2998 The following convenience functions first create a base expression and
2999 then create a piecewise expression over a given domain.
3001         #include <isl/aff.h>
3002         __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(
3003                 __isl_take isl_set *domain,
3004                 __isl_take isl_val *v);
3005         __isl_give isl_pw_multi_aff *
3006         isl_pw_multi_aff_multi_val_on_domain(
3007                 __isl_take isl_set *domain,
3008                 __isl_take isl_multi_val *mv);
3010 As a convenience, a piecewise multiple expression can
3011 also be created from a piecewise expression.
3012 Each multiple expression in the result is derived
3013 from the corresponding base expression.
3015         #include <isl/aff.h>
3016         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff(
3017                 __isl_take isl_pw_aff *pa);
3019 Similarly, a piecewise quasipolynomial can be
3020 created from a piecewise quasi-affine expression using
3021 the following function.
3023         #include <isl/polynomial.h>
3024         __isl_give isl_pw_qpolynomial *
3025         isl_pw_qpolynomial_from_pw_aff(
3026                 __isl_take isl_pw_aff *pwaff);
3028 Piecewise expressions can be copied and freed using the following functions.
3030         #include <isl/aff.h>
3031         __isl_give isl_pw_aff *isl_pw_aff_copy(
3032                 __isl_keep isl_pw_aff *pwaff);
3033         __isl_null isl_pw_aff *isl_pw_aff_free(
3034                 __isl_take isl_pw_aff *pwaff);
3035         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy(
3036                 __isl_keep isl_pw_multi_aff *pma);
3037         __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free(
3038                 __isl_take isl_pw_multi_aff *pma);
3040         #include <isl/polynomial.h>
3041         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_copy(
3042                 __isl_keep isl_pw_qpolynomial *pwqp);
3043         __isl_null isl_pw_qpolynomial *isl_pw_qpolynomial_free(
3044                 __isl_take isl_pw_qpolynomial *pwqp);
3045         __isl_give isl_pw_qpolynomial_fold *
3046         isl_pw_qpolynomial_fold_copy(
3047                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3048         __isl_null isl_pw_qpolynomial_fold *
3049         isl_pw_qpolynomial_fold_free(
3050                 __isl_take isl_pw_qpolynomial_fold *pwf);
3052 To iterate over the different cells of a piecewise expression,
3053 use the following functions.
3055         #include <isl/aff.h>
3056         isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff);
3057         int isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff);
3058         isl_stat isl_pw_aff_foreach_piece(
3059                 __isl_keep isl_pw_aff *pwaff,
3060                 isl_stat (*fn)(__isl_take isl_set *set,
3061                           __isl_take isl_aff *aff,
3062                           void *user), void *user);
3063         isl_stat isl_pw_multi_aff_foreach_piece(
3064                 __isl_keep isl_pw_multi_aff *pma,
3065                 isl_stat (*fn)(__isl_take isl_set *set,
3066                             __isl_take isl_multi_aff *maff,
3067                             void *user), void *user);
3069         #include <isl/polynomial.h>
3070         isl_stat isl_pw_qpolynomial_foreach_piece(
3071                 __isl_keep isl_pw_qpolynomial *pwqp,
3072                 isl_stat (*fn)(__isl_take isl_set *set,
3073                           __isl_take isl_qpolynomial *qp,
3074                           void *user), void *user);
3075         isl_stat isl_pw_qpolynomial_foreach_lifted_piece(
3076                 __isl_keep isl_pw_qpolynomial *pwqp,
3077                 isl_stat (*fn)(__isl_take isl_set *set,
3078                           __isl_take isl_qpolynomial *qp,
3079                           void *user), void *user);
3080         isl_stat isl_pw_qpolynomial_fold_foreach_piece(
3081                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3082                 isl_stat (*fn)(__isl_take isl_set *set,
3083                           __isl_take isl_qpolynomial_fold *fold,
3084                           void *user), void *user);
3085         isl_stat isl_pw_qpolynomial_fold_foreach_lifted_piece(
3086                 __isl_keep isl_pw_qpolynomial_fold *pwf,
3087                 isl_stat (*fn)(__isl_take isl_set *set,
3088                           __isl_take isl_qpolynomial_fold *fold,
3089                           void *user), void *user);
3091 As usual, the function C<fn> should return C<0> on success
3092 and C<-1> on failure.  The difference between
3093 C<isl_pw_qpolynomial_foreach_piece> and
3094 C<isl_pw_qpolynomial_foreach_lifted_piece> is that
3095 C<isl_pw_qpolynomial_foreach_lifted_piece> will first
3096 compute unique representations for all existentially quantified
3097 variables and then turn these existentially quantified variables
3098 into extra set variables, adapting the associated quasipolynomial
3099 accordingly.  This means that the C<set> passed to C<fn>
3100 will not have any existentially quantified variables, but that
3101 the dimensions of the sets may be different for different
3102 invocations of C<fn>.
3103 Similarly for C<isl_pw_qpolynomial_fold_foreach_piece>
3104 and C<isl_pw_qpolynomial_fold_foreach_lifted_piece>.
3106 A piecewise expression consisting of the expressions at a given
3107 position of a piecewise multiple expression can be extracted
3108 using the following function.
3110         #include <isl/aff.h>
3111         __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff(
3112                 __isl_keep isl_pw_multi_aff *pma, int pos);
3114 These expressions can be replaced using the following function.
3116         #include <isl/aff.h>
3117         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff(
3118                 __isl_take isl_pw_multi_aff *pma, unsigned pos,
3119                 __isl_take isl_pw_aff *pa);
3121 Note that there is a difference between C<isl_multi_pw_aff> and
3122 C<isl_pw_multi_aff> objects.  The first is a sequence of piecewise
3123 affine expressions, while the second is a piecewise sequence
3124 of affine expressions.  In particular, each of the piecewise
3125 affine expressions in an C<isl_multi_pw_aff> may have a different
3126 domain, while all multiple expressions associated to a cell
3127 in an C<isl_pw_multi_aff> have the same domain.
3128 It is possible to convert between the two, but when converting
3129 an C<isl_multi_pw_aff> to an C<isl_pw_multi_aff>, the domain
3130 of the result is the intersection of the domains of the input.
3131 The reverse conversion is exact.
3133         #include <isl/aff.h>
3134         __isl_give isl_pw_multi_aff *
3135         isl_pw_multi_aff_from_multi_pw_aff(
3136                 __isl_take isl_multi_pw_aff *mpa);
3137         __isl_give isl_multi_pw_aff *
3138         isl_multi_pw_aff_from_pw_multi_aff(
3139                 __isl_take isl_pw_multi_aff *pma);
3141 =head3 Union Expressions
3143 A union expression collects base expressions defined
3144 over different domains.  The space of a union expression
3145 is that of the shared parameter space.
3147 The union expression types defined by C<isl>
3148 are C<isl_union_pw_aff>, C<isl_union_pw_multi_aff>,
3149 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>.
3150 In case of
3151 C<isl_union_pw_aff>,
3152 C<isl_union_pw_qpolynomial> and C<isl_union_pw_qpolynomial_fold>,
3153 there can be at most one base expression for a given domain space.
3154 In case of
3155 C<isl_union_pw_multi_aff>,
3156 there can be multiple such expressions for a given domain space,
3157 but the domains of these expressions need to be disjoint.
3159 An empty union expression can be created using the following functions.
3161         #include <isl/aff.h>
3162         __isl_give isl_union_pw_aff *isl_union_pw_aff_empty(
3163                 __isl_take isl_space *space);
3164         __isl_give isl_union_pw_multi_aff *
3165         isl_union_pw_multi_aff_empty(
3166                 __isl_take isl_space *space);
3168         #include <isl/polynomial.h>
3169         __isl_give isl_union_pw_qpolynomial *
3170         isl_union_pw_qpolynomial_zero(
3171                 __isl_take isl_space *space);
3173 A union expression containing a single base expression
3174 can be created using the following functions.
3176         #include <isl/aff.h>
3177         __isl_give isl_union_pw_aff *
3178         isl_union_pw_aff_from_pw_aff(
3179                 __isl_take isl_pw_aff *pa);
3180         __isl_give isl_union_pw_multi_aff *
3181         isl_union_pw_multi_aff_from_aff(
3182                 __isl_take isl_aff *aff);
3183         __isl_give isl_union_pw_multi_aff *
3184         isl_union_pw_multi_aff_from_pw_multi_aff(
3185                 __isl_take isl_pw_multi_aff *pma);
3187         #include <isl/polynomial.h>
3188         __isl_give isl_union_pw_qpolynomial *
3189         isl_union_pw_qpolynomial_from_pw_qpolynomial(
3190                 __isl_take isl_pw_qpolynomial *pwqp);
3192 The following functions create a base expression on each
3193 of the sets in the union set and collect the results.
3195         #include <isl/aff.h>
3196         __isl_give isl_union_pw_multi_aff *
3197         isl_union_pw_multi_aff_from_union_pw_aff(
3198                 __isl_take isl_union_pw_aff *upa);
3199         __isl_give isl_union_pw_aff *
3200         isl_union_pw_multi_aff_get_union_pw_aff(
3201                 __isl_keep isl_union_pw_multi_aff *upma, int pos);
3202         __isl_give isl_union_pw_aff *
3203         isl_union_pw_aff_val_on_domain(
3204                 __isl_take isl_union_set *domain,
3205                 __isl_take isl_val *v);
3206         __isl_give isl_union_pw_multi_aff *
3207         isl_union_pw_multi_aff_multi_val_on_domain(
3208                 __isl_take isl_union_set *domain,
3209                 __isl_take isl_multi_val *mv);
3211 An C<isl_union_pw_aff> that is equal to a (parametric) affine
3212 expression on a given domain can be created using the following
3213 function.
3215         #include <isl/aff.h>
3216         __isl_give isl_union_pw_aff *
3217         isl_union_pw_aff_aff_on_domain(
3218                 __isl_take isl_union_set *domain,
3219                 __isl_take isl_aff *aff);
3221 A base expression can be added to a union expression using
3222 the following functions.
3224         #include <isl/aff.h>
3225         __isl_give isl_union_pw_aff *
3226         isl_union_pw_aff_add_pw_aff(
3227                 __isl_take isl_union_pw_aff *upa,
3228                 __isl_take isl_pw_aff *pa);
3229         __isl_give isl_union_pw_multi_aff *
3230         isl_union_pw_multi_aff_add_pw_multi_aff(
3231                 __isl_take isl_union_pw_multi_aff *upma,
3232                 __isl_take isl_pw_multi_aff *pma);
3234         #include <isl/polynomial.h>
3235         __isl_give isl_union_pw_qpolynomial *
3236         isl_union_pw_qpolynomial_add_pw_qpolynomial(
3237                 __isl_take isl_union_pw_qpolynomial *upwqp,
3238                 __isl_take isl_pw_qpolynomial *pwqp);
3240 Union expressions can be copied and freed using
3241 the following functions.
3243         #include <isl/aff.h>
3244         __isl_give isl_union_pw_aff *isl_union_pw_aff_copy(
3245                 __isl_keep isl_union_pw_aff *upa);
3246         __isl_null isl_union_pw_aff *isl_union_pw_aff_free(
3247                 __isl_take isl_union_pw_aff *upa);
3248         __isl_give isl_union_pw_multi_aff *
3249         isl_union_pw_multi_aff_copy(
3250                 __isl_keep isl_union_pw_multi_aff *upma);
3251         __isl_null isl_union_pw_multi_aff *
3252         isl_union_pw_multi_aff_free(
3253                 __isl_take isl_union_pw_multi_aff *upma);
3255         #include <isl/polynomial.h>
3256         __isl_give isl_union_pw_qpolynomial *
3257         isl_union_pw_qpolynomial_copy(
3258                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3259         __isl_null isl_union_pw_qpolynomial *
3260         isl_union_pw_qpolynomial_free(
3261                 __isl_take isl_union_pw_qpolynomial *upwqp);
3262         __isl_give isl_union_pw_qpolynomial_fold *
3263         isl_union_pw_qpolynomial_fold_copy(
3264                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3265         __isl_null isl_union_pw_qpolynomial_fold *
3266         isl_union_pw_qpolynomial_fold_free(
3267                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
3269 To iterate over the base expressions in a union expression,
3270 use the following functions.
3272         #include <isl/aff.h>
3273         int isl_union_pw_aff_n_pw_aff(
3274                 __isl_keep isl_union_pw_aff *upa);
3275         isl_stat isl_union_pw_aff_foreach_pw_aff(
3276                 __isl_keep isl_union_pw_aff *upa,
3277                 isl_stat (*fn)(__isl_take isl_pw_aff *pa,
3278                         void *user), void *user);
3279         int isl_union_pw_multi_aff_n_pw_multi_aff(
3280                 __isl_keep isl_union_pw_multi_aff *upma);
3281         isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff(
3282                 __isl_keep isl_union_pw_multi_aff *upma,
3283                 isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma,
3284                             void *user), void *user);
3286         #include <isl/polynomial.h>
3287         int isl_union_pw_qpolynomial_n_pw_qpolynomial(
3288                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3289         isl_stat isl_union_pw_qpolynomial_foreach_pw_qpolynomial(
3290                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3291                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial *pwqp,
3292                             void *user), void *user);
3293         int isl_union_pw_qpolynomial_fold_n_pw_qpolynomial_fold(
3294                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3295         isl_stat isl_union_pw_qpolynomial_fold_foreach_pw_qpolynomial_fold(
3296                 __isl_keep isl_union_pw_qpolynomial_fold *upwf,
3297                 isl_stat (*fn)(__isl_take isl_pw_qpolynomial_fold *pwf,
3298                             void *user), void *user);
3300 To extract the base expression in a given space from a union, use
3301 the following functions.
3303         #include <isl/aff.h>
3304         __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff(
3305                 __isl_keep isl_union_pw_aff *upa,
3306                 __isl_take isl_space *space);
3307         __isl_give isl_pw_multi_aff *
3308         isl_union_pw_multi_aff_extract_pw_multi_aff(
3309                 __isl_keep isl_union_pw_multi_aff *upma,
3310                 __isl_take isl_space *space);
3312         #include <isl/polynomial.h>
3313         __isl_give isl_pw_qpolynomial *
3314         isl_union_pw_qpolynomial_extract_pw_qpolynomial(
3315                 __isl_keep isl_union_pw_qpolynomial *upwqp,
3316                 __isl_take isl_space *space);
3318 =head2 Input and Output
3320 For set and relation,
3321 C<isl> supports its own input/output format, which is similar
3322 to the C<Omega> format, but also supports the C<PolyLib> format
3323 in some cases.
3324 For other object types, typically only an C<isl> format is supported.
3326 =head3 C<isl> format
3328 The C<isl> format is similar to that of C<Omega>, but has a different
3329 syntax for describing the parameters and allows for the definition
3330 of an existentially quantified variable as the integer division
3331 of an affine expression.
3332 For example, the set of integers C<i> between C<0> and C<n>
3333 such that C<i % 10 <= 6> can be described as
3335         [n] -> { [i] : exists (a = [i/10] : 0 <= i and i <= n and
3336                                 i - 10 a <= 6) }
3338 A set or relation can have several disjuncts, separated
3339 by the keyword C<or>.  Each disjunct is either a conjunction
3340 of constraints or a projection (C<exists>) of a conjunction
3341 of constraints.  The constraints are separated by the keyword
3342 C<and>.
3344 =head3 C<PolyLib> format
3346 If the represented set is a union, then the first line
3347 contains a single number representing the number of disjuncts.
3348 Otherwise, a line containing the number C<1> is optional.
3350 Each disjunct is represented by a matrix of constraints.
3351 The first line contains two numbers representing
3352 the number of rows and columns,
3353 where the number of rows is equal to the number of constraints
3354 and the number of columns is equal to two plus the number of variables.
3355 The following lines contain the actual rows of the constraint matrix.
3356 In each row, the first column indicates whether the constraint
3357 is an equality (C<0>) or inequality (C<1>).  The final column
3358 corresponds to the constant term.
3360 If the set is parametric, then the coefficients of the parameters
3361 appear in the last columns before the constant column.
3362 The coefficients of any existentially quantified variables appear
3363 between those of the set variables and those of the parameters.
3365 =head3 Extended C<PolyLib> format
3367 The extended C<PolyLib> format is nearly identical to the
3368 C<PolyLib> format.  The only difference is that the line
3369 containing the number of rows and columns of a constraint matrix
3370 also contains four additional numbers:
3371 the number of output dimensions, the number of input dimensions,
3372 the number of local dimensions (i.e., the number of existentially
3373 quantified variables) and the number of parameters.
3374 For sets, the number of ``output'' dimensions is equal
3375 to the number of set dimensions, while the number of ``input''
3376 dimensions is zero.
3378 =head3 Input
3380 Objects can be read from input using the following functions.
3382         #include <isl/val.h>
3383         __isl_give isl_val *isl_val_read_from_str(isl_ctx *ctx,
3384                 const char *str);
3385         __isl_give isl_multi_val *isl_multi_val_read_from_str(
3386                 isl_ctx *ctx, const char *str);
3388         #include <isl/set.h>
3389         __isl_give isl_basic_set *isl_basic_set_read_from_file(
3390                 isl_ctx *ctx, FILE *input);
3391         __isl_give isl_basic_set *isl_basic_set_read_from_str(
3392                 isl_ctx *ctx, const char *str);
3393         __isl_give isl_set *isl_set_read_from_file(isl_ctx *ctx,
3394                 FILE *input);
3395         __isl_give isl_set *isl_set_read_from_str(isl_ctx *ctx,
3396                 const char *str);
3398         #include <isl/map.h>
3399         __isl_give isl_basic_map *isl_basic_map_read_from_file(
3400                 isl_ctx *ctx, FILE *input);
3401         __isl_give isl_basic_map *isl_basic_map_read_from_str(
3402                 isl_ctx *ctx, const char *str);
3403         __isl_give isl_map *isl_map_read_from_file(
3404                 isl_ctx *ctx, FILE *input);
3405         __isl_give isl_map *isl_map_read_from_str(isl_ctx *ctx,
3406                 const char *str);
3408         #include <isl/union_set.h>
3409         __isl_give isl_union_set *isl_union_set_read_from_file(
3410                 isl_ctx *ctx, FILE *input);
3411         __isl_give isl_union_set *isl_union_set_read_from_str(
3412                 isl_ctx *ctx, const char *str);
3414         #include <isl/union_map.h>
3415         __isl_give isl_union_map *isl_union_map_read_from_file(
3416                 isl_ctx *ctx, FILE *input);
3417         __isl_give isl_union_map *isl_union_map_read_from_str(
3418                 isl_ctx *ctx, const char *str);
3420         #include <isl/aff.h>
3421         __isl_give isl_aff *isl_aff_read_from_str(
3422                 isl_ctx *ctx, const char *str);
3423         __isl_give isl_multi_aff *isl_multi_aff_read_from_str(
3424                 isl_ctx *ctx, const char *str);
3425         __isl_give isl_pw_aff *isl_pw_aff_read_from_str(
3426                 isl_ctx *ctx, const char *str);
3427         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(
3428                 isl_ctx *ctx, const char *str);
3429         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(
3430                 isl_ctx *ctx, const char *str);
3431         __isl_give isl_union_pw_aff *
3432         isl_union_pw_aff_read_from_str(
3433                 isl_ctx *ctx, const char *str);
3434         __isl_give isl_union_pw_multi_aff *
3435         isl_union_pw_multi_aff_read_from_str(
3436                 isl_ctx *ctx, const char *str);
3437         __isl_give isl_multi_union_pw_aff *
3438         isl_multi_union_pw_aff_read_from_str(
3439                 isl_ctx *ctx, const char *str);
3441         #include <isl/polynomial.h>
3442         __isl_give isl_union_pw_qpolynomial *
3443         isl_union_pw_qpolynomial_read_from_str(
3444                 isl_ctx *ctx, const char *str);
3446 For sets and relations,
3447 the input format is autodetected and may be either the C<PolyLib> format
3448 or the C<isl> format.
3450 =head3 Output
3452 Before anything can be printed, an C<isl_printer> needs to
3453 be created.
3455         __isl_give isl_printer *isl_printer_to_file(isl_ctx *ctx,
3456                 FILE *file);
3457         __isl_give isl_printer *isl_printer_to_str(isl_ctx *ctx);
3458         __isl_null isl_printer *isl_printer_free(
3459                 __isl_take isl_printer *printer);
3461 C<isl_printer_to_file> prints to the given file, while
3462 C<isl_printer_to_str> prints to a string that can be extracted
3463 using the following function.
3465         #include <isl/printer.h>
3466         __isl_give char *isl_printer_get_str(
3467                 __isl_keep isl_printer *printer);
3469 The printer can be inspected using the following functions.
3471         FILE *isl_printer_get_file(
3472                 __isl_keep isl_printer *printer);
3473         int isl_printer_get_output_format(
3474                 __isl_keep isl_printer *p);
3475         int isl_printer_get_yaml_style(__isl_keep isl_printer *p);
3477 The behavior of the printer can be modified in various ways
3479         __isl_give isl_printer *isl_printer_set_output_format(
3480                 __isl_take isl_printer *p, int output_format);
3481         __isl_give isl_printer *isl_printer_set_indent(
3482                 __isl_take isl_printer *p, int indent);
3483         __isl_give isl_printer *isl_printer_set_indent_prefix(
3484                 __isl_take isl_printer *p, const char *prefix);
3485         __isl_give isl_printer *isl_printer_indent(
3486                 __isl_take isl_printer *p, int indent);
3487         __isl_give isl_printer *isl_printer_set_prefix(
3488                 __isl_take isl_printer *p, const char *prefix);
3489         __isl_give isl_printer *isl_printer_set_suffix(
3490                 __isl_take isl_printer *p, const char *suffix);
3491         __isl_give isl_printer *isl_printer_set_yaml_style(
3492                 __isl_take isl_printer *p, int yaml_style);
3494 The C<output_format> may be either C<ISL_FORMAT_ISL>, C<ISL_FORMAT_OMEGA>,
3495 C<ISL_FORMAT_POLYLIB>, C<ISL_FORMAT_EXT_POLYLIB> or C<ISL_FORMAT_LATEX>
3496 and defaults to C<ISL_FORMAT_ISL>.
3497 Each line in the output is prefixed by C<indent_prefix>,
3498 indented by C<indent> (set by C<isl_printer_set_indent>) spaces
3499 (default: 0), prefixed by C<prefix> and suffixed by C<suffix>.
3500 In the C<PolyLib> format output,
3501 the coefficients of the existentially quantified variables
3502 appear between those of the set variables and those
3503 of the parameters.
3504 The function C<isl_printer_indent> increases the indentation
3505 by the specified amount (which may be negative).
3506 The YAML style may be either C<ISL_YAML_STYLE_BLOCK> or
3507 C<ISL_YAML_STYLE_FLOW> and when we are printing something
3508 in YAML format.
3510 To actually print something, use
3512         #include <isl/printer.h>
3513         __isl_give isl_printer *isl_printer_print_double(
3514                 __isl_take isl_printer *p, double d);
3516         #include <isl/val.h>
3517         __isl_give isl_printer *isl_printer_print_val(
3518                 __isl_take isl_printer *p, __isl_keep isl_val *v);
3520         #include <isl/set.h>
3521         __isl_give isl_printer *isl_printer_print_basic_set(
3522                 __isl_take isl_printer *printer,
3523                 __isl_keep isl_basic_set *bset);
3524         __isl_give isl_printer *isl_printer_print_set(
3525                 __isl_take isl_printer *printer,
3526                 __isl_keep isl_set *set);
3528         #include <isl/map.h>
3529         __isl_give isl_printer *isl_printer_print_basic_map(
3530                 __isl_take isl_printer *printer,
3531                 __isl_keep isl_basic_map *bmap);
3532         __isl_give isl_printer *isl_printer_print_map(
3533                 __isl_take isl_printer *printer,
3534                 __isl_keep isl_map *map);
3536         #include <isl/union_set.h>
3537         __isl_give isl_printer *isl_printer_print_union_set(
3538                 __isl_take isl_printer *p,
3539                 __isl_keep isl_union_set *uset);
3541         #include <isl/union_map.h>
3542         __isl_give isl_printer *isl_printer_print_union_map(
3543                 __isl_take isl_printer *p,
3544                 __isl_keep isl_union_map *umap);
3546         #include <isl/val.h>
3547         __isl_give isl_printer *isl_printer_print_multi_val(
3548                 __isl_take isl_printer *p,
3549                 __isl_keep isl_multi_val *mv);
3551         #include <isl/aff.h>
3552         __isl_give isl_printer *isl_printer_print_aff(
3553                 __isl_take isl_printer *p, __isl_keep isl_aff *aff);
3554         __isl_give isl_printer *isl_printer_print_multi_aff(
3555                 __isl_take isl_printer *p,
3556                 __isl_keep isl_multi_aff *maff);
3557         __isl_give isl_printer *isl_printer_print_pw_aff(
3558                 __isl_take isl_printer *p,
3559                 __isl_keep isl_pw_aff *pwaff);
3560         __isl_give isl_printer *isl_printer_print_pw_multi_aff(
3561                 __isl_take isl_printer *p,
3562                 __isl_keep isl_pw_multi_aff *pma);
3563         __isl_give isl_printer *isl_printer_print_multi_pw_aff(
3564                 __isl_take isl_printer *p,
3565                 __isl_keep isl_multi_pw_aff *mpa);
3566         __isl_give isl_printer *isl_printer_print_union_pw_aff(
3567                 __isl_take isl_printer *p,
3568                 __isl_keep isl_union_pw_aff *upa);
3569         __isl_give isl_printer *isl_printer_print_union_pw_multi_aff(
3570                 __isl_take isl_printer *p,
3571                 __isl_keep isl_union_pw_multi_aff *upma);
3572         __isl_give isl_printer *
3573         isl_printer_print_multi_union_pw_aff(
3574                 __isl_take isl_printer *p,
3575                 __isl_keep isl_multi_union_pw_aff *mupa);
3577         #include <isl/polynomial.h>
3578         __isl_give isl_printer *isl_printer_print_qpolynomial(
3579                 __isl_take isl_printer *p,
3580                 __isl_keep isl_qpolynomial *qp);
3581         __isl_give isl_printer *isl_printer_print_pw_qpolynomial(
3582                 __isl_take isl_printer *p,
3583                 __isl_keep isl_pw_qpolynomial *pwqp);
3584         __isl_give isl_printer *isl_printer_print_union_pw_qpolynomial(
3585                 __isl_take isl_printer *p,
3586                 __isl_keep isl_union_pw_qpolynomial *upwqp);
3588         __isl_give isl_printer *
3589         isl_printer_print_pw_qpolynomial_fold(
3590                 __isl_take isl_printer *p,
3591                 __isl_keep isl_pw_qpolynomial_fold *pwf);
3592         __isl_give isl_printer *
3593         isl_printer_print_union_pw_qpolynomial_fold(
3594                 __isl_take isl_printer *p,
3595                 __isl_keep isl_union_pw_qpolynomial_fold *upwf);
3597 For C<isl_printer_print_qpolynomial>,
3598 C<isl_printer_print_pw_qpolynomial> and
3599 C<isl_printer_print_pw_qpolynomial_fold>,
3600 the output format of the printer
3601 needs to be set to either C<ISL_FORMAT_ISL> or C<ISL_FORMAT_C>.
3602 For C<isl_printer_print_union_pw_qpolynomial> and
3603 C<isl_printer_print_union_pw_qpolynomial_fold>, only C<ISL_FORMAT_ISL>
3604 is supported.
3605 In case of printing in C<ISL_FORMAT_C>, the user may want
3606 to set the names of all dimensions first.
3608 C<isl> also provides limited support for printing YAML documents,
3609 just enough for the internal use for printing such documents.
3611         #include <isl/printer.h>
3612         __isl_give isl_printer *isl_printer_yaml_start_mapping(
3613                 __isl_take isl_printer *p);
3614         __isl_give isl_printer *isl_printer_yaml_end_mapping(
3615                 __isl_take isl_printer *p);
3616         __isl_give isl_printer *isl_printer_yaml_start_sequence(
3617                 __isl_take isl_printer *p);
3618         __isl_give isl_printer *isl_printer_yaml_end_sequence(
3619                 __isl_take isl_printer *p);
3620         __isl_give isl_printer *isl_printer_yaml_next(
3621                 __isl_take isl_printer *p);
3623 A document is started by a call to either
3624 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3625 Anything printed to the printer after such a call belong to the
3626 first key of the mapping or the first element in the sequence.
3627 The function C<isl_printer_yaml_next> moves to the value if
3628 we are currently printing a mapping key, the next key if we
3629 are printing a value or the next element if we are printing
3630 an element in a sequence.
3631 Nested mappings and sequences are initiated by the same
3632 C<isl_printer_yaml_start_mapping> or C<isl_printer_yaml_start_sequence>.
3633 Each call to these functions needs to have a corresponding call to
3634 C<isl_printer_yaml_end_mapping> or C<isl_printer_yaml_end_sequence>.
3636 When called on a file printer, the following function flushes
3637 the file.  When called on a string printer, the buffer is cleared.
3639         __isl_give isl_printer *isl_printer_flush(
3640                 __isl_take isl_printer *p);
3642 The following functions allow the user to attach
3643 notes to a printer in order to keep track of additional state.
3645         #include <isl/printer.h>
3646         isl_bool isl_printer_has_note(__isl_keep isl_printer *p,
3647                 __isl_keep isl_id *id);
3648         __isl_give isl_id *isl_printer_get_note(
3649                 __isl_keep isl_printer *p, __isl_take isl_id *id);
3650         __isl_give isl_printer *isl_printer_set_note(
3651                 __isl_take isl_printer *p,
3652                 __isl_take isl_id *id, __isl_take isl_id *note);
3654 C<isl_printer_set_note> associates the given note to the given
3655 identifier in the printer.
3656 C<isl_printer_get_note> retrieves a note associated to an
3657 identifier, while
3658 C<isl_printer_has_note> checks if there is such a note.
3659 C<isl_printer_get_note> fails if the requested note does not exist.
3661 Alternatively, a string representation can be obtained
3662 directly using the following functions, which always print
3663 in isl format.
3665         #include <isl/space.h>
3666         __isl_give char *isl_space_to_str(
3667                 __isl_keep isl_space *space);
3669         #include <isl/val.h>
3670         __isl_give char *isl_val_to_str(__isl_keep isl_val *v);
3671         __isl_give char *isl_multi_val_to_str(
3672                 __isl_keep isl_multi_val *mv);
3674         #include <isl/set.h>
3675         __isl_give char *isl_set_to_str(
3676                 __isl_keep isl_set *set);
3678         #include <isl/union_set.h>
3679         __isl_give char *isl_union_set_to_str(
3680                 __isl_keep isl_union_set *uset);
3682         #include <isl/map.h>
3683         __isl_give char *isl_map_to_str(
3684                 __isl_keep isl_map *map);
3686         #include <isl/union_map.h>
3687         __isl_give char *isl_union_map_to_str(
3688                 __isl_keep isl_union_map *umap);
3690         #include <isl/aff.h>
3691         __isl_give char *isl_aff_to_str(__isl_keep isl_aff *aff);
3692         __isl_give char *isl_pw_aff_to_str(
3693                 __isl_keep isl_pw_aff *pa);
3694         __isl_give char *isl_multi_aff_to_str(
3695                 __isl_keep isl_multi_aff *ma);
3696         __isl_give char *isl_pw_multi_aff_to_str(
3697                 __isl_keep isl_pw_multi_aff *pma);
3698         __isl_give char *isl_multi_pw_aff_to_str(
3699                 __isl_keep isl_multi_pw_aff *mpa);
3700         __isl_give char *isl_union_pw_aff_to_str(
3701                 __isl_keep isl_union_pw_aff *upa);
3702         __isl_give char *isl_union_pw_multi_aff_to_str(
3703                 __isl_keep isl_union_pw_multi_aff *upma);
3704         __isl_give char *isl_multi_union_pw_aff_to_str(
3705                 __isl_keep isl_multi_union_pw_aff *mupa);
3707 =head2 Properties
3709 =head3 Unary Properties
3711 =over
3713 =item * Emptiness
3715 The following functions test whether the given set or relation
3716 contains any integer points.  The ``plain'' variants do not perform
3717 any computations, but simply check if the given set or relation
3718 is already known to be empty.
3720         isl_bool isl_basic_set_plain_is_empty(
3721                 __isl_keep isl_basic_set *bset);
3722         isl_bool isl_basic_set_is_empty(
3723                 __isl_keep isl_basic_set *bset);
3724         isl_bool isl_set_plain_is_empty(
3725                 __isl_keep isl_set *set);
3726         isl_bool isl_set_is_empty(__isl_keep isl_set *set);
3727         isl_bool isl_union_set_is_empty(
3728                 __isl_keep isl_union_set *uset);
3729         isl_bool isl_basic_map_plain_is_empty(
3730                 __isl_keep isl_basic_map *bmap);
3731         isl_bool isl_basic_map_is_empty(
3732                 __isl_keep isl_basic_map *bmap);
3733         isl_bool isl_map_plain_is_empty(
3734                 __isl_keep isl_map *map);
3735         isl_bool isl_map_is_empty(__isl_keep isl_map *map);
3736         isl_bool isl_union_map_is_empty(
3737                 __isl_keep isl_union_map *umap);
3739 =item * Universality
3741         isl_bool isl_basic_set_plain_is_universe(
3742                 __isl_keep isl_basic_set *bset);
3743         isl_bool isl_basic_set_is_universe(
3744                 __isl_keep isl_basic_set *bset);
3745         isl_bool isl_basic_map_plain_is_universe(
3746                 __isl_keep isl_basic_map *bmap);
3747         isl_bool isl_basic_map_is_universe(
3748                 __isl_keep isl_basic_map *bmap);
3749         isl_bool isl_set_plain_is_universe(
3750                 __isl_keep isl_set *set);
3751         isl_bool isl_map_plain_is_universe(
3752                 __isl_keep isl_map *map);
3754 =item * Single-valuedness
3756         #include <isl/set.h>
3757         isl_bool isl_set_is_singleton(__isl_keep isl_set *set);
3759         #include <isl/map.h>
3760         isl_bool isl_basic_map_is_single_valued(
3761                 __isl_keep isl_basic_map *bmap);
3762         isl_bool isl_map_plain_is_single_valued(
3763                 __isl_keep isl_map *map);
3764         isl_bool isl_map_is_single_valued(__isl_keep isl_map *map);
3766         #include <isl/union_map.h>
3767         isl_bool isl_union_map_is_single_valued(
3768                 __isl_keep isl_union_map *umap);
3770 =item * Injectivity
3772         isl_bool isl_map_plain_is_injective(
3773                 __isl_keep isl_map *map);
3774         isl_bool isl_map_is_injective(
3775                 __isl_keep isl_map *map);
3776         isl_bool isl_union_map_plain_is_injective(
3777                 __isl_keep isl_union_map *umap);
3778         isl_bool isl_union_map_is_injective(
3779                 __isl_keep isl_union_map *umap);
3781 =item * Bijectivity
3783         isl_bool isl_map_is_bijective(
3784                 __isl_keep isl_map *map);
3785         isl_bool isl_union_map_is_bijective(
3786                 __isl_keep isl_union_map *umap);
3788 =item * Identity
3790 The following functions test whether the given relation
3791 only maps elements to themselves.
3793         #include <isl/map.h>
3794         isl_bool isl_map_is_identity(
3795                 __isl_keep isl_map *map);
3797         #include <isl/union_map.h>
3798         isl_bool isl_union_map_is_identity(
3799                 __isl_keep isl_union_map *umap);
3801 =item * Position
3803         __isl_give isl_val *
3804         isl_basic_map_plain_get_val_if_fixed(
3805                 __isl_keep isl_basic_map *bmap,
3806                 enum isl_dim_type type, unsigned pos);
3807         __isl_give isl_val *isl_set_plain_get_val_if_fixed(
3808                 __isl_keep isl_set *set,
3809                 enum isl_dim_type type, unsigned pos);
3810         __isl_give isl_val *isl_map_plain_get_val_if_fixed(
3811                 __isl_keep isl_map *map,
3812                 enum isl_dim_type type, unsigned pos);
3814 If the set or relation obviously lies on a hyperplane where the given dimension
3815 has a fixed value, then return that value.
3816 Otherwise return NaN.
3818 =item * Stride
3820         isl_stat isl_set_dim_residue_class_val(
3821                 __isl_keep isl_set *set,
3822                 int pos, __isl_give isl_val **modulo,
3823                 __isl_give isl_val **residue);
3825 Check if the values of the given set dimension are equal to a fixed
3826 value modulo some integer value.  If so, assign the modulo to C<*modulo>
3827 and the fixed value to C<*residue>.  If the given dimension attains only
3828 a single value, then assign C<0> to C<*modulo> and the fixed value to
3829 C<*residue>.
3830 If the dimension does not attain only a single value and if no modulo
3831 can be found then assign C<1> to C<*modulo> and C<1> to C<*residue>.
3833 =item * Dependence
3835 To check whether the description of a set, relation or function depends
3836 on one or more given dimensions,
3837 the following functions can be used.
3839         #include <isl/constraint.h>
3840         isl_bool isl_constraint_involves_dims(
3841                 __isl_keep isl_constraint *constraint,
3842                 enum isl_dim_type type, unsigned first, unsigned n);
3844         #include <isl/set.h>
3845         isl_bool isl_basic_set_involves_dims(
3846                 __isl_keep isl_basic_set *bset,
3847                 enum isl_dim_type type, unsigned first, unsigned n);
3848         isl_bool isl_set_involves_dims(__isl_keep isl_set *set,
3849                 enum isl_dim_type type, unsigned first, unsigned n);
3851         #include <isl/map.h>
3852         isl_bool isl_basic_map_involves_dims(
3853                 __isl_keep isl_basic_map *bmap,
3854                 enum isl_dim_type type, unsigned first, unsigned n);
3855         isl_bool isl_map_involves_dims(__isl_keep isl_map *map,
3856                 enum isl_dim_type type, unsigned first, unsigned n);
3858         #include <isl/union_map.h>
3859         isl_bool isl_union_map_involves_dims(
3860                 __isl_keep isl_union_map *umap,
3861                 enum isl_dim_type type, unsigned first, unsigned n);
3863         #include <isl/aff.h>
3864         isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff,
3865                 enum isl_dim_type type, unsigned first, unsigned n);
3866         isl_bool isl_pw_aff_involves_dims(
3867                 __isl_keep isl_pw_aff *pwaff,
3868                 enum isl_dim_type type, unsigned first, unsigned n);
3869         isl_bool isl_multi_aff_involves_dims(
3870                 __isl_keep isl_multi_aff *ma,
3871                 enum isl_dim_type type, unsigned first, unsigned n);
3872         isl_bool isl_multi_pw_aff_involves_dims(
3873                 __isl_keep isl_multi_pw_aff *mpa,
3874                 enum isl_dim_type type, unsigned first, unsigned n);
3876         #include <isl/polynomial.h>
3877         isl_bool isl_qpolynomial_involves_dims(
3878                 __isl_keep isl_qpolynomial *qp,
3879                 enum isl_dim_type type, unsigned first, unsigned n);
3881 Similarly, the following functions can be used to check whether
3882 a given dimension is involved in any lower or upper bound.
3884         #include <isl/set.h>
3885         isl_bool isl_set_dim_has_any_lower_bound(
3886                 __isl_keep isl_set *set,
3887                 enum isl_dim_type type, unsigned pos);
3888         isl_bool isl_set_dim_has_any_upper_bound(
3889                 __isl_keep isl_set *set,
3890                 enum isl_dim_type type, unsigned pos);
3892 Note that these functions return true even if there is a bound on
3893 the dimension on only some of the basic sets of C<set>.
3894 To check if they have a bound for all of the basic sets in C<set>,
3895 use the following functions instead.
3897         #include <isl/set.h>
3898         isl_bool isl_set_dim_has_lower_bound(
3899                 __isl_keep isl_set *set,
3900                 enum isl_dim_type type, unsigned pos);
3901         isl_bool isl_set_dim_has_upper_bound(
3902                 __isl_keep isl_set *set,
3903                 enum isl_dim_type type, unsigned pos);
3905 =item * Space
3907 To check whether a set is a parameter domain, use this function:
3909         isl_bool isl_set_is_params(__isl_keep isl_set *set);
3910         isl_bool isl_union_set_is_params(
3911                 __isl_keep isl_union_set *uset);
3913 =item * Wrapping
3915 The following functions check whether the space of the given
3916 (basic) set or relation range is a wrapped relation.
3918         #include <isl/space.h>
3919         isl_bool isl_space_is_wrapping(
3920                 __isl_keep isl_space *space);
3921         isl_bool isl_space_domain_is_wrapping(
3922                 __isl_keep isl_space *space);
3923         isl_bool isl_space_range_is_wrapping(
3924                 __isl_keep isl_space *space);
3926         #include <isl/set.h>
3927         isl_bool isl_basic_set_is_wrapping(
3928                 __isl_keep isl_basic_set *bset);
3929         isl_bool isl_set_is_wrapping(__isl_keep isl_set *set);
3931         #include <isl/map.h>
3932         isl_bool isl_map_domain_is_wrapping(
3933                 __isl_keep isl_map *map);
3934         isl_bool isl_map_range_is_wrapping(
3935                 __isl_keep isl_map *map);
3937         #include <isl/val.h>
3938         isl_bool isl_multi_val_range_is_wrapping(
3939                 __isl_keep isl_multi_val *mv);
3941         #include <isl/aff.h>
3942         isl_bool isl_multi_aff_range_is_wrapping(
3943                 __isl_keep isl_multi_aff *ma);
3944         isl_bool isl_multi_pw_aff_range_is_wrapping(
3945                 __isl_keep isl_multi_pw_aff *mpa);
3946         isl_bool isl_multi_union_pw_aff_range_is_wrapping(
3947                 __isl_keep isl_multi_union_pw_aff *mupa);
3949 The input to C<isl_space_is_wrapping> should
3950 be the space of a set, while that of
3951 C<isl_space_domain_is_wrapping> and
3952 C<isl_space_range_is_wrapping> should be the space of a relation.
3954 =item * Internal Product
3956         isl_bool isl_basic_map_can_zip(
3957                 __isl_keep isl_basic_map *bmap);
3958         isl_bool isl_map_can_zip(__isl_keep isl_map *map);
3960 Check whether the product of domain and range of the given relation
3961 can be computed,
3962 i.e., whether both domain and range are nested relations.
3964 =item * Currying
3966         #include <isl/space.h>
3967         isl_bool isl_space_can_curry(
3968                 __isl_keep isl_space *space);
3970         #include <isl/map.h>
3971         isl_bool isl_basic_map_can_curry(
3972                 __isl_keep isl_basic_map *bmap);
3973         isl_bool isl_map_can_curry(__isl_keep isl_map *map);
3975 Check whether the domain of the (basic) relation is a wrapped relation.
3977         #include <isl/space.h>
3978         __isl_give isl_space *isl_space_uncurry(
3979                 __isl_take isl_space *space);
3981         #include <isl/map.h>
3982         isl_bool isl_basic_map_can_uncurry(
3983                 __isl_keep isl_basic_map *bmap);
3984         isl_bool isl_map_can_uncurry(__isl_keep isl_map *map);
3986 Check whether the range of the (basic) relation is a wrapped relation.
3988         #include <isl/space.h>
3989         isl_bool isl_space_can_range_curry(
3990                 __isl_keep isl_space *space);
3992         #include <isl/map.h>
3993         isl_bool isl_map_can_range_curry(
3994                 __isl_keep isl_map *map);
3996 Check whether the domain of the relation wrapped in the range of
3997 the input is itself a wrapped relation.
3999 =item * Special Values
4001         #include <isl/aff.h>
4002         isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff);
4003         isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff);
4004         isl_bool isl_multi_pw_aff_is_cst(
4005                 __isl_keep isl_multi_pw_aff *mpa);
4007 Check whether the given expression is a constant.
4009         #include <isl/aff.h>
4010         isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff);
4011         isl_bool isl_pw_aff_involves_nan(
4012                 __isl_keep isl_pw_aff *pa);
4014         #include <isl/polynomial.h>
4015         isl_bool isl_qpolynomial_fold_is_nan(
4016                 __isl_keep isl_qpolynomial_fold *fold);
4018 Check whether the given expression is equal to or involves NaN.
4020         #include <isl/aff.h>
4021         isl_bool isl_aff_plain_is_zero(
4022                 __isl_keep isl_aff *aff);
4024 Check whether the affine expression is obviously zero.
4026 =back
4028 =head3 Binary Properties
4030 =over
4032 =item * Equality
4034 The following functions check whether two objects
4035 represent the same set, relation or function.
4036 The C<plain> variants only return true if the objects
4037 are obviously the same.  That is, they may return false
4038 even if the objects are the same, but they will never
4039 return true if the objects are not the same.
4041         #include <isl/set.h>
4042         isl_bool isl_basic_set_plain_is_equal(
4043                 __isl_keep isl_basic_set *bset1,
4044                 __isl_keep isl_basic_set *bset2);
4045         isl_bool isl_basic_set_is_equal(
4046                 __isl_keep isl_basic_set *bset1,
4047                 __isl_keep isl_basic_set *bset2);
4048         isl_bool isl_set_plain_is_equal(
4049                 __isl_keep isl_set *set1,
4050                 __isl_keep isl_set *set2);
4051         isl_bool isl_set_is_equal(__isl_keep isl_set *set1,
4052                 __isl_keep isl_set *set2);
4054         #include <isl/map.h>
4055         isl_bool isl_basic_map_is_equal(
4056                 __isl_keep isl_basic_map *bmap1,
4057                 __isl_keep isl_basic_map *bmap2);
4058         isl_bool isl_map_is_equal(__isl_keep isl_map *map1,
4059                 __isl_keep isl_map *map2);
4060         isl_bool isl_map_plain_is_equal(
4061                 __isl_keep isl_map *map1,
4062                 __isl_keep isl_map *map2);
4064         #include <isl/union_set.h>
4065         isl_bool isl_union_set_is_equal(
4066                 __isl_keep isl_union_set *uset1,
4067                 __isl_keep isl_union_set *uset2);
4069         #include <isl/union_map.h>
4070         isl_bool isl_union_map_is_equal(
4071                 __isl_keep isl_union_map *umap1,
4072                 __isl_keep isl_union_map *umap2);
4074         #include <isl/aff.h>
4075         isl_bool isl_aff_plain_is_equal(
4076                 __isl_keep isl_aff *aff1,
4077                 __isl_keep isl_aff *aff2);
4078         isl_bool isl_multi_aff_plain_is_equal(
4079                 __isl_keep isl_multi_aff *maff1,
4080                 __isl_keep isl_multi_aff *maff2);
4081         isl_bool isl_pw_aff_plain_is_equal(
4082                 __isl_keep isl_pw_aff *pwaff1,
4083                 __isl_keep isl_pw_aff *pwaff2);
4084         isl_bool isl_pw_multi_aff_plain_is_equal(
4085                 __isl_keep isl_pw_multi_aff *pma1,
4086                 __isl_keep isl_pw_multi_aff *pma2);
4087         isl_bool isl_multi_pw_aff_plain_is_equal(
4088                 __isl_keep isl_multi_pw_aff *mpa1,
4089                 __isl_keep isl_multi_pw_aff *mpa2);
4090         isl_bool isl_multi_pw_aff_is_equal(
4091                 __isl_keep isl_multi_pw_aff *mpa1,
4092                 __isl_keep isl_multi_pw_aff *mpa2);
4093         isl_bool isl_union_pw_aff_plain_is_equal(
4094                 __isl_keep isl_union_pw_aff *upa1,
4095                 __isl_keep isl_union_pw_aff *upa2);
4096         isl_bool isl_union_pw_multi_aff_plain_is_equal(
4097                 __isl_keep isl_union_pw_multi_aff *upma1,
4098                 __isl_keep isl_union_pw_multi_aff *upma2);
4099         isl_bool isl_multi_union_pw_aff_plain_is_equal(
4100                 __isl_keep isl_multi_union_pw_aff *mupa1,
4101                 __isl_keep isl_multi_union_pw_aff *mupa2);
4103         #include <isl/polynomial.h>
4104         isl_bool isl_union_pw_qpolynomial_plain_is_equal(
4105                 __isl_keep isl_union_pw_qpolynomial *upwqp1,
4106                 __isl_keep isl_union_pw_qpolynomial *upwqp2);
4107         isl_bool isl_union_pw_qpolynomial_fold_plain_is_equal(
4108                 __isl_keep isl_union_pw_qpolynomial_fold *upwf1,
4109                 __isl_keep isl_union_pw_qpolynomial_fold *upwf2);
4111 =item * Disjointness
4113         #include <isl/set.h>
4114         isl_bool isl_basic_set_is_disjoint(
4115                 __isl_keep isl_basic_set *bset1,
4116                 __isl_keep isl_basic_set *bset2);
4117         isl_bool isl_set_plain_is_disjoint(
4118                 __isl_keep isl_set *set1,
4119                 __isl_keep isl_set *set2);
4120         isl_bool isl_set_is_disjoint(__isl_keep isl_set *set1,
4121                 __isl_keep isl_set *set2);
4123         #include <isl/map.h>
4124         isl_bool isl_basic_map_is_disjoint(
4125                 __isl_keep isl_basic_map *bmap1,
4126                 __isl_keep isl_basic_map *bmap2);
4127         isl_bool isl_map_is_disjoint(__isl_keep isl_map *map1,
4128                 __isl_keep isl_map *map2);
4130         #include <isl/union_set.h>
4131         isl_bool isl_union_set_is_disjoint(
4132                 __isl_keep isl_union_set *uset1,
4133                 __isl_keep isl_union_set *uset2);
4135         #include <isl/union_map.h>
4136         isl_bool isl_union_map_is_disjoint(
4137                 __isl_keep isl_union_map *umap1,
4138                 __isl_keep isl_union_map *umap2);
4140 =item * Subset
4142         isl_bool isl_basic_set_is_subset(
4143                 __isl_keep isl_basic_set *bset1,
4144                 __isl_keep isl_basic_set *bset2);
4145         isl_bool isl_set_is_subset(__isl_keep isl_set *set1,
4146                 __isl_keep isl_set *set2);
4147         isl_bool isl_set_is_strict_subset(
4148                 __isl_keep isl_set *set1,
4149                 __isl_keep isl_set *set2);
4150         isl_bool isl_union_set_is_subset(
4151                 __isl_keep isl_union_set *uset1,
4152                 __isl_keep isl_union_set *uset2);
4153         isl_bool isl_union_set_is_strict_subset(
4154                 __isl_keep isl_union_set *uset1,
4155                 __isl_keep isl_union_set *uset2);
4156         isl_bool isl_basic_map_is_subset(
4157                 __isl_keep isl_basic_map *bmap1,
4158                 __isl_keep isl_basic_map *bmap2);
4159         isl_bool isl_basic_map_is_strict_subset(
4160                 __isl_keep isl_basic_map *bmap1,
4161                 __isl_keep isl_basic_map *bmap2);
4162         isl_bool isl_map_is_subset(
4163                 __isl_keep isl_map *map1,
4164                 __isl_keep isl_map *map2);
4165         isl_bool isl_map_is_strict_subset(
4166                 __isl_keep isl_map *map1,
4167                 __isl_keep isl_map *map2);
4168         isl_bool isl_union_map_is_subset(
4169                 __isl_keep isl_union_map *umap1,
4170                 __isl_keep isl_union_map *umap2);
4171         isl_bool isl_union_map_is_strict_subset(
4172                 __isl_keep isl_union_map *umap1,
4173                 __isl_keep isl_union_map *umap2);
4175 Check whether the first argument is a (strict) subset of the
4176 second argument.
4178 =item * Order
4180 Every comparison function returns a negative value if the first
4181 argument is considered smaller than the second, a positive value
4182 if the first argument is considered greater and zero if the two
4183 constraints are considered the same by the comparison criterion.
4185         #include <isl/constraint.h>
4186         int isl_constraint_plain_cmp(
4187                 __isl_keep isl_constraint *c1,
4188                 __isl_keep isl_constraint *c2);
4190 This function is useful for sorting C<isl_constraint>s.
4191 The order depends on the internal representation of the inputs.
4192 The order is fixed over different calls to the function (assuming
4193 the internal representation of the inputs has not changed), but may
4194 change over different versions of C<isl>.
4196         #include <isl/constraint.h>
4197         int isl_constraint_cmp_last_non_zero(
4198                 __isl_keep isl_constraint *c1,
4199                 __isl_keep isl_constraint *c2);
4201 This function can be used to sort constraints that live in the same
4202 local space.  Constraints that involve ``earlier'' dimensions or
4203 that have a smaller coefficient for the shared latest dimension
4204 are considered smaller than other constraints.
4205 This function only defines a B<partial> order.
4207         #include <isl/set.h>
4208         int isl_set_plain_cmp(__isl_keep isl_set *set1,
4209                 __isl_keep isl_set *set2);
4211 This function is useful for sorting C<isl_set>s.
4212 The order depends on the internal representation of the inputs.
4213 The order is fixed over different calls to the function (assuming
4214 the internal representation of the inputs has not changed), but may
4215 change over different versions of C<isl>.
4217         #include <isl/aff.h>
4218         int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1,
4219                 __isl_keep isl_pw_aff *pa2);
4221 The function C<isl_pw_aff_plain_cmp> can be used to sort
4222 C<isl_pw_aff>s.  The order is not strictly defined.
4223 The current order sorts expressions that only involve
4224 earlier dimensions before those that involve later dimensions.
4226 =back
4228 =head2 Unary Operations
4230 =over
4232 =item * Complement
4234         __isl_give isl_set *isl_set_complement(
4235                 __isl_take isl_set *set);
4236         __isl_give isl_map *isl_map_complement(
4237                 __isl_take isl_map *map);
4239 =item * Inverse map
4241         #include <isl/space.h>
4242         __isl_give isl_space *isl_space_reverse(
4243                 __isl_take isl_space *space);
4245         #include <isl/map.h>
4246         __isl_give isl_basic_map *isl_basic_map_reverse(
4247                 __isl_take isl_basic_map *bmap);
4248         __isl_give isl_map *isl_map_reverse(
4249                 __isl_take isl_map *map);
4251         #include <isl/union_map.h>
4252         __isl_give isl_union_map *isl_union_map_reverse(
4253                 __isl_take isl_union_map *umap);
4255 =item * Projection
4257         #include <isl/space.h>
4258         __isl_give isl_space *isl_space_domain(
4259                 __isl_take isl_space *space);
4260         __isl_give isl_space *isl_space_range(
4261                 __isl_take isl_space *space);
4262         __isl_give isl_space *isl_space_params(
4263                 __isl_take isl_space *space);
4265         #include <isl/local_space.h>
4266         __isl_give isl_local_space *isl_local_space_domain(
4267                 __isl_take isl_local_space *ls);
4268         __isl_give isl_local_space *isl_local_space_range(
4269                 __isl_take isl_local_space *ls);
4271         #include <isl/set.h>
4272         __isl_give isl_basic_set *isl_basic_set_project_out(
4273                 __isl_take isl_basic_set *bset,
4274                 enum isl_dim_type type, unsigned first, unsigned n);
4275         __isl_give isl_set *isl_set_project_out(__isl_take isl_set *set,
4276                 enum isl_dim_type type, unsigned first, unsigned n);
4277         __isl_give isl_map *isl_set_project_onto_map(
4278                 __isl_take isl_set *set,
4279                 enum isl_dim_type type, unsigned first,
4280                 unsigned n);
4281         __isl_give isl_basic_set *isl_basic_set_params(
4282                 __isl_take isl_basic_set *bset);
4283         __isl_give isl_set *isl_set_params(__isl_take isl_set *set);
4285 The function C<isl_set_project_onto_map> returns a relation
4286 that projects the input set onto the given set dimensions.
4288         #include <isl/map.h>
4289         __isl_give isl_basic_map *isl_basic_map_project_out(
4290                 __isl_take isl_basic_map *bmap,
4291                 enum isl_dim_type type, unsigned first, unsigned n);
4292         __isl_give isl_map *isl_map_project_out(__isl_take isl_map *map,
4293                 enum isl_dim_type type, unsigned first, unsigned n);
4294         __isl_give isl_basic_set *isl_basic_map_domain(
4295                 __isl_take isl_basic_map *bmap);
4296         __isl_give isl_basic_set *isl_basic_map_range(
4297                 __isl_take isl_basic_map *bmap);
4298         __isl_give isl_set *isl_map_params(__isl_take isl_map *map);
4299         __isl_give isl_set *isl_map_domain(
4300                 __isl_take isl_map *bmap);
4301         __isl_give isl_set *isl_map_range(
4302                 __isl_take isl_map *map);
4304         #include <isl/union_set.h>
4305         __isl_give isl_union_set *isl_union_set_project_out(
4306                 __isl_take isl_union_set *uset,
4307                 enum isl_dim_type type,
4308                 unsigned first, unsigned n);
4309         __isl_give isl_set *isl_union_set_params(
4310                 __isl_take isl_union_set *uset);
4312 The function C<isl_union_set_project_out> can only project out
4313 parameters.
4315         #include <isl/union_map.h>
4316         __isl_give isl_union_map *isl_union_map_project_out(
4317                 __isl_take isl_union_map *umap,
4318                 enum isl_dim_type type, unsigned first, unsigned n);
4319         __isl_give isl_set *isl_union_map_params(
4320                 __isl_take isl_union_map *umap);
4321         __isl_give isl_union_set *isl_union_map_domain(
4322                 __isl_take isl_union_map *umap);
4323         __isl_give isl_union_set *isl_union_map_range(
4324                 __isl_take isl_union_map *umap);
4326 The function C<isl_union_map_project_out> can only project out
4327 parameters.
4329         #include <isl/aff.h>
4330         __isl_give isl_aff *isl_aff_project_domain_on_params(
4331                 __isl_take isl_aff *aff);
4332         __isl_give isl_pw_multi_aff *
4333         isl_pw_multi_aff_project_domain_on_params(
4334                 __isl_take isl_pw_multi_aff *pma);
4335         __isl_give isl_set *isl_pw_aff_domain(
4336                 __isl_take isl_pw_aff *pwaff);
4337         __isl_give isl_set *isl_pw_multi_aff_domain(
4338                 __isl_take isl_pw_multi_aff *pma);
4339         __isl_give isl_set *isl_multi_pw_aff_domain(
4340                 __isl_take isl_multi_pw_aff *mpa);
4341         __isl_give isl_union_set *isl_union_pw_aff_domain(
4342                 __isl_take isl_union_pw_aff *upa);
4343         __isl_give isl_union_set *isl_union_pw_multi_aff_domain(
4344                 __isl_take isl_union_pw_multi_aff *upma);
4345         __isl_give isl_union_set *
4346         isl_multi_union_pw_aff_domain(
4347                 __isl_take isl_multi_union_pw_aff *mupa);
4348         __isl_give isl_set *isl_pw_aff_params(
4349                 __isl_take isl_pw_aff *pwa);
4351 The function C<isl_multi_union_pw_aff_domain> requires its
4352 input to have at least one set dimension.
4354         #include <isl/polynomial.h>
4355         __isl_give isl_qpolynomial *
4356         isl_qpolynomial_project_domain_on_params(
4357                 __isl_take isl_qpolynomial *qp);
4358         __isl_give isl_pw_qpolynomial *
4359         isl_pw_qpolynomial_project_domain_on_params(
4360                 __isl_take isl_pw_qpolynomial *pwqp);
4361         __isl_give isl_pw_qpolynomial_fold *
4362         isl_pw_qpolynomial_fold_project_domain_on_params(
4363                 __isl_take isl_pw_qpolynomial_fold *pwf);
4364         __isl_give isl_set *isl_pw_qpolynomial_domain(
4365                 __isl_take isl_pw_qpolynomial *pwqp);
4366         __isl_give isl_union_set *isl_union_pw_qpolynomial_fold_domain(
4367                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4368         __isl_give isl_union_set *isl_union_pw_qpolynomial_domain(
4369                 __isl_take isl_union_pw_qpolynomial *upwqp);
4371         #include <isl/space.h>
4372         __isl_give isl_space *isl_space_domain_map(
4373                 __isl_take isl_space *space);
4374         __isl_give isl_space *isl_space_range_map(
4375                 __isl_take isl_space *space);
4377         #include <isl/map.h>
4378         __isl_give isl_map *isl_set_wrapped_domain_map(
4379                 __isl_take isl_set *set);
4380         __isl_give isl_basic_map *isl_basic_map_domain_map(
4381                 __isl_take isl_basic_map *bmap);
4382         __isl_give isl_basic_map *isl_basic_map_range_map(
4383                 __isl_take isl_basic_map *bmap);
4384         __isl_give isl_map *isl_map_domain_map(__isl_take isl_map *map);
4385         __isl_give isl_map *isl_map_range_map(__isl_take isl_map *map);
4387         #include <isl/union_map.h>
4388         __isl_give isl_union_map *isl_union_map_domain_map(
4389                 __isl_take isl_union_map *umap);
4390         __isl_give isl_union_pw_multi_aff *
4391         isl_union_map_domain_map_union_pw_multi_aff(
4392                 __isl_take isl_union_map *umap);
4393         __isl_give isl_union_map *isl_union_map_range_map(
4394                 __isl_take isl_union_map *umap);
4395         __isl_give isl_union_map *
4396         isl_union_set_wrapped_domain_map(
4397                 __isl_take isl_union_set *uset);
4399 The functions above construct a (basic, regular or union) relation
4400 that maps (a wrapped version of) the input relation to its domain or range.
4401 C<isl_set_wrapped_domain_map> maps the input set to the domain
4402 of its wrapped relation.
4404 =item * Elimination
4406         __isl_give isl_basic_set *isl_basic_set_eliminate(
4407                 __isl_take isl_basic_set *bset,
4408                 enum isl_dim_type type,
4409                 unsigned first, unsigned n);
4410         __isl_give isl_set *isl_set_eliminate(
4411                 __isl_take isl_set *set, enum isl_dim_type type,
4412                 unsigned first, unsigned n);
4413         __isl_give isl_basic_map *isl_basic_map_eliminate(
4414                 __isl_take isl_basic_map *bmap,
4415                 enum isl_dim_type type,
4416                 unsigned first, unsigned n);
4417         __isl_give isl_map *isl_map_eliminate(
4418                 __isl_take isl_map *map, enum isl_dim_type type,
4419                 unsigned first, unsigned n);
4421 Eliminate the coefficients for the given dimensions from the constraints,
4422 without removing the dimensions.
4424 =item * Constructing a set from a parameter domain
4426 A zero-dimensional space or (basic) set can be constructed
4427 on a given parameter domain using the following functions.
4429         #include <isl/space.h>
4430         __isl_give isl_space *isl_space_set_from_params(
4431                 __isl_take isl_space *space);
4433         #include <isl/set.h>
4434         __isl_give isl_basic_set *isl_basic_set_from_params(
4435                 __isl_take isl_basic_set *bset);
4436         __isl_give isl_set *isl_set_from_params(
4437                 __isl_take isl_set *set);
4439 =item * Constructing a relation from one or two sets
4441 Create a relation with the given set(s) as domain and/or range.
4442 If only the domain or the range is specified, then
4443 the range or domain of the created relation is a zero-dimensional
4444 flat anonymous space.
4446         #include <isl/space.h>
4447         __isl_give isl_space *isl_space_from_domain(
4448                 __isl_take isl_space *space);
4449         __isl_give isl_space *isl_space_from_range(
4450                 __isl_take isl_space *space);
4451         __isl_give isl_space *isl_space_map_from_set(
4452                 __isl_take isl_space *space);
4453         __isl_give isl_space *isl_space_map_from_domain_and_range(
4454                 __isl_take isl_space *domain,
4455                 __isl_take isl_space *range);
4457         #include <isl/local_space.h>
4458         __isl_give isl_local_space *isl_local_space_from_domain(
4459                 __isl_take isl_local_space *ls);
4461         #include <isl/map.h>
4462         __isl_give isl_map *isl_map_from_domain(
4463                 __isl_take isl_set *set);
4464         __isl_give isl_map *isl_map_from_range(
4465                 __isl_take isl_set *set);
4467         #include <isl/union_map.h>
4468         __isl_give isl_union_map *
4469         isl_union_map_from_domain_and_range(
4470                 __isl_take isl_union_set *domain,
4471                 __isl_take isl_union_set *range);
4473         #include <isl/val.h>
4474         __isl_give isl_multi_val *isl_multi_val_from_range(
4475                 __isl_take isl_multi_val *mv);
4477         #include <isl/aff.h>
4478         __isl_give isl_multi_aff *isl_multi_aff_from_range(
4479                 __isl_take isl_multi_aff *ma);
4480         __isl_give isl_pw_aff *isl_pw_aff_from_range(
4481                 __isl_take isl_pw_aff *pwa);
4482         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_range(
4483                 __isl_take isl_multi_pw_aff *mpa);
4484         __isl_give isl_multi_union_pw_aff *
4485         isl_multi_union_pw_aff_from_range(
4486                 __isl_take isl_multi_union_pw_aff *mupa);
4487         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain(
4488                 __isl_take isl_set *set);
4489         __isl_give isl_union_pw_multi_aff *
4490         isl_union_pw_multi_aff_from_domain(
4491                 __isl_take isl_union_set *uset);
4493 =item * Slicing
4495         #include <isl/set.h>
4496         __isl_give isl_basic_set *isl_basic_set_fix_si(
4497                 __isl_take isl_basic_set *bset,
4498                 enum isl_dim_type type, unsigned pos, int value);
4499         __isl_give isl_basic_set *isl_basic_set_fix_val(
4500                 __isl_take isl_basic_set *bset,
4501                 enum isl_dim_type type, unsigned pos,
4502                 __isl_take isl_val *v);
4503         __isl_give isl_set *isl_set_fix_si(__isl_take isl_set *set,
4504                 enum isl_dim_type type, unsigned pos, int value);
4505         __isl_give isl_set *isl_set_fix_val(
4506                 __isl_take isl_set *set,
4507                 enum isl_dim_type type, unsigned pos,
4508                 __isl_take isl_val *v);
4510         #include <isl/map.h>
4511         __isl_give isl_basic_map *isl_basic_map_fix_si(
4512                 __isl_take isl_basic_map *bmap,
4513                 enum isl_dim_type type, unsigned pos, int value);
4514         __isl_give isl_basic_map *isl_basic_map_fix_val(
4515                 __isl_take isl_basic_map *bmap,
4516                 enum isl_dim_type type, unsigned pos,
4517                 __isl_take isl_val *v);
4518         __isl_give isl_map *isl_map_fix_si(__isl_take isl_map *map,
4519                 enum isl_dim_type type, unsigned pos, int value);
4520         __isl_give isl_map *isl_map_fix_val(
4521                 __isl_take isl_map *map,
4522                 enum isl_dim_type type, unsigned pos,
4523                 __isl_take isl_val *v);
4525         #include <isl/aff.h>
4526         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si(
4527                 __isl_take isl_pw_multi_aff *pma,
4528                 enum isl_dim_type type, unsigned pos, int value);
4530         #include <isl/polynomial.h>
4531         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_val(
4532                 __isl_take isl_pw_qpolynomial *pwqp,
4533                 enum isl_dim_type type, unsigned n,
4534                 __isl_take isl_val *v);
4536 Intersect the set, relation or function domain
4537 with the hyperplane where the given
4538 dimension has the fixed given value.
4540         __isl_give isl_basic_map *isl_basic_map_lower_bound_si(
4541                 __isl_take isl_basic_map *bmap,
4542                 enum isl_dim_type type, unsigned pos, int value);
4543         __isl_give isl_basic_map *isl_basic_map_upper_bound_si(
4544                 __isl_take isl_basic_map *bmap,
4545                 enum isl_dim_type type, unsigned pos, int value);
4546         __isl_give isl_set *isl_set_lower_bound_si(
4547                 __isl_take isl_set *set,
4548                 enum isl_dim_type type, unsigned pos, int value);
4549         __isl_give isl_set *isl_set_lower_bound_val(
4550                 __isl_take isl_set *set,
4551                 enum isl_dim_type type, unsigned pos,
4552                 __isl_take isl_val *value);
4553         __isl_give isl_map *isl_map_lower_bound_si(
4554                 __isl_take isl_map *map,
4555                 enum isl_dim_type type, unsigned pos, int value);
4556         __isl_give isl_set *isl_set_upper_bound_si(
4557                 __isl_take isl_set *set,
4558                 enum isl_dim_type type, unsigned pos, int value);
4559         __isl_give isl_set *isl_set_upper_bound_val(
4560                 __isl_take isl_set *set,
4561                 enum isl_dim_type type, unsigned pos,
4562                 __isl_take isl_val *value);
4563         __isl_give isl_map *isl_map_upper_bound_si(
4564                 __isl_take isl_map *map,
4565                 enum isl_dim_type type, unsigned pos, int value);
4567 Intersect the set or relation with the half-space where the given
4568 dimension has a value bounded by the fixed given integer value.
4570         __isl_give isl_set *isl_set_equate(__isl_take isl_set *set,
4571                 enum isl_dim_type type1, int pos1,
4572                 enum isl_dim_type type2, int pos2);
4573         __isl_give isl_basic_map *isl_basic_map_equate(
4574                 __isl_take isl_basic_map *bmap,
4575                 enum isl_dim_type type1, int pos1,
4576                 enum isl_dim_type type2, int pos2);
4577         __isl_give isl_map *isl_map_equate(__isl_take isl_map *map,
4578                 enum isl_dim_type type1, int pos1,
4579                 enum isl_dim_type type2, int pos2);
4581 Intersect the set or relation with the hyperplane where the given
4582 dimensions are equal to each other.
4584         __isl_give isl_map *isl_map_oppose(__isl_take isl_map *map,
4585                 enum isl_dim_type type1, int pos1,
4586                 enum isl_dim_type type2, int pos2);
4588 Intersect the relation with the hyperplane where the given
4589 dimensions have opposite values.
4591         __isl_give isl_map *isl_map_order_le(
4592                 __isl_take isl_map *map,
4593                 enum isl_dim_type type1, int pos1,
4594                 enum isl_dim_type type2, int pos2);
4595         __isl_give isl_basic_map *isl_basic_map_order_ge(
4596                 __isl_take isl_basic_map *bmap,
4597                 enum isl_dim_type type1, int pos1,
4598                 enum isl_dim_type type2, int pos2);
4599         __isl_give isl_map *isl_map_order_ge(
4600                 __isl_take isl_map *map,
4601                 enum isl_dim_type type1, int pos1,
4602                 enum isl_dim_type type2, int pos2);
4603         __isl_give isl_map *isl_map_order_lt(__isl_take isl_map *map,
4604                 enum isl_dim_type type1, int pos1,
4605                 enum isl_dim_type type2, int pos2);
4606         __isl_give isl_basic_map *isl_basic_map_order_gt(
4607                 __isl_take isl_basic_map *bmap,
4608                 enum isl_dim_type type1, int pos1,
4609                 enum isl_dim_type type2, int pos2);
4610         __isl_give isl_map *isl_map_order_gt(__isl_take isl_map *map,
4611                 enum isl_dim_type type1, int pos1,
4612                 enum isl_dim_type type2, int pos2);
4614 Intersect the relation with the half-space where the given
4615 dimensions satisfy the given ordering.
4617 =item * Locus
4619         #include <isl/aff.h>
4620         __isl_give isl_basic_set *isl_aff_zero_basic_set(
4621                 __isl_take isl_aff *aff);
4622         __isl_give isl_basic_set *isl_aff_neg_basic_set(
4623                 __isl_take isl_aff *aff);
4624         __isl_give isl_set *isl_pw_aff_pos_set(
4625                 __isl_take isl_pw_aff *pa);
4626         __isl_give isl_set *isl_pw_aff_nonneg_set(
4627                 __isl_take isl_pw_aff *pwaff);
4628         __isl_give isl_set *isl_pw_aff_zero_set(
4629                 __isl_take isl_pw_aff *pwaff);
4630         __isl_give isl_set *isl_pw_aff_non_zero_set(
4631                 __isl_take isl_pw_aff *pwaff);
4632         __isl_give isl_union_set *
4633         isl_union_pw_aff_zero_union_set(
4634                 __isl_take isl_union_pw_aff *upa);
4635         __isl_give isl_union_set *
4636         isl_multi_union_pw_aff_zero_union_set(
4637                 __isl_take isl_multi_union_pw_aff *mupa);
4639 The function C<isl_aff_neg_basic_set> returns a basic set
4640 containing those elements in the domain space
4641 of C<aff> where C<aff> is negative.
4642 The function C<isl_pw_aff_nonneg_set> returns a set
4643 containing those elements in the domain
4644 of C<pwaff> where C<pwaff> is non-negative.
4645 The function C<isl_multi_union_pw_aff_zero_union_set>
4646 returns a union set containing those elements
4647 in the domains of its elements where they are all zero.
4649 =item * Identity
4651         __isl_give isl_map *isl_set_identity(
4652                 __isl_take isl_set *set);
4653         __isl_give isl_union_map *isl_union_set_identity(
4654                 __isl_take isl_union_set *uset);
4655         __isl_give isl_union_pw_multi_aff *
4656         isl_union_set_identity_union_pw_multi_aff(
4657                 __isl_take isl_union_set *uset);
4659 Construct an identity relation on the given (union) set.
4661 =item * Function Extraction
4663 A piecewise quasi affine expression that is equal to 1 on a set
4664 and 0 outside the set can be created using the following function.
4666         #include <isl/aff.h>
4667         __isl_give isl_pw_aff *isl_set_indicator_function(
4668                 __isl_take isl_set *set);
4670 A piecewise multiple quasi affine expression can be extracted
4671 from an C<isl_set> or C<isl_map>, provided the C<isl_set> is a singleton
4672 and the C<isl_map> is single-valued.
4673 In case of a conversion from an C<isl_union_map>
4674 to an C<isl_union_pw_multi_aff>, these properties need to hold
4675 in each domain space.
4676 A conversion to a C<isl_multi_union_pw_aff> additionally
4677 requires that the input is non-empty and involves only a single
4678 range space.
4680         #include <isl/aff.h>
4681         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(
4682                 __isl_take isl_set *set);
4683         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(
4684                 __isl_take isl_map *map);
4686         __isl_give isl_union_pw_multi_aff *
4687         isl_union_pw_multi_aff_from_union_set(
4688                 __isl_take isl_union_set *uset);
4689         __isl_give isl_union_pw_multi_aff *
4690         isl_union_pw_multi_aff_from_union_map(
4691                 __isl_take isl_union_map *umap);
4693         __isl_give isl_multi_union_pw_aff *
4694         isl_multi_union_pw_aff_from_union_map(
4695                 __isl_take isl_union_map *umap);
4697 =item * Deltas
4699         __isl_give isl_basic_set *isl_basic_map_deltas(
4700                 __isl_take isl_basic_map *bmap);
4701         __isl_give isl_set *isl_map_deltas(__isl_take isl_map *map);
4702         __isl_give isl_union_set *isl_union_map_deltas(
4703                 __isl_take isl_union_map *umap);
4705 These functions return a (basic) set containing the differences
4706 between image elements and corresponding domain elements in the input.
4708         __isl_give isl_basic_map *isl_basic_map_deltas_map(
4709                 __isl_take isl_basic_map *bmap);
4710         __isl_give isl_map *isl_map_deltas_map(
4711                 __isl_take isl_map *map);
4712         __isl_give isl_union_map *isl_union_map_deltas_map(
4713                 __isl_take isl_union_map *umap);
4715 The functions above construct a (basic, regular or union) relation
4716 that maps (a wrapped version of) the input relation to its delta set.
4718 =item * Coalescing
4720 Simplify the representation of a set, relation or functions by trying
4721 to combine pairs of basic sets or relations into a single
4722 basic set or relation.
4724         #include <isl/set.h>
4725         __isl_give isl_set *isl_set_coalesce(__isl_take isl_set *set);
4727         #include <isl/map.h>
4728         __isl_give isl_map *isl_map_coalesce(__isl_take isl_map *map);
4730         #include <isl/union_set.h>
4731         __isl_give isl_union_set *isl_union_set_coalesce(
4732                 __isl_take isl_union_set *uset);
4734         #include <isl/union_map.h>
4735         __isl_give isl_union_map *isl_union_map_coalesce(
4736                 __isl_take isl_union_map *umap);
4738         #include <isl/aff.h>
4739         __isl_give isl_pw_aff *isl_pw_aff_coalesce(
4740                 __isl_take isl_pw_aff *pwqp);
4741         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce(
4742                 __isl_take isl_pw_multi_aff *pma);
4743         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce(
4744                 __isl_take isl_multi_pw_aff *mpa);
4745         __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce(
4746                 __isl_take isl_union_pw_aff *upa);
4747         __isl_give isl_union_pw_multi_aff *
4748         isl_union_pw_multi_aff_coalesce(
4749                 __isl_take isl_union_pw_multi_aff *upma);
4750         __isl_give isl_multi_union_pw_aff *
4751         isl_multi_union_pw_aff_coalesce(
4752                 __isl_take isl_multi_union_pw_aff *aff);
4754         #include <isl/polynomial.h>
4755         __isl_give isl_pw_qpolynomial_fold *
4756         isl_pw_qpolynomial_fold_coalesce(
4757                 __isl_take isl_pw_qpolynomial_fold *pwf);
4758         __isl_give isl_union_pw_qpolynomial *
4759         isl_union_pw_qpolynomial_coalesce(
4760                 __isl_take isl_union_pw_qpolynomial *upwqp);
4761         __isl_give isl_union_pw_qpolynomial_fold *
4762         isl_union_pw_qpolynomial_fold_coalesce(
4763                 __isl_take isl_union_pw_qpolynomial_fold *upwf);
4765 One of the methods for combining pairs of basic sets or relations
4766 can result in coefficients that are much larger than those that appear
4767 in the constraints of the input.  By default, the coefficients are
4768 not allowed to grow larger, but this can be changed by unsetting
4769 the following option.
4771         isl_stat isl_options_set_coalesce_bounded_wrapping(
4772                 isl_ctx *ctx, int val);
4773         int isl_options_get_coalesce_bounded_wrapping(
4774                 isl_ctx *ctx);
4776 =item * Detecting equalities
4778         __isl_give isl_basic_set *isl_basic_set_detect_equalities(
4779                 __isl_take isl_basic_set *bset);
4780         __isl_give isl_basic_map *isl_basic_map_detect_equalities(
4781                 __isl_take isl_basic_map *bmap);
4782         __isl_give isl_set *isl_set_detect_equalities(
4783                 __isl_take isl_set *set);
4784         __isl_give isl_map *isl_map_detect_equalities(
4785                 __isl_take isl_map *map);
4786         __isl_give isl_union_set *isl_union_set_detect_equalities(
4787                 __isl_take isl_union_set *uset);
4788         __isl_give isl_union_map *isl_union_map_detect_equalities(
4789                 __isl_take isl_union_map *umap);
4791 Simplify the representation of a set or relation by detecting implicit
4792 equalities.
4794 =item * Removing redundant constraints
4796         #include <isl/set.h>
4797         __isl_give isl_basic_set *isl_basic_set_remove_redundancies(
4798                 __isl_take isl_basic_set *bset);
4799         __isl_give isl_set *isl_set_remove_redundancies(
4800                 __isl_take isl_set *set);
4802         #include <isl/union_set.h>
4803         __isl_give isl_union_set *
4804         isl_union_set_remove_redundancies(
4805                 __isl_take isl_union_set *uset);
4807         #include <isl/map.h>
4808         __isl_give isl_basic_map *isl_basic_map_remove_redundancies(
4809                 __isl_take isl_basic_map *bmap);
4810         __isl_give isl_map *isl_map_remove_redundancies(
4811                 __isl_take isl_map *map);
4813         #include <isl/union_map.h>
4814         __isl_give isl_union_map *
4815         isl_union_map_remove_redundancies(
4816                 __isl_take isl_union_map *umap);
4818 =item * Convex hull
4820         __isl_give isl_basic_set *isl_set_convex_hull(
4821                 __isl_take isl_set *set);
4822         __isl_give isl_basic_map *isl_map_convex_hull(
4823                 __isl_take isl_map *map);
4825 If the input set or relation has any existentially quantified
4826 variables, then the result of these operations is currently undefined.
4828 =item * Simple hull
4830         #include <isl/set.h>
4831         __isl_give isl_basic_set *
4832         isl_set_unshifted_simple_hull(
4833                 __isl_take isl_set *set);
4834         __isl_give isl_basic_set *isl_set_simple_hull(
4835                 __isl_take isl_set *set);
4836         __isl_give isl_basic_set *
4837         isl_set_plain_unshifted_simple_hull(
4838                 __isl_take isl_set *set);
4839         __isl_give isl_basic_set *
4840         isl_set_unshifted_simple_hull_from_set_list(
4841                 __isl_take isl_set *set,
4842                 __isl_take isl_set_list *list);
4844         #include <isl/map.h>
4845         __isl_give isl_basic_map *
4846         isl_map_unshifted_simple_hull(
4847                 __isl_take isl_map *map);
4848         __isl_give isl_basic_map *isl_map_simple_hull(
4849                 __isl_take isl_map *map);
4850         __isl_give isl_basic_map *
4851         isl_map_plain_unshifted_simple_hull(
4852                 __isl_take isl_map *map);
4853                 __isl_give isl_basic_map *
4854         isl_map_unshifted_simple_hull_from_map_list(
4855                 __isl_take isl_map *map,
4856                 __isl_take isl_map_list *list);
4858         #include <isl/union_map.h>
4859         __isl_give isl_union_map *isl_union_map_simple_hull(
4860                 __isl_take isl_union_map *umap);
4862 These functions compute a single basic set or relation
4863 that contains the whole input set or relation.
4864 In particular, the output is described by translates
4865 of the constraints describing the basic sets or relations in the input.
4866 In case of C<isl_set_unshifted_simple_hull>, only the original
4867 constraints are used, without any translation.
4868 In case of C<isl_set_plain_unshifted_simple_hull> and
4869 C<isl_map_plain_unshifted_simple_hull>, the result is described
4870 by original constraints that are obviously satisfied
4871 by the entire input set or relation.
4872 In case of C<isl_set_unshifted_simple_hull_from_set_list> and
4873 C<isl_map_unshifted_simple_hull_from_map_list>, the
4874 constraints are taken from the elements of the second argument.
4876 =begin latex
4878 (See \autoref{s:simple hull}.)
4880 =end latex
4882 =item * Affine hull
4884         __isl_give isl_basic_set *isl_basic_set_affine_hull(
4885                 __isl_take isl_basic_set *bset);
4886         __isl_give isl_basic_set *isl_set_affine_hull(
4887                 __isl_take isl_set *set);
4888         __isl_give isl_union_set *isl_union_set_affine_hull(
4889                 __isl_take isl_union_set *uset);
4890         __isl_give isl_basic_map *isl_basic_map_affine_hull(
4891                 __isl_take isl_basic_map *bmap);
4892         __isl_give isl_basic_map *isl_map_affine_hull(
4893                 __isl_take isl_map *map);
4894         __isl_give isl_union_map *isl_union_map_affine_hull(
4895                 __isl_take isl_union_map *umap);
4897 In case of union sets and relations, the affine hull is computed
4898 per space.
4900 =item * Polyhedral hull
4902         __isl_give isl_basic_set *isl_set_polyhedral_hull(
4903                 __isl_take isl_set *set);
4904         __isl_give isl_basic_map *isl_map_polyhedral_hull(
4905                 __isl_take isl_map *map);
4906         __isl_give isl_union_set *isl_union_set_polyhedral_hull(
4907                 __isl_take isl_union_set *uset);
4908         __isl_give isl_union_map *isl_union_map_polyhedral_hull(
4909                 __isl_take isl_union_map *umap);
4911 These functions compute a single basic set or relation
4912 not involving any existentially quantified variables
4913 that contains the whole input set or relation.
4914 In case of union sets and relations, the polyhedral hull is computed
4915 per space.
4917 =item * Other approximations
4919         #include <isl/set.h>
4920         __isl_give isl_basic_set *
4921         isl_basic_set_drop_constraints_involving_dims(
4922                 __isl_take isl_basic_set *bset,
4923                 enum isl_dim_type type,
4924                 unsigned first, unsigned n);
4925         __isl_give isl_basic_set *
4926         isl_basic_set_drop_constraints_not_involving_dims(
4927                 __isl_take isl_basic_set *bset,
4928                 enum isl_dim_type type,
4929                 unsigned first, unsigned n);
4930         __isl_give isl_set *
4931         isl_set_drop_constraints_involving_dims(
4932                 __isl_take isl_set *set,
4933                 enum isl_dim_type type,
4934                 unsigned first, unsigned n);
4935         __isl_give isl_set *
4936         isl_set_drop_constraints_not_involving_dims(
4937                 __isl_take isl_set *set,
4938                 enum isl_dim_type type,
4939                 unsigned first, unsigned n);
4941         #include <isl/map.h>
4942         __isl_give isl_basic_map *
4943         isl_basic_map_drop_constraints_involving_dims(
4944                 __isl_take isl_basic_map *bmap,
4945                 enum isl_dim_type type,
4946                 unsigned first, unsigned n);
4947         __isl_give isl_basic_map *
4948         isl_basic_map_drop_constraints_not_involving_dims(
4949                 __isl_take isl_basic_map *bmap,
4950                 enum isl_dim_type type,
4951                 unsigned first, unsigned n);
4952         __isl_give isl_map *
4953         isl_map_drop_constraints_involving_dims(
4954                 __isl_take isl_map *map,
4955                 enum isl_dim_type type,
4956                 unsigned first, unsigned n);
4957         __isl_give isl_map *
4958         isl_map_drop_constraints_not_involving_dims(
4959                 __isl_take isl_map *map,
4960                 enum isl_dim_type type,
4961                 unsigned first, unsigned n);
4963 These functions drop any constraints (not) involving the specified dimensions.
4964 Note that the result depends on the representation of the input.
4966         #include <isl/polynomial.h>
4967         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_to_polynomial(
4968                 __isl_take isl_pw_qpolynomial *pwqp, int sign);
4969         __isl_give isl_union_pw_qpolynomial *
4970         isl_union_pw_qpolynomial_to_polynomial(
4971                 __isl_take isl_union_pw_qpolynomial *upwqp, int sign);
4973 Approximate each quasipolynomial by a polynomial.  If C<sign> is positive,
4974 the polynomial will be an overapproximation.  If C<sign> is negative,
4975 it will be an underapproximation.  If C<sign> is zero, the approximation
4976 will lie somewhere in between.
4978 =item * Feasibility
4980         __isl_give isl_basic_set *isl_basic_set_sample(
4981                 __isl_take isl_basic_set *bset);
4982         __isl_give isl_basic_set *isl_set_sample(
4983                 __isl_take isl_set *set);
4984         __isl_give isl_basic_map *isl_basic_map_sample(
4985                 __isl_take isl_basic_map *bmap);
4986         __isl_give isl_basic_map *isl_map_sample(
4987                 __isl_take isl_map *map);
4989 If the input (basic) set or relation is non-empty, then return
4990 a singleton subset of the input.  Otherwise, return an empty set.
4992 =item * Optimization
4994         #include <isl/ilp.h>
4995         __isl_give isl_val *isl_basic_set_max_val(
4996                 __isl_keep isl_basic_set *bset,
4997                 __isl_keep isl_aff *obj);
4998         __isl_give isl_val *isl_set_min_val(
4999                 __isl_keep isl_set *set,
5000                 __isl_keep isl_aff *obj);
5001         __isl_give isl_val *isl_set_max_val(
5002                 __isl_keep isl_set *set,
5003                 __isl_keep isl_aff *obj);
5004         __isl_give isl_multi_val *
5005         isl_union_set_min_multi_union_pw_aff(
5006                 __isl_keep isl_union_set *set,
5007                 __isl_keep isl_multi_union_pw_aff *obj);
5009 Compute the minimum or maximum of the integer affine expression C<obj>
5010 over the points in C<set>, returning the result in C<opt>.
5011 The result is C<NULL> in case of an error, the optimal value in case
5012 there is one, negative infinity or infinity if the problem is unbounded and
5013 NaN if the problem is empty.
5015 =item * Parametric optimization
5017         __isl_give isl_pw_aff *isl_set_dim_min(
5018                 __isl_take isl_set *set, int pos);
5019         __isl_give isl_pw_aff *isl_set_dim_max(
5020                 __isl_take isl_set *set, int pos);
5021         __isl_give isl_pw_aff *isl_map_dim_max(
5022                 __isl_take isl_map *map, int pos);
5024 Compute the minimum or maximum of the given set or output dimension
5025 as a function of the parameters (and input dimensions), but independently
5026 of the other set or output dimensions.
5027 For lexicographic optimization, see L<"Lexicographic Optimization">.
5029 =item * Dual
5031 The following functions compute either the set of (rational) coefficient
5032 values of valid constraints for the given set or the set of (rational)
5033 values satisfying the constraints with coefficients from the given set.
5034 Internally, these two sets of functions perform essentially the
5035 same operations, except that the set of coefficients is assumed to
5036 be a cone, while the set of values may be any polyhedron.
5037 The current implementation is based on the Farkas lemma and
5038 Fourier-Motzkin elimination, but this may change or be made optional
5039 in future.  In particular, future implementations may use different
5040 dualization algorithms or skip the elimination step.
5042         __isl_give isl_basic_set *isl_basic_set_coefficients(
5043                 __isl_take isl_basic_set *bset);
5044         __isl_give isl_basic_set *isl_set_coefficients(
5045                 __isl_take isl_set *set);
5046         __isl_give isl_union_set *isl_union_set_coefficients(
5047                 __isl_take isl_union_set *bset);
5048         __isl_give isl_basic_set *isl_basic_set_solutions(
5049                 __isl_take isl_basic_set *bset);
5050         __isl_give isl_basic_set *isl_set_solutions(
5051                 __isl_take isl_set *set);
5052         __isl_give isl_union_set *isl_union_set_solutions(
5053                 __isl_take isl_union_set *bset);
5055 =item * Power
5057         __isl_give isl_map *isl_map_fixed_power_val(
5058                 __isl_take isl_map *map,
5059                 __isl_take isl_val *exp);
5060         __isl_give isl_union_map *
5061         isl_union_map_fixed_power_val(
5062                 __isl_take isl_union_map *umap,
5063                 __isl_take isl_val *exp);
5065 Compute the given power of C<map>, where C<exp> is assumed to be non-zero.
5066 If the exponent C<exp> is negative, then the -C<exp> th power of the inverse
5067 of C<map> is computed.
5069         __isl_give isl_map *isl_map_power(__isl_take isl_map *map,
5070                 int *exact);
5071         __isl_give isl_union_map *isl_union_map_power(
5072                 __isl_take isl_union_map *umap, int *exact);
5074 Compute a parametric representation for all positive powers I<k> of C<map>.
5075 The result maps I<k> to a nested relation corresponding to the
5076 I<k>th power of C<map>.
5077 The result may be an overapproximation.  If the result is known to be exact,
5078 then C<*exact> is set to C<1>.
5080 =item * Transitive closure
5082         __isl_give isl_map *isl_map_transitive_closure(
5083                 __isl_take isl_map *map, int *exact);
5084         __isl_give isl_union_map *isl_union_map_transitive_closure(
5085                 __isl_take isl_union_map *umap, int *exact);
5087 Compute the transitive closure of C<map>.
5088 The result may be an overapproximation.  If the result is known to be exact,
5089 then C<*exact> is set to C<1>.
5091 =item * Reaching path lengths
5093         __isl_give isl_map *isl_map_reaching_path_lengths(
5094                 __isl_take isl_map *map, int *exact);
5096 Compute a relation that maps each element in the range of C<map>
5097 to the lengths of all paths composed of edges in C<map> that
5098 end up in the given element.
5099 The result may be an overapproximation.  If the result is known to be exact,
5100 then C<*exact> is set to C<1>.
5101 To compute the I<maximal> path length, the resulting relation
5102 should be postprocessed by C<isl_map_lexmax>.
5103 In particular, if the input relation is a dependence relation
5104 (mapping sources to sinks), then the maximal path length corresponds
5105 to the free schedule.
5106 Note, however, that C<isl_map_lexmax> expects the maximum to be
5107 finite, so if the path lengths are unbounded (possibly due to
5108 the overapproximation), then you will get an error message.
5110 =item * Wrapping
5112         #include <isl/space.h>
5113         __isl_give isl_space *isl_space_wrap(
5114                 __isl_take isl_space *space);
5115         __isl_give isl_space *isl_space_unwrap(
5116                 __isl_take isl_space *space);
5118         #include <isl/local_space.h>
5119         __isl_give isl_local_space *isl_local_space_wrap(
5120                 __isl_take isl_local_space *ls);
5122         #include <isl/set.h>
5123         __isl_give isl_basic_map *isl_basic_set_unwrap(
5124                 __isl_take isl_basic_set *bset);
5125         __isl_give isl_map *isl_set_unwrap(
5126                 __isl_take isl_set *set);
5128         #include <isl/map.h>
5129         __isl_give isl_basic_set *isl_basic_map_wrap(
5130                 __isl_take isl_basic_map *bmap);
5131         __isl_give isl_set *isl_map_wrap(
5132                 __isl_take isl_map *map);
5134         #include <isl/union_set.h>
5135         __isl_give isl_union_map *isl_union_set_unwrap(
5136                 __isl_take isl_union_set *uset);
5138         #include <isl/union_map.h>
5139         __isl_give isl_union_set *isl_union_map_wrap(
5140                 __isl_take isl_union_map *umap);
5142 The input to C<isl_space_unwrap> should
5143 be the space of a set, while that of
5144 C<isl_space_wrap> should be the space of a relation.
5145 Conversely, the output of C<isl_space_unwrap> is the space
5146 of a relation, while that of C<isl_space_wrap> is the space of a set.
5148 =item * Flattening
5150 Remove any internal structure of domain (and range) of the given
5151 set or relation.  If there is any such internal structure in the input,
5152 then the name of the space is also removed.
5154         #include <isl/local_space.h>
5155         __isl_give isl_local_space *
5156         isl_local_space_flatten_domain(
5157                 __isl_take isl_local_space *ls);
5158         __isl_give isl_local_space *
5159         isl_local_space_flatten_range(
5160                 __isl_take isl_local_space *ls);
5162         #include <isl/set.h>
5163         __isl_give isl_basic_set *isl_basic_set_flatten(
5164                 __isl_take isl_basic_set *bset);
5165         __isl_give isl_set *isl_set_flatten(
5166                 __isl_take isl_set *set);
5168         #include <isl/map.h>
5169         __isl_give isl_basic_map *isl_basic_map_flatten_domain(
5170                 __isl_take isl_basic_map *bmap);
5171         __isl_give isl_basic_map *isl_basic_map_flatten_range(
5172                 __isl_take isl_basic_map *bmap);
5173         __isl_give isl_map *isl_map_flatten_range(
5174                 __isl_take isl_map *map);
5175         __isl_give isl_map *isl_map_flatten_domain(
5176                 __isl_take isl_map *map);
5177         __isl_give isl_basic_map *isl_basic_map_flatten(
5178                 __isl_take isl_basic_map *bmap);
5179         __isl_give isl_map *isl_map_flatten(
5180                 __isl_take isl_map *map);
5182         #include <isl/val.h>
5183         __isl_give isl_multi_val *isl_multi_val_flatten_range(
5184                 __isl_take isl_multi_val *mv);
5186         #include <isl/aff.h>
5187         __isl_give isl_multi_aff *isl_multi_aff_flatten_domain(
5188                 __isl_take isl_multi_aff *ma);
5189         __isl_give isl_multi_aff *isl_multi_aff_flatten_range(
5190                 __isl_take isl_multi_aff *ma);
5191         __isl_give isl_multi_pw_aff *
5192         isl_multi_pw_aff_flatten_range(
5193                 __isl_take isl_multi_pw_aff *mpa);
5194         __isl_give isl_multi_union_pw_aff *
5195         isl_multi_union_pw_aff_flatten_range(
5196                 __isl_take isl_multi_union_pw_aff *mupa);
5198         #include <isl/map.h>
5199         __isl_give isl_map *isl_set_flatten_map(
5200                 __isl_take isl_set *set);
5202 The function above constructs a relation
5203 that maps the input set to a flattened version of the set.
5205 =item * Lifting
5207 Lift the input set to a space with extra dimensions corresponding
5208 to the existentially quantified variables in the input.
5209 In particular, the result lives in a wrapped map where the domain
5210 is the original space and the range corresponds to the original
5211 existentially quantified variables.
5213         #include <isl/set.h>
5214         __isl_give isl_basic_set *isl_basic_set_lift(
5215                 __isl_take isl_basic_set *bset);
5216         __isl_give isl_set *isl_set_lift(
5217                 __isl_take isl_set *set);
5218         __isl_give isl_union_set *isl_union_set_lift(
5219                 __isl_take isl_union_set *uset);
5221 Given a local space that contains the existentially quantified
5222 variables of a set, a basic relation that, when applied to
5223 a basic set, has essentially the same effect as C<isl_basic_set_lift>,
5224 can be constructed using the following function.
5226         #include <isl/local_space.h>
5227         __isl_give isl_basic_map *isl_local_space_lifting(
5228                 __isl_take isl_local_space *ls);
5230         #include <isl/aff.h>
5231         __isl_give isl_multi_aff *isl_multi_aff_lift(
5232                 __isl_take isl_multi_aff *maff,
5233                 __isl_give isl_local_space **ls);
5235 If the C<ls> argument of C<isl_multi_aff_lift> is not C<NULL>,
5236 then it is assigned the local space that lies at the basis of
5237 the lifting applied.
5239 =item * Internal Product
5241         #include <isl/space.h>
5242         __isl_give isl_space *isl_space_zip(
5243                 __isl_take isl_space *space);
5245         #include <isl/map.h>
5246         __isl_give isl_basic_map *isl_basic_map_zip(
5247                 __isl_take isl_basic_map *bmap);
5248         __isl_give isl_map *isl_map_zip(
5249                 __isl_take isl_map *map);
5251         #include <isl/union_map.h>
5252         __isl_give isl_union_map *isl_union_map_zip(
5253                 __isl_take isl_union_map *umap);
5255 Given a relation with nested relations for domain and range,
5256 interchange the range of the domain with the domain of the range.
5258 =item * Currying
5260         #include <isl/space.h>
5261         __isl_give isl_space *isl_space_curry(
5262                 __isl_take isl_space *space);
5263         __isl_give isl_space *isl_space_uncurry(
5264                 __isl_take isl_space *space);
5266         #include <isl/map.h>
5267         __isl_give isl_basic_map *isl_basic_map_curry(
5268                 __isl_take isl_basic_map *bmap);
5269         __isl_give isl_basic_map *isl_basic_map_uncurry(
5270                 __isl_take isl_basic_map *bmap);
5271         __isl_give isl_map *isl_map_curry(
5272                 __isl_take isl_map *map);
5273         __isl_give isl_map *isl_map_uncurry(
5274                 __isl_take isl_map *map);
5276         #include <isl/union_map.h>
5277         __isl_give isl_union_map *isl_union_map_curry(
5278                 __isl_take isl_union_map *umap);
5279         __isl_give isl_union_map *isl_union_map_uncurry(
5280                 __isl_take isl_union_map *umap);
5282 Given a relation with a nested relation for domain,
5283 the C<curry> functions
5284 move the range of the nested relation out of the domain
5285 and use it as the domain of a nested relation in the range,
5286 with the original range as range of this nested relation.
5287 The C<uncurry> functions perform the inverse operation.
5289         #include <isl/space.h>
5290         __isl_give isl_space *isl_space_range_curry(
5291                 __isl_take isl_space *space);
5293         #include <isl/map.h>
5294         __isl_give isl_map *isl_map_range_curry(
5295                 __isl_take isl_map *map);
5297         #include <isl/union_map.h>
5298         __isl_give isl_union_map *isl_union_map_range_curry(
5299                 __isl_take isl_union_map *umap);
5301 These functions apply the currying to the relation that
5302 is nested inside the range of the input.
5304 =item * Aligning parameters
5306 Change the order of the parameters of the given set, relation
5307 or function
5308 such that the first parameters match those of C<model>.
5309 This may involve the introduction of extra parameters.
5310 All parameters need to be named.
5312         #include <isl/space.h>
5313         __isl_give isl_space *isl_space_align_params(
5314                 __isl_take isl_space *space1,
5315                 __isl_take isl_space *space2)
5317         #include <isl/set.h>
5318         __isl_give isl_basic_set *isl_basic_set_align_params(
5319                 __isl_take isl_basic_set *bset,
5320                 __isl_take isl_space *model);
5321         __isl_give isl_set *isl_set_align_params(
5322                 __isl_take isl_set *set,
5323                 __isl_take isl_space *model);
5325         #include <isl/map.h>
5326         __isl_give isl_basic_map *isl_basic_map_align_params(
5327                 __isl_take isl_basic_map *bmap,
5328                 __isl_take isl_space *model);
5329         __isl_give isl_map *isl_map_align_params(
5330                 __isl_take isl_map *map,
5331                 __isl_take isl_space *model);
5333         #include <isl/val.h>
5334         __isl_give isl_multi_val *isl_multi_val_align_params(
5335                 __isl_take isl_multi_val *mv,
5336                 __isl_take isl_space *model);
5338         #include <isl/aff.h>
5339         __isl_give isl_aff *isl_aff_align_params(
5340                 __isl_take isl_aff *aff,
5341                 __isl_take isl_space *model);
5342         __isl_give isl_multi_aff *isl_multi_aff_align_params(
5343                 __isl_take isl_multi_aff *multi,
5344                 __isl_take isl_space *model);
5345         __isl_give isl_pw_aff *isl_pw_aff_align_params(
5346                 __isl_take isl_pw_aff *pwaff,
5347                 __isl_take isl_space *model);
5348         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params(
5349                 __isl_take isl_pw_multi_aff *pma,
5350                 __isl_take isl_space *model);
5351         __isl_give isl_union_pw_aff *
5352         isl_union_pw_aff_align_params(
5353                 __isl_take isl_union_pw_aff *upa,
5354                 __isl_take isl_space *model);
5355         __isl_give isl_union_pw_multi_aff *
5356         isl_union_pw_multi_aff_align_params(
5357                 __isl_take isl_union_pw_multi_aff *upma,
5358                 __isl_take isl_space *model);
5359         __isl_give isl_multi_union_pw_aff *
5360         isl_multi_union_pw_aff_align_params(
5361                 __isl_take isl_multi_union_pw_aff *mupa,
5362                 __isl_take isl_space *model);
5364         #include <isl/polynomial.h>
5365         __isl_give isl_qpolynomial *isl_qpolynomial_align_params(
5366                 __isl_take isl_qpolynomial *qp,
5367                 __isl_take isl_space *model);
5369 =item * Unary Arithmetic Operations
5371         #include <isl/set.h>
5372         __isl_give isl_set *isl_set_neg(
5373                 __isl_take isl_set *set);
5374         #include <isl/map.h>
5375         __isl_give isl_map *isl_map_neg(
5376                 __isl_take isl_map *map);
5378 C<isl_set_neg> constructs a set containing the opposites of
5379 the elements in its argument.
5380 The domain of the result of C<isl_map_neg> is the same
5381 as the domain of its argument.  The corresponding range
5382 elements are the opposites of the corresponding range
5383 elements in the argument.
5385         #include <isl/val.h>
5386         __isl_give isl_multi_val *isl_multi_val_neg(
5387                 __isl_take isl_multi_val *mv);
5389         #include <isl/aff.h>
5390         __isl_give isl_aff *isl_aff_neg(
5391                 __isl_take isl_aff *aff);
5392         __isl_give isl_multi_aff *isl_multi_aff_neg(
5393                 __isl_take isl_multi_aff *ma);
5394         __isl_give isl_pw_aff *isl_pw_aff_neg(
5395                 __isl_take isl_pw_aff *pwaff);
5396         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg(
5397                 __isl_take isl_pw_multi_aff *pma);
5398         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_neg(
5399                 __isl_take isl_multi_pw_aff *mpa);
5400         __isl_give isl_union_pw_aff *isl_union_pw_aff_neg(
5401                 __isl_take isl_union_pw_aff *upa);
5402         __isl_give isl_union_pw_multi_aff *
5403         isl_union_pw_multi_aff_neg(
5404                 __isl_take isl_union_pw_multi_aff *upma);
5405         __isl_give isl_multi_union_pw_aff *
5406         isl_multi_union_pw_aff_neg(
5407                 __isl_take isl_multi_union_pw_aff *mupa);
5408         __isl_give isl_aff *isl_aff_ceil(
5409                 __isl_take isl_aff *aff);
5410         __isl_give isl_pw_aff *isl_pw_aff_ceil(
5411                 __isl_take isl_pw_aff *pwaff);
5412         __isl_give isl_aff *isl_aff_floor(
5413                 __isl_take isl_aff *aff);
5414         __isl_give isl_multi_aff *isl_multi_aff_floor(
5415                 __isl_take isl_multi_aff *ma);
5416         __isl_give isl_pw_aff *isl_pw_aff_floor(
5417                 __isl_take isl_pw_aff *pwaff);
5418         __isl_give isl_union_pw_aff *isl_union_pw_aff_floor(
5419                 __isl_take isl_union_pw_aff *upa);
5420         __isl_give isl_multi_union_pw_aff *
5421         isl_multi_union_pw_aff_floor(
5422                 __isl_take isl_multi_union_pw_aff *mupa);
5424         #include <isl/aff.h>
5425         __isl_give isl_pw_aff *isl_pw_aff_list_min(
5426                 __isl_take isl_pw_aff_list *list);
5427         __isl_give isl_pw_aff *isl_pw_aff_list_max(
5428                 __isl_take isl_pw_aff_list *list);
5430         #include <isl/polynomial.h>
5431         __isl_give isl_qpolynomial *isl_qpolynomial_neg(
5432                 __isl_take isl_qpolynomial *qp);
5433         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_neg(
5434                 __isl_take isl_pw_qpolynomial *pwqp);
5435         __isl_give isl_union_pw_qpolynomial *
5436         isl_union_pw_qpolynomial_neg(
5437                 __isl_take isl_union_pw_qpolynomial *upwqp);
5438         __isl_give isl_qpolynomial *isl_qpolynomial_pow(
5439                 __isl_take isl_qpolynomial *qp,
5440                 unsigned exponent);
5441         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_pow(
5442                 __isl_take isl_pw_qpolynomial *pwqp,
5443                 unsigned exponent);
5445 =item * Evaluation
5447 The following functions evaluate a function in a point.
5449         #include <isl/polynomial.h>
5450         __isl_give isl_val *isl_pw_qpolynomial_eval(
5451                 __isl_take isl_pw_qpolynomial *pwqp,
5452                 __isl_take isl_point *pnt);
5453         __isl_give isl_val *isl_pw_qpolynomial_fold_eval(
5454                 __isl_take isl_pw_qpolynomial_fold *pwf,
5455                 __isl_take isl_point *pnt);
5456         __isl_give isl_val *isl_union_pw_qpolynomial_eval(
5457                 __isl_take isl_union_pw_qpolynomial *upwqp,
5458                 __isl_take isl_point *pnt);
5459         __isl_give isl_val *isl_union_pw_qpolynomial_fold_eval(
5460                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5461                 __isl_take isl_point *pnt);
5463 =item * Dimension manipulation
5465 It is usually not advisable to directly change the (input or output)
5466 space of a set or a relation as this removes the name and the internal
5467 structure of the space.  However, the functions below can be useful
5468 to add new parameters, assuming
5469 C<isl_set_align_params> and C<isl_map_align_params>
5470 are not sufficient.
5472         #include <isl/space.h>
5473         __isl_give isl_space *isl_space_add_dims(
5474                 __isl_take isl_space *space,
5475                 enum isl_dim_type type, unsigned n);
5476         __isl_give isl_space *isl_space_insert_dims(
5477                 __isl_take isl_space *space,
5478                 enum isl_dim_type type, unsigned pos, unsigned n);
5479         __isl_give isl_space *isl_space_drop_dims(
5480                 __isl_take isl_space *space,
5481                 enum isl_dim_type type, unsigned first, unsigned n);
5482         __isl_give isl_space *isl_space_move_dims(
5483                 __isl_take isl_space *space,
5484                 enum isl_dim_type dst_type, unsigned dst_pos,
5485                 enum isl_dim_type src_type, unsigned src_pos,
5486                 unsigned n);
5488         #include <isl/local_space.h>
5489         __isl_give isl_local_space *isl_local_space_add_dims(
5490                 __isl_take isl_local_space *ls,
5491                 enum isl_dim_type type, unsigned n);
5492         __isl_give isl_local_space *isl_local_space_insert_dims(
5493                 __isl_take isl_local_space *ls,
5494                 enum isl_dim_type type, unsigned first, unsigned n);
5495         __isl_give isl_local_space *isl_local_space_drop_dims(
5496                 __isl_take isl_local_space *ls,
5497                 enum isl_dim_type type, unsigned first, unsigned n);
5499         #include <isl/set.h>
5500         __isl_give isl_basic_set *isl_basic_set_add_dims(
5501                 __isl_take isl_basic_set *bset,
5502                 enum isl_dim_type type, unsigned n);
5503         __isl_give isl_set *isl_set_add_dims(
5504                 __isl_take isl_set *set,
5505                 enum isl_dim_type type, unsigned n);
5506         __isl_give isl_basic_set *isl_basic_set_insert_dims(
5507                 __isl_take isl_basic_set *bset,
5508                 enum isl_dim_type type, unsigned pos,
5509                 unsigned n);
5510         __isl_give isl_set *isl_set_insert_dims(
5511                 __isl_take isl_set *set,
5512                 enum isl_dim_type type, unsigned pos, unsigned n);
5513         __isl_give isl_basic_set *isl_basic_set_move_dims(
5514                 __isl_take isl_basic_set *bset,
5515                 enum isl_dim_type dst_type, unsigned dst_pos,
5516                 enum isl_dim_type src_type, unsigned src_pos,
5517                 unsigned n);
5518         __isl_give isl_set *isl_set_move_dims(
5519                 __isl_take isl_set *set,
5520                 enum isl_dim_type dst_type, unsigned dst_pos,
5521                 enum isl_dim_type src_type, unsigned src_pos,
5522                 unsigned n);
5524         #include <isl/map.h>
5525         __isl_give isl_basic_map *isl_basic_map_add_dims(
5526                 __isl_take isl_basic_map *bmap,
5527                 enum isl_dim_type type, unsigned n);
5528         __isl_give isl_map *isl_map_add_dims(
5529                 __isl_take isl_map *map,
5530                 enum isl_dim_type type, unsigned n);
5531         __isl_give isl_basic_map *isl_basic_map_insert_dims(
5532                 __isl_take isl_basic_map *bmap,
5533                 enum isl_dim_type type, unsigned pos,
5534                 unsigned n);
5535         __isl_give isl_map *isl_map_insert_dims(
5536                 __isl_take isl_map *map,
5537                 enum isl_dim_type type, unsigned pos, unsigned n);
5538         __isl_give isl_basic_map *isl_basic_map_move_dims(
5539                 __isl_take isl_basic_map *bmap,
5540                 enum isl_dim_type dst_type, unsigned dst_pos,
5541                 enum isl_dim_type src_type, unsigned src_pos,
5542                 unsigned n);
5543         __isl_give isl_map *isl_map_move_dims(
5544                 __isl_take isl_map *map,
5545                 enum isl_dim_type dst_type, unsigned dst_pos,
5546                 enum isl_dim_type src_type, unsigned src_pos,
5547                 unsigned n);
5549         #include <isl/val.h>
5550         __isl_give isl_multi_val *isl_multi_val_insert_dims(
5551                 __isl_take isl_multi_val *mv,
5552                 enum isl_dim_type type, unsigned first, unsigned n);
5553         __isl_give isl_multi_val *isl_multi_val_add_dims(
5554                 __isl_take isl_multi_val *mv,
5555                 enum isl_dim_type type, unsigned n);
5556         __isl_give isl_multi_val *isl_multi_val_drop_dims(
5557                 __isl_take isl_multi_val *mv,
5558                 enum isl_dim_type type, unsigned first, unsigned n);
5560         #include <isl/aff.h>
5561         __isl_give isl_aff *isl_aff_insert_dims(
5562                 __isl_take isl_aff *aff,
5563                 enum isl_dim_type type, unsigned first, unsigned n);
5564         __isl_give isl_multi_aff *isl_multi_aff_insert_dims(
5565                 __isl_take isl_multi_aff *ma,
5566                 enum isl_dim_type type, unsigned first, unsigned n);
5567         __isl_give isl_pw_aff *isl_pw_aff_insert_dims(
5568                 __isl_take isl_pw_aff *pwaff,
5569                 enum isl_dim_type type, unsigned first, unsigned n);
5570         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_insert_dims(
5571                 __isl_take isl_multi_pw_aff *mpa,
5572                 enum isl_dim_type type, unsigned first, unsigned n);
5573         __isl_give isl_aff *isl_aff_add_dims(
5574                 __isl_take isl_aff *aff,
5575                 enum isl_dim_type type, unsigned n);
5576         __isl_give isl_multi_aff *isl_multi_aff_add_dims(
5577                 __isl_take isl_multi_aff *ma,
5578                 enum isl_dim_type type, unsigned n);
5579         __isl_give isl_pw_aff *isl_pw_aff_add_dims(
5580                 __isl_take isl_pw_aff *pwaff,
5581                 enum isl_dim_type type, unsigned n);
5582         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add_dims(
5583                 __isl_take isl_multi_pw_aff *mpa,
5584                 enum isl_dim_type type, unsigned n);
5585         __isl_give isl_aff *isl_aff_drop_dims(
5586                 __isl_take isl_aff *aff,
5587                 enum isl_dim_type type, unsigned first, unsigned n);
5588         __isl_give isl_multi_aff *isl_multi_aff_drop_dims(
5589                 __isl_take isl_multi_aff *maff,
5590                 enum isl_dim_type type, unsigned first, unsigned n);
5591         __isl_give isl_pw_aff *isl_pw_aff_drop_dims(
5592                 __isl_take isl_pw_aff *pwaff,
5593                 enum isl_dim_type type, unsigned first, unsigned n);
5594         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims(
5595                 __isl_take isl_pw_multi_aff *pma,
5596                 enum isl_dim_type type, unsigned first, unsigned n);
5597         __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims(
5598                 __isl_take isl_union_pw_aff *upa,
5599                 enum isl_dim_type type, unsigned first, unsigned n);
5600         __isl_give isl_union_pw_multi_aff *
5601                 isl_union_pw_multi_aff_drop_dims(
5602                 __isl_take isl_union_pw_multi_aff *upma,
5603                 enum isl_dim_type type,
5604                 unsigned first, unsigned n);
5605         __isl_give isl_multi_union_pw_aff *
5606         isl_multi_union_pw_aff_drop_dims(
5607                 __isl_take isl_multi_union_pw_aff *mupa,
5608                 enum isl_dim_type type, unsigned first,
5609                 unsigned n);
5610         __isl_give isl_aff *isl_aff_move_dims(
5611                 __isl_take isl_aff *aff,
5612                 enum isl_dim_type dst_type, unsigned dst_pos,
5613                 enum isl_dim_type src_type, unsigned src_pos,
5614                 unsigned n);
5615         __isl_give isl_multi_aff *isl_multi_aff_move_dims(
5616                 __isl_take isl_multi_aff *ma,
5617                 enum isl_dim_type dst_type, unsigned dst_pos,
5618                 enum isl_dim_type src_type, unsigned src_pos,
5619                 unsigned n);
5620         __isl_give isl_pw_aff *isl_pw_aff_move_dims(
5621                 __isl_take isl_pw_aff *pa,
5622                 enum isl_dim_type dst_type, unsigned dst_pos,
5623                 enum isl_dim_type src_type, unsigned src_pos,
5624                 unsigned n);
5625         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims(
5626                 __isl_take isl_multi_pw_aff *pma,
5627                 enum isl_dim_type dst_type, unsigned dst_pos,
5628                 enum isl_dim_type src_type, unsigned src_pos,
5629                 unsigned n);
5631         #include <isl/polynomial.h>
5632         __isl_give isl_union_pw_qpolynomial *
5633         isl_union_pw_qpolynomial_drop_dims(
5634                 __isl_take isl_union_pw_qpolynomial *upwqp,
5635                 enum isl_dim_type type,
5636                 unsigned first, unsigned n);
5637         __isl_give isl_union_pw_qpolynomial_fold *
5638                 isl_union_pw_qpolynomial_fold_drop_dims(
5639                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5640                 enum isl_dim_type type,
5641                 unsigned first, unsigned n);
5643 The operations on union expressions can only manipulate parameters.
5645 =back
5647 =head2 Binary Operations
5649 The two arguments of a binary operation not only need to live
5650 in the same C<isl_ctx>, they currently also need to have
5651 the same (number of) parameters.
5653 =head3 Basic Operations
5655 =over
5657 =item * Intersection
5659         #include <isl/local_space.h>
5660         __isl_give isl_local_space *isl_local_space_intersect(
5661                 __isl_take isl_local_space *ls1,
5662                 __isl_take isl_local_space *ls2);
5664         #include <isl/set.h>
5665         __isl_give isl_basic_set *isl_basic_set_intersect_params(
5666                 __isl_take isl_basic_set *bset1,
5667                 __isl_take isl_basic_set *bset2);
5668         __isl_give isl_basic_set *isl_basic_set_intersect(
5669                 __isl_take isl_basic_set *bset1,
5670                 __isl_take isl_basic_set *bset2);
5671         __isl_give isl_basic_set *isl_basic_set_list_intersect(
5672                 __isl_take struct isl_basic_set_list *list);
5673         __isl_give isl_set *isl_set_intersect_params(
5674                 __isl_take isl_set *set,
5675                 __isl_take isl_set *params);
5676         __isl_give isl_set *isl_set_intersect(
5677                 __isl_take isl_set *set1,
5678                 __isl_take isl_set *set2);
5680         #include <isl/map.h>
5681         __isl_give isl_basic_map *isl_basic_map_intersect_domain(
5682                 __isl_take isl_basic_map *bmap,
5683                 __isl_take isl_basic_set *bset);
5684         __isl_give isl_basic_map *isl_basic_map_intersect_range(
5685                 __isl_take isl_basic_map *bmap,
5686                 __isl_take isl_basic_set *bset);
5687         __isl_give isl_basic_map *isl_basic_map_intersect(
5688                 __isl_take isl_basic_map *bmap1,
5689                 __isl_take isl_basic_map *bmap2);
5690         __isl_give isl_basic_map *isl_basic_map_list_intersect(
5691                 __isl_take isl_basic_map_list *list);
5692         __isl_give isl_map *isl_map_intersect_params(
5693                 __isl_take isl_map *map,
5694                 __isl_take isl_set *params);
5695         __isl_give isl_map *isl_map_intersect_domain(
5696                 __isl_take isl_map *map,
5697                 __isl_take isl_set *set);
5698         __isl_give isl_map *isl_map_intersect_range(
5699                 __isl_take isl_map *map,
5700                 __isl_take isl_set *set);
5701         __isl_give isl_map *isl_map_intersect(
5702                 __isl_take isl_map *map1,
5703                 __isl_take isl_map *map2);
5705         #include <isl/union_set.h>
5706         __isl_give isl_union_set *isl_union_set_intersect_params(
5707                 __isl_take isl_union_set *uset,
5708                 __isl_take isl_set *set);
5709         __isl_give isl_union_set *isl_union_set_intersect(
5710                 __isl_take isl_union_set *uset1,
5711                 __isl_take isl_union_set *uset2);
5713         #include <isl/union_map.h>
5714         __isl_give isl_union_map *isl_union_map_intersect_params(
5715                 __isl_take isl_union_map *umap,
5716                 __isl_take isl_set *set);
5717         __isl_give isl_union_map *isl_union_map_intersect_domain(
5718                 __isl_take isl_union_map *umap,
5719                 __isl_take isl_union_set *uset);
5720         __isl_give isl_union_map *isl_union_map_intersect_range(
5721                 __isl_take isl_union_map *umap,
5722                 __isl_take isl_union_set *uset);
5723         __isl_give isl_union_map *isl_union_map_intersect(
5724                 __isl_take isl_union_map *umap1,
5725                 __isl_take isl_union_map *umap2);
5727         #include <isl/aff.h>
5728         __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(
5729                 __isl_take isl_pw_aff *pa,
5730                 __isl_take isl_set *set);
5731         __isl_give isl_multi_pw_aff *
5732         isl_multi_pw_aff_intersect_domain(
5733                 __isl_take isl_multi_pw_aff *mpa,
5734                 __isl_take isl_set *domain);
5735         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain(
5736                 __isl_take isl_pw_multi_aff *pma,
5737                 __isl_take isl_set *set);
5738         __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain(
5739                 __isl_take isl_union_pw_aff *upa,
5740                 __isl_take isl_union_set *uset);
5741         __isl_give isl_union_pw_multi_aff *
5742         isl_union_pw_multi_aff_intersect_domain(
5743                 __isl_take isl_union_pw_multi_aff *upma,
5744                 __isl_take isl_union_set *uset);
5745         __isl_give isl_multi_union_pw_aff *
5746         isl_multi_union_pw_aff_intersect_domain(
5747                 __isl_take isl_multi_union_pw_aff *mupa,
5748                 __isl_take isl_union_set *uset);
5749         __isl_give isl_pw_aff *isl_pw_aff_intersect_params(
5750                 __isl_take isl_pw_aff *pa,
5751                 __isl_take isl_set *set);
5752         __isl_give isl_multi_pw_aff *
5753         isl_multi_pw_aff_intersect_params(
5754                 __isl_take isl_multi_pw_aff *mpa,
5755                 __isl_take isl_set *set);
5756         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params(
5757                 __isl_take isl_pw_multi_aff *pma,
5758                 __isl_take isl_set *set);
5759         __isl_give isl_union_pw_aff *
5760         isl_union_pw_aff_intersect_params(
5761                 __isl_take isl_union_pw_aff *upa,
5762         __isl_give isl_union_pw_multi_aff *
5763         isl_union_pw_multi_aff_intersect_params(
5764                 __isl_take isl_union_pw_multi_aff *upma,
5765                 __isl_take isl_set *set);
5766         __isl_give isl_multi_union_pw_aff *
5767         isl_multi_union_pw_aff_intersect_params(
5768                 __isl_take isl_multi_union_pw_aff *mupa,
5769                 __isl_take isl_set *params);
5770         isl_multi_union_pw_aff_intersect_range(
5771                 __isl_take isl_multi_union_pw_aff *mupa,
5772                 __isl_take isl_set *set);
5774         #include <isl/polynomial.h>
5775         __isl_give isl_pw_qpolynomial *
5776         isl_pw_qpolynomial_intersect_domain(
5777                 __isl_take isl_pw_qpolynomial *pwpq,
5778                 __isl_take isl_set *set);
5779         __isl_give isl_union_pw_qpolynomial *
5780         isl_union_pw_qpolynomial_intersect_domain(
5781                 __isl_take isl_union_pw_qpolynomial *upwpq,
5782                 __isl_take isl_union_set *uset);
5783         __isl_give isl_union_pw_qpolynomial_fold *
5784         isl_union_pw_qpolynomial_fold_intersect_domain(
5785                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5786                 __isl_take isl_union_set *uset);
5787         __isl_give isl_pw_qpolynomial *
5788         isl_pw_qpolynomial_intersect_params(
5789                 __isl_take isl_pw_qpolynomial *pwpq,
5790                 __isl_take isl_set *set);
5791         __isl_give isl_pw_qpolynomial_fold *
5792         isl_pw_qpolynomial_fold_intersect_params(
5793                 __isl_take isl_pw_qpolynomial_fold *pwf,
5794                 __isl_take isl_set *set);
5795         __isl_give isl_union_pw_qpolynomial *
5796         isl_union_pw_qpolynomial_intersect_params(
5797                 __isl_take isl_union_pw_qpolynomial *upwpq,
5798                 __isl_take isl_set *set);
5799         __isl_give isl_union_pw_qpolynomial_fold *
5800         isl_union_pw_qpolynomial_fold_intersect_params(
5801                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5802                 __isl_take isl_set *set);
5804 The second argument to the C<_params> functions needs to be
5805 a parametric (basic) set.  For the other functions, a parametric set
5806 for either argument is only allowed if the other argument is
5807 a parametric set as well.
5808 The list passed to C<isl_basic_set_list_intersect> needs to have
5809 at least one element and all elements need to live in the same space.
5810 The function C<isl_multi_union_pw_aff_intersect_range>
5811 restricts the input function to those shared domain elements
5812 that map to the specified range.
5814 =item * Union
5816         #include <isl/set.h>
5817         __isl_give isl_set *isl_basic_set_union(
5818                 __isl_take isl_basic_set *bset1,
5819                 __isl_take isl_basic_set *bset2);
5820         __isl_give isl_set *isl_set_union(
5821                 __isl_take isl_set *set1,
5822                 __isl_take isl_set *set2);
5823         __isl_give isl_set *isl_set_list_union(
5824                 __isl_take isl_set_list *list);
5826         #include <isl/map.h>
5827         __isl_give isl_map *isl_basic_map_union(
5828                 __isl_take isl_basic_map *bmap1,
5829                 __isl_take isl_basic_map *bmap2);
5830         __isl_give isl_map *isl_map_union(
5831                 __isl_take isl_map *map1,
5832                 __isl_take isl_map *map2);
5834         #include <isl/union_set.h>
5835         __isl_give isl_union_set *isl_union_set_union(
5836                 __isl_take isl_union_set *uset1,
5837                 __isl_take isl_union_set *uset2);
5838         __isl_give isl_union_set *isl_union_set_list_union(
5839                 __isl_take isl_union_set_list *list);
5841         #include <isl/union_map.h>
5842         __isl_give isl_union_map *isl_union_map_union(
5843                 __isl_take isl_union_map *umap1,
5844                 __isl_take isl_union_map *umap2);
5846 The list passed to C<isl_set_list_union> needs to have
5847 at least one element and all elements need to live in the same space.
5849 =item * Set difference
5851         #include <isl/set.h>
5852         __isl_give isl_set *isl_set_subtract(
5853                 __isl_take isl_set *set1,
5854                 __isl_take isl_set *set2);
5856         #include <isl/map.h>
5857         __isl_give isl_map *isl_map_subtract(
5858                 __isl_take isl_map *map1,
5859                 __isl_take isl_map *map2);
5860         __isl_give isl_map *isl_map_subtract_domain(
5861                 __isl_take isl_map *map,
5862                 __isl_take isl_set *dom);
5863         __isl_give isl_map *isl_map_subtract_range(
5864                 __isl_take isl_map *map,
5865                 __isl_take isl_set *dom);
5867         #include <isl/union_set.h>
5868         __isl_give isl_union_set *isl_union_set_subtract(
5869                 __isl_take isl_union_set *uset1,
5870                 __isl_take isl_union_set *uset2);
5872         #include <isl/union_map.h>
5873         __isl_give isl_union_map *isl_union_map_subtract(
5874                 __isl_take isl_union_map *umap1,
5875                 __isl_take isl_union_map *umap2);
5876         __isl_give isl_union_map *isl_union_map_subtract_domain(
5877                 __isl_take isl_union_map *umap,
5878                 __isl_take isl_union_set *dom);
5879         __isl_give isl_union_map *isl_union_map_subtract_range(
5880                 __isl_take isl_union_map *umap,
5881                 __isl_take isl_union_set *dom);
5883         #include <isl/aff.h>
5884         __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(
5885                 __isl_take isl_pw_aff *pa,
5886                 __isl_take isl_set *set);
5887         __isl_give isl_pw_multi_aff *
5888         isl_pw_multi_aff_subtract_domain(
5889                 __isl_take isl_pw_multi_aff *pma,
5890                 __isl_take isl_set *set);
5891         __isl_give isl_union_pw_aff *
5892         isl_union_pw_aff_subtract_domain(
5893                 __isl_take isl_union_pw_aff *upa,
5894                 __isl_take isl_union_set *uset);
5895         __isl_give isl_union_pw_multi_aff *
5896         isl_union_pw_multi_aff_subtract_domain(
5897                 __isl_take isl_union_pw_multi_aff *upma,
5898                 __isl_take isl_set *set);
5900         #include <isl/polynomial.h>
5901         __isl_give isl_pw_qpolynomial *
5902         isl_pw_qpolynomial_subtract_domain(
5903                 __isl_take isl_pw_qpolynomial *pwpq,
5904                 __isl_take isl_set *set);
5905         __isl_give isl_pw_qpolynomial_fold *
5906         isl_pw_qpolynomial_fold_subtract_domain(
5907                 __isl_take isl_pw_qpolynomial_fold *pwf,
5908                 __isl_take isl_set *set);
5909         __isl_give isl_union_pw_qpolynomial *
5910         isl_union_pw_qpolynomial_subtract_domain(
5911                 __isl_take isl_union_pw_qpolynomial *upwpq,
5912                 __isl_take isl_union_set *uset);
5913         __isl_give isl_union_pw_qpolynomial_fold *
5914         isl_union_pw_qpolynomial_fold_subtract_domain(
5915                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5916                 __isl_take isl_union_set *uset);
5918 =item * Application
5920         #include <isl/space.h>
5921         __isl_give isl_space *isl_space_join(
5922                 __isl_take isl_space *left,
5923                 __isl_take isl_space *right);
5925         #include <isl/map.h>
5926         __isl_give isl_basic_set *isl_basic_set_apply(
5927                 __isl_take isl_basic_set *bset,
5928                 __isl_take isl_basic_map *bmap);
5929         __isl_give isl_set *isl_set_apply(
5930                 __isl_take isl_set *set,
5931                 __isl_take isl_map *map);
5932         __isl_give isl_union_set *isl_union_set_apply(
5933                 __isl_take isl_union_set *uset,
5934                 __isl_take isl_union_map *umap);
5935         __isl_give isl_basic_map *isl_basic_map_apply_domain(
5936                 __isl_take isl_basic_map *bmap1,
5937                 __isl_take isl_basic_map *bmap2);
5938         __isl_give isl_basic_map *isl_basic_map_apply_range(
5939                 __isl_take isl_basic_map *bmap1,
5940                 __isl_take isl_basic_map *bmap2);
5941         __isl_give isl_map *isl_map_apply_domain(
5942                 __isl_take isl_map *map1,
5943                 __isl_take isl_map *map2);
5944         __isl_give isl_map *isl_map_apply_range(
5945                 __isl_take isl_map *map1,
5946                 __isl_take isl_map *map2);
5948         #include <isl/union_map.h>
5949         __isl_give isl_union_map *isl_union_map_apply_domain(
5950                 __isl_take isl_union_map *umap1,
5951                 __isl_take isl_union_map *umap2);
5952         __isl_give isl_union_map *isl_union_map_apply_range(
5953                 __isl_take isl_union_map *umap1,
5954                 __isl_take isl_union_map *umap2);
5956         #include <isl/aff.h>
5957         __isl_give isl_union_pw_aff *
5958         isl_multi_union_pw_aff_apply_aff(
5959                 __isl_take isl_multi_union_pw_aff *mupa,
5960                 __isl_take isl_aff *aff);
5961         __isl_give isl_union_pw_aff *
5962         isl_multi_union_pw_aff_apply_pw_aff(
5963                 __isl_take isl_multi_union_pw_aff *mupa,
5964                 __isl_take isl_pw_aff *pa);
5965         __isl_give isl_multi_union_pw_aff *
5966         isl_multi_union_pw_aff_apply_multi_aff(
5967                 __isl_take isl_multi_union_pw_aff *mupa,
5968                 __isl_take isl_multi_aff *ma);
5969         __isl_give isl_multi_union_pw_aff *
5970         isl_multi_union_pw_aff_apply_pw_multi_aff(
5971                 __isl_take isl_multi_union_pw_aff *mupa,
5972                 __isl_take isl_pw_multi_aff *pma);
5974 The result of C<isl_multi_union_pw_aff_apply_aff> is defined
5975 over the shared domain of the elements of the input.  The dimension is
5976 required to be greater than zero.
5977 The C<isl_multi_union_pw_aff> argument of
5978 C<isl_multi_union_pw_aff_apply_multi_aff> is allowed to be zero-dimensional,
5979 but only if the range of the C<isl_multi_aff> argument
5980 is also zero-dimensional.
5981 Similarly for C<isl_multi_union_pw_aff_apply_pw_multi_aff>.
5983         #include <isl/polynomial.h>
5984         __isl_give isl_pw_qpolynomial_fold *
5985         isl_set_apply_pw_qpolynomial_fold(
5986                 __isl_take isl_set *set,
5987                 __isl_take isl_pw_qpolynomial_fold *pwf,
5988                 int *tight);
5989         __isl_give isl_pw_qpolynomial_fold *
5990         isl_map_apply_pw_qpolynomial_fold(
5991                 __isl_take isl_map *map,
5992                 __isl_take isl_pw_qpolynomial_fold *pwf,
5993                 int *tight);
5994         __isl_give isl_union_pw_qpolynomial_fold *
5995         isl_union_set_apply_union_pw_qpolynomial_fold(
5996                 __isl_take isl_union_set *uset,
5997                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
5998                 int *tight);
5999         __isl_give isl_union_pw_qpolynomial_fold *
6000         isl_union_map_apply_union_pw_qpolynomial_fold(
6001                 __isl_take isl_union_map *umap,
6002                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6003                 int *tight);
6005 The functions taking a map
6006 compose the given map with the given piecewise quasipolynomial reduction.
6007 That is, compute a bound (of the same type as C<pwf> or C<upwf> itself)
6008 over all elements in the intersection of the range of the map
6009 and the domain of the piecewise quasipolynomial reduction
6010 as a function of an element in the domain of the map.
6011 The functions taking a set compute a bound over all elements in the
6012 intersection of the set and the domain of the
6013 piecewise quasipolynomial reduction.
6015 =item * Preimage
6017         #include <isl/set.h>
6018         __isl_give isl_basic_set *
6019         isl_basic_set_preimage_multi_aff(
6020                 __isl_take isl_basic_set *bset,
6021                 __isl_take isl_multi_aff *ma);
6022         __isl_give isl_set *isl_set_preimage_multi_aff(
6023                 __isl_take isl_set *set,
6024                 __isl_take isl_multi_aff *ma);
6025         __isl_give isl_set *isl_set_preimage_pw_multi_aff(
6026                 __isl_take isl_set *set,
6027                 __isl_take isl_pw_multi_aff *pma);
6028         __isl_give isl_set *isl_set_preimage_multi_pw_aff(
6029                 __isl_take isl_set *set,
6030                 __isl_take isl_multi_pw_aff *mpa);
6032         #include <isl/union_set.h>
6033         __isl_give isl_union_set *
6034         isl_union_set_preimage_multi_aff(
6035                 __isl_take isl_union_set *uset,
6036                 __isl_take isl_multi_aff *ma);
6037         __isl_give isl_union_set *
6038         isl_union_set_preimage_pw_multi_aff(
6039                 __isl_take isl_union_set *uset,
6040                 __isl_take isl_pw_multi_aff *pma);
6041         __isl_give isl_union_set *
6042         isl_union_set_preimage_union_pw_multi_aff(
6043                 __isl_take isl_union_set *uset,
6044                 __isl_take isl_union_pw_multi_aff *upma);
6046         #include <isl/map.h>
6047         __isl_give isl_basic_map *
6048         isl_basic_map_preimage_domain_multi_aff(
6049                 __isl_take isl_basic_map *bmap,
6050                 __isl_take isl_multi_aff *ma);
6051         __isl_give isl_map *isl_map_preimage_domain_multi_aff(
6052                 __isl_take isl_map *map,
6053                 __isl_take isl_multi_aff *ma);
6054         __isl_give isl_map *isl_map_preimage_range_multi_aff(
6055                 __isl_take isl_map *map,
6056                 __isl_take isl_multi_aff *ma);
6057         __isl_give isl_map *
6058         isl_map_preimage_domain_pw_multi_aff(
6059                 __isl_take isl_map *map,
6060                 __isl_take isl_pw_multi_aff *pma);
6061         __isl_give isl_map *
6062         isl_map_preimage_range_pw_multi_aff(
6063                 __isl_take isl_map *map,
6064                 __isl_take isl_pw_multi_aff *pma);
6065         __isl_give isl_map *
6066         isl_map_preimage_domain_multi_pw_aff(
6067                 __isl_take isl_map *map,
6068                 __isl_take isl_multi_pw_aff *mpa);
6069         __isl_give isl_basic_map *
6070         isl_basic_map_preimage_range_multi_aff(
6071                 __isl_take isl_basic_map *bmap,
6072                 __isl_take isl_multi_aff *ma);
6074         #include <isl/union_map.h>
6075         __isl_give isl_union_map *
6076         isl_union_map_preimage_domain_multi_aff(
6077                 __isl_take isl_union_map *umap,
6078                 __isl_take isl_multi_aff *ma);
6079         __isl_give isl_union_map *
6080         isl_union_map_preimage_range_multi_aff(
6081                 __isl_take isl_union_map *umap,
6082                 __isl_take isl_multi_aff *ma);
6083         __isl_give isl_union_map *
6084         isl_union_map_preimage_domain_pw_multi_aff(
6085                 __isl_take isl_union_map *umap,
6086                 __isl_take isl_pw_multi_aff *pma);
6087         __isl_give isl_union_map *
6088         isl_union_map_preimage_range_pw_multi_aff(
6089                 __isl_take isl_union_map *umap,
6090                 __isl_take isl_pw_multi_aff *pma);
6091         __isl_give isl_union_map *
6092         isl_union_map_preimage_domain_union_pw_multi_aff(
6093                 __isl_take isl_union_map *umap,
6094                 __isl_take isl_union_pw_multi_aff *upma);
6095         __isl_give isl_union_map *
6096         isl_union_map_preimage_range_union_pw_multi_aff(
6097                 __isl_take isl_union_map *umap,
6098                 __isl_take isl_union_pw_multi_aff *upma);
6100 These functions compute the preimage of the given set or map domain/range under
6101 the given function.  In other words, the expression is plugged
6102 into the set description or into the domain/range of the map.
6104 =item * Pullback
6106         #include <isl/aff.h>
6107         __isl_give isl_aff *isl_aff_pullback_aff(
6108                 __isl_take isl_aff *aff1,
6109                 __isl_take isl_aff *aff2);
6110         __isl_give isl_aff *isl_aff_pullback_multi_aff(
6111                 __isl_take isl_aff *aff,
6112                 __isl_take isl_multi_aff *ma);
6113         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff(
6114                 __isl_take isl_pw_aff *pa,
6115                 __isl_take isl_multi_aff *ma);
6116         __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff(
6117                 __isl_take isl_pw_aff *pa,
6118                 __isl_take isl_pw_multi_aff *pma);
6119         __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff(
6120                 __isl_take isl_pw_aff *pa,
6121                 __isl_take isl_multi_pw_aff *mpa);
6122         __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff(
6123                 __isl_take isl_multi_aff *ma1,
6124                 __isl_take isl_multi_aff *ma2);
6125         __isl_give isl_pw_multi_aff *
6126         isl_pw_multi_aff_pullback_multi_aff(
6127                 __isl_take isl_pw_multi_aff *pma,
6128                 __isl_take isl_multi_aff *ma);
6129         __isl_give isl_multi_pw_aff *
6130         isl_multi_pw_aff_pullback_multi_aff(
6131                 __isl_take isl_multi_pw_aff *mpa,
6132                 __isl_take isl_multi_aff *ma);
6133         __isl_give isl_pw_multi_aff *
6134         isl_pw_multi_aff_pullback_pw_multi_aff(
6135                 __isl_take isl_pw_multi_aff *pma1,
6136                 __isl_take isl_pw_multi_aff *pma2);
6137         __isl_give isl_multi_pw_aff *
6138         isl_multi_pw_aff_pullback_pw_multi_aff(
6139                 __isl_take isl_multi_pw_aff *mpa,
6140                 __isl_take isl_pw_multi_aff *pma);
6141         __isl_give isl_multi_pw_aff *
6142         isl_multi_pw_aff_pullback_multi_pw_aff(
6143                 __isl_take isl_multi_pw_aff *mpa1,
6144                 __isl_take isl_multi_pw_aff *mpa2);
6145         __isl_give isl_union_pw_aff *
6146         isl_union_pw_aff_pullback_union_pw_multi_aff(
6147                 __isl_take isl_union_pw_aff *upa,
6148                 __isl_take isl_union_pw_multi_aff *upma);
6149         __isl_give isl_union_pw_multi_aff *
6150         isl_union_pw_multi_aff_pullback_union_pw_multi_aff(
6151                 __isl_take isl_union_pw_multi_aff *upma1,
6152                 __isl_take isl_union_pw_multi_aff *upma2);
6153         __isl_give isl_multi_union_pw_aff *
6154         isl_multi_union_pw_aff_pullback_union_pw_multi_aff(
6155                 __isl_take isl_multi_union_pw_aff *mupa,
6156                 __isl_take isl_union_pw_multi_aff *upma);
6158 These functions precompose the first expression by the second function.
6159 In other words, the second function is plugged
6160 into the first expression.
6162 =item * Locus
6164         #include <isl/aff.h>
6165         __isl_give isl_basic_set *isl_aff_eq_basic_set(
6166                 __isl_take isl_aff *aff1,
6167                 __isl_take isl_aff *aff2);
6168         __isl_give isl_set *isl_aff_eq_set(
6169                 __isl_take isl_aff *aff1,
6170                 __isl_take isl_aff *aff2);
6171         __isl_give isl_basic_set *isl_aff_le_basic_set(
6172                 __isl_take isl_aff *aff1,
6173                 __isl_take isl_aff *aff2);
6174         __isl_give isl_set *isl_aff_le_set(
6175                 __isl_take isl_aff *aff1,
6176                 __isl_take isl_aff *aff2);
6177         __isl_give isl_basic_set *isl_aff_ge_basic_set(
6178                 __isl_take isl_aff *aff1,
6179                 __isl_take isl_aff *aff2);
6180         __isl_give isl_set *isl_aff_ge_set(
6181                 __isl_take isl_aff *aff1,
6182                 __isl_take isl_aff *aff2);
6183         __isl_give isl_set *isl_pw_aff_eq_set(
6184                 __isl_take isl_pw_aff *pwaff1,
6185                 __isl_take isl_pw_aff *pwaff2);
6186         __isl_give isl_set *isl_pw_aff_ne_set(
6187                 __isl_take isl_pw_aff *pwaff1,
6188                 __isl_take isl_pw_aff *pwaff2);
6189         __isl_give isl_set *isl_pw_aff_le_set(
6190                 __isl_take isl_pw_aff *pwaff1,
6191                 __isl_take isl_pw_aff *pwaff2);
6192         __isl_give isl_set *isl_pw_aff_lt_set(
6193                 __isl_take isl_pw_aff *pwaff1,
6194                 __isl_take isl_pw_aff *pwaff2);
6195         __isl_give isl_set *isl_pw_aff_ge_set(
6196                 __isl_take isl_pw_aff *pwaff1,
6197                 __isl_take isl_pw_aff *pwaff2);
6198         __isl_give isl_set *isl_pw_aff_gt_set(
6199                 __isl_take isl_pw_aff *pwaff1,
6200                 __isl_take isl_pw_aff *pwaff2);
6202         __isl_give isl_set *isl_multi_aff_lex_le_set(
6203                 __isl_take isl_multi_aff *ma1,
6204                 __isl_take isl_multi_aff *ma2);
6205         __isl_give isl_set *isl_multi_aff_lex_lt_set(
6206                 __isl_take isl_multi_aff *ma1,
6207                 __isl_take isl_multi_aff *ma2);
6208         __isl_give isl_set *isl_multi_aff_lex_ge_set(
6209                 __isl_take isl_multi_aff *ma1,
6210                 __isl_take isl_multi_aff *ma2);
6211         __isl_give isl_set *isl_multi_aff_lex_gt_set(
6212                 __isl_take isl_multi_aff *ma1,
6213                 __isl_take isl_multi_aff *ma2);
6215         __isl_give isl_set *isl_pw_aff_list_eq_set(
6216                 __isl_take isl_pw_aff_list *list1,
6217                 __isl_take isl_pw_aff_list *list2);
6218         __isl_give isl_set *isl_pw_aff_list_ne_set(
6219                 __isl_take isl_pw_aff_list *list1,
6220                 __isl_take isl_pw_aff_list *list2);
6221         __isl_give isl_set *isl_pw_aff_list_le_set(
6222                 __isl_take isl_pw_aff_list *list1,
6223                 __isl_take isl_pw_aff_list *list2);
6224         __isl_give isl_set *isl_pw_aff_list_lt_set(
6225                 __isl_take isl_pw_aff_list *list1,
6226                 __isl_take isl_pw_aff_list *list2);
6227         __isl_give isl_set *isl_pw_aff_list_ge_set(
6228                 __isl_take isl_pw_aff_list *list1,
6229                 __isl_take isl_pw_aff_list *list2);
6230         __isl_give isl_set *isl_pw_aff_list_gt_set(
6231                 __isl_take isl_pw_aff_list *list1,
6232                 __isl_take isl_pw_aff_list *list2);
6234 The function C<isl_aff_ge_basic_set> returns a basic set
6235 containing those elements in the shared space
6236 of C<aff1> and C<aff2> where C<aff1> is greater than or equal to C<aff2>.
6237 The function C<isl_pw_aff_ge_set> returns a set
6238 containing those elements in the shared domain
6239 of C<pwaff1> and C<pwaff2> where C<pwaff1> is
6240 greater than or equal to C<pwaff2>.
6241 The function C<isl_multi_aff_lex_le_set> returns a set
6242 containing those elements in the shared domain space
6243 where C<ma1> is lexicographically smaller than or
6244 equal to C<ma2>.
6245 The functions operating on C<isl_pw_aff_list> apply the corresponding
6246 C<isl_pw_aff> function to each pair of elements in the two lists.
6248         #include <isl/aff.h>
6249         __isl_give isl_map *isl_pw_aff_eq_map(
6250                 __isl_take isl_pw_aff *pa1,
6251                 __isl_take isl_pw_aff *pa2);
6252         __isl_give isl_map *isl_pw_aff_lt_map(
6253                 __isl_take isl_pw_aff *pa1,
6254                 __isl_take isl_pw_aff *pa2);
6255         __isl_give isl_map *isl_pw_aff_gt_map(
6256                 __isl_take isl_pw_aff *pa1,
6257                 __isl_take isl_pw_aff *pa2);
6259         __isl_give isl_map *isl_multi_pw_aff_eq_map(
6260                 __isl_take isl_multi_pw_aff *mpa1,
6261                 __isl_take isl_multi_pw_aff *mpa2);
6262         __isl_give isl_map *isl_multi_pw_aff_lex_lt_map(
6263                 __isl_take isl_multi_pw_aff *mpa1,
6264                 __isl_take isl_multi_pw_aff *mpa2);
6265         __isl_give isl_map *isl_multi_pw_aff_lex_gt_map(
6266                 __isl_take isl_multi_pw_aff *mpa1,
6267                 __isl_take isl_multi_pw_aff *mpa2);
6269 These functions return a map between domain elements of the arguments
6270 where the function values satisfy the given relation.
6272         #include <isl/union_map.h>
6273         __isl_give isl_union_map *
6274         isl_union_map_eq_at_multi_union_pw_aff(
6275                 __isl_take isl_union_map *umap,
6276                 __isl_take isl_multi_union_pw_aff *mupa);
6277         __isl_give isl_union_map *
6278         isl_union_map_lex_lt_at_multi_union_pw_aff(
6279                 __isl_take isl_union_map *umap,
6280                 __isl_take isl_multi_union_pw_aff *mupa);
6281         __isl_give isl_union_map *
6282         isl_union_map_lex_gt_at_multi_union_pw_aff(
6283                 __isl_take isl_union_map *umap,
6284                 __isl_take isl_multi_union_pw_aff *mupa);
6286 These functions select the subset of elements in the union map
6287 that have an equal or lexicographically smaller function value.
6289 =item * Cartesian Product
6291         #include <isl/space.h>
6292         __isl_give isl_space *isl_space_product(
6293                 __isl_take isl_space *space1,
6294                 __isl_take isl_space *space2);
6295         __isl_give isl_space *isl_space_domain_product(
6296                 __isl_take isl_space *space1,
6297                 __isl_take isl_space *space2);
6298         __isl_give isl_space *isl_space_range_product(
6299                 __isl_take isl_space *space1,
6300                 __isl_take isl_space *space2);
6302 The functions
6303 C<isl_space_product>, C<isl_space_domain_product>
6304 and C<isl_space_range_product> take pairs or relation spaces and
6305 produce a single relations space, where either the domain, the range
6306 or both domain and range are wrapped spaces of relations between
6307 the domains and/or ranges of the input spaces.
6308 If the product is only constructed over the domain or the range
6309 then the ranges or the domains of the inputs should be the same.
6310 The function C<isl_space_product> also accepts a pair of set spaces,
6311 in which case it returns a wrapped space of a relation between the
6312 two input spaces.
6314         #include <isl/set.h>
6315         __isl_give isl_set *isl_set_product(
6316                 __isl_take isl_set *set1,
6317                 __isl_take isl_set *set2);
6319         #include <isl/map.h>
6320         __isl_give isl_basic_map *isl_basic_map_domain_product(
6321                 __isl_take isl_basic_map *bmap1,
6322                 __isl_take isl_basic_map *bmap2);
6323         __isl_give isl_basic_map *isl_basic_map_range_product(
6324                 __isl_take isl_basic_map *bmap1,
6325                 __isl_take isl_basic_map *bmap2);
6326         __isl_give isl_basic_map *isl_basic_map_product(
6327                 __isl_take isl_basic_map *bmap1,
6328                 __isl_take isl_basic_map *bmap2);
6329         __isl_give isl_map *isl_map_domain_product(
6330                 __isl_take isl_map *map1,
6331                 __isl_take isl_map *map2);
6332         __isl_give isl_map *isl_map_range_product(
6333                 __isl_take isl_map *map1,
6334                 __isl_take isl_map *map2);
6335         __isl_give isl_map *isl_map_product(
6336                 __isl_take isl_map *map1,
6337                 __isl_take isl_map *map2);
6339         #include <isl/union_set.h>
6340         __isl_give isl_union_set *isl_union_set_product(
6341                 __isl_take isl_union_set *uset1,
6342                 __isl_take isl_union_set *uset2);
6344         #include <isl/union_map.h>
6345         __isl_give isl_union_map *isl_union_map_domain_product(
6346                 __isl_take isl_union_map *umap1,
6347                 __isl_take isl_union_map *umap2);
6348         __isl_give isl_union_map *isl_union_map_range_product(
6349                 __isl_take isl_union_map *umap1,
6350                 __isl_take isl_union_map *umap2);
6351         __isl_give isl_union_map *isl_union_map_product(
6352                 __isl_take isl_union_map *umap1,
6353                 __isl_take isl_union_map *umap2);
6355         #include <isl/val.h>
6356         __isl_give isl_multi_val *isl_multi_val_range_product(
6357                 __isl_take isl_multi_val *mv1,
6358                 __isl_take isl_multi_val *mv2);
6359         __isl_give isl_multi_val *isl_multi_val_product(
6360                 __isl_take isl_multi_val *mv1,
6361                 __isl_take isl_multi_val *mv2);
6363         #include <isl/aff.h>
6364         __isl_give isl_multi_aff *isl_multi_aff_range_product(
6365                 __isl_take isl_multi_aff *ma1,
6366                 __isl_take isl_multi_aff *ma2);
6367         __isl_give isl_multi_aff *isl_multi_aff_product(
6368                 __isl_take isl_multi_aff *ma1,
6369                 __isl_take isl_multi_aff *ma2);
6370         __isl_give isl_multi_pw_aff *
6371         isl_multi_pw_aff_range_product(
6372                 __isl_take isl_multi_pw_aff *mpa1,
6373                 __isl_take isl_multi_pw_aff *mpa2);
6374         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_product(
6375                 __isl_take isl_multi_pw_aff *mpa1,
6376                 __isl_take isl_multi_pw_aff *mpa2);
6377         __isl_give isl_pw_multi_aff *
6378         isl_pw_multi_aff_range_product(
6379                 __isl_take isl_pw_multi_aff *pma1,
6380                 __isl_take isl_pw_multi_aff *pma2);
6381         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product(
6382                 __isl_take isl_pw_multi_aff *pma1,
6383                 __isl_take isl_pw_multi_aff *pma2);
6384         __isl_give isl_multi_union_pw_aff *
6385         isl_multi_union_pw_aff_range_product(
6386                 __isl_take isl_multi_union_pw_aff *mupa1,
6387                 __isl_take isl_multi_union_pw_aff *mupa2);
6389 The above functions compute the cross product of the given
6390 sets, relations or functions.  The domains and ranges of the results
6391 are wrapped maps between domains and ranges of the inputs.
6392 To obtain a ``flat'' product, use the following functions
6393 instead.
6395         #include <isl/set.h>
6396         __isl_give isl_basic_set *isl_basic_set_flat_product(
6397                 __isl_take isl_basic_set *bset1,
6398                 __isl_take isl_basic_set *bset2);
6399         __isl_give isl_set *isl_set_flat_product(
6400                 __isl_take isl_set *set1,
6401                 __isl_take isl_set *set2);
6403         #include <isl/map.h>
6404         __isl_give isl_basic_map *isl_basic_map_flat_range_product(
6405                 __isl_take isl_basic_map *bmap1,
6406                 __isl_take isl_basic_map *bmap2);
6407         __isl_give isl_map *isl_map_flat_domain_product(
6408                 __isl_take isl_map *map1,
6409                 __isl_take isl_map *map2);
6410         __isl_give isl_map *isl_map_flat_range_product(
6411                 __isl_take isl_map *map1,
6412                 __isl_take isl_map *map2);
6413         __isl_give isl_basic_map *isl_basic_map_flat_product(
6414                 __isl_take isl_basic_map *bmap1,
6415                 __isl_take isl_basic_map *bmap2);
6416         __isl_give isl_map *isl_map_flat_product(
6417                 __isl_take isl_map *map1,
6418                 __isl_take isl_map *map2);
6420         #include <isl/union_map.h>
6421         __isl_give isl_union_map *
6422         isl_union_map_flat_domain_product(
6423                 __isl_take isl_union_map *umap1,
6424                 __isl_take isl_union_map *umap2);
6425         __isl_give isl_union_map *
6426         isl_union_map_flat_range_product(
6427                 __isl_take isl_union_map *umap1,
6428                 __isl_take isl_union_map *umap2);
6430         #include <isl/val.h>
6431         __isl_give isl_multi_val *isl_multi_val_flat_range_product(
6432                 __isl_take isl_multi_val *mv1,
6433                 __isl_take isl_multi_aff *mv2);
6435         #include <isl/aff.h>
6436         __isl_give isl_multi_aff *isl_multi_aff_flat_range_product(
6437                 __isl_take isl_multi_aff *ma1,
6438                 __isl_take isl_multi_aff *ma2);
6439         __isl_give isl_pw_multi_aff *
6440         isl_pw_multi_aff_flat_range_product(
6441                 __isl_take isl_pw_multi_aff *pma1,
6442                 __isl_take isl_pw_multi_aff *pma2);
6443         __isl_give isl_multi_pw_aff *
6444         isl_multi_pw_aff_flat_range_product(
6445                 __isl_take isl_multi_pw_aff *mpa1,
6446                 __isl_take isl_multi_pw_aff *mpa2);
6447         __isl_give isl_union_pw_multi_aff *
6448         isl_union_pw_multi_aff_flat_range_product(
6449                 __isl_take isl_union_pw_multi_aff *upma1,
6450                 __isl_take isl_union_pw_multi_aff *upma2);
6451         __isl_give isl_multi_union_pw_aff *
6452         isl_multi_union_pw_aff_flat_range_product(
6453                 __isl_take isl_multi_union_pw_aff *mupa1,
6454                 __isl_take isl_multi_union_pw_aff *mupa2);
6456         #include <isl/space.h>
6457         __isl_give isl_space *isl_space_factor_domain(
6458                 __isl_take isl_space *space);
6459         __isl_give isl_space *isl_space_factor_range(
6460                 __isl_take isl_space *space);
6461         __isl_give isl_space *isl_space_domain_factor_domain(
6462                 __isl_take isl_space *space);
6463         __isl_give isl_space *isl_space_domain_factor_range(
6464                 __isl_take isl_space *space);
6465         __isl_give isl_space *isl_space_range_factor_domain(
6466                 __isl_take isl_space *space);
6467         __isl_give isl_space *isl_space_range_factor_range(
6468                 __isl_take isl_space *space);
6470 The functions C<isl_space_range_factor_domain> and
6471 C<isl_space_range_factor_range> extract the two arguments from
6472 the result of a call to C<isl_space_range_product>.
6474 The arguments of a call to a product can be extracted
6475 from the result using the following functions.
6477         #include <isl/map.h>
6478         __isl_give isl_map *isl_map_factor_domain(
6479                 __isl_take isl_map *map);
6480         __isl_give isl_map *isl_map_factor_range(
6481                 __isl_take isl_map *map);
6482         __isl_give isl_map *isl_map_domain_factor_domain(
6483                 __isl_take isl_map *map);
6484         __isl_give isl_map *isl_map_domain_factor_range(
6485                 __isl_take isl_map *map);
6486         __isl_give isl_map *isl_map_range_factor_domain(
6487                 __isl_take isl_map *map);
6488         __isl_give isl_map *isl_map_range_factor_range(
6489                 __isl_take isl_map *map);
6491         #include <isl/union_map.h>
6492         __isl_give isl_union_map *isl_union_map_factor_domain(
6493                 __isl_take isl_union_map *umap);
6494         __isl_give isl_union_map *isl_union_map_factor_range(
6495                 __isl_take isl_union_map *umap);
6496         __isl_give isl_union_map *
6497         isl_union_map_domain_factor_domain(
6498                 __isl_take isl_union_map *umap);
6499         __isl_give isl_union_map *
6500         isl_union_map_domain_factor_range(
6501                 __isl_take isl_union_map *umap);
6502         __isl_give isl_union_map *
6503         isl_union_map_range_factor_domain(
6504                 __isl_take isl_union_map *umap);
6505         __isl_give isl_union_map *
6506         isl_union_map_range_factor_range(
6507                 __isl_take isl_union_map *umap);
6509         #include <isl/val.h>
6510         __isl_give isl_multi_val *isl_multi_val_factor_range(
6511                 __isl_take isl_multi_val *mv);
6512         __isl_give isl_multi_val *
6513         isl_multi_val_range_factor_domain(
6514                 __isl_take isl_multi_val *mv);
6515         __isl_give isl_multi_val *
6516         isl_multi_val_range_factor_range(
6517                 __isl_take isl_multi_val *mv);
6519         #include <isl/aff.h>
6520         __isl_give isl_multi_aff *isl_multi_aff_factor_range(
6521                 __isl_take isl_multi_aff *ma);
6522         __isl_give isl_multi_aff *
6523         isl_multi_aff_range_factor_domain(
6524                 __isl_take isl_multi_aff *ma);
6525         __isl_give isl_multi_aff *
6526         isl_multi_aff_range_factor_range(
6527                 __isl_take isl_multi_aff *ma);
6528         __isl_give isl_multi_pw_aff *
6529         isl_multi_pw_aff_factor_range(
6530                 __isl_take isl_multi_pw_aff *mpa);
6531         __isl_give isl_multi_pw_aff *
6532         isl_multi_pw_aff_range_factor_domain(
6533                 __isl_take isl_multi_pw_aff *mpa);
6534         __isl_give isl_multi_pw_aff *
6535         isl_multi_pw_aff_range_factor_range(
6536                 __isl_take isl_multi_pw_aff *mpa);
6537         __isl_give isl_multi_union_pw_aff *
6538         isl_multi_union_pw_aff_factor_range(
6539                 __isl_take isl_multi_union_pw_aff *mupa);
6540         __isl_give isl_multi_union_pw_aff *
6541         isl_multi_union_pw_aff_range_factor_domain(
6542                 __isl_take isl_multi_union_pw_aff *mupa);
6543         __isl_give isl_multi_union_pw_aff *
6544         isl_multi_union_pw_aff_range_factor_range(
6545                 __isl_take isl_multi_union_pw_aff *mupa);
6547 The splice functions are a generalization of the flat product functions,
6548 where the second argument may be inserted at any position inside
6549 the first argument rather than being placed at the end.
6550 The functions C<isl_multi_val_factor_range>,
6551 C<isl_multi_aff_factor_range>,
6552 C<isl_multi_pw_aff_factor_range> and
6553 C<isl_multi_union_pw_aff_factor_range>
6554 take functions that live in a set space.
6556         #include <isl/val.h>
6557         __isl_give isl_multi_val *isl_multi_val_range_splice(
6558                 __isl_take isl_multi_val *mv1, unsigned pos,
6559                 __isl_take isl_multi_val *mv2);
6561         #include <isl/aff.h>
6562         __isl_give isl_multi_aff *isl_multi_aff_range_splice(
6563                 __isl_take isl_multi_aff *ma1, unsigned pos,
6564                 __isl_take isl_multi_aff *ma2);
6565         __isl_give isl_multi_aff *isl_multi_aff_splice(
6566                 __isl_take isl_multi_aff *ma1,
6567                 unsigned in_pos, unsigned out_pos,
6568                 __isl_take isl_multi_aff *ma2);
6569         __isl_give isl_multi_pw_aff *
6570         isl_multi_pw_aff_range_splice(
6571                 __isl_take isl_multi_pw_aff *mpa1, unsigned pos,
6572                 __isl_take isl_multi_pw_aff *mpa2);
6573         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_splice(
6574                 __isl_take isl_multi_pw_aff *mpa1,
6575                 unsigned in_pos, unsigned out_pos,
6576                 __isl_take isl_multi_pw_aff *mpa2);
6577         __isl_give isl_multi_union_pw_aff *
6578         isl_multi_union_pw_aff_range_splice(
6579                 __isl_take isl_multi_union_pw_aff *mupa1,
6580                 unsigned pos,
6581                 __isl_take isl_multi_union_pw_aff *mupa2);
6583 =item * Simplification
6585 When applied to a set or relation,
6586 the gist operation returns a set or relation that has the
6587 same intersection with the context as the input set or relation.
6588 Any implicit equality in the intersection is made explicit in the result,
6589 while all inequalities that are redundant with respect to the intersection
6590 are removed.
6591 In case of union sets and relations, the gist operation is performed
6592 per space.
6594 When applied to a function,
6595 the gist operation applies the set gist operation to each of
6596 the cells in the domain of the input piecewise expression.
6597 The context is also exploited
6598 to simplify the expression associated to each cell.
6600         #include <isl/set.h>
6601         __isl_give isl_basic_set *isl_basic_set_gist(
6602                 __isl_take isl_basic_set *bset,
6603                 __isl_take isl_basic_set *context);
6604         __isl_give isl_set *isl_set_gist(__isl_take isl_set *set,
6605                 __isl_take isl_set *context);
6606         __isl_give isl_set *isl_set_gist_params(
6607                 __isl_take isl_set *set,
6608                 __isl_take isl_set *context);
6610         #include <isl/map.h>
6611         __isl_give isl_basic_map *isl_basic_map_gist(
6612                 __isl_take isl_basic_map *bmap,
6613                 __isl_take isl_basic_map *context);
6614         __isl_give isl_basic_map *isl_basic_map_gist_domain(
6615                 __isl_take isl_basic_map *bmap,
6616                 __isl_take isl_basic_set *context);
6617         __isl_give isl_map *isl_map_gist(__isl_take isl_map *map,
6618                 __isl_take isl_map *context);
6619         __isl_give isl_map *isl_map_gist_params(
6620                 __isl_take isl_map *map,
6621                 __isl_take isl_set *context);
6622         __isl_give isl_map *isl_map_gist_domain(
6623                 __isl_take isl_map *map,
6624                 __isl_take isl_set *context);
6625         __isl_give isl_map *isl_map_gist_range(
6626                 __isl_take isl_map *map,
6627                 __isl_take isl_set *context);
6629         #include <isl/union_set.h>
6630         __isl_give isl_union_set *isl_union_set_gist(
6631                 __isl_take isl_union_set *uset,
6632                 __isl_take isl_union_set *context);
6633         __isl_give isl_union_set *isl_union_set_gist_params(
6634                 __isl_take isl_union_set *uset,
6635                 __isl_take isl_set *set);
6637         #include <isl/union_map.h>
6638         __isl_give isl_union_map *isl_union_map_gist(
6639                 __isl_take isl_union_map *umap,
6640                 __isl_take isl_union_map *context);
6641         __isl_give isl_union_map *isl_union_map_gist_params(
6642                 __isl_take isl_union_map *umap,
6643                 __isl_take isl_set *set);
6644         __isl_give isl_union_map *isl_union_map_gist_domain(
6645                 __isl_take isl_union_map *umap,
6646                 __isl_take isl_union_set *uset);
6647         __isl_give isl_union_map *isl_union_map_gist_range(
6648                 __isl_take isl_union_map *umap,
6649                 __isl_take isl_union_set *uset);
6651         #include <isl/aff.h>
6652         __isl_give isl_aff *isl_aff_gist_params(
6653                 __isl_take isl_aff *aff,
6654                 __isl_take isl_set *context);
6655         __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff,
6656                 __isl_take isl_set *context);
6657         __isl_give isl_multi_aff *isl_multi_aff_gist_params(
6658                 __isl_take isl_multi_aff *maff,
6659                 __isl_take isl_set *context);
6660         __isl_give isl_multi_aff *isl_multi_aff_gist(
6661                 __isl_take isl_multi_aff *maff,
6662                 __isl_take isl_set *context);
6663         __isl_give isl_pw_aff *isl_pw_aff_gist_params(
6664                 __isl_take isl_pw_aff *pwaff,
6665                 __isl_take isl_set *context);
6666         __isl_give isl_pw_aff *isl_pw_aff_gist(
6667                 __isl_take isl_pw_aff *pwaff,
6668                 __isl_take isl_set *context);
6669         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params(
6670                 __isl_take isl_pw_multi_aff *pma,
6671                 __isl_take isl_set *set);
6672         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist(
6673                 __isl_take isl_pw_multi_aff *pma,
6674                 __isl_take isl_set *set);
6675         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params(
6676                 __isl_take isl_multi_pw_aff *mpa,
6677                 __isl_take isl_set *set);
6678         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist(
6679                 __isl_take isl_multi_pw_aff *mpa,
6680                 __isl_take isl_set *set);
6681         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist(
6682                 __isl_take isl_union_pw_aff *upa,
6683                 __isl_take isl_union_set *context);
6684         __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params(
6685                 __isl_take isl_union_pw_aff *upa,
6686                 __isl_take isl_set *context);
6687         __isl_give isl_union_pw_multi_aff *
6688         isl_union_pw_multi_aff_gist_params(
6689                 __isl_take isl_union_pw_multi_aff *upma,
6690                 __isl_take isl_set *context);
6691         __isl_give isl_union_pw_multi_aff *
6692         isl_union_pw_multi_aff_gist(
6693                 __isl_take isl_union_pw_multi_aff *upma,
6694                 __isl_take isl_union_set *context);
6695         __isl_give isl_multi_union_pw_aff *
6696         isl_multi_union_pw_aff_gist_params(
6697                 __isl_take isl_multi_union_pw_aff *aff,
6698                 __isl_take isl_set *context);
6699         __isl_give isl_multi_union_pw_aff *
6700         isl_multi_union_pw_aff_gist(
6701                 __isl_take isl_multi_union_pw_aff *aff,
6702                 __isl_take isl_union_set *context);
6704         #include <isl/polynomial.h>
6705         __isl_give isl_qpolynomial *isl_qpolynomial_gist_params(
6706                 __isl_take isl_qpolynomial *qp,
6707                 __isl_take isl_set *context);
6708         __isl_give isl_qpolynomial *isl_qpolynomial_gist(
6709                 __isl_take isl_qpolynomial *qp,
6710                 __isl_take isl_set *context);
6711         __isl_give isl_qpolynomial_fold *
6712         isl_qpolynomial_fold_gist_params(
6713                 __isl_take isl_qpolynomial_fold *fold,
6714                 __isl_take isl_set *context);
6715         __isl_give isl_qpolynomial_fold *isl_qpolynomial_fold_gist(
6716                 __isl_take isl_qpolynomial_fold *fold,
6717                 __isl_take isl_set *context);
6718         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist_params(
6719                 __isl_take isl_pw_qpolynomial *pwqp,
6720                 __isl_take isl_set *context);
6721         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_gist(
6722                 __isl_take isl_pw_qpolynomial *pwqp,
6723                 __isl_take isl_set *context);
6724         __isl_give isl_pw_qpolynomial_fold *
6725         isl_pw_qpolynomial_fold_gist(
6726                 __isl_take isl_pw_qpolynomial_fold *pwf,
6727                 __isl_take isl_set *context);
6728         __isl_give isl_pw_qpolynomial_fold *
6729         isl_pw_qpolynomial_fold_gist_params(
6730                 __isl_take isl_pw_qpolynomial_fold *pwf,
6731                 __isl_take isl_set *context);
6732         __isl_give isl_union_pw_qpolynomial *
6733         isl_union_pw_qpolynomial_gist_params(
6734                 __isl_take isl_union_pw_qpolynomial *upwqp,
6735                 __isl_take isl_set *context);
6736         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_gist(
6737                 __isl_take isl_union_pw_qpolynomial *upwqp,
6738                 __isl_take isl_union_set *context);
6739         __isl_give isl_union_pw_qpolynomial_fold *
6740         isl_union_pw_qpolynomial_fold_gist(
6741                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6742                 __isl_take isl_union_set *context);
6743         __isl_give isl_union_pw_qpolynomial_fold *
6744         isl_union_pw_qpolynomial_fold_gist_params(
6745                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
6746                 __isl_take isl_set *context);
6748 =item * Binary Arithmetic Operations
6750         #include <isl/set.h>
6751         __isl_give isl_set *isl_set_sum(
6752                 __isl_take isl_set *set1,
6753                 __isl_take isl_set *set2);
6754         #include <isl/map.h>
6755         __isl_give isl_map *isl_map_sum(
6756                 __isl_take isl_map *map1,
6757                 __isl_take isl_map *map2);
6759 C<isl_set_sum> computes the Minkowski sum of its two arguments,
6760 i.e., the set containing the sums of pairs of elements from
6761 C<set1> and C<set2>.
6762 The domain of the result of C<isl_map_sum> is the intersection
6763 of the domains of its two arguments.  The corresponding range
6764 elements are the sums of the corresponding range elements
6765 in the two arguments.
6767         #include <isl/val.h>
6768         __isl_give isl_multi_val *isl_multi_val_add(
6769                 __isl_take isl_multi_val *mv1,
6770                 __isl_take isl_multi_val *mv2);
6771         __isl_give isl_multi_val *isl_multi_val_sub(
6772                 __isl_take isl_multi_val *mv1,
6773                 __isl_take isl_multi_val *mv2);
6775         #include <isl/aff.h>
6776         __isl_give isl_aff *isl_aff_add(
6777                 __isl_take isl_aff *aff1,
6778                 __isl_take isl_aff *aff2);
6779         __isl_give isl_multi_aff *isl_multi_aff_add(
6780                 __isl_take isl_multi_aff *maff1,
6781                 __isl_take isl_multi_aff *maff2);
6782         __isl_give isl_pw_aff *isl_pw_aff_add(
6783                 __isl_take isl_pw_aff *pwaff1,
6784                 __isl_take isl_pw_aff *pwaff2);
6785         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_add(
6786                 __isl_take isl_multi_pw_aff *mpa1,
6787                 __isl_take isl_multi_pw_aff *mpa2);
6788         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add(
6789                 __isl_take isl_pw_multi_aff *pma1,
6790                 __isl_take isl_pw_multi_aff *pma2);
6791         __isl_give isl_union_pw_aff *isl_union_pw_aff_add(
6792                 __isl_take isl_union_pw_aff *upa1,
6793                 __isl_take isl_union_pw_aff *upa2);
6794         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add(
6795                 __isl_take isl_union_pw_multi_aff *upma1,
6796                 __isl_take isl_union_pw_multi_aff *upma2);
6797         __isl_give isl_multi_union_pw_aff *
6798         isl_multi_union_pw_aff_add(
6799                 __isl_take isl_multi_union_pw_aff *mupa1,
6800                 __isl_take isl_multi_union_pw_aff *mupa2);
6801         __isl_give isl_pw_aff *isl_pw_aff_min(
6802                 __isl_take isl_pw_aff *pwaff1,
6803                 __isl_take isl_pw_aff *pwaff2);
6804         __isl_give isl_pw_aff *isl_pw_aff_max(
6805                 __isl_take isl_pw_aff *pwaff1,
6806                 __isl_take isl_pw_aff *pwaff2);
6807         __isl_give isl_aff *isl_aff_sub(
6808                 __isl_take isl_aff *aff1,
6809                 __isl_take isl_aff *aff2);
6810         __isl_give isl_multi_aff *isl_multi_aff_sub(
6811                 __isl_take isl_multi_aff *ma1,
6812                 __isl_take isl_multi_aff *ma2);
6813         __isl_give isl_pw_aff *isl_pw_aff_sub(
6814                 __isl_take isl_pw_aff *pwaff1,
6815                 __isl_take isl_pw_aff *pwaff2);
6816         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_sub(
6817                 __isl_take isl_multi_pw_aff *mpa1,
6818                 __isl_take isl_multi_pw_aff *mpa2);
6819         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub(
6820                 __isl_take isl_pw_multi_aff *pma1,
6821                 __isl_take isl_pw_multi_aff *pma2);
6822         __isl_give isl_union_pw_aff *isl_union_pw_aff_sub(
6823                 __isl_take isl_union_pw_aff *upa1,
6824                 __isl_take isl_union_pw_aff *upa2);
6825         __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub(
6826                 __isl_take isl_union_pw_multi_aff *upma1,
6827                 __isl_take isl_union_pw_multi_aff *upma2);
6828         __isl_give isl_multi_union_pw_aff *
6829         isl_multi_union_pw_aff_sub(
6830                 __isl_take isl_multi_union_pw_aff *mupa1,
6831                 __isl_take isl_multi_union_pw_aff *mupa2);
6833 C<isl_aff_sub> subtracts the second argument from the first.
6835         #include <isl/polynomial.h>
6836         __isl_give isl_qpolynomial *isl_qpolynomial_add(
6837                 __isl_take isl_qpolynomial *qp1,
6838                 __isl_take isl_qpolynomial *qp2);
6839         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add(
6840                 __isl_take isl_pw_qpolynomial *pwqp1,
6841                 __isl_take isl_pw_qpolynomial *pwqp2);
6842         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_add_disjoint(
6843                 __isl_take isl_pw_qpolynomial *pwqp1,
6844                 __isl_take isl_pw_qpolynomial *pwqp2);
6845         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_add(
6846                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6847                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6848         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_add(
6849                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6850                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6851         __isl_give isl_qpolynomial *isl_qpolynomial_sub(
6852                 __isl_take isl_qpolynomial *qp1,
6853                 __isl_take isl_qpolynomial *qp2);
6854         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_sub(
6855                 __isl_take isl_pw_qpolynomial *pwqp1,
6856                 __isl_take isl_pw_qpolynomial *pwqp2);
6857         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_sub(
6858                 __isl_take isl_union_pw_qpolynomial *upwqp1,
6859                 __isl_take isl_union_pw_qpolynomial *upwqp2);
6860         __isl_give isl_pw_qpolynomial_fold *isl_pw_qpolynomial_fold_fold(
6861                 __isl_take isl_pw_qpolynomial_fold *pwf1,
6862                 __isl_take isl_pw_qpolynomial_fold *pwf2);
6863         __isl_give isl_union_pw_qpolynomial_fold *
6864         isl_union_pw_qpolynomial_fold_fold(
6865                 __isl_take isl_union_pw_qpolynomial_fold *upwf1,
6866                 __isl_take isl_union_pw_qpolynomial_fold *upwf2);
6868         #include <isl/aff.h>
6869         __isl_give isl_pw_aff *isl_pw_aff_union_add(
6870                 __isl_take isl_pw_aff *pwaff1,
6871                 __isl_take isl_pw_aff *pwaff2);
6872         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add(
6873                 __isl_take isl_pw_multi_aff *pma1,
6874                 __isl_take isl_pw_multi_aff *pma2);
6875         __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add(
6876                 __isl_take isl_union_pw_aff *upa1,
6877                 __isl_take isl_union_pw_aff *upa2);
6878         __isl_give isl_union_pw_multi_aff *
6879         isl_union_pw_multi_aff_union_add(
6880                 __isl_take isl_union_pw_multi_aff *upma1,
6881                 __isl_take isl_union_pw_multi_aff *upma2);
6882         __isl_give isl_multi_union_pw_aff *
6883         isl_multi_union_pw_aff_union_add(
6884                 __isl_take isl_multi_union_pw_aff *mupa1,
6885                 __isl_take isl_multi_union_pw_aff *mupa2);
6886         __isl_give isl_pw_aff *isl_pw_aff_union_min(
6887                 __isl_take isl_pw_aff *pwaff1,
6888                 __isl_take isl_pw_aff *pwaff2);
6889         __isl_give isl_pw_aff *isl_pw_aff_union_max(
6890                 __isl_take isl_pw_aff *pwaff1,
6891                 __isl_take isl_pw_aff *pwaff2);
6893 The function C<isl_pw_aff_union_max> computes a piecewise quasi-affine
6894 expression with a domain that is the union of those of C<pwaff1> and
6895 C<pwaff2> and such that on each cell, the quasi-affine expression is
6896 the maximum of those of C<pwaff1> and C<pwaff2>.  If only one of
6897 C<pwaff1> or C<pwaff2> is defined on a given cell, then the
6898 associated expression is the defined one.
6899 This in contrast to the C<isl_pw_aff_max> function, which is
6900 only defined on the shared definition domain of the arguments.
6902         #include <isl/val.h>
6903         __isl_give isl_multi_val *isl_multi_val_add_val(
6904                 __isl_take isl_multi_val *mv,
6905                 __isl_take isl_val *v);
6906         __isl_give isl_multi_val *isl_multi_val_mod_val(
6907                 __isl_take isl_multi_val *mv,
6908                 __isl_take isl_val *v);
6909         __isl_give isl_multi_val *isl_multi_val_scale_val(
6910                 __isl_take isl_multi_val *mv,
6911                 __isl_take isl_val *v);
6912         __isl_give isl_multi_val *isl_multi_val_scale_down_val(
6913                 __isl_take isl_multi_val *mv,
6914                 __isl_take isl_val *v);
6916         #include <isl/aff.h>
6917         __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff,
6918                 __isl_take isl_val *mod);
6919         __isl_give isl_pw_aff *isl_pw_aff_mod_val(
6920                 __isl_take isl_pw_aff *pa,
6921                 __isl_take isl_val *mod);
6922         __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val(
6923                 __isl_take isl_union_pw_aff *upa,
6924                 __isl_take isl_val *f);
6925         __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff,
6926                 __isl_take isl_val *v);
6927         __isl_give isl_multi_aff *isl_multi_aff_scale_val(
6928                 __isl_take isl_multi_aff *ma,
6929                 __isl_take isl_val *v);
6930         __isl_give isl_pw_aff *isl_pw_aff_scale_val(
6931                 __isl_take isl_pw_aff *pa, __isl_take isl_val *v);
6932         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_val(
6933                 __isl_take isl_multi_pw_aff *mpa,
6934                 __isl_take isl_val *v);
6935         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val(
6936                 __isl_take isl_pw_multi_aff *pma,
6937                 __isl_take isl_val *v);
6938         __isl_give isl_union_pw_multi_aff *
6939         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val(
6940                 __isl_take isl_union_pw_aff *upa,
6941                 __isl_take isl_val *f);
6942         isl_union_pw_multi_aff_scale_val(
6943                 __isl_take isl_union_pw_multi_aff *upma,
6944                 __isl_take isl_val *val);
6945         __isl_give isl_multi_union_pw_aff *
6946         isl_multi_union_pw_aff_scale_val(
6947                 __isl_take isl_multi_union_pw_aff *mupa,
6948                 __isl_take isl_val *v);
6949         __isl_give isl_aff *isl_aff_scale_down_ui(
6950                 __isl_take isl_aff *aff, unsigned f);
6951         __isl_give isl_aff *isl_aff_scale_down_val(
6952                 __isl_take isl_aff *aff, __isl_take isl_val *v);
6953         __isl_give isl_multi_aff *isl_multi_aff_scale_down_val(
6954                 __isl_take isl_multi_aff *ma,
6955                 __isl_take isl_val *v);
6956         __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(
6957                 __isl_take isl_pw_aff *pa,
6958                 __isl_take isl_val *f);
6959         __isl_give isl_multi_pw_aff *isl_multi_pw_aff_scale_down_val(
6960                 __isl_take isl_multi_pw_aff *mpa,
6961                 __isl_take isl_val *v);
6962         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val(
6963                 __isl_take isl_pw_multi_aff *pma,
6964                 __isl_take isl_val *v);
6965         __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val(
6966                 __isl_take isl_union_pw_aff *upa,
6967                 __isl_take isl_val *v);
6968         __isl_give isl_union_pw_multi_aff *
6969         isl_union_pw_multi_aff_scale_down_val(
6970                 __isl_take isl_union_pw_multi_aff *upma,
6971                 __isl_take isl_val *val);
6972         __isl_give isl_multi_union_pw_aff *
6973         isl_multi_union_pw_aff_scale_down_val(
6974                 __isl_take isl_multi_union_pw_aff *mupa,
6975                 __isl_take isl_val *v);
6977         #include <isl/polynomial.h>
6978         __isl_give isl_qpolynomial *isl_qpolynomial_scale_val(
6979                 __isl_take isl_qpolynomial *qp,
6980                 __isl_take isl_val *v);
6981         __isl_give isl_qpolynomial_fold *
6982         isl_qpolynomial_fold_scale_val(
6983                 __isl_take isl_qpolynomial_fold *fold,
6984                 __isl_take isl_val *v);
6985         __isl_give isl_pw_qpolynomial *
6986         isl_pw_qpolynomial_scale_val(
6987                 __isl_take isl_pw_qpolynomial *pwqp,
6988                 __isl_take isl_val *v);
6989         __isl_give isl_pw_qpolynomial_fold *
6990         isl_pw_qpolynomial_fold_scale_val(
6991                 __isl_take isl_pw_qpolynomial_fold *pwf,
6992                 __isl_take isl_val *v);
6993         __isl_give isl_union_pw_qpolynomial *
6994         isl_union_pw_qpolynomial_scale_val(
6995                 __isl_take isl_union_pw_qpolynomial *upwqp,
6996                 __isl_take isl_val *v);
6997         __isl_give isl_union_pw_qpolynomial_fold *
6998         isl_union_pw_qpolynomial_fold_scale_val(
6999                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7000                 __isl_take isl_val *v);
7001         __isl_give isl_qpolynomial *
7002         isl_qpolynomial_scale_down_val(
7003                 __isl_take isl_qpolynomial *qp,
7004                 __isl_take isl_val *v);
7005         __isl_give isl_qpolynomial_fold *
7006         isl_qpolynomial_fold_scale_down_val(
7007                 __isl_take isl_qpolynomial_fold *fold,
7008                 __isl_take isl_val *v);
7009         __isl_give isl_pw_qpolynomial *
7010         isl_pw_qpolynomial_scale_down_val(
7011                 __isl_take isl_pw_qpolynomial *pwqp,
7012                 __isl_take isl_val *v);
7013         __isl_give isl_pw_qpolynomial_fold *
7014         isl_pw_qpolynomial_fold_scale_down_val(
7015                 __isl_take isl_pw_qpolynomial_fold *pwf,
7016                 __isl_take isl_val *v);
7017         __isl_give isl_union_pw_qpolynomial *
7018         isl_union_pw_qpolynomial_scale_down_val(
7019                 __isl_take isl_union_pw_qpolynomial *upwqp,
7020                 __isl_take isl_val *v);
7021         __isl_give isl_union_pw_qpolynomial_fold *
7022         isl_union_pw_qpolynomial_fold_scale_down_val(
7023                 __isl_take isl_union_pw_qpolynomial_fold *upwf,
7024                 __isl_take isl_val *v);
7026         #include <isl/val.h>
7027         __isl_give isl_multi_val *isl_multi_val_mod_multi_val(
7028                 __isl_take isl_multi_val *mv1,
7029                 __isl_take isl_multi_val *mv2);
7030         __isl_give isl_multi_val *isl_multi_val_scale_multi_val(
7031                 __isl_take isl_multi_val *mv1,
7032                 __isl_take isl_multi_val *mv2);
7033         __isl_give isl_multi_val *
7034         isl_multi_val_scale_down_multi_val(
7035                 __isl_take isl_multi_val *mv1,
7036                 __isl_take isl_multi_val *mv2);
7038         #include <isl/aff.h>
7039         __isl_give isl_multi_aff *isl_multi_aff_mod_multi_val(
7040                 __isl_take isl_multi_aff *ma,
7041                 __isl_take isl_multi_val *mv);
7042         __isl_give isl_multi_union_pw_aff *
7043         isl_multi_union_pw_aff_mod_multi_val(
7044                 __isl_take isl_multi_union_pw_aff *upma,
7045                 __isl_take isl_multi_val *mv);
7046         __isl_give isl_multi_pw_aff *
7047         isl_multi_pw_aff_mod_multi_val(
7048                 __isl_take isl_multi_pw_aff *mpa,
7049                 __isl_take isl_multi_val *mv);
7050         __isl_give isl_multi_aff *isl_multi_aff_scale_multi_val(
7051                 __isl_take isl_multi_aff *ma,
7052                 __isl_take isl_multi_val *mv);
7053         __isl_give isl_pw_multi_aff *
7054         isl_pw_multi_aff_scale_multi_val(
7055                 __isl_take isl_pw_multi_aff *pma,
7056                 __isl_take isl_multi_val *mv);
7057         __isl_give isl_multi_pw_aff *
7058         isl_multi_pw_aff_scale_multi_val(
7059                 __isl_take isl_multi_pw_aff *mpa,
7060                 __isl_take isl_multi_val *mv);
7061         __isl_give isl_multi_union_pw_aff *
7062         isl_multi_union_pw_aff_scale_multi_val(
7063                 __isl_take isl_multi_union_pw_aff *mupa,
7064                 __isl_take isl_multi_val *mv);
7065         __isl_give isl_union_pw_multi_aff *
7066         isl_union_pw_multi_aff_scale_multi_val(
7067                 __isl_take isl_union_pw_multi_aff *upma,
7068                 __isl_take isl_multi_val *mv);
7069         __isl_give isl_multi_aff *
7070         isl_multi_aff_scale_down_multi_val(
7071                 __isl_take isl_multi_aff *ma,
7072                 __isl_take isl_multi_val *mv);
7073         __isl_give isl_multi_pw_aff *
7074         isl_multi_pw_aff_scale_down_multi_val(
7075                 __isl_take isl_multi_pw_aff *mpa,
7076                 __isl_take isl_multi_val *mv);
7077         __isl_give isl_multi_union_pw_aff *
7078         isl_multi_union_pw_aff_scale_down_multi_val(
7079                 __isl_take isl_multi_union_pw_aff *mupa,
7080                 __isl_take isl_multi_val *mv);
7082 C<isl_multi_aff_scale_multi_val> scales the elements of C<ma>
7083 by the corresponding elements of C<mv>.
7085         #include <isl/aff.h>
7086         __isl_give isl_aff *isl_aff_mul(
7087                 __isl_take isl_aff *aff1,
7088                 __isl_take isl_aff *aff2);
7089         __isl_give isl_aff *isl_aff_div(
7090                 __isl_take isl_aff *aff1,
7091                 __isl_take isl_aff *aff2);
7092         __isl_give isl_pw_aff *isl_pw_aff_mul(
7093                 __isl_take isl_pw_aff *pwaff1,
7094                 __isl_take isl_pw_aff *pwaff2);
7095         __isl_give isl_pw_aff *isl_pw_aff_div(
7096                 __isl_take isl_pw_aff *pa1,
7097                 __isl_take isl_pw_aff *pa2);
7098         __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(
7099                 __isl_take isl_pw_aff *pa1,
7100                 __isl_take isl_pw_aff *pa2);
7101         __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(
7102                 __isl_take isl_pw_aff *pa1,
7103                 __isl_take isl_pw_aff *pa2);
7105 When multiplying two affine expressions, at least one of the two needs
7106 to be a constant.  Similarly, when dividing an affine expression by another,
7107 the second expression needs to be a constant.
7108 C<isl_pw_aff_tdiv_q> computes the quotient of an integer division with
7109 rounding towards zero.  C<isl_pw_aff_tdiv_r> computes the corresponding
7110 remainder.
7112         #include <isl/polynomial.h>
7113         __isl_give isl_qpolynomial *isl_qpolynomial_mul(
7114                 __isl_take isl_qpolynomial *qp1,
7115                 __isl_take isl_qpolynomial *qp2);
7116         __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_mul(
7117                 __isl_take isl_pw_qpolynomial *pwqp1,
7118                 __isl_take isl_pw_qpolynomial *pwqp2);
7119         __isl_give isl_union_pw_qpolynomial *isl_union_pw_qpolynomial_mul(
7120                 __isl_take isl_union_pw_qpolynomial *upwqp1,
7121                 __isl_take isl_union_pw_qpolynomial *upwqp2);
7123 =back
7125 =head3 Lexicographic Optimization
7127 Given a (basic) set C<set> (or C<bset>) and a zero-dimensional domain C<dom>,
7128 the following functions
7129 compute a set that contains the lexicographic minimum or maximum
7130 of the elements in C<set> (or C<bset>) for those values of the parameters
7131 that satisfy C<dom>.
7132 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7133 that contains the parameter values in C<dom> for which C<set> (or C<bset>)
7134 has no elements.
7135 In other words, the union of the parameter values
7136 for which the result is non-empty and of C<*empty>
7137 is equal to C<dom>.
7139         #include <isl/set.h>
7140         __isl_give isl_set *isl_basic_set_partial_lexmin(
7141                 __isl_take isl_basic_set *bset,
7142                 __isl_take isl_basic_set *dom,
7143                 __isl_give isl_set **empty);
7144         __isl_give isl_set *isl_basic_set_partial_lexmax(
7145                 __isl_take isl_basic_set *bset,
7146                 __isl_take isl_basic_set *dom,
7147                 __isl_give isl_set **empty);
7148         __isl_give isl_set *isl_set_partial_lexmin(
7149                 __isl_take isl_set *set, __isl_take isl_set *dom,
7150                 __isl_give isl_set **empty);
7151         __isl_give isl_set *isl_set_partial_lexmax(
7152                 __isl_take isl_set *set, __isl_take isl_set *dom,
7153                 __isl_give isl_set **empty);
7155 Given a (basic) set C<set> (or C<bset>), the following functions simply
7156 return a set containing the lexicographic minimum or maximum
7157 of the elements in C<set> (or C<bset>).
7158 In case of union sets, the optimum is computed per space.
7160         #include <isl/set.h>
7161         __isl_give isl_set *isl_basic_set_lexmin(
7162                 __isl_take isl_basic_set *bset);
7163         __isl_give isl_set *isl_basic_set_lexmax(
7164                 __isl_take isl_basic_set *bset);
7165         __isl_give isl_set *isl_set_lexmin(
7166                 __isl_take isl_set *set);
7167         __isl_give isl_set *isl_set_lexmax(
7168                 __isl_take isl_set *set);
7169         __isl_give isl_union_set *isl_union_set_lexmin(
7170                 __isl_take isl_union_set *uset);
7171         __isl_give isl_union_set *isl_union_set_lexmax(
7172                 __isl_take isl_union_set *uset);
7174 Given a (basic) relation C<map> (or C<bmap>) and a domain C<dom>,
7175 the following functions
7176 compute a relation that maps each element of C<dom>
7177 to the single lexicographic minimum or maximum
7178 of the elements that are associated to that same
7179 element in C<map> (or C<bmap>).
7180 If C<empty> is not C<NULL>, then C<*empty> is assigned a set
7181 that contains the elements in C<dom> that do not map
7182 to any elements in C<map> (or C<bmap>).
7183 In other words, the union of the domain of the result and of C<*empty>
7184 is equal to C<dom>.
7186         #include <isl/map.h>
7187         __isl_give isl_map *isl_basic_map_partial_lexmax(
7188                 __isl_take isl_basic_map *bmap,
7189                 __isl_take isl_basic_set *dom,
7190                 __isl_give isl_set **empty);
7191         __isl_give isl_map *isl_basic_map_partial_lexmin(
7192                 __isl_take isl_basic_map *bmap,
7193                 __isl_take isl_basic_set *dom,
7194                 __isl_give isl_set **empty);
7195         __isl_give isl_map *isl_map_partial_lexmax(
7196                 __isl_take isl_map *map, __isl_take isl_set *dom,
7197                 __isl_give isl_set **empty);
7198         __isl_give isl_map *isl_map_partial_lexmin(
7199                 __isl_take isl_map *map, __isl_take isl_set *dom,
7200                 __isl_give isl_set **empty);
7202 Given a (basic) map C<map> (or C<bmap>), the following functions simply
7203 return a map mapping each element in the domain of
7204 C<map> (or C<bmap>) to the lexicographic minimum or maximum
7205 of all elements associated to that element.
7206 In case of union relations, the optimum is computed per space.
7208         #include <isl/map.h>
7209         __isl_give isl_map *isl_basic_map_lexmin(
7210                 __isl_take isl_basic_map *bmap);
7211         __isl_give isl_map *isl_basic_map_lexmax(
7212                 __isl_take isl_basic_map *bmap);
7213         __isl_give isl_map *isl_map_lexmin(
7214                 __isl_take isl_map *map);
7215         __isl_give isl_map *isl_map_lexmax(
7216                 __isl_take isl_map *map);
7217         __isl_give isl_union_map *isl_union_map_lexmin(
7218                 __isl_take isl_union_map *umap);
7219         __isl_give isl_union_map *isl_union_map_lexmax(
7220                 __isl_take isl_union_map *umap);
7222 The following functions return their result in the form of
7223 a piecewise multi-affine expression,
7224 but are otherwise equivalent to the corresponding functions
7225 returning a basic set or relation.
7227         #include <isl/set.h>
7228         __isl_give isl_pw_multi_aff *
7229         isl_basic_set_partial_lexmin_pw_multi_aff(
7230                 __isl_take isl_basic_set *bset,
7231                 __isl_take isl_basic_set *dom,
7232                 __isl_give isl_set **empty);
7233         __isl_give isl_pw_multi_aff *
7234         isl_basic_set_partial_lexmax_pw_multi_aff(
7235                 __isl_take isl_basic_set *bset,
7236                 __isl_take isl_basic_set *dom,
7237                 __isl_give isl_set **empty);
7238         __isl_give isl_pw_multi_aff *isl_set_lexmin_pw_multi_aff(
7239                 __isl_take isl_set *set);
7240         __isl_give isl_pw_multi_aff *isl_set_lexmax_pw_multi_aff(
7241                 __isl_take isl_set *set);
7243         #include <isl/map.h>
7244         __isl_give isl_pw_multi_aff *
7245         isl_basic_map_lexmin_pw_multi_aff(
7246                 __isl_take isl_basic_map *bmap);
7247         __isl_give isl_pw_multi_aff *
7248         isl_basic_map_partial_lexmin_pw_multi_aff(
7249                 __isl_take isl_basic_map *bmap,
7250                 __isl_take isl_basic_set *dom,
7251                 __isl_give isl_set **empty);
7252         __isl_give isl_pw_multi_aff *
7253         isl_basic_map_partial_lexmax_pw_multi_aff(
7254                 __isl_take isl_basic_map *bmap,
7255                 __isl_take isl_basic_set *dom,
7256                 __isl_give isl_set **empty);
7257         __isl_give isl_pw_multi_aff *isl_map_lexmin_pw_multi_aff(
7258                 __isl_take isl_map *map);
7259         __isl_give isl_pw_multi_aff *isl_map_lexmax_pw_multi_aff(
7260                 __isl_take isl_map *map);
7262 The following functions return the lexicographic minimum or maximum
7263 on the shared domain of the inputs and the single defined function
7264 on those parts of the domain where only a single function is defined.
7266         #include <isl/aff.h>
7267         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin(
7268                 __isl_take isl_pw_multi_aff *pma1,
7269                 __isl_take isl_pw_multi_aff *pma2);
7270         __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax(
7271                 __isl_take isl_pw_multi_aff *pma1,
7272                 __isl_take isl_pw_multi_aff *pma2);
7274 If the input to a lexicographic optimization problem has
7275 multiple constraints with the same coefficients for the optimized
7276 variables, then, by default, this symmetry is exploited by
7277 replacing those constraints by a single constraint with
7278 an abstract bound, which is in turn bounded by the corresponding terms
7279 in the original constraints.
7280 Without this optimization, the solver would typically consider
7281 all possible orderings of those original bounds, resulting in a needless
7282 decomposition of the domain.
7283 However, the optimization can also result in slowdowns since
7284 an extra parameter is introduced that may get used in additional
7285 integer divisions.
7286 The following option determines whether symmetry detection is applied
7287 during lexicographic optimization.
7289         #include <isl/options.h>
7290         isl_stat isl_options_set_pip_symmetry(isl_ctx *ctx,
7291                 int val);
7292         int isl_options_get_pip_symmetry(isl_ctx *ctx);
7294 =begin latex
7296 See also \autoref{s:offline}.
7298 =end latex
7300 =head2 Ternary Operations
7302         #include <isl/aff.h>
7303         __isl_give isl_pw_aff *isl_pw_aff_cond(
7304                 __isl_take isl_pw_aff *cond,
7305                 __isl_take isl_pw_aff *pwaff_true,
7306                 __isl_take isl_pw_aff *pwaff_false);
7308 The function C<isl_pw_aff_cond> performs a conditional operator
7309 and returns an expression that is equal to C<pwaff_true>
7310 for elements where C<cond> is non-zero and equal to C<pwaff_false> for elements
7311 where C<cond> is zero.
7313 =head2 Lists
7315 Lists are defined over several element types, including
7316 C<isl_val>, C<isl_id>, C<isl_aff>, C<isl_pw_aff>, C<isl_union_pw_aff>,
7317 C<isl_union_pw_multi_aff>, C<isl_constraint>,
7318 C<isl_basic_set>, C<isl_set>, C<isl_basic_map>, C<isl_map>, C<isl_union_set>,
7319 C<isl_union_map>, C<isl_ast_expr> and C<isl_ast_node>.
7320 Here we take lists of C<isl_set>s as an example.
7321 Lists can be created, copied, modified and freed using the following functions.
7323         #include <isl/set.h>
7324         __isl_give isl_set_list *isl_set_list_from_set(
7325                 __isl_take isl_set *el);
7326         __isl_give isl_set_list *isl_set_list_alloc(
7327                 isl_ctx *ctx, int n);
7328         __isl_give isl_set_list *isl_set_list_copy(
7329                 __isl_keep isl_set_list *list);
7330         __isl_give isl_set_list *isl_set_list_insert(
7331                 __isl_take isl_set_list *list, unsigned pos,
7332                 __isl_take isl_set *el);
7333         __isl_give isl_set_list *isl_set_list_add(
7334                 __isl_take isl_set_list *list,
7335                 __isl_take isl_set *el);
7336         __isl_give isl_set_list *isl_set_list_drop(
7337                 __isl_take isl_set_list *list,
7338                 unsigned first, unsigned n);
7339         __isl_give isl_set_list *isl_set_list_set_set(
7340                 __isl_take isl_set_list *list, int index,
7341                 __isl_take isl_set *set);
7342         __isl_give isl_set_list *isl_set_list_concat(
7343                 __isl_take isl_set_list *list1,
7344                 __isl_take isl_set_list *list2);
7345         __isl_give isl_set_list *isl_set_list_sort(
7346                 __isl_take isl_set_list *list,
7347                 int (*cmp)(__isl_keep isl_set *a,
7348                         __isl_keep isl_set *b, void *user),
7349                 void *user);
7350         __isl_null isl_set_list *isl_set_list_free(
7351                 __isl_take isl_set_list *list);
7353 C<isl_set_list_alloc> creates an empty list with an initial capacity
7354 for C<n> elements.  C<isl_set_list_insert> and C<isl_set_list_add>
7355 add elements to a list, increasing its capacity as needed.
7356 C<isl_set_list_from_set> creates a list with a single element.
7358 Lists can be inspected using the following functions.
7360         #include <isl/set.h>
7361         int isl_set_list_n_set(__isl_keep isl_set_list *list);
7362         __isl_give isl_set *isl_set_list_get_set(
7363                 __isl_keep isl_set_list *list, int index);
7364         isl_stat isl_set_list_foreach(__isl_keep isl_set_list *list,
7365                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7366                 void *user);
7367         isl_stat isl_set_list_foreach_scc(
7368                 __isl_keep isl_set_list *list,
7369                 isl_bool (*follows)(__isl_keep isl_set *a,
7370                         __isl_keep isl_set *b, void *user),
7371                 void *follows_user,
7372                 isl_stat (*fn)(__isl_take isl_set *el, void *user),
7373                 void *fn_user);
7375 The function C<isl_set_list_foreach_scc> calls C<fn> on each of the
7376 strongly connected components of the graph with as vertices the elements
7377 of C<list> and a directed edge from vertex C<b> to vertex C<a>
7378 iff C<follows(a, b)> returns C<isl_bool_true>.  The callbacks C<follows> and
7379 C<fn> should return C<isl_bool_error> or C<isl_stat_error> on error.
7381 Lists can be printed using
7383         #include <isl/set.h>
7384         __isl_give isl_printer *isl_printer_print_set_list(
7385                 __isl_take isl_printer *p,
7386                 __isl_keep isl_set_list *list);
7388 =head2 Associative arrays
7390 Associative arrays map isl objects of a specific type to isl objects
7391 of some (other) specific type.  They are defined for several pairs
7392 of types, including (C<isl_map>, C<isl_basic_set>),
7393 (C<isl_id>, C<isl_ast_expr>),
7394 (C<isl_id>, C<isl_id>) and
7395 (C<isl_id>, C<isl_pw_aff>).
7396 Here, we take associative arrays that map C<isl_id>s to C<isl_ast_expr>s
7397 as an example.
7399 Associative arrays can be created, copied and freed using
7400 the following functions.
7402         #include <isl/id_to_ast_expr.h>
7403         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_alloc(
7404                 isl_ctx *ctx, int min_size);
7405         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_copy(
7406                 __isl_keep isl_id_to_ast_expr *id2expr);
7407         __isl_null isl_id_to_ast_expr *isl_id_to_ast_expr_free(
7408                 __isl_take isl_id_to_ast_expr *id2expr);
7410 The C<min_size> argument to C<isl_id_to_ast_expr_alloc> can be used
7411 to specify the expected size of the associative array.
7412 The associative array will be grown automatically as needed.
7414 Associative arrays can be inspected using the following functions.
7416         #include <isl/id_to_ast_expr.h>
7417         __isl_give isl_maybe_isl_ast_expr
7418         isl_id_to_ast_expr_try_get(
7419                 __isl_keep isl_id_to_ast_expr *id2expr,
7420                 __isl_keep isl_id *key);
7421         isl_bool isl_id_to_ast_expr_has(
7422                 __isl_keep isl_id_to_ast_expr *id2expr,
7423                 __isl_keep isl_id *key);
7424         __isl_give isl_ast_expr *isl_id_to_ast_expr_get(
7425                 __isl_keep isl_id_to_ast_expr *id2expr,
7426                 __isl_take isl_id *key);
7427         isl_stat isl_id_to_ast_expr_foreach(
7428                 __isl_keep isl_id_to_ast_expr *id2expr,
7429                 isl_stat (*fn)(__isl_take isl_id *key,
7430                         __isl_take isl_ast_expr *val, void *user),
7431                 void *user);
7433 The function C<isl_id_to_ast_expr_try_get> returns a structure
7434 containing two elements, C<valid> and C<value>.
7435 If there is a value associated to the key, then C<valid>
7436 is set to C<isl_bool_true> and C<value> contains a copy of
7437 the associated value.  Otherwise C<value> is C<NULL> and
7438 C<valid> may be C<isl_bool_error> or C<isl_bool_false> depending
7439 on whether some error has occurred or there simply is no associated value.
7440 The function C<isl_id_to_ast_expr_has> returns the C<valid> field
7441 in the structure and
7442 the function C<isl_id_to_ast_expr_get> returns the C<value> field.
7444 Associative arrays can be modified using the following functions.
7446         #include <isl/id_to_ast_expr.h>
7447         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_set(
7448                 __isl_take isl_id_to_ast_expr *id2expr,
7449                 __isl_take isl_id *key,
7450                 __isl_take isl_ast_expr *val);
7451         __isl_give isl_id_to_ast_expr *isl_id_to_ast_expr_drop(
7452                 __isl_take isl_id_to_ast_expr *id2expr,
7453                 __isl_take isl_id *key);
7455 Associative arrays can be printed using the following function.
7457         #include <isl/id_to_ast_expr.h>
7458         __isl_give isl_printer *isl_printer_print_id_to_ast_expr(
7459                 __isl_take isl_printer *p,
7460                 __isl_keep isl_id_to_ast_expr *id2expr);
7462 =head2 Vectors
7464 Vectors can be created, copied and freed using the following functions.
7466         #include <isl/vec.h>
7467         __isl_give isl_vec *isl_vec_alloc(isl_ctx *ctx,
7468                 unsigned size);
7469         __isl_give isl_vec *isl_vec_copy(__isl_keep isl_vec *vec);
7470         __isl_null isl_vec *isl_vec_free(__isl_take isl_vec *vec);
7472 Note that the elements of a newly created vector may have arbitrary values.
7473 The elements can be changed and inspected using the following functions.
7475         int isl_vec_size(__isl_keep isl_vec *vec);
7476         __isl_give isl_val *isl_vec_get_element_val(
7477                 __isl_keep isl_vec *vec, int pos);
7478         __isl_give isl_vec *isl_vec_set_element_si(
7479                 __isl_take isl_vec *vec, int pos, int v);
7480         __isl_give isl_vec *isl_vec_set_element_val(
7481                 __isl_take isl_vec *vec, int pos,
7482                 __isl_take isl_val *v);
7483         __isl_give isl_vec *isl_vec_set_si(__isl_take isl_vec *vec,
7484                 int v);
7485         __isl_give isl_vec *isl_vec_set_val(
7486                 __isl_take isl_vec *vec, __isl_take isl_val *v);
7487         int isl_vec_cmp_element(__isl_keep isl_vec *vec1,
7488                 __isl_keep isl_vec *vec2, int pos);
7490 C<isl_vec_get_element> will return a negative value if anything went wrong.
7491 In that case, the value of C<*v> is undefined.
7493 The following function can be used to concatenate two vectors.
7495         __isl_give isl_vec *isl_vec_concat(__isl_take isl_vec *vec1,
7496                 __isl_take isl_vec *vec2);
7498 =head2 Matrices
7500 Matrices can be created, copied and freed using the following functions.
7502         #include <isl/mat.h>
7503         __isl_give isl_mat *isl_mat_alloc(isl_ctx *ctx,
7504                 unsigned n_row, unsigned n_col);
7505         __isl_give isl_mat *isl_mat_copy(__isl_keep isl_mat *mat);
7506         __isl_null isl_mat *isl_mat_free(__isl_take isl_mat *mat);
7508 Note that the elements of a newly created matrix may have arbitrary values.
7509 The elements can be changed and inspected using the following functions.
7511         int isl_mat_rows(__isl_keep isl_mat *mat);
7512         int isl_mat_cols(__isl_keep isl_mat *mat);
7513         __isl_give isl_val *isl_mat_get_element_val(
7514                 __isl_keep isl_mat *mat, int row, int col);
7515         __isl_give isl_mat *isl_mat_set_element_si(__isl_take isl_mat *mat,
7516                 int row, int col, int v);
7517         __isl_give isl_mat *isl_mat_set_element_val(
7518                 __isl_take isl_mat *mat, int row, int col,
7519                 __isl_take isl_val *v);
7521 C<isl_mat_get_element> will return a negative value if anything went wrong.
7522 In that case, the value of C<*v> is undefined.
7524 The following function can be used to compute the (right) inverse
7525 of a matrix, i.e., a matrix such that the product of the original
7526 and the inverse (in that order) is a multiple of the identity matrix.
7527 The input matrix is assumed to be of full row-rank.
7529         __isl_give isl_mat *isl_mat_right_inverse(__isl_take isl_mat *mat);
7531 The following function can be used to compute the (right) kernel
7532 (or null space) of a matrix, i.e., a matrix such that the product of
7533 the original and the kernel (in that order) is the zero matrix.
7535         __isl_give isl_mat *isl_mat_right_kernel(__isl_take isl_mat *mat);
7537 =head2 Bounds on Piecewise Quasipolynomials and Piecewise Quasipolynomial Reductions
7539 The following functions determine
7540 an upper or lower bound on a quasipolynomial over its domain.
7542         __isl_give isl_pw_qpolynomial_fold *
7543         isl_pw_qpolynomial_bound(
7544                 __isl_take isl_pw_qpolynomial *pwqp,
7545                 enum isl_fold type, int *tight);
7547         __isl_give isl_union_pw_qpolynomial_fold *
7548         isl_union_pw_qpolynomial_bound(
7549                 __isl_take isl_union_pw_qpolynomial *upwqp,
7550                 enum isl_fold type, int *tight);
7552 The C<type> argument may be either C<isl_fold_min> or C<isl_fold_max>.
7553 If C<tight> is not C<NULL>, then C<*tight> is set to C<1>
7554 is the returned bound is known be tight, i.e., for each value
7555 of the parameters there is at least
7556 one element in the domain that reaches the bound.
7557 If the domain of C<pwqp> is not wrapping, then the bound is computed
7558 over all elements in that domain and the result has a purely parametric
7559 domain.  If the domain of C<pwqp> is wrapping, then the bound is
7560 computed over the range of the wrapped relation.  The domain of the
7561 wrapped relation becomes the domain of the result.
7563 =head2 Parametric Vertex Enumeration
7565 The parametric vertex enumeration described in this section
7566 is mainly intended to be used internally and by the C<barvinok>
7567 library.
7569         #include <isl/vertices.h>
7570         __isl_give isl_vertices *isl_basic_set_compute_vertices(
7571                 __isl_keep isl_basic_set *bset);
7573 The function C<isl_basic_set_compute_vertices> performs the
7574 actual computation of the parametric vertices and the chamber
7575 decomposition and store the result in an C<isl_vertices> object.
7576 This information can be queried by either iterating over all
7577 the vertices or iterating over all the chambers or cells
7578 and then iterating over all vertices that are active on the chamber.
7580         isl_stat isl_vertices_foreach_vertex(
7581                 __isl_keep isl_vertices *vertices,
7582                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7583                         void *user), void *user);
7585         isl_stat isl_vertices_foreach_cell(
7586                 __isl_keep isl_vertices *vertices,
7587                 isl_stat (*fn)(__isl_take isl_cell *cell,
7588                         void *user), void *user);
7589         isl_stat isl_cell_foreach_vertex(__isl_keep isl_cell *cell,
7590                 isl_stat (*fn)(__isl_take isl_vertex *vertex,
7591                         void *user), void *user);
7593 Other operations that can be performed on an C<isl_vertices> object are
7594 the following.
7596         int isl_vertices_get_n_vertices(
7597                 __isl_keep isl_vertices *vertices);
7598         void isl_vertices_free(__isl_take isl_vertices *vertices);
7600 Vertices can be inspected and destroyed using the following functions.
7602         int isl_vertex_get_id(__isl_keep isl_vertex *vertex);
7603         __isl_give isl_basic_set *isl_vertex_get_domain(
7604                 __isl_keep isl_vertex *vertex);
7605         __isl_give isl_multi_aff *isl_vertex_get_expr(
7606                 __isl_keep isl_vertex *vertex);
7607         void isl_vertex_free(__isl_take isl_vertex *vertex);
7609 C<isl_vertex_get_expr> returns a multiple quasi-affine expression
7610 describing the vertex in terms of the parameters,
7611 while C<isl_vertex_get_domain> returns the activity domain
7612 of the vertex.
7614 Chambers can be inspected and destroyed using the following functions.
7616         __isl_give isl_basic_set *isl_cell_get_domain(
7617                 __isl_keep isl_cell *cell);
7618         void isl_cell_free(__isl_take isl_cell *cell);
7620 =head1 Polyhedral Compilation Library
7622 This section collects functionality in C<isl> that has been specifically
7623 designed for use during polyhedral compilation.
7625 =head2 Schedule Trees
7627 A schedule tree is a structured representation of a schedule,
7628 assigning a relative order to a set of domain elements.
7629 The relative order expressed by the schedule tree is
7630 defined recursively.  In particular, the order between
7631 two domain elements is determined by the node that is closest
7632 to the root that refers to both elements and that orders them apart.
7633 Each node in the tree is of one of several types.
7634 The root node is always of type C<isl_schedule_node_domain>
7635 (or C<isl_schedule_node_extension>)
7636 and it describes the (extra) domain elements to which the schedule applies.
7637 The other types of nodes are as follows.
7639 =over
7641 =item C<isl_schedule_node_band>
7643 A band of schedule dimensions.  Each schedule dimension is represented
7644 by a union piecewise quasi-affine expression.  If this expression
7645 assigns a different value to two domain elements, while all previous
7646 schedule dimensions in the same band assign them the same value,
7647 then the two domain elements are ordered according to these two
7648 different values.
7649 Each expression is required to be total in the domain elements
7650 that reach the band node.
7652 =item C<isl_schedule_node_expansion>
7654 An expansion node maps each of the domain elements that reach the node
7655 to one or more domain elements.  The image of this mapping forms
7656 the set of domain elements that reach the child of the expansion node.
7657 The function that maps each of the expanded domain elements
7658 to the original domain element from which it was expanded
7659 is called the contraction.
7661 =item C<isl_schedule_node_filter>
7663 A filter node does not impose any ordering, but rather intersects
7664 the set of domain elements that the current subtree refers to
7665 with a given union set.  The subtree of the filter node only
7666 refers to domain elements in the intersection.
7667 A filter node is typically only used a child of a sequence or
7668 set node.
7670 =item C<isl_schedule_node_leaf>
7672 A leaf of the schedule tree.  Leaf nodes do not impose any ordering.
7674 =item C<isl_schedule_node_mark>
7676 A mark node can be used to attach any kind of information to a subtree
7677 of the schedule tree.
7679 =item C<isl_schedule_node_sequence>
7681 A sequence node has one or more children, each of which is a filter node.
7682 The filters on these filter nodes form a partition of
7683 the domain elements that the current subtree refers to.
7684 If two domain elements appear in distinct filters then the sequence
7685 node orders them according to the child positions of the corresponding
7686 filter nodes.
7688 =item C<isl_schedule_node_set>
7690 A set node is similar to a sequence node, except that
7691 it expresses that domain elements appearing in distinct filters
7692 may have any order.  The order of the children of a set node
7693 is therefore also immaterial.
7695 =back
7697 The following node types are only supported by the AST generator.
7699 =over
7701 =item C<isl_schedule_node_context>
7703 The context describes constraints on the parameters and
7704 the schedule dimensions of outer
7705 bands that the AST generator may assume to hold.  It is also the only
7706 kind of node that may introduce additional parameters.
7707 The space of the context is that of the flat product of the outer
7708 band nodes.  In particular, if there are no outer band nodes, then
7709 this space is the unnamed zero-dimensional space.
7710 Since a context node references the outer band nodes, any tree
7711 containing a context node is considered to be anchored.
7713 =item C<isl_schedule_node_extension>
7715 An extension node instructs the AST generator to add additional
7716 domain elements that need to be scheduled.
7717 The additional domain elements are described by the range of
7718 the extension map in terms of the outer schedule dimensions,
7719 i.e., the flat product of the outer band nodes.
7720 Note that domain elements are added whenever the AST generator
7721 reaches the extension node, meaning that there are still some
7722 active domain elements for which an AST needs to be generated.
7723 The conditions under which some domain elements are still active
7724 may however not be completely described by the outer AST nodes
7725 generated at that point.
7727 An extension node may also appear as the root of a schedule tree,
7728 when it is intended to be inserted into another tree
7729 using C<isl_schedule_node_graft_before> or C<isl_schedule_node_graft_after>.
7730 In this case, the domain of the extension node should
7731 correspond to the flat product of the outer band nodes
7732 in this other schedule tree at the point where the extension tree
7733 will be inserted.
7735 =item C<isl_schedule_node_guard>
7737 The guard describes constraints on the parameters and
7738 the schedule dimensions of outer
7739 bands that need to be enforced by the outer nodes
7740 in the generated AST.
7741 The space of the guard is that of the flat product of the outer
7742 band nodes.  In particular, if there are no outer band nodes, then
7743 this space is the unnamed zero-dimensional space.
7744 Since a guard node references the outer band nodes, any tree
7745 containing a guard node is considered to be anchored.
7747 =back
7749 Except for the C<isl_schedule_node_context> nodes,
7750 none of the nodes may introduce any parameters that were not
7751 already present in the root domain node.
7753 A schedule tree is encapsulated in an C<isl_schedule> object.
7754 The simplest such objects, those with a tree consisting of single domain node,
7755 can be created using the following functions with either an empty
7756 domain or a given domain.
7758         #include <isl/schedule.h>
7759         __isl_give isl_schedule *isl_schedule_empty(
7760                 __isl_take isl_space *space);
7761         __isl_give isl_schedule *isl_schedule_from_domain(
7762                 __isl_take isl_union_set *domain);
7764 The function C<isl_schedule_constraints_compute_schedule> described
7765 in L</"Scheduling"> can also be used to construct schedules.
7767 C<isl_schedule> objects may be copied and freed using the following functions.
7769         #include <isl/schedule.h>
7770         __isl_give isl_schedule *isl_schedule_copy(
7771                 __isl_keep isl_schedule *sched);
7772         __isl_null isl_schedule *isl_schedule_free(
7773                 __isl_take isl_schedule *sched);
7775 The following functions checks whether two C<isl_schedule> objects
7776 are obviously the same.
7778         #include <isl/schedule.h>
7779         isl_bool isl_schedule_plain_is_equal(
7780                 __isl_keep isl_schedule *schedule1,
7781                 __isl_keep isl_schedule *schedule2);
7783 The domain of the schedule, i.e., the domain described by the root node,
7784 can be obtained using the following function.
7786         #include <isl/schedule.h>
7787         __isl_give isl_union_set *isl_schedule_get_domain(
7788                 __isl_keep isl_schedule *schedule);
7790 An extra top-level band node (right underneath the domain node) can
7791 be introduced into the schedule using the following function.
7792 The schedule tree is assumed not to have any anchored nodes.
7794         #include <isl/schedule.h>
7795         __isl_give isl_schedule *
7796         isl_schedule_insert_partial_schedule(
7797                 __isl_take isl_schedule *schedule,
7798                 __isl_take isl_multi_union_pw_aff *partial);
7800 A top-level context node (right underneath the domain node) can
7801 be introduced into the schedule using the following function.
7803         #include <isl/schedule.h>
7804         __isl_give isl_schedule *isl_schedule_insert_context(
7805                 __isl_take isl_schedule *schedule,
7806                 __isl_take isl_set *context)
7808 A top-level guard node (right underneath the domain node) can
7809 be introduced into the schedule using the following function.
7811         #include <isl/schedule.h>
7812         __isl_give isl_schedule *isl_schedule_insert_guard(
7813                 __isl_take isl_schedule *schedule,
7814                 __isl_take isl_set *guard)
7816 A schedule that combines two schedules either in the given
7817 order or in an arbitrary order, i.e., with an C<isl_schedule_node_sequence>
7818 or an C<isl_schedule_node_set> node,
7819 can be created using the following functions.
7821         #include <isl/schedule.h>
7822         __isl_give isl_schedule *isl_schedule_sequence(
7823                 __isl_take isl_schedule *schedule1,
7824                 __isl_take isl_schedule *schedule2);
7825         __isl_give isl_schedule *isl_schedule_set(
7826                 __isl_take isl_schedule *schedule1,
7827                 __isl_take isl_schedule *schedule2);
7829 The domains of the two input schedules need to be disjoint.
7831 The following function can be used to restrict the domain
7832 of a schedule with a domain node as root to be a subset of the given union set.
7833 This operation may remove nodes in the tree that have become
7834 redundant.
7836         #include <isl/schedule.h>
7837         __isl_give isl_schedule *isl_schedule_intersect_domain(
7838                 __isl_take isl_schedule *schedule,
7839                 __isl_take isl_union_set *domain);
7841 The following function can be used to simplify the domain
7842 of a schedule with a domain node as root with respect to the given
7843 parameter domain.
7845         #include <isl/schedule.h>
7846         __isl_give isl_schedule *isl_schedule_gist_domain_params(
7847                 __isl_take isl_schedule *schedule,
7848                 __isl_take isl_set *context);
7850 The following function resets the user pointers on all parameter
7851 and tuple identifiers referenced by the nodes of the given schedule.
7853         #include <isl/schedule.h>
7854         __isl_give isl_schedule *isl_schedule_reset_user(
7855                 __isl_take isl_schedule *schedule);
7857 The following function aligns the parameters of all nodes
7858 in the given schedule to the given space.
7860         #include <isl/schedule.h>
7861         __isl_give isl_schedule *isl_schedule_align_params(
7862                 __isl_take isl_schedule *schedule,
7863                 __isl_take isl_space *space);
7865 The following function allows the user to plug in a given function
7866 in the iteration domains.  The input schedule is not allowed to contain
7867 any expansion nodes.
7869         #include <isl/schedule.h>
7870         __isl_give isl_schedule *
7871         isl_schedule_pullback_union_pw_multi_aff(
7872                 __isl_take isl_schedule *schedule,
7873                 __isl_take isl_union_pw_multi_aff *upma);
7875 The following function can be used to plug in the schedule C<expansion>
7876 in the leaves of C<schedule>, where C<contraction> describes how
7877 the domain elements of C<expansion> map to the domain elements
7878 at the original leaves of C<schedule>.
7879 The resulting schedule will contain expansion nodes, unless
7880 C<contraction> is an identity function.
7882         #include <isl/schedule.h>
7883         __isl_give isl_schedule *isl_schedule_expand(
7884                 __isl_take isl_schedule *schedule,
7885                 __isl_take isl_union_pw_multi_aff *contraction,
7886                 __isl_take isl_schedule *expansion);
7888 An C<isl_union_map> representation of the schedule can be obtained
7889 from an C<isl_schedule> using the following function.
7891         #include <isl/schedule.h>
7892         __isl_give isl_union_map *isl_schedule_get_map(
7893                 __isl_keep isl_schedule *sched);
7895 The resulting relation encodes the same relative ordering as
7896 the schedule by mapping the domain elements to a common schedule space.
7897 If the schedule_separate_components option is set, then the order
7898 of the children of a set node is explicitly encoded in the result.
7899 If the tree contains any expansion nodes, then the relation
7900 is formulated in terms of the expanded domain elements.
7902 Schedules can be read from input using the following functions.
7904         #include <isl/schedule.h>
7905         __isl_give isl_schedule *isl_schedule_read_from_file(
7906                 isl_ctx *ctx, FILE *input);
7907         __isl_give isl_schedule *isl_schedule_read_from_str(
7908                 isl_ctx *ctx, const char *str);
7910 A representation of the schedule can be printed using
7912         #include <isl/schedule.h>
7913         __isl_give isl_printer *isl_printer_print_schedule(
7914                 __isl_take isl_printer *p,
7915                 __isl_keep isl_schedule *schedule);
7916         __isl_give char *isl_schedule_to_str(
7917                 __isl_keep isl_schedule *schedule);
7919 C<isl_schedule_to_str> prints the schedule in flow format.
7921 The schedule tree can be traversed through the use of
7922 C<isl_schedule_node> objects that point to a particular
7923 position in the schedule tree.  Whenever a C<isl_schedule_node>
7924 is use to modify a node in the schedule tree, the original schedule
7925 tree is left untouched and the modifications are performed to a copy
7926 of the tree.  The returned C<isl_schedule_node> then points to
7927 this modified copy of the tree.
7929 The root of the schedule tree can be obtained using the following function.
7931         #include <isl/schedule.h>
7932         __isl_give isl_schedule_node *isl_schedule_get_root(
7933                 __isl_keep isl_schedule *schedule);
7935 A pointer to a newly created schedule tree with a single domain
7936 node can be created using the following functions.
7938         #include <isl/schedule_node.h>
7939         __isl_give isl_schedule_node *
7940         isl_schedule_node_from_domain(
7941                 __isl_take isl_union_set *domain);
7942         __isl_give isl_schedule_node *
7943         isl_schedule_node_from_extension(
7944                 __isl_take isl_union_map *extension);
7946 C<isl_schedule_node_from_extension> creates a tree with an extension
7947 node as root.
7949 Schedule nodes can be copied and freed using the following functions.
7951         #include <isl/schedule_node.h>
7952         __isl_give isl_schedule_node *isl_schedule_node_copy(
7953                 __isl_keep isl_schedule_node *node);
7954         __isl_null isl_schedule_node *isl_schedule_node_free(
7955                 __isl_take isl_schedule_node *node);
7957 The following functions can be used to check if two schedule
7958 nodes point to the same position in the same schedule.
7960         #include <isl/schedule_node.h>
7961         isl_bool isl_schedule_node_is_equal(
7962                 __isl_keep isl_schedule_node *node1,
7963                 __isl_keep isl_schedule_node *node2);
7965 The following properties can be obtained from a schedule node.
7967         #include <isl/schedule_node.h>
7968         enum isl_schedule_node_type isl_schedule_node_get_type(
7969                 __isl_keep isl_schedule_node *node);
7970         enum isl_schedule_node_type
7971         isl_schedule_node_get_parent_type(
7972                 __isl_keep isl_schedule_node *node);
7973         __isl_give isl_schedule *isl_schedule_node_get_schedule(
7974                 __isl_keep isl_schedule_node *node);
7976 The function C<isl_schedule_node_get_type> returns the type of
7977 the node, while C<isl_schedule_node_get_parent_type> returns
7978 type of the parent of the node, which is required to exist.
7979 The function C<isl_schedule_node_get_schedule> returns a copy
7980 to the schedule to which the node belongs.
7982 The following functions can be used to move the schedule node
7983 to a different position in the tree or to check if such a position
7984 exists.
7986         #include <isl/schedule_node.h>
7987         isl_bool isl_schedule_node_has_parent(
7988                 __isl_keep isl_schedule_node *node);
7989         __isl_give isl_schedule_node *isl_schedule_node_parent(
7990                 __isl_take isl_schedule_node *node);
7991         __isl_give isl_schedule_node *isl_schedule_node_root(
7992                 __isl_take isl_schedule_node *node);
7993         __isl_give isl_schedule_node *isl_schedule_node_ancestor(
7994                 __isl_take isl_schedule_node *node,
7995                 int generation);
7996         int isl_schedule_node_n_children(
7997                 __isl_keep isl_schedule_node *node);
7998         __isl_give isl_schedule_node *isl_schedule_node_child(
7999                 __isl_take isl_schedule_node *node, int pos);
8000         isl_bool isl_schedule_node_has_children(
8001                 __isl_keep isl_schedule_node *node);
8002         __isl_give isl_schedule_node *isl_schedule_node_first_child(
8003                 __isl_take isl_schedule_node *node);
8004         isl_bool isl_schedule_node_has_previous_sibling(
8005                 __isl_keep isl_schedule_node *node);
8006         __isl_give isl_schedule_node *
8007         isl_schedule_node_previous_sibling(
8008                 __isl_take isl_schedule_node *node);
8009         isl_bool isl_schedule_node_has_next_sibling(
8010                 __isl_keep isl_schedule_node *node);
8011         __isl_give isl_schedule_node *
8012         isl_schedule_node_next_sibling(
8013                 __isl_take isl_schedule_node *node);
8015 For C<isl_schedule_node_ancestor>, the ancestor of generation 0
8016 is the node itself, the ancestor of generation 1 is its parent and so on.
8018 It is also possible to query the number of ancestors of a node,
8019 the position of the current node
8020 within the children of its parent, the position of the subtree
8021 containing a node within the children of an ancestor
8022 or to obtain a copy of a given
8023 child without destroying the current node.
8024 Given two nodes that point to the same schedule, their closest
8025 shared ancestor can be obtained using
8026 C<isl_schedule_node_get_shared_ancestor>.
8028         #include <isl/schedule_node.h>
8029         int isl_schedule_node_get_tree_depth(
8030                 __isl_keep isl_schedule_node *node);
8031         int isl_schedule_node_get_child_position(
8032                 __isl_keep isl_schedule_node *node);
8033         int isl_schedule_node_get_ancestor_child_position(
8034                 __isl_keep isl_schedule_node *node,
8035                 __isl_keep isl_schedule_node *ancestor);
8036         __isl_give isl_schedule_node *isl_schedule_node_get_child(
8037                 __isl_keep isl_schedule_node *node, int pos);
8038         __isl_give isl_schedule_node *
8039         isl_schedule_node_get_shared_ancestor(
8040                 __isl_keep isl_schedule_node *node1,
8041                 __isl_keep isl_schedule_node *node2);
8043 All nodes in a schedule tree or
8044 all descendants of a specific node (including the node) can be visited
8045 in depth-first pre-order using the following functions.
8047         #include <isl/schedule.h>
8048         isl_stat isl_schedule_foreach_schedule_node_top_down(
8049                 __isl_keep isl_schedule *sched,
8050                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8051                         void *user), void *user);
8053         #include <isl/schedule_node.h>
8054         isl_stat isl_schedule_node_foreach_descendant_top_down(
8055                 __isl_keep isl_schedule_node *node,
8056                 isl_bool (*fn)(__isl_keep isl_schedule_node *node,
8057                         void *user), void *user);
8059 The callback function is slightly different from the usual
8060 callbacks in that it not only indicates success (non-negative result)
8061 or failure (negative result), but also indicates whether the children
8062 of the given node should be visited.  In particular, if the callback
8063 returns a positive value, then the children are visited, but if
8064 the callback returns zero, then the children are not visited.
8066 The ancestors of a node in a schedule tree can be visited from
8067 the root down to and including the parent of the node using
8068 the following function.
8070         #include <isl/schedule_node.h>
8071         isl_stat isl_schedule_node_foreach_ancestor_top_down(
8072                 __isl_keep isl_schedule_node *node,
8073                 isl_stat (*fn)(__isl_keep isl_schedule_node *node,
8074                         void *user), void *user);
8076 The following functions allows for a depth-first post-order
8077 traversal of the nodes in a schedule tree or
8078 of the descendants of a specific node (including the node
8079 itself), where the user callback is allowed to modify the
8080 visited node.
8082         #include <isl/schedule.h>
8083         __isl_give isl_schedule *
8084         isl_schedule_map_schedule_node_bottom_up(
8085                 __isl_take isl_schedule *schedule,
8086                 __isl_give isl_schedule_node *(*fn)(
8087                         __isl_take isl_schedule_node *node,
8088                         void *user), void *user);
8090         #include <isl/schedule_node.h>
8091         __isl_give isl_schedule_node *
8092         isl_schedule_node_map_descendant_bottom_up(
8093                 __isl_take isl_schedule_node *node,
8094                 __isl_give isl_schedule_node *(*fn)(
8095                         __isl_take isl_schedule_node *node,
8096                         void *user), void *user);
8098 The traversal continues from the node returned by the callback function.
8099 It is the responsibility of the user to ensure that this does not
8100 lead to an infinite loop.  It is safest to always return a pointer
8101 to the same position (same ancestors and child positions) as the input node.
8103 The following function removes a node (along with its descendants)
8104 from a schedule tree and returns a pointer to the leaf at the
8105 same position in the updated tree.
8106 It is not allowed to remove the root of a schedule tree or
8107 a child of a set or sequence node.
8109         #include <isl/schedule_node.h>
8110         __isl_give isl_schedule_node *isl_schedule_node_cut(
8111                 __isl_take isl_schedule_node *node);
8113 The following function removes a single node
8114 from a schedule tree and returns a pointer to the child
8115 of the node, now located at the position of the original node
8116 or to a leaf node at that position if there was no child.
8117 It is not allowed to remove the root of a schedule tree,
8118 a set or sequence node, a child of a set or sequence node or
8119 a band node with an anchored subtree.
8121         #include <isl/schedule_node.h>
8122         __isl_give isl_schedule_node *isl_schedule_node_delete(
8123                 __isl_take isl_schedule_node *node);
8125 Most nodes in a schedule tree only contain local information.
8126 In some cases, however, a node may also refer to outer band nodes.
8127 This means that the position of the node within the tree should
8128 not be changed, or at least that no changes are performed to the
8129 outer band nodes.  The following function can be used to test
8130 whether the subtree rooted at a given node contains any such nodes.
8132         #include <isl/schedule_node.h>
8133         isl_bool isl_schedule_node_is_subtree_anchored(
8134                 __isl_keep isl_schedule_node *node);
8136 The following function resets the user pointers on all parameter
8137 and tuple identifiers referenced by the given schedule node.
8139         #include <isl/schedule_node.h>
8140         __isl_give isl_schedule_node *isl_schedule_node_reset_user(
8141                 __isl_take isl_schedule_node *node);
8143 The following function aligns the parameters of the given schedule
8144 node to the given space.
8146         #include <isl/schedule_node.h>
8147         __isl_give isl_schedule_node *
8148         isl_schedule_node_align_params(
8149                 __isl_take isl_schedule_node *node,
8150                 __isl_take isl_space *space);
8152 Several node types have their own functions for querying
8153 (and in some cases setting) some node type specific properties.
8155         #include <isl/schedule_node.h>
8156         __isl_give isl_space *isl_schedule_node_band_get_space(
8157                 __isl_keep isl_schedule_node *node);
8158         __isl_give isl_multi_union_pw_aff *
8159         isl_schedule_node_band_get_partial_schedule(
8160                 __isl_keep isl_schedule_node *node);
8161         __isl_give isl_union_map *
8162         isl_schedule_node_band_get_partial_schedule_union_map(
8163                 __isl_keep isl_schedule_node *node);
8164         unsigned isl_schedule_node_band_n_member(
8165                 __isl_keep isl_schedule_node *node);
8166         isl_bool isl_schedule_node_band_member_get_coincident(
8167                 __isl_keep isl_schedule_node *node, int pos);
8168         __isl_give isl_schedule_node *
8169         isl_schedule_node_band_member_set_coincident(
8170                 __isl_take isl_schedule_node *node, int pos,
8171                 int coincident);
8172         isl_bool isl_schedule_node_band_get_permutable(
8173                 __isl_keep isl_schedule_node *node);
8174         __isl_give isl_schedule_node *
8175         isl_schedule_node_band_set_permutable(
8176                 __isl_take isl_schedule_node *node, int permutable);
8177         enum isl_ast_loop_type
8178         isl_schedule_node_band_member_get_ast_loop_type(
8179                 __isl_keep isl_schedule_node *node, int pos);
8180         __isl_give isl_schedule_node *
8181         isl_schedule_node_band_member_set_ast_loop_type(
8182                 __isl_take isl_schedule_node *node, int pos,
8183                 enum isl_ast_loop_type type);
8184         __isl_give isl_union_set *
8185         enum isl_ast_loop_type
8186         isl_schedule_node_band_member_get_isolate_ast_loop_type(
8187                 __isl_keep isl_schedule_node *node, int pos);
8188         __isl_give isl_schedule_node *
8189         isl_schedule_node_band_member_set_isolate_ast_loop_type(
8190                 __isl_take isl_schedule_node *node, int pos,
8191                 enum isl_ast_loop_type type);
8192         isl_schedule_node_band_get_ast_build_options(
8193                 __isl_keep isl_schedule_node *node);
8194         __isl_give isl_schedule_node *
8195         isl_schedule_node_band_set_ast_build_options(
8196                 __isl_take isl_schedule_node *node,
8197                 __isl_take isl_union_set *options);
8198         __isl_give isl_set *
8199         isl_schedule_node_band_get_ast_isolate_option(
8200                 __isl_keep isl_schedule_node *node);
8202 The function C<isl_schedule_node_band_get_space> returns the space
8203 of the partial schedule of the band.
8204 The function C<isl_schedule_node_band_get_partial_schedule_union_map>
8205 returns a representation of the partial schedule of the band node
8206 in the form of an C<isl_union_map>.
8207 The coincident and permutable properties are set by
8208 C<isl_schedule_constraints_compute_schedule> on the schedule tree
8209 it produces.
8210 A scheduling dimension is considered to be ``coincident''
8211 if it satisfies the coincidence constraints within its band.
8212 That is, if the dependence distances of the coincidence
8213 constraints are all zero in that direction (for fixed
8214 iterations of outer bands).
8215 A band is marked permutable if it was produced using the Pluto-like scheduler.
8216 Note that the scheduler may have to resort to a Feautrier style scheduling
8217 step even if the default scheduler is used.
8218 An C<isl_ast_loop_type> is one of C<isl_ast_loop_default>,
8219 C<isl_ast_loop_atomic>, C<isl_ast_loop_unroll> or C<isl_ast_loop_separate>.
8220 For the meaning of these loop AST generation types and the difference
8221 between the regular loop AST generation type and the isolate
8222 loop AST generation type, see L</"AST Generation Options (Schedule Tree)">.
8223 The functions C<isl_schedule_node_band_member_get_ast_loop_type>
8224 and C<isl_schedule_node_band_member_get_isolate_ast_loop_type>
8225 may return C<isl_ast_loop_error> if an error occurs.
8226 The AST build options govern how an AST is generated for
8227 the individual schedule dimensions during AST generation.
8228 See L</"AST Generation Options (Schedule Tree)">.
8229 The isolate option for the given node can be extracted from these
8230 AST build options using the function
8231 C<isl_schedule_node_band_get_ast_isolate_option>.
8233         #include <isl/schedule_node.h>
8234         __isl_give isl_set *
8235         isl_schedule_node_context_get_context(
8236                 __isl_keep isl_schedule_node *node);
8238         #include <isl/schedule_node.h>
8239         __isl_give isl_union_set *
8240         isl_schedule_node_domain_get_domain(
8241                 __isl_keep isl_schedule_node *node);
8243         #include <isl/schedule_node.h>
8244         __isl_give isl_union_map *
8245         isl_schedule_node_expansion_get_expansion(
8246                 __isl_keep isl_schedule_node *node);
8247         __isl_give isl_union_pw_multi_aff *
8248         isl_schedule_node_expansion_get_contraction(
8249                 __isl_keep isl_schedule_node *node);
8251         #include <isl/schedule_node.h>
8252         __isl_give isl_union_map *
8253         isl_schedule_node_extension_get_extension(
8254                 __isl_keep isl_schedule_node *node);
8256         #include <isl/schedule_node.h>
8257         __isl_give isl_union_set *
8258         isl_schedule_node_filter_get_filter(
8259                 __isl_keep isl_schedule_node *node);
8261         #include <isl/schedule_node.h>
8262         __isl_give isl_set *isl_schedule_node_guard_get_guard(
8263                 __isl_keep isl_schedule_node *node);
8265         #include <isl/schedule_node.h>
8266         __isl_give isl_id *isl_schedule_node_mark_get_id(
8267                 __isl_keep isl_schedule_node *node);
8269 The following functions can be used to obtain an C<isl_multi_union_pw_aff>,
8270 an C<isl_union_pw_multi_aff> or C<isl_union_map> representation of
8271 partial schedules related to the node.
8273         #include <isl/schedule_node.h>
8274         __isl_give isl_multi_union_pw_aff *
8275         isl_schedule_node_get_prefix_schedule_multi_union_pw_aff(
8276                 __isl_keep isl_schedule_node *node);
8277         __isl_give isl_union_pw_multi_aff *
8278         isl_schedule_node_get_prefix_schedule_union_pw_multi_aff(
8279                 __isl_keep isl_schedule_node *node);
8280         __isl_give isl_union_map *
8281         isl_schedule_node_get_prefix_schedule_union_map(
8282                 __isl_keep isl_schedule_node *node);
8283         __isl_give isl_union_map *
8284         isl_schedule_node_get_prefix_schedule_relation(
8285                 __isl_keep isl_schedule_node *node);
8286         __isl_give isl_union_map *
8287         isl_schedule_node_get_subtree_schedule_union_map(
8288                 __isl_keep isl_schedule_node *node);
8290 In particular, the functions
8291 C<isl_schedule_node_get_prefix_schedule_multi_union_pw_aff>,
8292 C<isl_schedule_node_get_prefix_schedule_union_pw_multi_aff>
8293 and C<isl_schedule_node_get_prefix_schedule_union_map>
8294 return a relative ordering on the domain elements that reach the given
8295 node determined by its ancestors.
8296 The function C<isl_schedule_node_get_prefix_schedule_relation>
8297 additionally includes the domain constraints in the result.
8298 The function C<isl_schedule_node_get_subtree_schedule_union_map>
8299 returns a representation of the partial schedule defined by the
8300 subtree rooted at the given node.
8301 If the tree contains any expansion nodes, then the subtree schedule
8302 is formulated in terms of the expanded domain elements.
8303 The tree passed to functions returning a prefix schedule
8304 may only contain extension nodes if these would not affect
8305 the result of these functions.  That is, if one of the ancestors
8306 is an extension node, then all of the domain elements that were
8307 added by the extension node need to have been filtered out
8308 by filter nodes between the extension node and the input node.
8309 The tree passed to C<isl_schedule_node_get_subtree_schedule_union_map>
8310 may not contain in extension nodes in the selected subtree.
8312 The expansion/contraction defined by an entire subtree, combining
8313 the expansions/contractions
8314 on the expansion nodes in the subtree, can be obtained using
8315 the following functions.
8317         #include <isl/schedule_node.h>
8318         __isl_give isl_union_map *
8319         isl_schedule_node_get_subtree_expansion(
8320                 __isl_keep isl_schedule_node *node);
8321         __isl_give isl_union_pw_multi_aff *
8322         isl_schedule_node_get_subtree_contraction(
8323                 __isl_keep isl_schedule_node *node);
8325 The total number of outer band members of given node, i.e.,
8326 the shared output dimension of the maps in the result
8327 of C<isl_schedule_node_get_prefix_schedule_union_map> can be obtained
8328 using the following function.
8330         #include <isl/schedule_node.h>
8331         int isl_schedule_node_get_schedule_depth(
8332                 __isl_keep isl_schedule_node *node);
8334 The following functions return the elements that reach the given node
8335 or the union of universes in the spaces that contain these elements.
8337         #include <isl/schedule_node.h>
8338         __isl_give isl_union_set *
8339         isl_schedule_node_get_domain(
8340                 __isl_keep isl_schedule_node *node);
8341         __isl_give isl_union_set *
8342         isl_schedule_node_get_universe_domain(
8343                 __isl_keep isl_schedule_node *node);
8345 The input tree of C<isl_schedule_node_get_domain>
8346 may only contain extension nodes if these would not affect
8347 the result of this function.  That is, if one of the ancestors
8348 is an extension node, then all of the domain elements that were
8349 added by the extension node need to have been filtered out
8350 by filter nodes between the extension node and the input node.
8352 The following functions can be used to introduce additional nodes
8353 in the schedule tree.  The new node is introduced at the point
8354 in the tree where the C<isl_schedule_node> points to and
8355 the results points to the new node.
8357         #include <isl/schedule_node.h>
8358         __isl_give isl_schedule_node *
8359         isl_schedule_node_insert_partial_schedule(
8360                 __isl_take isl_schedule_node *node,
8361                 __isl_take isl_multi_union_pw_aff *schedule);
8363 This function inserts a new band node with (the greatest integer
8364 part of) the given partial schedule.
8365 The subtree rooted at the given node is assumed not to have
8366 any anchored nodes.
8368         #include <isl/schedule_node.h>
8369         __isl_give isl_schedule_node *
8370         isl_schedule_node_insert_context(
8371                 __isl_take isl_schedule_node *node,
8372                 __isl_take isl_set *context);
8374 This function inserts a new context node with the given context constraints.
8376         #include <isl/schedule_node.h>
8377         __isl_give isl_schedule_node *
8378         isl_schedule_node_insert_filter(
8379                 __isl_take isl_schedule_node *node,
8380                 __isl_take isl_union_set *filter);
8382 This function inserts a new filter node with the given filter.
8383 If the original node already pointed to a filter node, then the
8384 two filter nodes are merged into one.
8386         #include <isl/schedule_node.h>
8387         __isl_give isl_schedule_node *
8388         isl_schedule_node_insert_guard(
8389                 __isl_take isl_schedule_node *node,
8390                 __isl_take isl_set *guard);
8392 This function inserts a new guard node with the given guard constraints.
8394         #include <isl/schedule_node.h>
8395         __isl_give isl_schedule_node *
8396         isl_schedule_node_insert_mark(
8397                 __isl_take isl_schedule_node *node,
8398                 __isl_take isl_id *mark);
8400 This function inserts a new mark node with the give mark identifier.
8402         #include <isl/schedule_node.h>
8403         __isl_give isl_schedule_node *
8404         isl_schedule_node_insert_sequence(
8405                 __isl_take isl_schedule_node *node,
8406                 __isl_take isl_union_set_list *filters);
8407         __isl_give isl_schedule_node *
8408         isl_schedule_node_insert_set(
8409                 __isl_take isl_schedule_node *node,
8410                 __isl_take isl_union_set_list *filters);
8412 These functions insert a new sequence or set node with the given
8413 filters as children.
8415         #include <isl/schedule_node.h>
8416         __isl_give isl_schedule_node *isl_schedule_node_group(
8417                 __isl_take isl_schedule_node *node,
8418                 __isl_take isl_id *group_id);
8420 This function introduces an expansion node in between the current
8421 node and its parent that expands instances of a space with tuple
8422 identifier C<group_id> to the original domain elements that reach
8423 the node.  The group instances are identified by the prefix schedule
8424 of those domain elements.  The ancestors of the node are adjusted
8425 to refer to the group instances instead of the original domain
8426 elements.  The return value points to the same node in the updated
8427 schedule tree as the input node, i.e., to the child of the newly
8428 introduced expansion node.  Grouping instances of different statements
8429 ensures that they will be treated as a single statement by the
8430 AST generator up to the point of the expansion node.
8432 The following function can be used to flatten a nested
8433 sequence.
8435         #include <isl/schedule_node.h>
8436         __isl_give isl_schedule_node *
8437         isl_schedule_node_sequence_splice_child(
8438                 __isl_take isl_schedule_node *node, int pos);
8440 That is, given a sequence node C<node> that has another sequence node
8441 in its child at position C<pos> (in particular, the child of that filter
8442 node is a sequence node), attach the children of that other sequence
8443 node as children of C<node>, replacing the original child at position
8444 C<pos>.
8446 The partial schedule of a band node can be scaled (down) or reduced using
8447 the following functions.
8449         #include <isl/schedule_node.h>
8450         __isl_give isl_schedule_node *
8451         isl_schedule_node_band_scale(
8452                 __isl_take isl_schedule_node *node,
8453                 __isl_take isl_multi_val *mv);
8454         __isl_give isl_schedule_node *
8455         isl_schedule_node_band_scale_down(
8456                 __isl_take isl_schedule_node *node,
8457                 __isl_take isl_multi_val *mv);
8458         __isl_give isl_schedule_node *
8459         isl_schedule_node_band_mod(
8460                 __isl_take isl_schedule_node *node,
8461                 __isl_take isl_multi_val *mv);
8463 The spaces of the two arguments need to match.
8464 After scaling, the partial schedule is replaced by its greatest
8465 integer part to ensure that the schedule remains integral.
8467 The partial schedule of a band node can be shifted by an
8468 C<isl_multi_union_pw_aff> with a domain that is a superset
8469 of the domain of the partial schedule using
8470 the following function.
8472         #include <isl/schedule_node.h>
8473         __isl_give isl_schedule_node *
8474         isl_schedule_node_band_shift(
8475                 __isl_take isl_schedule_node *node,
8476                 __isl_take isl_multi_union_pw_aff *shift);
8478 A band node can be tiled using the following function.
8480         #include <isl/schedule_node.h>
8481         __isl_give isl_schedule_node *isl_schedule_node_band_tile(
8482                 __isl_take isl_schedule_node *node,
8483                 __isl_take isl_multi_val *sizes);
8485         isl_stat isl_options_set_tile_scale_tile_loops(isl_ctx *ctx,
8486                 int val);
8487         int isl_options_get_tile_scale_tile_loops(isl_ctx *ctx);
8488         isl_stat isl_options_set_tile_shift_point_loops(isl_ctx *ctx,
8489                 int val);
8490         int isl_options_get_tile_shift_point_loops(isl_ctx *ctx);
8492 The C<isl_schedule_node_band_tile> function tiles
8493 the band using the given tile sizes inside its schedule.
8494 A new child band node is created to represent the point loops and it is
8495 inserted between the modified band and its children.
8496 The subtree rooted at the given node is assumed not to have
8497 any anchored nodes.
8498 The C<tile_scale_tile_loops> option specifies whether the tile
8499 loops iterators should be scaled by the tile sizes.
8500 If the C<tile_shift_point_loops> option is set, then the point loops
8501 are shifted to start at zero.
8503 A band node can be split into two nested band nodes
8504 using the following function.
8506         #include <isl/schedule_node.h>
8507         __isl_give isl_schedule_node *isl_schedule_node_band_split(
8508                 __isl_take isl_schedule_node *node, int pos);
8510 The resulting outer band node contains the first C<pos> dimensions of
8511 the schedule of C<node> while the inner band contains the remaining dimensions.
8512 The schedules of the two band nodes live in anonymous spaces.
8513 The loop AST generation type options and the isolate option
8514 are split over the the two band nodes.
8516 A band node can be moved down to the leaves of the subtree rooted
8517 at the band node using the following function.
8519         #include <isl/schedule_node.h>
8520         __isl_give isl_schedule_node *isl_schedule_node_band_sink(
8521                 __isl_take isl_schedule_node *node);
8523 The subtree rooted at the given node is assumed not to have
8524 any anchored nodes.
8525 The result points to the node in the resulting tree that is in the same
8526 position as the node pointed to by C<node> in the original tree.
8528         #include <isl/schedule_node.h>
8529         __isl_give isl_schedule_node *
8530         isl_schedule_node_order_before(
8531                 __isl_take isl_schedule_node *node,
8532                 __isl_take isl_union_set *filter);
8533         __isl_give isl_schedule_node *
8534         isl_schedule_node_order_after(
8535                 __isl_take isl_schedule_node *node,
8536                 __isl_take isl_union_set *filter);
8538 These functions split the domain elements that reach C<node>
8539 into those that satisfy C<filter> and those that do not and
8540 arranges for the elements that do satisfy the filter to be
8541 executed before (in case of C<isl_schedule_node_order_before>)
8542 or after (in case of C<isl_schedule_node_order_after>)
8543 those that do not.  The order is imposed by
8544 a sequence node, possibly reusing the grandparent of C<node>
8545 on two copies of the subtree attached to the original C<node>.
8546 Both copies are simplified with respect to their filter.
8548 Return a pointer to the copy of the subtree that does not
8549 satisfy C<filter>.  If there is no such copy (because all
8550 reaching domain elements satisfy the filter), then return
8551 the original pointer.
8553         #include <isl/schedule_node.h>
8554         __isl_give isl_schedule_node *
8555         isl_schedule_node_graft_before(
8556                 __isl_take isl_schedule_node *node,
8557                 __isl_take isl_schedule_node *graft);
8558         __isl_give isl_schedule_node *
8559         isl_schedule_node_graft_after(
8560                 __isl_take isl_schedule_node *node,
8561                 __isl_take isl_schedule_node *graft);
8563 This function inserts the C<graft> tree into the tree containing C<node>
8564 such that it is executed before (in case of C<isl_schedule_node_graft_before>)
8565 or after (in case of C<isl_schedule_node_graft_after>) C<node>.
8566 The root node of C<graft>
8567 should be an extension node where the domain of the extension
8568 is the flat product of all outer band nodes of C<node>.
8569 The root node may also be a domain node.
8570 The elements of the domain or the range of the extension may not
8571 intersect with the domain elements that reach "node".
8572 The schedule tree of C<graft> may not be anchored.
8574 The schedule tree of C<node> is modified to include an extension node
8575 corresponding to the root node of C<graft> as a child of the original
8576 parent of C<node>.  The original node that C<node> points to and the
8577 child of the root node of C<graft> are attached to this extension node
8578 through a sequence, with appropriate filters and with the child
8579 of C<graft> appearing before or after the original C<node>.
8581 If C<node> already appears inside a sequence that is the child of
8582 an extension node and if the spaces of the new domain elements
8583 do not overlap with those of the original domain elements,
8584 then that extension node is extended with the new extension
8585 rather than introducing a new segment of extension and sequence nodes.
8587 Return a pointer to the same node in the modified tree that
8588 C<node> pointed to in the original tree.
8590 A representation of the schedule node can be printed using
8592         #include <isl/schedule_node.h>
8593         __isl_give isl_printer *isl_printer_print_schedule_node(
8594                 __isl_take isl_printer *p,
8595                 __isl_keep isl_schedule_node *node);
8596         __isl_give char *isl_schedule_node_to_str(
8597                 __isl_keep isl_schedule_node *node);
8599 C<isl_schedule_node_to_str> prints the schedule node in block format.
8601 =head2 Dependence Analysis
8603 C<isl> contains specialized functionality for performing
8604 array dataflow analysis.  That is, given a I<sink> access relation
8605 and a collection of possible I<source> access relations,
8606 C<isl> can compute relations that describe
8607 for each iteration of the sink access, which iteration
8608 of which of the source access relations was the last
8609 to access the same data element before the given iteration
8610 of the sink access.
8611 The resulting dependence relations map source iterations
8612 to either the corresponding sink iterations or
8613 pairs of corresponding sink iterations and accessed data elements.
8614 To compute standard flow dependences, the sink should be
8615 a read, while the sources should be writes.
8616 If any of the source accesses are marked as being I<may>
8617 accesses, then there will be a dependence from the last
8618 I<must> access B<and> from any I<may> access that follows
8619 this last I<must> access.
8620 In particular, if I<all> sources are I<may> accesses,
8621 then memory based dependence analysis is performed.
8622 If, on the other hand, all sources are I<must> accesses,
8623 then value based dependence analysis is performed.
8625 =head3 High-level Interface
8627 A high-level interface to dependence analysis is provided
8628 by the following function.
8630         #include <isl/flow.h>
8631         __isl_give isl_union_flow *
8632         isl_union_access_info_compute_flow(
8633                 __isl_take isl_union_access_info *access);
8635 The input C<isl_union_access_info> object describes the sink
8636 access relations, the source access relations and a schedule,
8637 while the output C<isl_union_flow> object describes
8638 the resulting dependence relations and the subsets of the
8639 sink relations for which no source was found.
8641 An C<isl_union_access_info> is created, modified, copied and freed using
8642 the following functions.
8644         #include <isl/flow.h>
8645         __isl_give isl_union_access_info *
8646         isl_union_access_info_from_sink(
8647                 __isl_take isl_union_map *sink);
8648         __isl_give isl_union_access_info *
8649         isl_union_access_info_set_must_source(
8650                 __isl_take isl_union_access_info *access,
8651                 __isl_take isl_union_map *must_source);
8652         __isl_give isl_union_access_info *
8653         isl_union_access_info_set_may_source(
8654                 __isl_take isl_union_access_info *access,
8655                 __isl_take isl_union_map *may_source);
8656         __isl_give isl_union_access_info *
8657         isl_union_access_info_set_schedule(
8658                 __isl_take isl_union_access_info *access,
8659                 __isl_take isl_schedule *schedule);
8660         __isl_give isl_union_access_info *
8661         isl_union_access_info_set_schedule_map(
8662                 __isl_take isl_union_access_info *access,
8663                 __isl_take isl_union_map *schedule_map);
8664         __isl_give isl_union_access_info *
8665         isl_union_access_info_copy(
8666                 __isl_keep isl_union_access_info *access);
8667         __isl_null isl_union_access_info *
8668         isl_union_access_info_free(
8669                 __isl_take isl_union_access_info *access);
8671 The may sources set by C<isl_union_access_info_set_may_source>
8672 do not need to include the must sources set by
8673 C<isl_union_access_info_set_must_source> as a subset.
8674 The user is free not to call one (or both) of these functions,
8675 in which case the corresponding set is kept to its empty default.
8676 Similarly, the default schedule initialized by
8677 C<isl_union_access_info_from_sink> is empty.
8678 The current schedule is determined by the last call to either
8679 C<isl_union_access_info_set_schedule> or
8680 C<isl_union_access_info_set_schedule_map>.
8681 The domain of the schedule corresponds to the domains of
8682 the access relations.  In particular, the domains of the access
8683 relations are effectively intersected with the domain of the schedule
8684 and only the resulting accesses are considered by the dependence analysis.
8686 A representation of the information contained in an object
8687 of type C<isl_union_access_info> can be obtained using
8689         #include <isl/flow.h>
8690         __isl_give isl_printer *
8691         isl_printer_print_union_access_info(
8692                 __isl_take isl_printer *p,
8693                 __isl_keep isl_union_access_info *access);
8694         __isl_give char *isl_union_access_info_to_str(
8695                 __isl_keep isl_union_access_info *access);
8697 C<isl_union_access_info_to_str> prints the information in flow format.
8699 The output of C<isl_union_access_info_compute_flow> can be examined
8700 and freed using the following functions.
8702         #include <isl/flow.h>
8703         __isl_give isl_union_map *isl_union_flow_get_must_dependence(
8704                 __isl_keep isl_union_flow *flow);
8705         __isl_give isl_union_map *isl_union_flow_get_may_dependence(
8706                 __isl_keep isl_union_flow *flow);
8707         __isl_give isl_union_map *
8708         isl_union_flow_get_full_must_dependence(
8709                 __isl_keep isl_union_flow *flow);
8710         __isl_give isl_union_map *
8711         isl_union_flow_get_full_may_dependence(
8712                 __isl_keep isl_union_flow *flow);
8713         __isl_give isl_union_map *isl_union_flow_get_must_no_source(
8714                 __isl_keep isl_union_flow *flow);
8715         __isl_give isl_union_map *isl_union_flow_get_may_no_source(
8716                 __isl_keep isl_union_flow *flow);
8717         __isl_null isl_union_flow *isl_union_flow_free(
8718                 __isl_take isl_union_flow *flow);
8720 The relation returned by C<isl_union_flow_get_must_dependence>
8721 relates domain elements of must sources to domain elements of the sink.
8722 The relation returned by C<isl_union_flow_get_may_dependence>
8723 relates domain elements of must or may sources to domain elements of the sink
8724 and includes the previous relation as a subset.
8725 The relation returned by C<isl_union_flow_get_full_must_dependence>
8726 relates domain elements of must sources to pairs of domain elements of the sink
8727 and accessed data elements.
8728 The relation returned by C<isl_union_flow_get_full_may_dependence>
8729 relates domain elements of must or may sources to pairs of
8730 domain elements of the sink and accessed data elements.
8731 This relation includes the previous relation as a subset.
8732 The relation returned by C<isl_union_flow_get_must_no_source> is the subset
8733 of the sink relation for which no dependences have been found.
8734 The relation returned by C<isl_union_flow_get_may_no_source> is the subset
8735 of the sink relation for which no definite dependences have been found.
8736 That is, it contains those sink access that do not contribute to any
8737 of the elements in the relation returned
8738 by C<isl_union_flow_get_must_dependence>.
8740 A representation of the information contained in an object
8741 of type C<isl_union_flow> can be obtained using
8743         #include <isl/flow.h>
8744         __isl_give isl_printer *isl_printer_print_union_flow(
8745                 __isl_take isl_printer *p,
8746                 __isl_keep isl_union_flow *flow);
8747         __isl_give char *isl_union_flow_to_str(
8748                 __isl_keep isl_union_flow *flow);
8750 C<isl_union_flow_to_str> prints the information in flow format.
8752 =head3 Low-level Interface
8754 A lower-level interface is provided by the following functions.
8756         #include <isl/flow.h>
8758         typedef int (*isl_access_level_before)(void *first, void *second);
8760         __isl_give isl_access_info *isl_access_info_alloc(
8761                 __isl_take isl_map *sink,
8762                 void *sink_user, isl_access_level_before fn,
8763                 int max_source);
8764         __isl_give isl_access_info *isl_access_info_add_source(
8765                 __isl_take isl_access_info *acc,
8766                 __isl_take isl_map *source, int must,
8767                 void *source_user);
8768         __isl_null isl_access_info *isl_access_info_free(
8769                 __isl_take isl_access_info *acc);
8771         __isl_give isl_flow *isl_access_info_compute_flow(
8772                 __isl_take isl_access_info *acc);
8774         isl_stat isl_flow_foreach(__isl_keep isl_flow *deps,
8775                 isl_stat (*fn)(__isl_take isl_map *dep, int must,
8776                           void *dep_user, void *user),
8777                 void *user);
8778         __isl_give isl_map *isl_flow_get_no_source(
8779                 __isl_keep isl_flow *deps, int must);
8780         void isl_flow_free(__isl_take isl_flow *deps);
8782 The function C<isl_access_info_compute_flow> performs the actual
8783 dependence analysis.  The other functions are used to construct
8784 the input for this function or to read off the output.
8786 The input is collected in an C<isl_access_info>, which can
8787 be created through a call to C<isl_access_info_alloc>.
8788 The arguments to this functions are the sink access relation
8789 C<sink>, a token C<sink_user> used to identify the sink
8790 access to the user, a callback function for specifying the
8791 relative order of source and sink accesses, and the number
8792 of source access relations that will be added.
8793 The callback function has type C<int (*)(void *first, void *second)>.
8794 The function is called with two user supplied tokens identifying
8795 either a source or the sink and it should return the shared nesting
8796 level and the relative order of the two accesses.
8797 In particular, let I<n> be the number of loops shared by
8798 the two accesses.  If C<first> precedes C<second> textually,
8799 then the function should return I<2 * n + 1>; otherwise,
8800 it should return I<2 * n>.
8801 The sources can be added to the C<isl_access_info> by performing
8802 (at most) C<max_source> calls to C<isl_access_info_add_source>.
8803 C<must> indicates whether the source is a I<must> access
8804 or a I<may> access.  Note that a multi-valued access relation
8805 should only be marked I<must> if every iteration in the domain
8806 of the relation accesses I<all> elements in its image.
8807 The C<source_user> token is again used to identify
8808 the source access.  The range of the source access relation
8809 C<source> should have the same dimension as the range
8810 of the sink access relation.
8811 The C<isl_access_info_free> function should usually not be
8812 called explicitly, because it is called implicitly by
8813 C<isl_access_info_compute_flow>.
8815 The result of the dependence analysis is collected in an
8816 C<isl_flow>.  There may be elements of
8817 the sink access for which no preceding source access could be
8818 found or for which all preceding sources are I<may> accesses.
8819 The relations containing these elements can be obtained through
8820 calls to C<isl_flow_get_no_source>, the first with C<must> set
8821 and the second with C<must> unset.
8822 In the case of standard flow dependence analysis,
8823 with the sink a read and the sources I<must> writes,
8824 the first relation corresponds to the reads from uninitialized
8825 array elements and the second relation is empty.
8826 The actual flow dependences can be extracted using
8827 C<isl_flow_foreach>.  This function will call the user-specified
8828 callback function C<fn> for each B<non-empty> dependence between
8829 a source and the sink.  The callback function is called
8830 with four arguments, the actual flow dependence relation
8831 mapping source iterations to sink iterations, a boolean that
8832 indicates whether it is a I<must> or I<may> dependence, a token
8833 identifying the source and an additional C<void *> with value
8834 equal to the third argument of the C<isl_flow_foreach> call.
8835 A dependence is marked I<must> if it originates from a I<must>
8836 source and if it is not followed by any I<may> sources.
8838 After finishing with an C<isl_flow>, the user should call
8839 C<isl_flow_free> to free all associated memory.
8841 =head3 Interaction with the Low-level Interface
8843 During the dependence analysis, we frequently need to perform
8844 the following operation.  Given a relation between sink iterations
8845 and potential source iterations from a particular source domain,
8846 what is the last potential source iteration corresponding to each
8847 sink iteration.  It can sometimes be convenient to adjust
8848 the set of potential source iterations before or after each such operation.
8849 The prototypical example is fuzzy array dataflow analysis,
8850 where we need to analyze if, based on data-dependent constraints,
8851 the sink iteration can ever be executed without one or more of
8852 the corresponding potential source iterations being executed.
8853 If so, we can introduce extra parameters and select an unknown
8854 but fixed source iteration from the potential source iterations.
8855 To be able to perform such manipulations, C<isl> provides the following
8856 function.
8858         #include <isl/flow.h>
8860         typedef __isl_give isl_restriction *(*isl_access_restrict)(
8861                 __isl_keep isl_map *source_map,
8862                 __isl_keep isl_set *sink, void *source_user,
8863                 void *user);
8864         __isl_give isl_access_info *isl_access_info_set_restrict(
8865                 __isl_take isl_access_info *acc,
8866                 isl_access_restrict fn, void *user);
8868 The function C<isl_access_info_set_restrict> should be called
8869 before calling C<isl_access_info_compute_flow> and registers a callback function
8870 that will be called any time C<isl> is about to compute the last
8871 potential source.  The first argument is the (reverse) proto-dependence,
8872 mapping sink iterations to potential source iterations.
8873 The second argument represents the sink iterations for which
8874 we want to compute the last source iteration.
8875 The third argument is the token corresponding to the source
8876 and the final argument is the token passed to C<isl_access_info_set_restrict>.
8877 The callback is expected to return a restriction on either the input or
8878 the output of the operation computing the last potential source.
8879 If the input needs to be restricted then restrictions are needed
8880 for both the source and the sink iterations.  The sink iterations
8881 and the potential source iterations will be intersected with these sets.
8882 If the output needs to be restricted then only a restriction on the source
8883 iterations is required.
8884 If any error occurs, the callback should return C<NULL>.
8885 An C<isl_restriction> object can be created, freed and inspected
8886 using the following functions.
8888         #include <isl/flow.h>
8890         __isl_give isl_restriction *isl_restriction_input(
8891                 __isl_take isl_set *source_restr,
8892                 __isl_take isl_set *sink_restr);
8893         __isl_give isl_restriction *isl_restriction_output(
8894                 __isl_take isl_set *source_restr);
8895         __isl_give isl_restriction *isl_restriction_none(
8896                 __isl_take isl_map *source_map);
8897         __isl_give isl_restriction *isl_restriction_empty(
8898                 __isl_take isl_map *source_map);
8899         __isl_null isl_restriction *isl_restriction_free(
8900                 __isl_take isl_restriction *restr);
8902 C<isl_restriction_none> and C<isl_restriction_empty> are special
8903 cases of C<isl_restriction_input>.  C<isl_restriction_none>
8904 is essentially equivalent to
8906         isl_restriction_input(isl_set_universe(
8907             isl_space_range(isl_map_get_space(source_map))),
8908                             isl_set_universe(
8909             isl_space_domain(isl_map_get_space(source_map))));
8911 whereas C<isl_restriction_empty> is essentially equivalent to
8913         isl_restriction_input(isl_set_empty(
8914             isl_space_range(isl_map_get_space(source_map))),
8915                             isl_set_universe(
8916             isl_space_domain(isl_map_get_space(source_map))));
8918 =head2 Scheduling
8920         #include <isl/schedule.h>
8921         __isl_give isl_schedule *
8922         isl_schedule_constraints_compute_schedule(
8923                 __isl_take isl_schedule_constraints *sc);
8925 The function C<isl_schedule_constraints_compute_schedule> can be
8926 used to compute a schedule that satisfies the given schedule constraints.
8927 These schedule constraints include the iteration domain for which
8928 a schedule should be computed and dependences between pairs of
8929 iterations.  In particular, these dependences include
8930 I<validity> dependences and I<proximity> dependences.
8931 By default, the algorithm used to construct the schedule is similar
8932 to that of C<Pluto>.
8933 Alternatively, Feautrier's multi-dimensional scheduling algorithm can
8934 be selected.
8935 The generated schedule respects all validity dependences.
8936 That is, all dependence distances over these dependences in the
8937 scheduled space are lexicographically positive.
8939 The default algorithm tries to ensure that the dependence distances
8940 over coincidence constraints are zero and to minimize the
8941 dependence distances over proximity dependences.
8942 Moreover, it tries to obtain sequences (bands) of schedule dimensions
8943 for groups of domains where the dependence distances over validity
8944 dependences have only non-negative values.
8945 Note that when minimizing the maximal dependence distance
8946 over proximity dependences, a single affine expression in the parameters
8947 is constructed that bounds all dependence distances.  If no such expression
8948 exists, then the algorithm will fail and resort to an alternative
8949 scheduling algorithm.  In particular, this means that adding proximity
8950 dependences may eliminate valid solutions.  A typical example where this
8951 phenomenon may occur is when some subset of the proximity dependences
8952 has no restriction on some parameter, forcing the coefficient of that
8953 parameter to be zero, while some other subset forces the dependence
8954 distance to depend on that parameter, requiring the same coefficient
8955 to be non-zero.
8956 When using Feautrier's algorithm, the coincidence and proximity constraints
8957 are only taken into account during the extension to a
8958 full-dimensional schedule.
8960 An C<isl_schedule_constraints> object can be constructed
8961 and manipulated using the following functions.
8963         #include <isl/schedule.h>
8964         __isl_give isl_schedule_constraints *
8965         isl_schedule_constraints_copy(
8966                 __isl_keep isl_schedule_constraints *sc);
8967         __isl_give isl_schedule_constraints *
8968         isl_schedule_constraints_on_domain(
8969                 __isl_take isl_union_set *domain);
8970         __isl_give isl_schedule_constraints *
8971         isl_schedule_constraints_set_context(
8972                 __isl_take isl_schedule_constraints *sc,
8973                 __isl_take isl_set *context);
8974         __isl_give isl_schedule_constraints *
8975         isl_schedule_constraints_set_validity(
8976                 __isl_take isl_schedule_constraints *sc,
8977                 __isl_take isl_union_map *validity);
8978         __isl_give isl_schedule_constraints *
8979         isl_schedule_constraints_set_coincidence(
8980                 __isl_take isl_schedule_constraints *sc,
8981                 __isl_take isl_union_map *coincidence);
8982         __isl_give isl_schedule_constraints *
8983         isl_schedule_constraints_set_proximity(
8984                 __isl_take isl_schedule_constraints *sc,
8985                 __isl_take isl_union_map *proximity);
8986         __isl_give isl_schedule_constraints *
8987         isl_schedule_constraints_set_conditional_validity(
8988                 __isl_take isl_schedule_constraints *sc,
8989                 __isl_take isl_union_map *condition,
8990                 __isl_take isl_union_map *validity);
8991         __isl_give isl_schedule_constraints *
8992         isl_schedule_constraints_apply(
8993                 __isl_take isl_schedule_constraints *sc,
8994                 __isl_take isl_union_map *umap);
8995         __isl_null isl_schedule_constraints *
8996         isl_schedule_constraints_free(
8997                 __isl_take isl_schedule_constraints *sc);
8999 The initial C<isl_schedule_constraints> object created by
9000 C<isl_schedule_constraints_on_domain> does not impose any constraints.
9001 That is, it has an empty set of dependences.
9002 The function C<isl_schedule_constraints_set_context> allows the user
9003 to specify additional constraints on the parameters that may
9004 be assumed to hold during the construction of the schedule.
9005 The function C<isl_schedule_constraints_set_validity> replaces the
9006 validity dependences, mapping domain elements I<i> to domain
9007 elements that should be scheduled after I<i>.
9008 The function C<isl_schedule_constraints_set_coincidence> replaces the
9009 coincidence dependences, mapping domain elements I<i> to domain
9010 elements that should be scheduled together with I<I>, if possible.
9011 The function C<isl_schedule_constraints_set_proximity> replaces the
9012 proximity dependences, mapping domain elements I<i> to domain
9013 elements that should be scheduled either before I<I>
9014 or as early as possible after I<i>.
9016 The function C<isl_schedule_constraints_set_conditional_validity>
9017 replaces the conditional validity constraints.
9018 A conditional validity constraint is only imposed when any of the corresponding
9019 conditions is satisfied, i.e., when any of them is non-zero.
9020 That is, the scheduler ensures that within each band if the dependence
9021 distances over the condition constraints are not all zero
9022 then all corresponding conditional validity constraints are respected.
9023 A conditional validity constraint corresponds to a condition
9024 if the two are adjacent, i.e., if the domain of one relation intersect
9025 the range of the other relation.
9026 The typical use case of conditional validity constraints is
9027 to allow order constraints between live ranges to be violated
9028 as long as the live ranges themselves are local to the band.
9029 To allow more fine-grained control over which conditions correspond
9030 to which conditional validity constraints, the domains and ranges
9031 of these relations may include I<tags>.  That is, the domains and
9032 ranges of those relation may themselves be wrapped relations
9033 where the iteration domain appears in the domain of those wrapped relations
9034 and the range of the wrapped relations can be arbitrarily chosen
9035 by the user.  Conditions and conditional validity constraints are only
9036 considered adjacent to each other if the entire wrapped relation matches.
9037 In particular, a relation with a tag will never be considered adjacent
9038 to a relation without a tag.
9040 The function C<isl_schedule_constraints_compute_schedule> takes
9041 schedule constraints that are defined on some set of domain elements
9042 and transforms them to schedule constraints on the elements
9043 to which these domain elements are mapped by the given transformation.
9045 An C<isl_schedule_constraints> object can be inspected
9046 using the following functions.
9048         #include <isl/schedule.h>
9049         __isl_give isl_union_set *
9050         isl_schedule_constraints_get_domain(
9051                 __isl_keep isl_schedule_constraints *sc);
9052         __isl_give isl_union_map *
9053         isl_schedule_constraints_get_validity(
9054                 __isl_keep isl_schedule_constraints *sc);
9055         __isl_give isl_union_map *
9056         isl_schedule_constraints_get_coincidence(
9057                 __isl_keep isl_schedule_constraints *sc);
9058         __isl_give isl_union_map *
9059         isl_schedule_constraints_get_proximity(
9060                 __isl_keep isl_schedule_constraints *sc);
9061         __isl_give isl_union_map *
9062         isl_schedule_constraints_get_conditional_validity(
9063                 __isl_keep isl_schedule_constraints *sc);
9064         __isl_give isl_union_map *
9065         isl_schedule_constraints_get_conditional_validity_condition(
9066                 __isl_keep isl_schedule_constraints *sc);
9068 The following function computes a schedule directly from
9069 an iteration domain and validity and proximity dependences
9070 and is implemented in terms of the functions described above.
9071 The use of C<isl_union_set_compute_schedule> is discouraged.
9073         #include <isl/schedule.h>
9074         __isl_give isl_schedule *isl_union_set_compute_schedule(
9075                 __isl_take isl_union_set *domain,
9076                 __isl_take isl_union_map *validity,
9077                 __isl_take isl_union_map *proximity);
9079 The generated schedule represents a schedule tree.
9080 For more information on schedule trees, see
9081 L</"Schedule Trees">.
9083 =head3 Options
9085         #include <isl/schedule.h>
9086         isl_stat isl_options_set_schedule_max_coefficient(
9087                 isl_ctx *ctx, int val);
9088         int isl_options_get_schedule_max_coefficient(
9089                 isl_ctx *ctx);
9090         isl_stat isl_options_set_schedule_max_constant_term(
9091                 isl_ctx *ctx, int val);
9092         int isl_options_get_schedule_max_constant_term(
9093                 isl_ctx *ctx);
9094         isl_stat isl_options_set_schedule_serialize_sccs(
9095                 isl_ctx *ctx, int val);
9096         int isl_options_get_schedule_serialize_sccs(isl_ctx *ctx);
9097         isl_stat isl_options_set_schedule_whole_component(
9098                 isl_ctx *ctx, int val);
9099         int isl_options_get_schedule_whole_component(
9100                 isl_ctx *ctx);
9101         isl_stat isl_options_set_schedule_maximize_band_depth(
9102                 isl_ctx *ctx, int val);
9103         int isl_options_get_schedule_maximize_band_depth(
9104                 isl_ctx *ctx);
9105         isl_stat isl_options_set_schedule_maximize_coincidence(
9106                 isl_ctx *ctx, int val);
9107         int isl_options_get_schedule_maximize_coincidence(
9108                 isl_ctx *ctx);
9109         isl_stat isl_options_set_schedule_outer_coincidence(
9110                 isl_ctx *ctx, int val);
9111         int isl_options_get_schedule_outer_coincidence(
9112                 isl_ctx *ctx);
9113         isl_stat isl_options_set_schedule_split_scaled(
9114                 isl_ctx *ctx, int val);
9115         int isl_options_get_schedule_split_scaled(
9116                 isl_ctx *ctx);
9117         isl_stat isl_options_set_schedule_treat_coalescing(
9118                 isl_ctx *ctx, int val);
9119         int isl_options_get_schedule_treat_coalescing(
9120                 isl_ctx *ctx);
9121         isl_stat isl_options_set_schedule_algorithm(
9122                 isl_ctx *ctx, int val);
9123         int isl_options_get_schedule_algorithm(
9124                 isl_ctx *ctx);
9125         isl_stat isl_options_set_schedule_separate_components(
9126                 isl_ctx *ctx, int val);
9127         int isl_options_get_schedule_separate_components(
9128                 isl_ctx *ctx);
9130 =over
9132 =item * schedule_max_coefficient
9134 This option enforces that the coefficients for variable and parameter
9135 dimensions in the calculated schedule are not larger than the specified value.
9136 This option can significantly increase the speed of the scheduling calculation
9137 and may also prevent fusing of unrelated dimensions. A value of -1 means that
9138 this option does not introduce bounds on the variable or parameter
9139 coefficients.
9141 =item * schedule_max_constant_term
9143 This option enforces that the constant coefficients in the calculated schedule
9144 are not larger than the maximal constant term. This option can significantly
9145 increase the speed of the scheduling calculation and may also prevent fusing of
9146 unrelated dimensions. A value of -1 means that this option does not introduce
9147 bounds on the constant coefficients.
9149 =item * schedule_serialize_sccs
9151 If this option is set, then all strongly connected components
9152 in the dependence graph are serialized as soon as they are detected.
9153 This means in particular that instances of statements will only
9154 appear in the same band node if these statements belong
9155 to the same strongly connected component at the point where
9156 the band node is constructed.
9158 =item * schedule_whole_component
9160 If this option is set, then entire (weakly) connected
9161 components in the dependence graph are scheduled together
9162 as a whole.
9163 Otherwise, each strongly connected component within
9164 such a weakly connected component is first scheduled separately
9165 and then combined with other strongly connected components.
9166 This option has no effect if C<schedule_serialize_sccs> is set.
9168 =item * schedule_maximize_band_depth
9170 If this option is set, then the scheduler tries to maximize
9171 the width of the bands.  Wider bands give more possibilities for tiling.
9172 In particular, if the C<schedule_whole_component> option is set,
9173 then bands are split if this might result in wider bands.
9174 Otherwise, the effect of this option is to only allow
9175 strongly connected components to be combined if this does
9176 not reduce the width of the bands.
9177 Note that if the C<schedule_serialize_sccs> options is set, then
9178 the C<schedule_maximize_band_depth> option therefore has no effect.
9180 =item * schedule_maximize_coincidence
9182 This option is only effective if the C<schedule_whole_component>
9183 option is turned off.
9184 If the C<schedule_maximize_coincidence> option is set, then (clusters of)
9185 strongly connected components are only combined with each other
9186 if this does not reduce the number of coincident band members.
9188 =item * schedule_outer_coincidence
9190 If this option is set, then we try to construct schedules
9191 where the outermost scheduling dimension in each band
9192 satisfies the coincidence constraints.
9194 =item * schedule_algorithm
9196 Selects the scheduling algorithm to be used.
9197 Available scheduling algorithms are C<ISL_SCHEDULE_ALGORITHM_ISL>
9198 and C<ISL_SCHEDULE_ALGORITHM_FEAUTRIER>.
9200 =item * schedule_split_scaled
9202 If this option is set, then we try to construct schedules in which the
9203 constant term is split off from the linear part if the linear parts of
9204 the scheduling rows for all nodes in the graphs have a common non-trivial
9205 divisor.
9206 The constant term is then placed in a separate band and the linear
9207 part is reduced.
9208 This option is only effective when the Feautrier style scheduler is
9209 being used, either as the main scheduler or as a fallback for the
9210 Pluto-like scheduler.
9212 =item * schedule_treat_coalescing
9214 If this option is set, then the scheduler will try and avoid
9215 producing schedules that perform loop coalescing.
9216 In particular, for the Pluto-like scheduler, this option places
9217 bounds on the schedule coefficients based on the sizes of the instance sets.
9218 For the Feautrier style scheduler, this option detects potentially
9219 coalescing schedules and then tries to adjust the schedule to avoid
9220 the coalescing.
9222 =item * schedule_separate_components
9224 If this option is set then the function C<isl_schedule_get_map>
9225 will treat set nodes in the same way as sequence nodes.
9227 =back
9229 =head2 AST Generation
9231 This section describes the C<isl> functionality for generating
9232 ASTs that visit all the elements
9233 in a domain in an order specified by a schedule tree or
9234 a schedule map.
9235 In case the schedule given as a C<isl_union_map>, an AST is generated
9236 that visits all the elements in the domain of the C<isl_union_map>
9237 according to the lexicographic order of the corresponding image
9238 element(s).  If the range of the C<isl_union_map> consists of
9239 elements in more than one space, then each of these spaces is handled
9240 separately in an arbitrary order.
9241 It should be noted that the schedule tree or the image elements
9242 in a schedule map only specify the I<order>
9243 in which the corresponding domain elements should be visited.
9244 No direct relation between the partial schedule values
9245 or the image elements on the one hand and the loop iterators
9246 in the generated AST on the other hand should be assumed.
9248 Each AST is generated within a build.  The initial build
9249 simply specifies the constraints on the parameters (if any)
9250 and can be created, inspected, copied and freed using the following functions.
9252         #include <isl/ast_build.h>
9253         __isl_give isl_ast_build *isl_ast_build_alloc(
9254                 isl_ctx *ctx);
9255         __isl_give isl_ast_build *isl_ast_build_from_context(
9256                 __isl_take isl_set *set);
9257         __isl_give isl_ast_build *isl_ast_build_copy(
9258                 __isl_keep isl_ast_build *build);
9259         __isl_null isl_ast_build *isl_ast_build_free(
9260                 __isl_take isl_ast_build *build);
9262 The C<set> argument is usually a parameter set with zero or more parameters.
9263 In fact, when creating an AST using C<isl_ast_build_node_from_schedule>,
9264 this set is required to be a parameter set.
9265 An C<isl_ast_build> created using C<isl_ast_build_alloc> does not
9266 specify any parameter constraints.
9267 More C<isl_ast_build> functions are described in L</"Nested AST Generation">
9268 and L</"Fine-grained Control over AST Generation">.
9269 Finally, the AST itself can be constructed using one of the following
9270 functions.
9272         #include <isl/ast_build.h>
9273         __isl_give isl_ast_node *isl_ast_build_node_from_schedule(
9274                 __isl_keep isl_ast_build *build,
9275                 __isl_take isl_schedule *schedule);
9276         __isl_give isl_ast_node *
9277         isl_ast_build_node_from_schedule_map(
9278                 __isl_keep isl_ast_build *build,
9279                 __isl_take isl_union_map *schedule);
9281 =head3 Inspecting the AST
9283 The basic properties of an AST node can be obtained as follows.
9285         #include <isl/ast.h>
9286         enum isl_ast_node_type isl_ast_node_get_type(
9287                 __isl_keep isl_ast_node *node);
9289 The type of an AST node is one of
9290 C<isl_ast_node_for>,
9291 C<isl_ast_node_if>,
9292 C<isl_ast_node_block>,
9293 C<isl_ast_node_mark> or
9294 C<isl_ast_node_user>.
9295 An C<isl_ast_node_for> represents a for node.
9296 An C<isl_ast_node_if> represents an if node.
9297 An C<isl_ast_node_block> represents a compound node.
9298 An C<isl_ast_node_mark> introduces a mark in the AST.
9299 An C<isl_ast_node_user> represents an expression statement.
9300 An expression statement typically corresponds to a domain element, i.e.,
9301 one of the elements that is visited by the AST.
9303 Each type of node has its own additional properties.
9305         #include <isl/ast.h>
9306         __isl_give isl_ast_expr *isl_ast_node_for_get_iterator(
9307                 __isl_keep isl_ast_node *node);
9308         __isl_give isl_ast_expr *isl_ast_node_for_get_init(
9309                 __isl_keep isl_ast_node *node);
9310         __isl_give isl_ast_expr *isl_ast_node_for_get_cond(
9311                 __isl_keep isl_ast_node *node);
9312         __isl_give isl_ast_expr *isl_ast_node_for_get_inc(
9313                 __isl_keep isl_ast_node *node);
9314         __isl_give isl_ast_node *isl_ast_node_for_get_body(
9315                 __isl_keep isl_ast_node *node);
9316         isl_bool isl_ast_node_for_is_degenerate(
9317                 __isl_keep isl_ast_node *node);
9319 An C<isl_ast_for> is considered degenerate if it is known to execute
9320 exactly once.
9322         #include <isl/ast.h>
9323         __isl_give isl_ast_expr *isl_ast_node_if_get_cond(
9324                 __isl_keep isl_ast_node *node);
9325         __isl_give isl_ast_node *isl_ast_node_if_get_then(
9326                 __isl_keep isl_ast_node *node);
9327         isl_bool isl_ast_node_if_has_else(
9328                 __isl_keep isl_ast_node *node);
9329         __isl_give isl_ast_node *isl_ast_node_if_get_else(
9330                 __isl_keep isl_ast_node *node);
9332         __isl_give isl_ast_node_list *
9333         isl_ast_node_block_get_children(
9334                 __isl_keep isl_ast_node *node);
9336         __isl_give isl_id *isl_ast_node_mark_get_id(
9337                 __isl_keep isl_ast_node *node);
9338         __isl_give isl_ast_node *isl_ast_node_mark_get_node(
9339                 __isl_keep isl_ast_node *node);
9341 C<isl_ast_node_mark_get_id> returns the identifier of the mark.
9342 C<isl_ast_node_mark_get_node> returns the child node that is being marked.
9344         #include <isl/ast.h>
9345         __isl_give isl_ast_expr *isl_ast_node_user_get_expr(
9346                 __isl_keep isl_ast_node *node);
9348 All descendants of a specific node in the AST (including the node itself)
9349 can be visited
9350 in depth-first pre-order using the following function.
9352         #include <isl/ast.h>
9353         isl_stat isl_ast_node_foreach_descendant_top_down(
9354                 __isl_keep isl_ast_node *node,
9355                 isl_bool (*fn)(__isl_keep isl_ast_node *node,
9356                         void *user), void *user);
9358 The callback function should return C<isl_bool_true> if the children
9359 of the given node should be visited and C<isl_bool_false> if they should not.
9360 It should return C<isl_bool_error> in case of failure, in which case
9361 the entire traversal is aborted.
9363 Each of the returned C<isl_ast_expr>s can in turn be inspected using
9364 the following functions.
9366         #include <isl/ast.h>
9367         enum isl_ast_expr_type isl_ast_expr_get_type(
9368                 __isl_keep isl_ast_expr *expr);
9370 The type of an AST expression is one of
9371 C<isl_ast_expr_op>,
9372 C<isl_ast_expr_id> or
9373 C<isl_ast_expr_int>.
9374 An C<isl_ast_expr_op> represents the result of an operation.
9375 An C<isl_ast_expr_id> represents an identifier.
9376 An C<isl_ast_expr_int> represents an integer value.
9378 Each type of expression has its own additional properties.
9380         #include <isl/ast.h>
9381         enum isl_ast_op_type isl_ast_expr_get_op_type(
9382                 __isl_keep isl_ast_expr *expr);
9383         int isl_ast_expr_get_op_n_arg(__isl_keep isl_ast_expr *expr);
9384         __isl_give isl_ast_expr *isl_ast_expr_get_op_arg(
9385                 __isl_keep isl_ast_expr *expr, int pos);
9386         isl_stat isl_ast_expr_foreach_ast_op_type(
9387                 __isl_keep isl_ast_expr *expr,
9388                 isl_stat (*fn)(enum isl_ast_op_type type,
9389                         void *user), void *user);
9390         isl_stat isl_ast_node_foreach_ast_op_type(
9391                 __isl_keep isl_ast_node *node,
9392                 isl_stat (*fn)(enum isl_ast_op_type type,
9393                         void *user), void *user);
9395 C<isl_ast_expr_get_op_type> returns the type of the operation
9396 performed.  C<isl_ast_expr_get_op_n_arg> returns the number of
9397 arguments.  C<isl_ast_expr_get_op_arg> returns the specified
9398 argument.
9399 C<isl_ast_expr_foreach_ast_op_type> calls C<fn> for each distinct
9400 C<isl_ast_op_type> that appears in C<expr>.
9401 C<isl_ast_node_foreach_ast_op_type> does the same for each distinct
9402 C<isl_ast_op_type> that appears in C<node>.
9403 The operation type is one of the following.
9405 =over
9407 =item C<isl_ast_op_and>
9409 Logical I<and> of two arguments.
9410 Both arguments can be evaluated.
9412 =item C<isl_ast_op_and_then>
9414 Logical I<and> of two arguments.
9415 The second argument can only be evaluated if the first evaluates to true.
9417 =item C<isl_ast_op_or>
9419 Logical I<or> of two arguments.
9420 Both arguments can be evaluated.
9422 =item C<isl_ast_op_or_else>
9424 Logical I<or> of two arguments.
9425 The second argument can only be evaluated if the first evaluates to false.
9427 =item C<isl_ast_op_max>
9429 Maximum of two or more arguments.
9431 =item C<isl_ast_op_min>
9433 Minimum of two or more arguments.
9435 =item C<isl_ast_op_minus>
9437 Change sign.
9439 =item C<isl_ast_op_add>
9441 Sum of two arguments.
9443 =item C<isl_ast_op_sub>
9445 Difference of two arguments.
9447 =item C<isl_ast_op_mul>
9449 Product of two arguments.
9451 =item C<isl_ast_op_div>
9453 Exact division.  That is, the result is known to be an integer.
9455 =item C<isl_ast_op_fdiv_q>
9457 Result of integer division, rounded towards negative
9458 infinity.
9460 =item C<isl_ast_op_pdiv_q>
9462 Result of integer division, where dividend is known to be non-negative.
9464 =item C<isl_ast_op_pdiv_r>
9466 Remainder of integer division, where dividend is known to be non-negative.
9468 =item C<isl_ast_op_zdiv_r>
9470 Equal to zero iff the remainder on integer division is zero.
9472 =item C<isl_ast_op_cond>
9474 Conditional operator defined on three arguments.
9475 If the first argument evaluates to true, then the result
9476 is equal to the second argument.  Otherwise, the result
9477 is equal to the third argument.
9478 The second and third argument may only be evaluated if
9479 the first argument evaluates to true and false, respectively.
9480 Corresponds to C<a ? b : c> in C.
9482 =item C<isl_ast_op_select>
9484 Conditional operator defined on three arguments.
9485 If the first argument evaluates to true, then the result
9486 is equal to the second argument.  Otherwise, the result
9487 is equal to the third argument.
9488 The second and third argument may be evaluated independently
9489 of the value of the first argument.
9490 Corresponds to C<a * b + (1 - a) * c> in C.
9492 =item C<isl_ast_op_eq>
9494 Equality relation.
9496 =item C<isl_ast_op_le>
9498 Less than or equal relation.
9500 =item C<isl_ast_op_lt>
9502 Less than relation.
9504 =item C<isl_ast_op_ge>
9506 Greater than or equal relation.
9508 =item C<isl_ast_op_gt>
9510 Greater than relation.
9512 =item C<isl_ast_op_call>
9514 A function call.
9515 The number of arguments of the C<isl_ast_expr> is one more than
9516 the number of arguments in the function call, the first argument
9517 representing the function being called.
9519 =item C<isl_ast_op_access>
9521 An array access.
9522 The number of arguments of the C<isl_ast_expr> is one more than
9523 the number of index expressions in the array access, the first argument
9524 representing the array being accessed.
9526 =item C<isl_ast_op_member>
9528 A member access.
9529 This operation has two arguments, a structure and the name of
9530 the member of the structure being accessed.
9532 =back
9534         #include <isl/ast.h>
9535         __isl_give isl_id *isl_ast_expr_get_id(
9536                 __isl_keep isl_ast_expr *expr);
9538 Return the identifier represented by the AST expression.
9540         #include <isl/ast.h>
9541         __isl_give isl_val *isl_ast_expr_get_val(
9542                 __isl_keep isl_ast_expr *expr);
9544 Return the integer represented by the AST expression.
9546 =head3 Properties of ASTs
9548         #include <isl/ast.h>
9549         isl_bool isl_ast_expr_is_equal(
9550                 __isl_keep isl_ast_expr *expr1,
9551                 __isl_keep isl_ast_expr *expr2);
9553 Check if two C<isl_ast_expr>s are equal to each other.
9555 =head3 Manipulating and printing the AST
9557 AST nodes can be copied and freed using the following functions.
9559         #include <isl/ast.h>
9560         __isl_give isl_ast_node *isl_ast_node_copy(
9561                 __isl_keep isl_ast_node *node);
9562         __isl_null isl_ast_node *isl_ast_node_free(
9563                 __isl_take isl_ast_node *node);
9565 AST expressions can be copied and freed using the following functions.
9567         #include <isl/ast.h>
9568         __isl_give isl_ast_expr *isl_ast_expr_copy(
9569                 __isl_keep isl_ast_expr *expr);
9570         __isl_null isl_ast_expr *isl_ast_expr_free(
9571                 __isl_take isl_ast_expr *expr);
9573 New AST expressions can be created either directly or within
9574 the context of an C<isl_ast_build>.
9576         #include <isl/ast.h>
9577         __isl_give isl_ast_expr *isl_ast_expr_from_val(
9578                 __isl_take isl_val *v);
9579         __isl_give isl_ast_expr *isl_ast_expr_from_id(
9580                 __isl_take isl_id *id);
9581         __isl_give isl_ast_expr *isl_ast_expr_neg(
9582                 __isl_take isl_ast_expr *expr);
9583         __isl_give isl_ast_expr *isl_ast_expr_address_of(
9584                 __isl_take isl_ast_expr *expr);
9585         __isl_give isl_ast_expr *isl_ast_expr_add(
9586                 __isl_take isl_ast_expr *expr1,
9587                 __isl_take isl_ast_expr *expr2);
9588         __isl_give isl_ast_expr *isl_ast_expr_sub(
9589                 __isl_take isl_ast_expr *expr1,
9590                 __isl_take isl_ast_expr *expr2);
9591         __isl_give isl_ast_expr *isl_ast_expr_mul(
9592                 __isl_take isl_ast_expr *expr1,
9593                 __isl_take isl_ast_expr *expr2);
9594         __isl_give isl_ast_expr *isl_ast_expr_div(
9595                 __isl_take isl_ast_expr *expr1,
9596                 __isl_take isl_ast_expr *expr2);
9597         __isl_give isl_ast_expr *isl_ast_expr_pdiv_q(
9598                 __isl_take isl_ast_expr *expr1,
9599                 __isl_take isl_ast_expr *expr2);
9600         __isl_give isl_ast_expr *isl_ast_expr_pdiv_r(
9601                 __isl_take isl_ast_expr *expr1,
9602                 __isl_take isl_ast_expr *expr2);
9603         __isl_give isl_ast_expr *isl_ast_expr_and(
9604                 __isl_take isl_ast_expr *expr1,
9605                 __isl_take isl_ast_expr *expr2)
9606         __isl_give isl_ast_expr *isl_ast_expr_and_then(
9607                 __isl_take isl_ast_expr *expr1,
9608                 __isl_take isl_ast_expr *expr2)
9609         __isl_give isl_ast_expr *isl_ast_expr_or(
9610                 __isl_take isl_ast_expr *expr1,
9611                 __isl_take isl_ast_expr *expr2)
9612         __isl_give isl_ast_expr *isl_ast_expr_or_else(
9613                 __isl_take isl_ast_expr *expr1,
9614                 __isl_take isl_ast_expr *expr2)
9615         __isl_give isl_ast_expr *isl_ast_expr_eq(
9616                 __isl_take isl_ast_expr *expr1,
9617                 __isl_take isl_ast_expr *expr2);
9618         __isl_give isl_ast_expr *isl_ast_expr_le(
9619                 __isl_take isl_ast_expr *expr1,
9620                 __isl_take isl_ast_expr *expr2);
9621         __isl_give isl_ast_expr *isl_ast_expr_lt(
9622                 __isl_take isl_ast_expr *expr1,
9623                 __isl_take isl_ast_expr *expr2);
9624         __isl_give isl_ast_expr *isl_ast_expr_ge(
9625                 __isl_take isl_ast_expr *expr1,
9626                 __isl_take isl_ast_expr *expr2);
9627         __isl_give isl_ast_expr *isl_ast_expr_gt(
9628                 __isl_take isl_ast_expr *expr1,
9629                 __isl_take isl_ast_expr *expr2);
9630         __isl_give isl_ast_expr *isl_ast_expr_access(
9631                 __isl_take isl_ast_expr *array,
9632                 __isl_take isl_ast_expr_list *indices);
9633         __isl_give isl_ast_expr *isl_ast_expr_call(
9634                 __isl_take isl_ast_expr *function,
9635                 __isl_take isl_ast_expr_list *arguments);
9637 The function C<isl_ast_expr_address_of> can be applied to an
9638 C<isl_ast_expr> of type C<isl_ast_op_access> only. It is meant
9639 to represent the address of the C<isl_ast_expr_access>. The function
9640 C<isl_ast_expr_and_then> as well as C<isl_ast_expr_or_else> are short-circuit
9641 versions of C<isl_ast_expr_and> and C<isl_ast_expr_or>, respectively.
9643         #include <isl/ast_build.h>
9644         __isl_give isl_ast_expr *isl_ast_build_expr_from_set(
9645                 __isl_keep isl_ast_build *build,
9646                 __isl_take isl_set *set);
9647         __isl_give isl_ast_expr *isl_ast_build_expr_from_pw_aff(
9648                 __isl_keep isl_ast_build *build,
9649                 __isl_take isl_pw_aff *pa);
9650         __isl_give isl_ast_expr *
9651         isl_ast_build_access_from_pw_multi_aff(
9652                 __isl_keep isl_ast_build *build,
9653                 __isl_take isl_pw_multi_aff *pma);
9654         __isl_give isl_ast_expr *
9655         isl_ast_build_access_from_multi_pw_aff(
9656                 __isl_keep isl_ast_build *build,
9657                 __isl_take isl_multi_pw_aff *mpa);
9658         __isl_give isl_ast_expr *
9659         isl_ast_build_call_from_pw_multi_aff(
9660                 __isl_keep isl_ast_build *build,
9661                 __isl_take isl_pw_multi_aff *pma);
9662         __isl_give isl_ast_expr *
9663         isl_ast_build_call_from_multi_pw_aff(
9664                 __isl_keep isl_ast_build *build,
9665                 __isl_take isl_multi_pw_aff *mpa);
9667 The set <set> and
9668 the domains of C<pa>, C<mpa> and C<pma> should correspond
9669 to the schedule space of C<build>.
9670 The tuple id of C<mpa> or C<pma> is used as the array being accessed or
9671 the function being called.
9672 If the accessed space is a nested relation, then it is taken
9673 to represent an access of the member specified by the range
9674 of this nested relation of the structure specified by the domain
9675 of the nested relation.
9677 The following functions can be used to modify an C<isl_ast_expr>.
9679         #include <isl/ast.h>
9680         __isl_give isl_ast_expr *isl_ast_expr_set_op_arg(
9681                 __isl_take isl_ast_expr *expr, int pos,
9682                 __isl_take isl_ast_expr *arg);
9684 Replace the argument of C<expr> at position C<pos> by C<arg>.
9686         #include <isl/ast.h>
9687         __isl_give isl_ast_expr *isl_ast_expr_substitute_ids(
9688                 __isl_take isl_ast_expr *expr,
9689                 __isl_take isl_id_to_ast_expr *id2expr);
9691 The function C<isl_ast_expr_substitute_ids> replaces the
9692 subexpressions of C<expr> of type C<isl_ast_expr_id>
9693 by the corresponding expression in C<id2expr>, if there is any.
9696 User specified data can be attached to an C<isl_ast_node> and obtained
9697 from the same C<isl_ast_node> using the following functions.
9699         #include <isl/ast.h>
9700         __isl_give isl_ast_node *isl_ast_node_set_annotation(
9701                 __isl_take isl_ast_node *node,
9702                 __isl_take isl_id *annotation);
9703         __isl_give isl_id *isl_ast_node_get_annotation(
9704                 __isl_keep isl_ast_node *node);
9706 Basic printing can be performed using the following functions.
9708         #include <isl/ast.h>
9709         __isl_give isl_printer *isl_printer_print_ast_expr(
9710                 __isl_take isl_printer *p,
9711                 __isl_keep isl_ast_expr *expr);
9712         __isl_give isl_printer *isl_printer_print_ast_node(
9713                 __isl_take isl_printer *p,
9714                 __isl_keep isl_ast_node *node);
9715         __isl_give char *isl_ast_expr_to_str(
9716                 __isl_keep isl_ast_expr *expr);
9717         __isl_give char *isl_ast_expr_to_C_str(
9718                 __isl_keep isl_ast_expr *expr);
9719         __isl_give char *isl_ast_node_to_C_str(
9720                 __isl_keep isl_ast_node *node);
9722 The functions C<isl_ast_expr_to_C_str> and
9723 C<isl_ast_node_to_C_str> are convenience functions
9724 that return a string representation of the input in C format.
9726 More advanced printing can be performed using the following functions.
9728         #include <isl/ast.h>
9729         __isl_give isl_printer *isl_ast_op_type_set_print_name(
9730                 __isl_take isl_printer *p,
9731                 enum isl_ast_op_type type,
9732                 __isl_keep const char *name);
9733         isl_stat isl_options_set_ast_print_macro_once(
9734                 isl_ctx *ctx, int val);
9735         int isl_options_get_ast_print_macro_once(isl_ctx *ctx);
9736         __isl_give isl_printer *isl_ast_op_type_print_macro(
9737                 enum isl_ast_op_type type,
9738                 __isl_take isl_printer *p);
9739         __isl_give isl_printer *isl_ast_expr_print_macros(
9740                 __isl_keep isl_ast_expr *expr,
9741                 __isl_take isl_printer *p);
9742         __isl_give isl_printer *isl_ast_node_print_macros(
9743                 __isl_keep isl_ast_node *node,
9744                 __isl_take isl_printer *p);
9745         __isl_give isl_printer *isl_ast_node_print(
9746                 __isl_keep isl_ast_node *node,
9747                 __isl_take isl_printer *p,
9748                 __isl_take isl_ast_print_options *options);
9749         __isl_give isl_printer *isl_ast_node_for_print(
9750                 __isl_keep isl_ast_node *node,
9751                 __isl_take isl_printer *p,
9752                 __isl_take isl_ast_print_options *options);
9753         __isl_give isl_printer *isl_ast_node_if_print(
9754                 __isl_keep isl_ast_node *node,
9755                 __isl_take isl_printer *p,
9756                 __isl_take isl_ast_print_options *options);
9758 While printing an C<isl_ast_node> in C<ISL_FORMAT_C>,
9759 C<isl> may print out an AST that makes use of macros such
9760 as C<floord>, C<min> and C<max>.
9761 The names of these macros may be modified by a call
9762 to C<isl_ast_op_type_set_print_name>.  The user-specified
9763 names are associated to the printer object.
9764 C<isl_ast_op_type_print_macro> prints out the macro
9765 corresponding to a specific C<isl_ast_op_type>.
9766 If the print-macro-once option is set, then a given macro definition
9767 is only printed once to any given printer object.
9768 C<isl_ast_expr_print_macros> scans the C<isl_ast_expr>
9769 for subexpressions where these macros would be used and prints
9770 out the required macro definitions.
9771 Essentially, C<isl_ast_expr_print_macros> calls
9772 C<isl_ast_expr_foreach_ast_op_type> with C<isl_ast_op_type_print_macro>
9773 as function argument.
9774 C<isl_ast_node_print_macros> does the same
9775 for expressions in its C<isl_ast_node> argument.
9776 C<isl_ast_node_print>, C<isl_ast_node_for_print> and
9777 C<isl_ast_node_if_print> print an C<isl_ast_node>
9778 in C<ISL_FORMAT_C>, but allow for some extra control
9779 through an C<isl_ast_print_options> object.
9780 This object can be created using the following functions.
9782         #include <isl/ast.h>
9783         __isl_give isl_ast_print_options *
9784         isl_ast_print_options_alloc(isl_ctx *ctx);
9785         __isl_give isl_ast_print_options *
9786         isl_ast_print_options_copy(
9787                 __isl_keep isl_ast_print_options *options);
9788         __isl_null isl_ast_print_options *
9789         isl_ast_print_options_free(
9790                 __isl_take isl_ast_print_options *options);
9792         __isl_give isl_ast_print_options *
9793         isl_ast_print_options_set_print_user(
9794                 __isl_take isl_ast_print_options *options,
9795                 __isl_give isl_printer *(*print_user)(
9796                         __isl_take isl_printer *p,
9797                         __isl_take isl_ast_print_options *options,
9798                         __isl_keep isl_ast_node *node, void *user),
9799                 void *user);
9800         __isl_give isl_ast_print_options *
9801         isl_ast_print_options_set_print_for(
9802                 __isl_take isl_ast_print_options *options,
9803                 __isl_give isl_printer *(*print_for)(
9804                         __isl_take isl_printer *p,
9805                         __isl_take isl_ast_print_options *options,
9806                         __isl_keep isl_ast_node *node, void *user),
9807                 void *user);
9809 The callback set by C<isl_ast_print_options_set_print_user>
9810 is called whenever a node of type C<isl_ast_node_user> needs to
9811 be printed.
9812 The callback set by C<isl_ast_print_options_set_print_for>
9813 is called whenever a node of type C<isl_ast_node_for> needs to
9814 be printed.
9815 Note that C<isl_ast_node_for_print> will I<not> call the
9816 callback set by C<isl_ast_print_options_set_print_for> on the node
9817 on which C<isl_ast_node_for_print> is called, but only on nested
9818 nodes of type C<isl_ast_node_for>.  It is therefore safe to
9819 call C<isl_ast_node_for_print> from within the callback set by
9820 C<isl_ast_print_options_set_print_for>.
9822 The following option determines the type to be used for iterators
9823 while printing the AST.
9825         isl_stat isl_options_set_ast_iterator_type(
9826                 isl_ctx *ctx, const char *val);
9827         const char *isl_options_get_ast_iterator_type(
9828                 isl_ctx *ctx);
9830 The AST printer only prints body nodes as blocks if these
9831 blocks cannot be safely omitted.
9832 For example, a C<for> node with one body node will not be
9833 surrounded with braces in C<ISL_FORMAT_C>.
9834 A block will always be printed by setting the following option.
9836         isl_stat isl_options_set_ast_always_print_block(isl_ctx *ctx,
9837                 int val);
9838         int isl_options_get_ast_always_print_block(isl_ctx *ctx);
9840 =head3 Options
9842         #include <isl/ast_build.h>
9843         isl_stat isl_options_set_ast_build_atomic_upper_bound(
9844                 isl_ctx *ctx, int val);
9845         int isl_options_get_ast_build_atomic_upper_bound(
9846                 isl_ctx *ctx);
9847         isl_stat isl_options_set_ast_build_prefer_pdiv(isl_ctx *ctx,
9848                 int val);
9849         int isl_options_get_ast_build_prefer_pdiv(isl_ctx *ctx);
9850         isl_stat isl_options_set_ast_build_detect_min_max(
9851                 isl_ctx *ctx, int val);
9852         int isl_options_get_ast_build_detect_min_max(
9853                 isl_ctx *ctx);
9854         isl_stat isl_options_set_ast_build_exploit_nested_bounds(
9855                 isl_ctx *ctx, int val);
9856         int isl_options_get_ast_build_exploit_nested_bounds(
9857                 isl_ctx *ctx);
9858         isl_stat isl_options_set_ast_build_group_coscheduled(
9859                 isl_ctx *ctx, int val);
9860         int isl_options_get_ast_build_group_coscheduled(
9861                 isl_ctx *ctx);
9862         isl_stat isl_options_set_ast_build_scale_strides(
9863                 isl_ctx *ctx, int val);
9864         int isl_options_get_ast_build_scale_strides(
9865                 isl_ctx *ctx);
9866         isl_stat isl_options_set_ast_build_allow_else(isl_ctx *ctx,
9867                 int val);
9868         int isl_options_get_ast_build_allow_else(isl_ctx *ctx);
9869         isl_stat isl_options_set_ast_build_allow_or(isl_ctx *ctx,
9870                 int val);
9871         int isl_options_get_ast_build_allow_or(isl_ctx *ctx);
9873 =over
9875 =item * ast_build_atomic_upper_bound
9877 Generate loop upper bounds that consist of the current loop iterator,
9878 an operator and an expression not involving the iterator.
9879 If this option is not set, then the current loop iterator may appear
9880 several times in the upper bound.
9881 For example, when this option is turned off, AST generation
9882 for the schedule
9884         [n] -> { A[i] -> [i] : 0 <= i <= 100, n }
9886 produces
9888         for (int c0 = 0; c0 <= 100 && n >= c0; c0 += 1)
9889           A(c0);
9891 When the option is turned on, the following AST is generated
9893         for (int c0 = 0; c0 <= min(100, n); c0 += 1)
9894           A(c0);
9896 =item * ast_build_prefer_pdiv
9898 If this option is turned off, then the AST generation will
9899 produce ASTs that may only contain C<isl_ast_op_fdiv_q>
9900 operators, but no C<isl_ast_op_pdiv_q> or
9901 C<isl_ast_op_pdiv_r> operators.
9902 If this option is turned on, then C<isl> will try to convert
9903 some of the C<isl_ast_op_fdiv_q> operators to (expressions containing)
9904 C<isl_ast_op_pdiv_q> or C<isl_ast_op_pdiv_r> operators.
9906 =item * ast_build_detect_min_max
9908 If this option is turned on, then C<isl> will try and detect
9909 min or max-expressions when building AST expressions from
9910 piecewise affine expressions.
9912 =item * ast_build_exploit_nested_bounds
9914 Simplify conditions based on bounds of nested for loops.
9915 In particular, remove conditions that are implied by the fact
9916 that one or more nested loops have at least one iteration,
9917 meaning that the upper bound is at least as large as the lower bound.
9918 For example, when this option is turned off, AST generation
9919 for the schedule
9921         [N,M] -> { A[i,j] -> [i,j] : 0 <= i <= N and
9922                                         0 <= j <= M }
9924 produces
9926         if (M >= 0)
9927           for (int c0 = 0; c0 <= N; c0 += 1)
9928             for (int c1 = 0; c1 <= M; c1 += 1)
9929               A(c0, c1);
9931 When the option is turned on, the following AST is generated
9933         for (int c0 = 0; c0 <= N; c0 += 1)
9934           for (int c1 = 0; c1 <= M; c1 += 1)
9935             A(c0, c1);
9937 =item * ast_build_group_coscheduled
9939 If two domain elements are assigned the same schedule point, then
9940 they may be executed in any order and they may even appear in different
9941 loops.  If this options is set, then the AST generator will make
9942 sure that coscheduled domain elements do not appear in separate parts
9943 of the AST.  This is useful in case of nested AST generation
9944 if the outer AST generation is given only part of a schedule
9945 and the inner AST generation should handle the domains that are
9946 coscheduled by this initial part of the schedule together.
9947 For example if an AST is generated for a schedule
9949         { A[i] -> [0]; B[i] -> [0] }
9951 then the C<isl_ast_build_set_create_leaf> callback described
9952 below may get called twice, once for each domain.
9953 Setting this option ensures that the callback is only called once
9954 on both domains together.
9956 =item * ast_build_separation_bounds
9958 This option specifies which bounds to use during separation.
9959 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_IMPLICIT>
9960 then all (possibly implicit) bounds on the current dimension will
9961 be used during separation.
9962 If this option is set to C<ISL_AST_BUILD_SEPARATION_BOUNDS_EXPLICIT>
9963 then only those bounds that are explicitly available will
9964 be used during separation.
9966 =item * ast_build_scale_strides
9968 This option specifies whether the AST generator is allowed
9969 to scale down iterators of strided loops.
9971 =item * ast_build_allow_else
9973 This option specifies whether the AST generator is allowed
9974 to construct if statements with else branches.
9976 =item * ast_build_allow_or
9978 This option specifies whether the AST generator is allowed
9979 to construct if conditions with disjunctions.
9981 =back
9983 =head3 AST Generation Options (Schedule Tree)
9985 In case of AST construction from a schedule tree, the options
9986 that control how an AST is created from the individual schedule
9987 dimensions are stored in the band nodes of the tree
9988 (see L</"Schedule Trees">).
9990 In particular, a schedule dimension can be handled in four
9991 different ways, atomic, separate, unroll or the default.
9992 This loop AST generation type can be set using
9993 C<isl_schedule_node_band_member_set_ast_loop_type>.
9994 Alternatively,
9995 the first three can be selected by including a one-dimensional
9996 element with as value the position of the schedule dimension
9997 within the band and as name one of C<atomic>, C<separate>
9998 or C<unroll> in the options
9999 set by C<isl_schedule_node_band_set_ast_build_options>.
10000 Only one of these three may be specified for
10001 any given schedule dimension within a band node.
10002 If none of these is specified, then the default
10003 is used.  The meaning of the options is as follows.
10005 =over
10007 =item C<atomic>
10009 When this option is specified, the AST generator will make
10010 sure that a given domains space only appears in a single
10011 loop at the specified level.
10013 For example, for the schedule tree
10015         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10016         child:
10017           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10018           options: "{ atomic[x] }"
10020 the following AST will be generated
10022         for (int c0 = 0; c0 <= 10; c0 += 1) {
10023           if (c0 >= 1)
10024             b(c0 - 1);
10025           if (c0 <= 9)
10026             a(c0);
10027         }
10029 On the other hand, for the schedule tree
10031         domain: "{ a[i] : 0 <= i < 10; b[i] : 0 <= i < 10 }"
10032         child:
10033           schedule: "[{ a[i] -> [i]; b[i] -> [i+1] }]"
10034           options: "{ separate[x] }"
10036 the following AST will be generated
10038         {
10039           a(0);
10040           for (int c0 = 1; c0 <= 9; c0 += 1) {
10041             b(c0 - 1);
10042             a(c0);
10043           }
10044           b(9);
10045         }
10047 If neither C<atomic> nor C<separate> is specified, then the AST generator
10048 may produce either of these two results or some intermediate form.
10050 =item C<separate>
10052 When this option is specified, the AST generator will
10053 split the domain of the specified schedule dimension
10054 into pieces with a fixed set of statements for which
10055 instances need to be executed by the iterations in
10056 the schedule domain part.  This option tends to avoid
10057 the generation of guards inside the corresponding loops.
10058 See also the C<atomic> option.
10060 =item C<unroll>
10062 When this option is specified, the AST generator will
10063 I<completely> unroll the corresponding schedule dimension.
10064 It is the responsibility of the user to ensure that such
10065 unrolling is possible.
10066 To obtain a partial unrolling, the user should apply an additional
10067 strip-mining to the schedule and fully unroll the inner schedule
10068 dimension.
10070 =back
10072 The C<isolate> option is a bit more involved.  It allows the user
10073 to isolate a range of schedule dimension values from smaller and
10074 greater values.  Additionally, the user may specify a different
10075 atomic/separate/unroll choice for the isolated part and the remaining
10076 parts.  The typical use case of the C<isolate> option is to isolate
10077 full tiles from partial tiles.
10078 The part that needs to be isolated may depend on outer schedule dimensions.
10079 The option therefore needs to be able to reference those outer schedule
10080 dimensions.  In particular, the space of the C<isolate> option is that
10081 of a wrapped map with as domain the flat product of all outer band nodes
10082 and as range the space of the current band node.
10083 The atomic/separate/unroll choice for the isolated part is determined
10084 by an option that lives in an unnamed wrapped space with as domain
10085 a zero-dimensional C<isolate> space and as range the regular
10086 C<atomic>, C<separate> or C<unroll> space.
10087 This option may also be set directly using
10088 C<isl_schedule_node_band_member_set_isolate_ast_loop_type>.
10089 The atomic/separate/unroll choice for the remaining part is determined
10090 by the regular C<atomic>, C<separate> or C<unroll> option.
10091 Since the C<isolate> option references outer schedule dimensions,
10092 its use in a band node causes any tree containing the node
10093 to be considered anchored.
10095 As an example, consider the isolation of full tiles from partial tiles
10096 in a tiling of a triangular domain.  The original schedule is as follows.
10098         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10099         child:
10100           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10101                 { A[i,j] -> [floor(j/10)] }, \
10102                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10104 The output is
10106         for (int c0 = 0; c0 <= 10; c0 += 1)
10107           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10108             for (int c2 = 10 * c0;
10109                  c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10110               for (int c3 = 10 * c1;
10111                    c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10112                 A(c2, c3);
10114 Isolating the full tiles, we have the following input
10116         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10117         child:
10118           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10119                 { A[i,j] -> [floor(j/10)] }, \
10120                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10121           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10122                 10a+9+10b+9 <= 100 }"
10124 and output
10126         {
10127           for (int c0 = 0; c0 <= 8; c0 += 1) {
10128             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10129               for (int c2 = 10 * c0;
10130                    c2 <= 10 * c0 + 9; c2 += 1)
10131                 for (int c3 = 10 * c1;
10132                      c3 <= 10 * c1 + 9; c3 += 1)
10133                   A(c2, c3);
10134             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10135               for (int c2 = 10 * c0;
10136                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10137                 for (int c3 = 10 * c1;
10138                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10139                   A(c2, c3);
10140           }
10141           for (int c0 = 9; c0 <= 10; c0 += 1)
10142             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10143               for (int c2 = 10 * c0;
10144                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10145                 for (int c3 = 10 * c1;
10146                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10147                   A(c2, c3);
10148         }
10150 We may then additionally unroll the innermost loop of the isolated part
10152         domain: "{ A[i,j] : 0 <= i,j and i + j <= 100 }"
10153         child:
10154           schedule: "[{ A[i,j] -> [floor(i/10)] }, \
10155                 { A[i,j] -> [floor(j/10)] }, \
10156                 { A[i,j] -> [i] }, { A[i,j] -> [j] }]"
10157           options: "{ isolate[[] -> [a,b,c,d]] : 0 <= 10a,10b and \
10158                 10a+9+10b+9 <= 100; [isolate[] -> unroll[3]] }"
10160 to obtain
10162         {
10163           for (int c0 = 0; c0 <= 8; c0 += 1) {
10164             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10165               for (int c2 = 10 * c0; c2 <= 10 * c0 + 9; c2 += 1) {
10166                 A(c2, 10 * c1);
10167                 A(c2, 10 * c1 + 1);
10168                 A(c2, 10 * c1 + 2);
10169                 A(c2, 10 * c1 + 3);
10170                 A(c2, 10 * c1 + 4);
10171                 A(c2, 10 * c1 + 5);
10172                 A(c2, 10 * c1 + 6);
10173                 A(c2, 10 * c1 + 7);
10174                 A(c2, 10 * c1 + 8);
10175                 A(c2, 10 * c1 + 9);
10176               }
10177             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10178               for (int c2 = 10 * c0;
10179                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10180                 for (int c3 = 10 * c1;
10181                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10182                   A(c2, c3);
10183           }
10184           for (int c0 = 9; c0 <= 10; c0 += 1)
10185             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10186               for (int c2 = 10 * c0;
10187                    c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1)
10188                 for (int c3 = 10 * c1;
10189                      c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1)
10190                   A(c2, c3);
10191         }
10194 =head3 AST Generation Options (Schedule Map)
10196 In case of AST construction using
10197 C<isl_ast_build_node_from_schedule_map>, the options
10198 that control how an AST is created from the individual schedule
10199 dimensions are stored in the C<isl_ast_build>.
10200 They can be set using the following function.
10202         #include <isl/ast_build.h>
10203         __isl_give isl_ast_build *
10204         isl_ast_build_set_options(
10205                 __isl_take isl_ast_build *control,
10206                 __isl_take isl_union_map *options);
10208 The options are encoded in an C<isl_union_map>.
10209 The domain of this union relation refers to the schedule domain,
10210 i.e., the range of the schedule passed
10211 to C<isl_ast_build_node_from_schedule_map>.
10212 In the case of nested AST generation (see L</"Nested AST Generation">),
10213 the domain of C<options> should refer to the extra piece of the schedule.
10214 That is, it should be equal to the range of the wrapped relation in the
10215 range of the schedule.
10216 The range of the options can consist of elements in one or more spaces,
10217 the names of which determine the effect of the option.
10218 The values of the range typically also refer to the schedule dimension
10219 to which the option applies.  In case of nested AST generation
10220 (see L</"Nested AST Generation">), these values refer to the position
10221 of the schedule dimension within the innermost AST generation.
10222 The constraints on the domain elements of
10223 the option should only refer to this dimension and earlier dimensions.
10224 We consider the following spaces.
10226 =over
10228 =item C<separation_class>
10230 B<This option has been deprecated.  Use the isolate option on
10231 schedule trees instead.>
10233 This space is a wrapped relation between two one dimensional spaces.
10234 The input space represents the schedule dimension to which the option
10235 applies and the output space represents the separation class.
10236 While constructing a loop corresponding to the specified schedule
10237 dimension(s), the AST generator will try to generate separate loops
10238 for domain elements that are assigned different classes.
10239 If only some of the elements are assigned a class, then those elements
10240 that are not assigned any class will be treated as belonging to a class
10241 that is separate from the explicitly assigned classes.
10242 The typical use case for this option is to separate full tiles from
10243 partial tiles.
10244 The other options, described below, are applied after the separation
10245 into classes.
10247 As an example, consider the separation into full and partial tiles
10248 of a tiling of a triangular domain.
10249 Take, for example, the domain
10251         { A[i,j] : 0 <= i,j and i + j <= 100 }
10253 and a tiling into tiles of 10 by 10.  The input to the AST generator
10254 is then the schedule
10256         { A[i,j] -> [([i/10]),[j/10],i,j] : 0 <= i,j and
10257                                                 i + j <= 100 }
10259 Without any options, the following AST is generated
10261         for (int c0 = 0; c0 <= 10; c0 += 1)
10262           for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10263             for (int c2 = 10 * c0;
10264                  c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10265                  c2 += 1)
10266               for (int c3 = 10 * c1;
10267                    c3 <= min(10 * c1 + 9, -c2 + 100);
10268                    c3 += 1)
10269                 A(c2, c3);
10271 Separation into full and partial tiles can be obtained by assigning
10272 a class, say C<0>, to the full tiles.  The full tiles are represented by those
10273 values of the first and second schedule dimensions for which there are
10274 values of the third and fourth dimensions to cover an entire tile.
10275 That is, we need to specify the following option
10277         { [a,b,c,d] -> separation_class[[0]->[0]] :
10278                 exists b': 0 <= 10a,10b' and
10279                            10a+9+10b'+9 <= 100;
10280           [a,b,c,d] -> separation_class[[1]->[0]] :
10281                 0 <= 10a,10b and 10a+9+10b+9 <= 100 }
10283 which simplifies to
10285         { [a, b, c, d] -> separation_class[[1] -> [0]] :
10286                 a >= 0 and b >= 0 and b <= 8 - a;
10287           [a, b, c, d] -> separation_class[[0] -> [0]] :
10288                 a >= 0 and a <= 8 }
10290 With this option, the generated AST is as follows
10292         {
10293           for (int c0 = 0; c0 <= 8; c0 += 1) {
10294             for (int c1 = 0; c1 <= -c0 + 8; c1 += 1)
10295               for (int c2 = 10 * c0;
10296                    c2 <= 10 * c0 + 9; c2 += 1)
10297                 for (int c3 = 10 * c1;
10298                      c3 <= 10 * c1 + 9; c3 += 1)
10299                   A(c2, c3);
10300             for (int c1 = -c0 + 9; c1 <= -c0 + 10; c1 += 1)
10301               for (int c2 = 10 * c0;
10302                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10303                    c2 += 1)
10304                 for (int c3 = 10 * c1;
10305                      c3 <= min(-c2 + 100, 10 * c1 + 9);
10306                      c3 += 1)
10307                   A(c2, c3);
10308           }
10309           for (int c0 = 9; c0 <= 10; c0 += 1)
10310             for (int c1 = 0; c1 <= -c0 + 10; c1 += 1)
10311               for (int c2 = 10 * c0;
10312                    c2 <= min(-10 * c1 + 100, 10 * c0 + 9);
10313                    c2 += 1)
10314                 for (int c3 = 10 * c1;
10315                      c3 <= min(10 * c1 + 9, -c2 + 100);
10316                      c3 += 1)
10317                   A(c2, c3);
10318         }
10320 =item C<separate>
10322 This is a single-dimensional space representing the schedule dimension(s)
10323 to which ``separation'' should be applied.  Separation tries to split
10324 a loop into several pieces if this can avoid the generation of guards
10325 inside the loop.
10326 See also the C<atomic> option.
10328 =item C<atomic>
10330 This is a single-dimensional space representing the schedule dimension(s)
10331 for which the domains should be considered ``atomic''.  That is, the
10332 AST generator will make sure that any given domain space will only appear
10333 in a single loop at the specified level.
10335 Consider the following schedule
10337         { a[i] -> [i] : 0 <= i < 10;
10338           b[i] -> [i+1] : 0 <= i < 10 }
10340 If the following option is specified
10342         { [i] -> separate[x] }
10344 then the following AST will be generated
10346         {
10347           a(0);
10348           for (int c0 = 1; c0 <= 9; c0 += 1) {
10349             a(c0);
10350             b(c0 - 1);
10351           }
10352           b(9);
10353         }
10355 If, on the other hand, the following option is specified
10357         { [i] -> atomic[x] }
10359 then the following AST will be generated
10361         for (int c0 = 0; c0 <= 10; c0 += 1) {
10362           if (c0 <= 9)
10363             a(c0);
10364           if (c0 >= 1)
10365             b(c0 - 1);
10366         }
10368 If neither C<atomic> nor C<separate> is specified, then the AST generator
10369 may produce either of these two results or some intermediate form.
10371 =item C<unroll>
10373 This is a single-dimensional space representing the schedule dimension(s)
10374 that should be I<completely> unrolled.
10375 To obtain a partial unrolling, the user should apply an additional
10376 strip-mining to the schedule and fully unroll the inner loop.
10378 =back
10380 =head3 Fine-grained Control over AST Generation
10382 Besides specifying the constraints on the parameters,
10383 an C<isl_ast_build> object can be used to control
10384 various aspects of the AST generation process.
10385 In case of AST construction using
10386 C<isl_ast_build_node_from_schedule_map>,
10387 the most prominent way of control is through ``options'',
10388 as explained above.
10390 Additional control is available through the following functions.
10392         #include <isl/ast_build.h>
10393         __isl_give isl_ast_build *
10394         isl_ast_build_set_iterators(
10395                 __isl_take isl_ast_build *control,
10396                 __isl_take isl_id_list *iterators);
10398 The function C<isl_ast_build_set_iterators> allows the user to
10399 specify a list of iterator C<isl_id>s to be used as iterators.
10400 If the input schedule is injective, then
10401 the number of elements in this list should be as large as the dimension
10402 of the schedule space, but no direct correspondence should be assumed
10403 between dimensions and elements.
10404 If the input schedule is not injective, then an additional number
10405 of C<isl_id>s equal to the largest dimension of the input domains
10406 may be required.
10407 If the number of provided C<isl_id>s is insufficient, then additional
10408 names are automatically generated.
10410         #include <isl/ast_build.h>
10411         __isl_give isl_ast_build *
10412         isl_ast_build_set_create_leaf(
10413                 __isl_take isl_ast_build *control,
10414                 __isl_give isl_ast_node *(*fn)(
10415                         __isl_take isl_ast_build *build,
10416                         void *user), void *user);
10419 C<isl_ast_build_set_create_leaf> function allows for the
10420 specification of a callback that should be called whenever the AST
10421 generator arrives at an element of the schedule domain.
10422 The callback should return an AST node that should be inserted
10423 at the corresponding position of the AST.  The default action (when
10424 the callback is not set) is to continue generating parts of the AST to scan
10425 all the domain elements associated to the schedule domain element
10426 and to insert user nodes, ``calling'' the domain element, for each of them.
10427 The C<build> argument contains the current state of the C<isl_ast_build>.
10428 To ease nested AST generation (see L</"Nested AST Generation">),
10429 all control information that is
10430 specific to the current AST generation such as the options and
10431 the callbacks has been removed from this C<isl_ast_build>.
10432 The callback would typically return the result of a nested
10433 AST generation or a
10434 user defined node created using the following function.
10436         #include <isl/ast.h>
10437         __isl_give isl_ast_node *isl_ast_node_alloc_user(
10438                 __isl_take isl_ast_expr *expr);
10440         #include <isl/ast_build.h>
10441         __isl_give isl_ast_build *
10442         isl_ast_build_set_at_each_domain(
10443                 __isl_take isl_ast_build *build,
10444                 __isl_give isl_ast_node *(*fn)(
10445                         __isl_take isl_ast_node *node,
10446                         __isl_keep isl_ast_build *build,
10447                         void *user), void *user);
10448         __isl_give isl_ast_build *
10449         isl_ast_build_set_before_each_for(
10450                 __isl_take isl_ast_build *build,
10451                 __isl_give isl_id *(*fn)(
10452                         __isl_keep isl_ast_build *build,
10453                         void *user), void *user);
10454         __isl_give isl_ast_build *
10455         isl_ast_build_set_after_each_for(
10456                 __isl_take isl_ast_build *build,
10457                 __isl_give isl_ast_node *(*fn)(
10458                         __isl_take isl_ast_node *node,
10459                         __isl_keep isl_ast_build *build,
10460                         void *user), void *user);
10461         __isl_give isl_ast_build *
10462         isl_ast_build_set_before_each_mark(
10463                 __isl_take isl_ast_build *build,
10464                 isl_stat (*fn)(__isl_keep isl_id *mark,
10465                         __isl_keep isl_ast_build *build,
10466                         void *user), void *user);
10467         __isl_give isl_ast_build *
10468         isl_ast_build_set_after_each_mark(
10469                 __isl_take isl_ast_build *build,
10470                 __isl_give isl_ast_node *(*fn)(
10471                         __isl_take isl_ast_node *node,
10472                         __isl_keep isl_ast_build *build,
10473                         void *user), void *user);
10475 The callback set by C<isl_ast_build_set_at_each_domain> will
10476 be called for each domain AST node.
10477 The callbacks set by C<isl_ast_build_set_before_each_for>
10478 and C<isl_ast_build_set_after_each_for> will be called
10479 for each for AST node.  The first will be called in depth-first
10480 pre-order, while the second will be called in depth-first post-order.
10481 Since C<isl_ast_build_set_before_each_for> is called before the for
10482 node is actually constructed, it is only passed an C<isl_ast_build>.
10483 The returned C<isl_id> will be added as an annotation (using
10484 C<isl_ast_node_set_annotation>) to the constructed for node.
10485 In particular, if the user has also specified an C<after_each_for>
10486 callback, then the annotation can be retrieved from the node passed to
10487 that callback using C<isl_ast_node_get_annotation>.
10488 The callbacks set by C<isl_ast_build_set_before_each_mark>
10489 and C<isl_ast_build_set_after_each_mark> will be called for each
10490 mark AST node that is created, i.e., for each mark schedule node
10491 in the input schedule tree.  The first will be called in depth-first
10492 pre-order, while the second will be called in depth-first post-order.
10493 Since the callback set by C<isl_ast_build_set_before_each_mark>
10494 is called before the mark AST node is actually constructed, it is passed
10495 the identifier of the mark node.
10496 All callbacks should C<NULL> (or -1) on failure.
10497 The given C<isl_ast_build> can be used to create new
10498 C<isl_ast_expr> objects using C<isl_ast_build_expr_from_pw_aff>
10499 or C<isl_ast_build_call_from_pw_multi_aff>.
10501 =head3 Nested AST Generation
10503 C<isl> allows the user to create an AST within the context
10504 of another AST.  These nested ASTs are created using the
10505 same C<isl_ast_build_node_from_schedule_map> function that is used to create
10506 the outer AST.  The C<build> argument should be an C<isl_ast_build>
10507 passed to a callback set by
10508 C<isl_ast_build_set_create_leaf>.
10509 The space of the range of the C<schedule> argument should refer
10510 to this build.  In particular, the space should be a wrapped
10511 relation and the domain of this wrapped relation should be the
10512 same as that of the range of the schedule returned by
10513 C<isl_ast_build_get_schedule> below.
10514 In practice, the new schedule is typically
10515 created by calling C<isl_union_map_range_product> on the old schedule
10516 and some extra piece of the schedule.
10517 The space of the schedule domain is also available from
10518 the C<isl_ast_build>.
10520         #include <isl/ast_build.h>
10521         __isl_give isl_union_map *isl_ast_build_get_schedule(
10522                 __isl_keep isl_ast_build *build);
10523         __isl_give isl_space *isl_ast_build_get_schedule_space(
10524                 __isl_keep isl_ast_build *build);
10525         __isl_give isl_ast_build *isl_ast_build_restrict(
10526                 __isl_take isl_ast_build *build,
10527                 __isl_take isl_set *set);
10529 The C<isl_ast_build_get_schedule> function returns a (partial)
10530 schedule for the domains elements for which part of the AST still needs to
10531 be generated in the current build.
10532 In particular, the domain elements are mapped to those iterations of the loops
10533 enclosing the current point of the AST generation inside which
10534 the domain elements are executed.
10535 No direct correspondence between
10536 the input schedule and this schedule should be assumed.
10537 The space obtained from C<isl_ast_build_get_schedule_space> can be used
10538 to create a set for C<isl_ast_build_restrict> to intersect
10539 with the current build.  In particular, the set passed to
10540 C<isl_ast_build_restrict> can have additional parameters.
10541 The ids of the set dimensions in the space returned by
10542 C<isl_ast_build_get_schedule_space> correspond to the
10543 iterators of the already generated loops.
10544 The user should not rely on the ids of the output dimensions
10545 of the relations in the union relation returned by
10546 C<isl_ast_build_get_schedule> having any particular value.
10548 =head1 Applications
10550 Although C<isl> is mainly meant to be used as a library,
10551 it also contains some basic applications that use some
10552 of the functionality of C<isl>.
10553 The input may be specified in either the L<isl format>
10554 or the L<PolyLib format>.
10556 =head2 C<isl_polyhedron_sample>
10558 C<isl_polyhedron_sample> takes a polyhedron as input and prints
10559 an integer element of the polyhedron, if there is any.
10560 The first column in the output is the denominator and is always
10561 equal to 1.  If the polyhedron contains no integer points,
10562 then a vector of length zero is printed.
10564 =head2 C<isl_pip>
10566 C<isl_pip> takes the same input as the C<example> program
10567 from the C<piplib> distribution, i.e., a set of constraints
10568 on the parameters, a line containing only -1 and finally a set
10569 of constraints on a parametric polyhedron.
10570 The coefficients of the parameters appear in the last columns
10571 (but before the final constant column).
10572 The output is the lexicographic minimum of the parametric polyhedron.
10573 As C<isl> currently does not have its own output format, the output
10574 is just a dump of the internal state.
10576 =head2 C<isl_polyhedron_minimize>
10578 C<isl_polyhedron_minimize> computes the minimum of some linear
10579 or affine objective function over the integer points in a polyhedron.
10580 If an affine objective function
10581 is given, then the constant should appear in the last column.
10583 =head2 C<isl_polytope_scan>
10585 Given a polytope, C<isl_polytope_scan> prints
10586 all integer points in the polytope.
10588 =head2 C<isl_codegen>
10590 Given a schedule, a context set and an options relation,
10591 C<isl_codegen> prints out an AST that scans the domain elements
10592 of the schedule in the order of their image(s) taking into account
10593 the constraints in the context set.