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