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